Commit 4210c7c5 by 浔阳陌客

init

parents
File added
#!/bin/bash
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o kmsc.exe
\ No newline at end of file
package main
import "log"
// 自动激活
// 查看激活状态
func main() {
res, err := reg_query_item_one(HKLM, `SOFTWARE\Microsoft\Windows NT\CurrentVersion`, "ProductName")
if err != nil {
log.Println(err)
}
log.Println(res)
}
module main
go 1.18
require golang.org/x/sys v0.0.0-20220614162138-6c1b26c55098
golang.org/x/sys v0.0.0-20220614162138-6c1b26c55098 h1:PgOr27OhUx2IRqGJ2RxAWI4dJQ7bi9cSrB82uzFzfUA=
golang.org/x/sys v0.0.0-20220614162138-6c1b26c55098/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
package main
import (
"golang.org/x/sys/windows/registry"
)
const (
HKCU = iota
HKLM
HKU
)
func reg_query_item_one(root int, path string, key string) (string, error) {
k, err := registry.OpenKey(prase(&root), path, registry.READ)
if err != nil {
return "", err
}
defer k.Close()
s, _, err := k.GetStringValue(key)
if err != nil {
return "", err
}
return s, nil
}
func prase(root *int) registry.Key {
switch *root {
case HKCU:
return registry.CURRENT_USER
case HKU:
return registry.USERS
case HKLM:
return registry.LOCAL_MACHINE
}
return registry.LOCAL_MACHINE
}
package gopkg
module server
go 1.18
package main
func main() {
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment