win

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MEM_COMMIT     = 0x00001000
	MEM_RESERVE    = 0x00002000
	MEM_RESET      = 0x00080000
	MEM_RESET_UNDO = 0x1000000

	MEM_LARGE_PAGES = 0x20000000
	MEM_PHYSICAL    = 0x00400000
	MEM_TOP_DOWN    = 0x00100000

	MEM_DECOMMIT = 0x4000
	MEM_RELEASE  = 0x8000
)
View Source
const (
	PAGE_EXECUTE           = 0x10
	PAGE_EXECUTE_READ      = 0x20
	PAGE_EXECUTE_READWRITE = 0x40
	PAGE_EXECUTE_WRITECOPY = 0x80
	PAGE_NOACCESS          = 0x01
	PAGE_READWRITE         = 0x04
	PAGE_WRITECOPY         = 0x08
	PAGE_TARGETS_INVALID   = 0x40000000
	PAGE_TARGETS_NO_UPDATE = 0x40000000
)
View Source
const (
	CREATE_UNICODE_ENVIRONMENT = 0x00000400
	CREATE_NO_WINDOW           = 0x08000000
	NORMAL_PRIORITY_CLASS      = 0x20

	INVALID_SESSION_ID        = 0xFFFFFFFF
	WTS_CURRENT_SERVER_HANDLE = 0

	TOKEN_DUPLICATE    = 0x0002
	MAXIMUM_ALLOWED    = 0x2000000
	CREATE_NEW_CONSOLE = 0x00000010

	IDLE_PRIORITY_CLASS     = 0x40
	HIGH_PRIORITY_CLASS     = 0x80
	REALTIME_PRIORITY_CLASS = 0x100
	GENERIC_ALL_ACCESS      = 0x10000000
)

Variables

View Source
var (
	GBKEncoder transform.Transformer = simplifiedchinese.GBK.NewEncoder()
	GBKDecoder transform.Transformer = simplifiedchinese.GBK.NewDecoder()
	ISW                              = SW{
		SW_HIDE:            0,
		SW_SHOWNORMAL:      1,
		SW_NORMAL:          1,
		SW_SHOWMINIMIZED:   2,
		SW_SHOWMAXIMIZED:   3,
		SW_MAXIMIZE:        3,
		SW_SHOWNOACTIVATE:  4,
		SW_SHOW:            5,
		SW_MINIMIZE:        6,
		SW_SHOWMINNOACTIVE: 7,
		SW_SHOWNA:          8,
		SW_RESTORE:         9,
		SW_SHOWDEFAULT:     10,
		SW_MAX:             10,
	}
)

Functions

func AddElementFunc

func AddElementFunc(hWnd win.HWND, hWndList *[]win.HWND) uintptr

回调函数,用于EnumWindows中的回调函数,第一个参数是hWnd,第二个是自定义穿的参数

func ConvertDosPath added in v0.0.20

func ConvertDosPath(p string) string

func CreateToolhelp32Snapshot

func CreateToolhelp32Snapshot(flags, processId uint32) w32.HANDLE

func FindResource

func FindResource(hModule w32.HMODULE, lpName, lpType *uint16) (w32.HRSRC, error)

func FindWindow

func FindWindow(title, processName string) win.HWND

func GetConsoleScreenBufferInfo

func GetConsoleScreenBufferInfo(hConsoleOutput w32.HANDLE) *w32.CONSOLE_SCREEN_BUFFER_INFO

func GetConsoleWindow

func GetConsoleWindow() w32.HWND

func GetCurrentThread

func GetCurrentThread() w32.HANDLE

func GetDesktopWindowHWND

func GetDesktopWindowHWND() []win.HWND

获取桌面下的所有窗口句柄,包括没有Windows标题的或者是窗口的。

func GetDiskFreeSpaceEx

func GetDiskFreeSpaceEx(dirName string) (r bool,
	freeBytesAvailable, totalNumberOfBytes, totalNumberOfFreeBytes uint64)

func GetLVItem

func GetLVItem(hwnd w32.HWND, row, col int) string

func GetLVItemRowCount

func GetLVItemRowCount(hwnd w32.HWND) int

func GetLastError

func GetLastError() uint32

func GetList

func GetList(hwnd w32.HWND, columns []int) [][]string

func GetLogicalDrives

func GetLogicalDrives() uint32

func GetModuleHandle

func GetModuleHandle(modulename string) w32.HINSTANCE

func GetProcName

func GetProcName(pid uint32) string

func GetProcessTimes

func GetProcessTimes(hProcess w32.HANDLE, lpCreationTime, lpExitTime, lpKernelTime, lpUserTime *w32.FILETIME) bool

func GetSystemTime

func GetSystemTime() *w32.SYSTEMTIME

func GetSystemTimes

func GetSystemTimes(lpIdleTime, lpKernelTime, lpUserTime *w32.FILETIME) bool

func GetUserDefaultLCID

func GetUserDefaultLCID() uint32

func GlobalAlloc

func GlobalAlloc(uFlags uint, dwBytes uint32) w32.HGLOBAL

func GlobalFree

func GlobalFree(hMem w32.HGLOBAL)

func GlobalLock

func GlobalLock(hMem w32.HGLOBAL) unsafe.Pointer

func GlobalUnlock

func GlobalUnlock(hMem w32.HGLOBAL) bool

func ListViews

func ListViews(hwnd w32.HWND) []w32.HWND

func LoadResource

func LoadResource(hModule w32.HMODULE, hResInfo w32.HRSRC) w32.HGLOBAL

func LockResource

func LockResource(hResData w32.HGLOBAL) unsafe.Pointer

func Lstrcpy

func Lstrcpy(buf []uint16, lpString *uint16)

func Lstrlen

func Lstrlen(lpString *uint16) int

func Module32First

func Module32First(snapshot w32.HANDLE, me *w32.MODULEENTRY32) bool

func Module32Next

func Module32Next(snapshot w32.HANDLE, me *w32.MODULEENTRY32) bool

func MoveMemory

func MoveMemory(destination, source unsafe.Pointer, length uint32)

func MulDiv

func MulDiv(number, numerator, denominator int) int

func Process32Next

func Process32Next(pHandle w32.HANDLE, proc uintptr) bool

func QueryPerformanceCounter

func QueryPerformanceCounter() uint64

func QueryPerformanceFrequency

func QueryPerformanceFrequency() uint64

func ReadProcessMemory

func ReadProcessMemory(hProcess w32.HANDLE, lpBaseAddress, nSize uintptr) (lpBuffer []uint16, lpNumberOfBytesRead int, ok bool)

func SetConsoleTextAttribute

func SetConsoleTextAttribute(hConsoleOutput w32.HANDLE, wAttributes uint16) bool

func SetSystemTime

func SetSystemTime(time *w32.SYSTEMTIME) bool

func SizeofResource

func SizeofResource(hModule w32.HMODULE, hResInfo w32.HRSRC) uint32

func StartProcessByPassUAC

func StartProcessByPassUAC(applicationCmd string) error

func StringToCharPtr

func StringToCharPtr(str string) *uint8

func TapKey

func TapKey(keys ...uint16)

func VirtualAllocEx

func VirtualAllocEx(hProcess w32.HANDLE, lpAddress, dwSize uintptr, flAllocationType, flProtect uint32) uintptr

func VirtualFreeEx

func VirtualFreeEx(hProcess w32.HANDLE, lpAddress, dwSize uintptr, dwFreeType uint32) bool

func WriteProcessMemory

func WriteProcessMemory(hProcess w32.HANDLE, lpBaseAddress, lpBuffer, nSize uintptr) (int, bool)

Types

type PROCESSENTRY32

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

Win32进程结构体

func GetProcessByName

func GetProcessByName(name string) (PROCESSENTRY32, error)

GetProcessByName 根据pid获取windows系统的某一个进程

参数:
name    string  进程名称, 建议加上.exe结尾
return  Process

func (*PROCESSENTRY32) ModuleID

func (p *PROCESSENTRY32) ModuleID() string

func (*PROCESSENTRY32) Name

func (p *PROCESSENTRY32) Name() string

func (*PROCESSENTRY32) PID

func (p *PROCESSENTRY32) PID() uint32

type SW

type SW struct {
	SW_HIDE            uint16 // 0,
	SW_SHOWNORMAL      uint16 // 1,
	SW_NORMAL          uint16 // 1,
	SW_SHOWMINIMIZED   uint16 // 2,
	SW_SHOWMAXIMIZED   uint16 // 3,
	SW_MAXIMIZE        uint16 // 3,
	SW_SHOWNOACTIVATE  uint16 // 4,
	SW_SHOW            uint16 // 5,
	SW_MINIMIZE        uint16 // 6,
	SW_SHOWMINNOACTIVE uint16 // 7,
	SW_SHOWNA          uint16 // 8,
	SW_RESTORE         uint16 // 9,
	SW_SHOWDEFAULT     uint16 // 10,
	SW_MAX             uint16 // 10
}

Jump to

Keyboard shortcuts

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