更新若干功能
This commit is contained in:
19
machineid_windows.go
Normal file
19
machineid_windows.go
Normal file
@@ -0,0 +1,19 @@
|
||||
//go:build windows
|
||||
|
||||
package main
|
||||
|
||||
import "golang.org/x/sys/windows/registry"
|
||||
|
||||
// rawMachineID 读取 Windows 的 MachineGuid(系统安装时生成,重装才会变)。
|
||||
func rawMachineID() string {
|
||||
k, e := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\Microsoft\Cryptography`, registry.QUERY_VALUE|registry.WOW64_64KEY)
|
||||
if e != nil {
|
||||
return ""
|
||||
}
|
||||
defer k.Close()
|
||||
v, _, e := k.GetStringValue("MachineGuid")
|
||||
if e != nil {
|
||||
return ""
|
||||
}
|
||||
return v
|
||||
}
|
||||
Reference in New Issue
Block a user