winapi

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: GPL-3.0 Imports: 6 Imported by: 1

Documentation

Overview

Package winapi is a Windows specific package that assists with handeling or accessing many advanced WinAPI functions. This package also contains various helper functions to assist with complex operations.

Index

Constants

View Source
const (
	// SwHide hides the window and activates another window.
	SwHide uint8 = iota
	// SwNormal activates and displays a window. If the window is minimized or
	// maximized, the system restores it to its original size and position. An
	// application should specify this flag when displaying the window for the
	// first time.
	SwNormal
	// SwMinimized activates the window and displays it as a minimized window.
	SwMinimized
	// SwMaximize activates the window and displays it as a maximized window.
	SwMaximize
	// SwNoActive displays a window in its most recent size and position. This
	// value is similar to SwNormal, except that the window is not activated.
	SwNoActive
	// SwShow activates the window and displays it in its current size and
	// position.
	SwShow
	// SwMinimize minimizes the specified window and activates the next top-level
	// window in the Z order.
	SwMinimize
	// SwMinimizeNoActive displays the window as a minimized window. This value
	// is similar to SwMinimizeNoActive, except the window is not activated.
	SwMinimizeNoActive
	// SwShowNoActive displays the window in its current size and position.
	// This value is similar to SwShow, except that the window is not activated.
	SwShowNoActive
	// SwRestore activates and displays the window. If the window is minimized
	// or maximized, the system restores it to its original size and position.
	// An application should specify this flag when restoring a minimized window.
	SwRestore
	// SwDefault sets the show state based on the SW_ value specified in the
	// STARTUPINFO structure passed to the CreateProcess function by the program
	// that started the application.
	SwDefault
	// SwMinimizeForce minimizes a window, even if the thread that owns the
	// window is not responding. This flag should only be used when minimizing
	// windows from a different thread.
	SwMinimizeForce
)

Variables

This section is empty.

Functions

func ExtractDLLBase added in v0.4.2

func ExtractDLLBase(dll string) (uint32, []byte, error)

ExtractDLLBase will extract the '.text' (executable) section of the supplied DLL file path or basename (Windows-only) and return the '.text' base address and raw bytes to be used in calls to 'winapi.Patch*' or 'winapi.Check*'

This function returns any errors that may occur during reading.

Non-Windows devices may use this function to extract DLL data.

func ExtractDLLBaseRaw added in v0.4.2

func ExtractDLLBaseRaw(v []byte) (uint32, []byte, error)

ExtractDLLBaseRaw will extract the '.text' (executable) section of the supplied DLL raw bytes and return the '.text' base address and raw bytes to be used in calls to 'winapi.Patch*' or 'winapi.Check*'

This function returns any errors that may occur during reading.

Non-Windows devices may use this function to extract DLL data.

func ExtractDLLFunction added in v0.4.2

func ExtractDLLFunction(dll string, name string, count uint32) ([]byte, error)

ExtractDLLFunction will extract 'count' bytes from the supplied DLL file path or basename (Windows-only) at the base of the supplied function name.

If 'count' is zero, this defaults to 16 bytes.

This function returns any errors that may occur during reading. Forwarded functions also return an error that indicates where the forward points to.

Non-Windows devices may use this function to extract DLL data.

func ExtractDLLFunctionRaw added in v0.4.2

func ExtractDLLFunctionRaw(v []byte, name string, count uint32) ([]byte, error)

ExtractDLLFunctionRaw will extract 'count' bytes from the supplied DLL raw bytes at the base of the supplied function name.

If 'count' is zero, this defaults to 16 bytes.

This function returns any errors that may occur during reading. Forwarded functions also return an error that indicates where the forward points to.

Non-Windows devices may use this function to extract DLL data.

func FnvHash added in v0.4.4

func FnvHash(n string) uint32

FnvHash returns the fnv32 hash of the supplied string value.

func UTF16Decode

func UTF16Decode(s []uint16) []rune

UTF16Decode returns the Unicode code point sequence represented by the UTF-16 encoding rune values supplied.

func UTF16EncodeStd

func UTF16EncodeStd(s []rune) []uint16

UTF16EncodeStd encodes the runes into a UTF16 array and ignores zero points.

This is ONLY safe to use if you know what you're doing.

func UTF16FromString

func UTF16FromString(s string) ([]uint16, error)

UTF16FromString returns the UTF-16 encoding of the UTF-8 string with a terminating NUL added.

If the string contains a NUL byte at any location, it returns syscall.EINVAL.

func UTF16PtrFromString

func UTF16PtrFromString(s string) (*uint16, error)

UTF16PtrFromString returns pointer to the UTF-16 encoding of the UTF-8 string, with a terminating NUL added.

If the string contains a NUL byte at any location, it returns syscall.EINVAL.

func UTF16PtrToString

func UTF16PtrToString(p *uint16) string

UTF16PtrToString takes a pointer to a UTF-16 sequence and returns the corresponding UTF-8 encoded string.

If the pointer is nil, it returns the empty string. It assumes that the UTF-16 sequence is terminated at a zero word; if the zero word is not present, the program may crash.

func UTF16ToString

func UTF16ToString(s []uint16) string

UTF16ToString returns the UTF-8 encoding of the UTF-16 sequence s, with a terminating NUL and any bytes after the NUL removed.

Types

type SliceHeader

type SliceHeader struct {
	Data unsafe.Pointer
	Len  int
	Cap  int
}

SliceHeader is the runtime representation of a slice.

It cannot be used safely or portably and its representation may change in a later release. ^ Hey, shut up.

Directories

Path Synopsis
Package registry contains code to handle common Windows registry operations.
Package registry contains code to handle common Windows registry operations.
Package svc is a Windows specific Service interface.
Package svc is a Windows specific Service interface.

Jump to

Keyboard shortcuts

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