regwatcher

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 4, 2024 License: MIT Imports: 4 Imported by: 0

README

RegWatcher

Windows registry monitor for golang

Example

package main

import "github.com/dean2021/regwatcher"

func main() {
	path := `SOFTWARE\Microsoft\Windows\CurrentVersion\Run`
	watcher, err := regwatcher.NewWatcher(regwatcher.HKeyLocalMachine, path, 1000)
	if err != nil {
		panic(err)
	}
	defer watcher.Close()
	for {
		changed, err := watcher.Watch()
		if err != nil {
			panic(err)
		}
		if changed {
			println("registry changed")
		}
	}
}

Documentation

Rendered for windows/amd64

Index

Constants

View Source
const (
	// HKeyClassesRoot represents HKEY_CLASSES_ROOT hive
	HKeyClassesRoot = windows.Handle(syscall.HKEY_CLASSES_ROOT)

	// HKeyCurrentUser represents HKEY_CURRENT_USER hive
	HKeyCurrentUser = windows.Handle(syscall.HKEY_CURRENT_USER)

	// HKeyLocalMachine represents HKEY_LOCAL_MACHINE hive
	HKeyLocalMachine = windows.Handle(syscall.HKEY_LOCAL_MACHINE)

	// HKeyUsers represents HKEY_USERS hive
	HKeyUsers = windows.Handle(syscall.HKEY_USERS)

	// HKeyCurrentConfig represents HKEY_CURRENT_CONFIG hive
	HKeyCurrentConfig = windows.Handle(syscall.HKEY_CURRENT_CONFIG)

	// HKeyPerformanceData represents HKEY_PERFORMANCE_DATA hive
	HKeyPerformanceData = windows.Handle(syscall.HKEY_PERFORMANCE_DATA)

	// Infinity is infinite timeout
	Infinity = 0xFFFFFFFF
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Watcher

type Watcher struct {
	// contains filtered or unexported fields
}

func NewWatcher

func NewWatcher(hMainKey windows.Handle, regPath string, timeout int) (*Watcher, error)

func (*Watcher) Close

func (w *Watcher) Close() error

func (*Watcher) Create

func (w *Watcher) Create(hMainKey windows.Handle, regPath string) error

func (*Watcher) Watch

func (w *Watcher) Watch() (bool, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL