package main

import (
	"fmt"
	"log"

	registry "github.com/golang/sys/windows/registry"
)

func main() {

	installListPath := [2]string{`SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall`,`SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall`}
	
	for _,ilp := range installListPath{
		k, kerr := registry.OpenKey(registry.LOCAL_MACHINE,ilp, registry.READ)

		if kerr != nil {
			log.Fatal(kerr)
		}
		defer k.Close()
		il,ilerr := k.ReadSubKeyNames(0)
		if ilerr != nil{
			log.Fatal(ilerr)
		}
		for _,each := range il{
			subil := ilp + `\` + each
			sk, skerr := registry.OpenKey(registry.LOCAL_MACHINE,subil, registry.READ)
			if skerr != nil{
				fmt.Print(skerr)
			}
			dn, _, skerr := sk.GetStringValue("DisplayName")
			us, _, userr := sk.GetStringValue("UninstallString")
			if skerr != nil || userr!=nil{
				continue 
			}
			fmt.Printf("%s,%s\n", dn,us)	
		}
	}

}