diff options
| author | Rutger Broekhoff | 2024-01-02 18:56:31 +0100 |
|---|---|---|
| committer | Rutger Broekhoff | 2024-01-02 18:56:31 +0100 |
| commit | 8db41da676ac8368ef7c2549d56239a5ff5eedde (patch) | |
| tree | 09c427fd66de2ec1ebffc8342f5fdbb84b0701b5 /vendor/github.com/rs/xid/hostid_windows.go | |
| parent | d4f75fb6db22e57577867445a022227e70958931 (diff) | |
| download | gitolfs3-8db41da676ac8368ef7c2549d56239a5ff5eedde.tar.gz gitolfs3-8db41da676ac8368ef7c2549d56239a5ff5eedde.zip | |
Delete vendor directory
Diffstat (limited to 'vendor/github.com/rs/xid/hostid_windows.go')
| -rw-r--r-- | vendor/github.com/rs/xid/hostid_windows.go | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/vendor/github.com/rs/xid/hostid_windows.go b/vendor/github.com/rs/xid/hostid_windows.go deleted file mode 100644 index ec2593e..0000000 --- a/vendor/github.com/rs/xid/hostid_windows.go +++ /dev/null | |||
| @@ -1,38 +0,0 @@ | |||
| 1 | // +build windows | ||
| 2 | |||
| 3 | package xid | ||
| 4 | |||
| 5 | import ( | ||
| 6 | "fmt" | ||
| 7 | "syscall" | ||
| 8 | "unsafe" | ||
| 9 | ) | ||
| 10 | |||
| 11 | func readPlatformMachineID() (string, error) { | ||
| 12 | // source: https://github.com/shirou/gopsutil/blob/master/host/host_syscall.go | ||
| 13 | var h syscall.Handle | ||
| 14 | err := syscall.RegOpenKeyEx(syscall.HKEY_LOCAL_MACHINE, syscall.StringToUTF16Ptr(`SOFTWARE\Microsoft\Cryptography`), 0, syscall.KEY_READ|syscall.KEY_WOW64_64KEY, &h) | ||
| 15 | if err != nil { | ||
| 16 | return "", err | ||
| 17 | } | ||
| 18 | defer syscall.RegCloseKey(h) | ||
| 19 | |||
| 20 | const syscallRegBufLen = 74 // len(`{`) + len(`abcdefgh-1234-456789012-123345456671` * 2) + len(`}`) // 2 == bytes/UTF16 | ||
| 21 | const uuidLen = 36 | ||
| 22 | |||
| 23 | var regBuf [syscallRegBufLen]uint16 | ||
| 24 | bufLen := uint32(syscallRegBufLen) | ||
| 25 | var valType uint32 | ||
| 26 | err = syscall.RegQueryValueEx(h, syscall.StringToUTF16Ptr(`MachineGuid`), nil, &valType, (*byte)(unsafe.Pointer(®Buf[0])), &bufLen) | ||
| 27 | if err != nil { | ||
| 28 | return "", err | ||
| 29 | } | ||
| 30 | |||
| 31 | hostID := syscall.UTF16ToString(regBuf[:]) | ||
| 32 | hostIDLen := len(hostID) | ||
| 33 | if hostIDLen != uuidLen { | ||
| 34 | return "", fmt.Errorf("HostID incorrect: %q\n", hostID) | ||
| 35 | } | ||
| 36 | |||
| 37 | return hostID, nil | ||
| 38 | } | ||