Skip to content

Commit f6f8006

Browse files
committed
move code to go-windows
1 parent ffd89d3 commit f6f8006

File tree

15 files changed

+159
-148
lines changed

15 files changed

+159
-148
lines changed

Readme.md

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
1-
[![Build Status](https://dev.azure.com/oneeyedelf1/wasm-imagemagick/_apis/build/status/KnicKnic.go-failovercluster-api?branchName=master)](https://dev.azure.com/oneeyedelf1/wasm-imagemagick/_build/latest?definitionId=4&branchName=master)
1+
[![Build Status](https://dev.azure.com/oneeyedelf1/powershell.native/_apis/build/status/KnicKnic.go-windows?branchName=master)](https://dev.azure.com/oneeyedelf1/powershell.native/_build/latest?definitionId=5&branchName=master)
22

33
# Goal
44

5-
To create bindings to allow you a go application to call Microsoft Windows Server Failover Cluster Api.
5+
To create bindings to allow you a go application to call various Microsoft Windows Server Apis.
66

7-
Currently uses syscall to wrap the c clusapi.dll and resutils.dll code.
8-
9-
## Completed
7+
## Contents (pkg/...)
108

119
Parts of the following cluster api sets
12-
1. Cluster
13-
1. Resource
14-
1. Registry
15-
1. Crypto
16-
17-
## TODO
18-
19-
* add comments for public functions
20-
* Write more tests
21-
* complete more wrappers for functions
10+
* [Cluster](pkg/cluster/Readme.md)
11+
* Microsoft Windows Failover Cluster bindings
12+
* [kernel32](pkg/kernel32)
13+
* LocalAlloc & LocalFree
14+
* [ntdll](pkg/ntdll)
15+
* memcpy

go.mod

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
module github.com/KnicKnic/go-failovercluster-api
1+
module github.com/KnicKnic/go-windows
22

33
go 1.13
44

55
require (
66
github.com/stretchr/testify v1.4.0
7-
golang.org/dl v0.0.0-20191205014302-95494741406c // indirect
87
golang.org/x/sys v0.0.0-20191128015809-6d18c012aee9
98
)

go.sum

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
55
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
66
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
77
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
8-
golang.org/dl v0.0.0-20191205014302-95494741406c/go.mod h1:IUMfjQLJQd4UTqG1Z90tenwKoCX93Gn3MAQJMOSBsDQ=
98
golang.org/x/sys v0.0.0-20191128015809-6d18c012aee9 h1:ZBzSG/7F4eNKz2L3GE9o300RX0Az1Bw5HF7PDraD+qU=
109
golang.org/x/sys v0.0.0-20191128015809-6d18c012aee9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
1110
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

pkg/cluster/Readme.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Goal
2+
3+
To create bindings to allow you a go application to call Microsoft Windows Server Failover Cluster Api.
4+
5+
Currently uses syscall to wrap the c clusapi.dll and resutils.dll code.
6+
7+
## Completed
8+
9+
Parts of the following cluster api sets
10+
1. Cluster
11+
1. Resource
12+
1. Registry
13+
1. Crypto
14+
15+
## TODO
16+
17+
* add comments for public functions
18+
* Write more tests
19+
* complete more wrappers for functions

pkg/cluster/cluster.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"syscall"
55
"unsafe"
66

7-
"github.com/KnicKnic/go-failovercluster-api/pkg/errors"
7+
"github.com/KnicKnic/go-windows/pkg/errors"
88
"golang.org/x/sys/windows"
99
)
1010

pkg/cluster/crypto.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import (
44
"syscall"
55
"unsafe"
66

7-
"github.com/KnicKnic/go-failovercluster-api/pkg/errors"
8-
"github.com/KnicKnic/go-failovercluster-api/pkg/kernel32"
9-
"github.com/KnicKnic/go-failovercluster-api/pkg/ntdll"
7+
"github.com/KnicKnic/go-windows/pkg/errors"
8+
"github.com/KnicKnic/go-windows/pkg/kernel32"
9+
"github.com/KnicKnic/go-windows/pkg/ntdll"
1010
"golang.org/x/sys/windows"
1111
)
1212

pkg/cluster/registry.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import (
44
"syscall"
55
"unsafe"
66

7-
"github.com/KnicKnic/go-failovercluster-api/pkg/errors"
8-
"github.com/KnicKnic/go-failovercluster-api/pkg/memory"
7+
"github.com/KnicKnic/go-windows/pkg/errors"
8+
"github.com/KnicKnic/go-windows/pkg/util/guid"
99
"golang.org/x/sys/windows"
1010
)
1111

@@ -67,7 +67,7 @@ func (handle KeyHandle) SetByteValue(value string, data []byte) error {
6767
}
6868

6969
// SetGuidValue sets a value on a key
70-
func (handle KeyHandle) SetGuidValue(value string, guid memory.GUID) error {
70+
func (handle KeyHandle) SetGuidValue(value string, guid guid.GUID) error {
7171
data, err := guid.ToByte()
7272
if err != nil {
7373
return err
@@ -214,7 +214,7 @@ func (handle KeyHandle) QueryByteValue(valueName string) (data []byte, err error
214214
}
215215

216216
// QueryGuidValue returns syscall.ERROR_FILE_NOT_FOUND if value does not exist
217-
func (handle KeyHandle) QueryGuidValue(valueName string) (data memory.GUID, err error) {
217+
func (handle KeyHandle) QueryGuidValue(valueName string) (data guid.GUID, err error) {
218218
dataBuf, err := handle.QueryByteValue(valueName)
219219
if err != nil {
220220
return
@@ -224,6 +224,6 @@ func (handle KeyHandle) QueryGuidValue(valueName string) (data memory.GUID, err
224224
return
225225
}
226226

227-
data, err = memory.GuidFromBytes(dataBuf)
227+
data, err = guid.FromBytes(dataBuf)
228228
return
229229
}

pkg/cluster/registry_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"syscall"
66
"testing"
77

8-
"github.com/KnicKnic/go-failovercluster-api/pkg/memory"
8+
"github.com/KnicKnic/go-windows/pkg/util/guid"
99
"github.com/stretchr/testify/assert"
1010
)
1111

@@ -33,7 +33,7 @@ func TestQueryInvalidValue(t *testing.T) {
3333
assert.Equal(t, syscall.ERROR_FILE_NOT_FOUND, err)
3434

3535
myGuidStr := "206994D6-C7B7-ABDB-D89E-AB9CBF3853C4"
36-
myGuid, err := memory.GuidFromString(myGuidStr)
36+
myGuid, err := guid.FromString(myGuidStr)
3737
err = key.SetGuidValue("test_guid_value", myGuid)
3838
assert.Nil(t, err)
3939

pkg/cluster/resource.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"syscall"
55
"unsafe"
66

7-
"github.com/KnicKnic/go-failovercluster-api/pkg/errors"
7+
"github.com/KnicKnic/go-windows/pkg/errors"
88
"golang.org/x/sys/windows"
99
)
1010

pkg/kernel32/kernel32.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package kernel32
33
import (
44
"syscall"
55

6-
"github.com/KnicKnic/go-failovercluster-api/pkg/errors"
6+
"github.com/KnicKnic/go-windows/pkg/errors"
77
"golang.org/x/sys/windows"
88
)
99

0 commit comments

Comments
 (0)