summaryrefslogtreecommitdiff
path: root/vendor/github.com/AllenDang/w32/advapi32_test.go
blob: 72a9198a3fdd14d07fcdc359d8d1112702cef378 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package w32

import (
	"testing"
)

func TestInitializeSecurityDescriptor(t *testing.T) {
	sd, err := InitializeSecurityDescriptor(1)
	if err != nil {
		t.Errorf("Failed: %v", err)
	}
	t.Logf("SD:\n%#v\n", *sd)
}

func TestSetSecurityDescriptorDacl(t *testing.T) {

	sd, err := InitializeSecurityDescriptor(1)
	if err != nil {
		t.Errorf("Failed to initialize: %v", err)
	}
	err = SetSecurityDescriptorDacl(sd, nil)
	if err != nil {
		t.Errorf("Failed to set NULL DACL: %v", err)
	}
	t.Logf("[OK] Set NULL DACL")

	empty := &ACL{
		AclRevision: 4,
		Sbz1:        0,
		AclSize:     4,
		AceCount:    0,
		Sbz2:        0,
	}
	err = SetSecurityDescriptorDacl(sd, empty)
	if err != nil {
		t.Errorf("Failed to set empty DACL: %v", err)
	}
	t.Logf("[OK] Set empty DACL")
	t.Logf("SD:\n%#v\n", *sd)

}