package main

import (
	"log"

	pub "git.zhiweidata.top/taotengfei/AD-Control-Golang/public"
	"golang.org/x/sys/windows/registry"
)

var MS = &pub.MS

func main() {
	if pub.Zhiweireach() {
		log.Printf("该主机属于知微域")
	}
	log.Println("--------------------------")
	if err := activeWindows(); err != nil {
		log.Println(err)
		log.Println("Windows 激活失败")
	}
	log.Println("--------------------------")
	if err := activeOffice(); err != nil {
		log.Println(err)
		log.Println("Office 激活失败")
	}
	log.Println("--------------------------")

	log.Println("程序运行结束")
	select {}
}

func query_key_one(path, key string) (string, error) {
	if k, kerr := registry.OpenKey(registry.LOCAL_MACHINE, path, registry.READ); kerr == nil {
		defer k.Close()
		if sk, _, err := k.GetStringValue(key); err != nil {
			return "", err
		} else {
			return sk, nil
		}
	} else {
		return "", kerr
	}
}
