Ejemplo n.º 1
0
func main() {
	chave := `BDS.PasFile\shell\Calcular métricas\Command`
	v, err := gowin.GetReg("HKCR", chave, "")
	//err := gowin.WriteStringReg("HKCR", `BDS.PasFile\shell\Metric\Command`, "", `c:\projetos\go\auditoria-e-metricas\client\clientAudit.exe -arquivo=%1 -browser`)
	if err != nil {
		gowin.WriteStringReg("HKCR", chave, "", `c:\projetos\go\auditoria-e-metricas\client\clientAudit.exe -arquivo=%1 -browser`)
	}
}
Ejemplo n.º 2
0
func CreateLaunchFile(autoLaunch bool) {
	var err error

	if autoLaunch {
		lanternPath, err := osext.Executable()
		if err != nil {
			log.Errorf("Could not get Lantern directory path: %q", err)
			return
		}
		err = gowin.WriteStringReg("HKCU", runDir, "value", lanternPath)
		if err != nil {
			log.Errorf("Error inserting Lantern auto-start registry key: %q", err)
		}
	} else {
		err = gowin.DeleteKey("HKCU", currentVersionDir, "Run")
		if err != nil {
			log.Errorf("Error removing Lantern auto-start registry key: %q", err)
		}
	}
}
Ejemplo n.º 3
0
func CreateLaunchFile(autoLaunch bool) {
	var startupCommand string

	lanternPath, err := osext.Executable()
	if err != nil {
		log.Errorf("Could not get Lantern directory path: %q", err)
		return
	}

	if autoLaunch {
		// Start Lantern normally.
		startupCommand = fmt.Sprintf(`"%s" -startup`, lanternPath)
	} else {
		// Just clear stored proxy settings and quit.
		startupCommand = fmt.Sprintf(`"%s" -clear-proxy-settings`, lanternPath)
	}

	err = gowin.WriteStringReg("HKCU", runDir, "Lantern", startupCommand)
	if err != nil {
		log.Errorf("Error setting Lantern auto-start registry key: %q", err)
	}
}