kernel32

package
v0.32.1 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Rendered for windows/amd64

Index

Constants

View Source
const (
	// JobObjectQuery is required to retrieve certain information about a job object,
	// such as attributes and accounting information (see QueryInformationJobObject and IsProcessInJob).
	// https://learn.microsoft.com/en-us/windows/win32/procthread/job-object-security-and-access-rights
	JobObjectQuery = 0x0004
)

Variables

View Source
var ErrDiskSpaceInformationUnavailable = errors.New("GetDiskSpaceInformationW is not available")

ErrDiskSpaceInformationUnavailable is returned by GetDiskSpaceInformation on Windows versions before Windows 10 1809 and Windows Server 2019, which lack GetDiskSpaceInformationW.

Functions

func IsProcessInJob added in v0.31.0

func IsProcessInJob(process windows.Handle, job windows.Handle) (bool, error)

func Load added in v0.32.0

func Load() error

Load checks that kernel32.dll exports every function this package calls without a check of its own. Call it in Build: a missing export panics on the first call otherwise.

func LocalFileTimeToFileTime

func LocalFileTimeToFileTime(localFileTime, utcFileTime *windows.Filetime) uint32

func OpenJobObject added in v0.31.0

func OpenJobObject(name string) (windows.Handle, error)

func QueryJobObjectProcessIDs added in v0.32.0

func QueryJobObjectProcessIDs(job windows.Handle) ([]uint32, error)

QueryJobObjectProcessIDs returns the IDs of all processes assigned to the job.

func QueryPerformanceFrequency added in v0.32.0

func QueryPerformanceFrequency() (int64, error)

QueryPerformanceFrequency returns the frequency of the performance counter in counts per second. 📑 https://learn.microsoft.com/en-us/windows/win32/api/profileapi/nf-profileapi-queryperformancefrequency

Types

type DiskSpaceInformation added in v0.32.0

type DiskSpaceInformation struct {
	ActualTotalAllocationUnits           uint64
	ActualAvailableAllocationUnits       uint64
	ActualPoolUnavailableAllocationUnits uint64
	CallerTotalAllocationUnits           uint64
	CallerAvailableAllocationUnits       uint64
	CallerPoolUnavailableAllocationUnits uint64
	UsedAllocationUnits                  uint64
	TotalReservedAllocationUnits         uint64
	VolumeStorageReserveAllocationUnits  uint64
	AvailableCommittedAllocationUnits    uint64
	PoolAvailableAllocationUnits         uint64
	SectorsPerAllocationUnit             uint32
	BytesPerSector                       uint32
}

DiskSpaceInformation contains disk space information for a volume. 📑 https://learn.microsoft.com/en-us/windows/win32/api/fileapi/ns-fileapi-disk_space_information

func GetDiskSpaceInformation added in v0.32.0

func GetDiskSpaceInformation(rootPath *uint16) (DiskSpaceInformation, error)

GetDiskSpaceInformation returns the disk space information of the volume with the root path rootPath. Unlike GetDiskFreeSpaceEx, it reports the size of the volume regardless of disk quotas. 📑 https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getdiskspaceinformationw

func (DiskSpaceInformation) AllocationUnitSize added in v0.32.0

func (d DiskSpaceInformation) AllocationUnitSize() uint64

AllocationUnitSize returns the size of an allocation unit in bytes.

type DynamicTimezoneInformation

type DynamicTimezoneInformation struct {
	Bias int32

	StandardDate                SYSTEMTIME
	StandardBias                int32
	DaylightName                [32]uint16
	DaylightDate                SYSTEMTIME
	DaylightBias                int32
	TimeZoneKeyName             [128]uint16
	DynamicDaylightTimeDisabled uint8 // BOOLEAN
	// contains filtered or unexported fields
}

DynamicTimezoneInformation contains the current dynamic daylight time settings. 📑 https://docs.microsoft.com/en-us/windows/win32/api/timezoneapi/ns-timezoneapi-dynamic_time_zone_information

func GetDynamicTimeZoneInformation

func GetDynamicTimeZoneInformation() (DynamicTimezoneInformation, error)

GetDynamicTimeZoneInformation retrieves the current dynamic daylight time settings. 📑 https://docs.microsoft.com/en-us/windows/win32/api/timezoneapi/nf-timezoneapi-getdynamictimezoneinformation

type JobObjectBasicAccountingInformation added in v0.31.0

type JobObjectBasicAccountingInformation struct {
	TotalUserTime             uint64
	TotalKernelTime           uint64
	ThisPeriodTotalUserTime   uint64
	ThisPeriodTotalKernelTime uint64
	TotalPageFaultCount       uint32
	TotalProcesses            uint32
	ActiveProcesses           uint32
	TotalTerminatedProcesses  uint32
}

type JobObjectBasicAndIOAccountingInformation added in v0.31.0

type JobObjectBasicAndIOAccountingInformation struct {
	BasicInfo JobObjectBasicAccountingInformation
	IoInfo    windows.IO_COUNTERS
}

JobObjectBasicAndIOAccountingInformation is a structure that contains both basic accounting information and I/O accounting information for a job object. It is used with the QueryInformationJobObject function. The structure is defined in the Windows API documentation. https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-jobobject_basic_and_io_accounting_information

type JobObjectBasicProcessIDList added in v0.31.0

type JobObjectBasicProcessIDList struct {
	NumberOfAssignedProcesses uint32
	NumberOfProcessIdsInList  uint32
	ProcessIdList             [1]uintptr
}

JobObjectBasicProcessIDList is the fixed-size head of JOBOBJECT_BASIC_PROCESS_ID_LIST. The ProcessIdList entries are ULONG_PTR and continue past the declared array; use QueryJobObjectProcessIDs to read them. https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-jobobject_basic_process_id_list

type JobObjectMemoryUsageInformation added in v0.31.0

type JobObjectMemoryUsageInformation struct {
	JobMemory         uint64
	PeakJobMemoryUsed uint64
}

type SYSTEMTIME

type SYSTEMTIME struct {
	WYear         uint16
	WMonth        uint16
	WDayOfWeek    uint16
	WDay          uint16
	WHour         uint16
	WMinute       uint16
	WSecond       uint16
	WMilliseconds uint16
}

SYSTEMTIME contains a date and time. 📑 https://docs.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-systemtime

type VM_COUNTERS_EX2 added in v0.32.0

type VM_COUNTERS_EX2 struct {
	PeakVirtualSize            uintptr
	VirtualSize                uintptr
	PageFaultCount             uint32
	PeakWorkingSetSize         uintptr
	WorkingSetSize             uintptr
	QuotaPeakPagedPoolUsage    uintptr
	QuotaPagedPoolUsage        uintptr
	QuotaPeakNonPagedPoolUsage uintptr
	QuotaNonPagedPoolUsage     uintptr
	PagefileUsage              uintptr
	PeakPagefileUsage          uintptr
	PrivateUsage               uintptr
	PrivateWorkingSetSize      uintptr
	SharedCommitUsage          uintptr
}

VM_COUNTERS_EX2 is the ProcessVmCounters layout used by NtQueryInformationProcess. PrivateUsage is private commit; PrivateWorkingSetSize is resident private memory.

Jump to

Keyboard shortcuts

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