windows

package
v0.0.0-...-81e3f6c Latest Latest
Warning

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

Go to latest
Published: May 25, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Rendered for windows/amd64

Index

Constants

View Source
const (
	AF_INET  = 2
	AF_INET6 = 23
)
View Source
const (
	MAX_MODULE_NAME32 = 255
	MAX_PATH          = 260
)
View Source
const (
	TH32CS_SNAPHEAPLIST = 0x00000001
	TH32CS_SNAPPROCESS  = 0x00000002
	TH32CS_SNAPTHREAD   = 0x00000004
	TH32CS_SNAPMODULE   = 0x00000008
	TH32CS_SNAPMODULE32 = 0x00000010
	TH32CS_INHERIT      = 0x80000000
	TH32CS_SNAPALL      = TH32CS_SNAPHEAPLIST | TH32CS_SNAPMODULE | TH32CS_SNAPPROCESS | TH32CS_SNAPTHREAD
)

https://docs.microsoft.com/en-us/windows/desktop/api/tlhelp32/nf-tlhelp32-createtoolhelp32snapshot

View Source
const (
	MAX_ADAPTER_NAME       = 128
	MAX_INTERFACE_NAME_LEN = 256
	MAXLEN_PHYSADDR        = 8
	MAXLEN_IFDESCR         = 256
)

Variables

This section is empty.

Functions

func CloseHandle

func CloseHandle(object HANDLE) bool

func CreateIpForwardEntry

func CreateIpForwardEntry(route *MIB_IPFORWARDROW) uint32

func DeleteIpForwardEntry

func DeleteIpForwardEntry(route *MIB_IPFORWARDROW) uint32

func GetBestRoute

func GetBestRoute(destAddr, sourceAddr uint32, bestRoute *MIB_IPFORWARDROW) int

func GetExtendedTcpTable

func GetExtendedTcpTable(tcpTable uintptr, size *uint32, order int32, af uint32, tableClass TCP_TABLE_CLASS) int

func GetExtendedUdpTable

func GetExtendedUdpTable(udpTable uintptr, size *uint32, order int32, af uint32, tableClass UDP_TABLE_CLASS) int

func GetIfTable

func GetIfTable(table *MIB_IFTABLE, size *uint32, order int32) int

func GetInterfaceInfo

func GetInterfaceInfo(ifTable *IP_INTERFACE_INFO, outBufLen *uint32) int

func GetIpForwardTable

func GetIpForwardTable(table *MIB_IPFORWARDTABLE, size *uint32, order int32) int

func GetTcpStatistics

func GetTcpStatistics(statistics *MIB_TCPSTATS) int

func IPAddrATON

func IPAddrATON(addr string) uint32

FIXME IPv6

func IPAddrNTOA

func IPAddrNTOA(addr uint32) string

FIXME IPv6

func Module32First

func Module32First(snapshot HANDLE, me *MODULEENTRY32) bool

func NTOHS

func NTOHS(port uint16) uint16

func Process32First

func Process32First(snapshot HANDLE, pe *PROCESSENTRY32) bool

func UTF16PtrToString

func UTF16PtrToString(cstr *uint16) string

Types

type BOOL

type BOOL int32

type DWORD

type DWORD uint32

type HANDLE

type HANDLE uintptr

func CreateToolhelp32Snapshot

func CreateToolhelp32Snapshot(flags, processId uint32) HANDLE

type HMODULE

type HMODULE HANDLE

type IP_ADAPTER_INDEX_MAP

type IP_ADAPTER_INDEX_MAP struct {
	Index uint32
	Name  [MAX_ADAPTER_NAME]uint16
}

type IP_INTERFACE_INFO

type IP_INTERFACE_INFO struct {
	NumAdapters int32
	Adapter     [1024]IP_ADAPTER_INDEX_MAP // FIXME
}

type MIB_IFROW

type MIB_IFROW struct {
	Name            [MAX_INTERFACE_NAME_LEN]uint16
	Index           uint32
	Type            uint32
	Mtu             uint32
	Speed           uint32
	PhysAddrLen     uint32
	PhysAddr        [MAXLEN_PHYSADDR]uint8
	AdminStatus     uint32
	OperStatus      uint32
	LastChange      uint32
	InOctets        uint32
	InUcastPkts     uint32
	InNUcastPkts    uint32
	InDiscards      uint32
	InErrors        uint32
	InUnknownProtos uint32
	OutOctets       uint32
	OutUcastPkts    uint32
	OutNUcastPkts   uint32
	OutDiscards     uint32
	OutErrors       uint32
	OutQLen         uint32
	DescrLen        uint32
	Descr           [MAXLEN_IFDESCR]uint8
}

type MIB_IFTABLE

type MIB_IFTABLE struct {
	NumEntries uint32
	Table      [1024]MIB_IFROW // FIXME
}

type MIB_IPFORWARDROW

type MIB_IPFORWARDROW struct {
	ForwardDest      uint32
	ForwardMask      uint32
	ForwardPolicy    uint32
	ForwardNextHop   uint32
	ForwardIfIndex   uint32
	ForwardType      uint32
	ForwardProto     uint32
	ForwardAge       uint32
	ForwardNextHopAS uint32
	ForwardMetric1   uint32
	ForwardMetric2   uint32
	ForwardMetric3   uint32
	ForwardMetric4   uint32
	ForwardMetric5   uint32
}

type MIB_IPFORWARDTABLE

type MIB_IPFORWARDTABLE struct {
	NumEntries DWORD
	Table      [1024]MIB_IPFORWARDROW // FIXME
}

type MIB_TCPROW_OWNER_PID

type MIB_TCPROW_OWNER_PID struct {
	State      DWORD
	LocalAddr  DWORD
	LocalPort  DWORD
	RemoteAddr DWORD
	RemotePort DWORD
	OwningPid  DWORD
}

type MIB_TCPSTATS

type MIB_TCPSTATS struct {
	RtoAlgorithm DWORD
	RtoMin       DWORD
	RtoMax       DWORD
	MaxConn      DWORD
	ActiveOpens  DWORD
	PassiveOpens DWORD
	AttemptFails DWORD
	EstabResets  DWORD
	CurrEstab    DWORD
	InSegs       DWORD
	OutSegs      DWORD
	RetransSegs  DWORD
	InErrs       DWORD
	OutRsts      DWORD
	NumConns     DWORD
}

type MIB_TCPTABLE_OWNER_PID

type MIB_TCPTABLE_OWNER_PID struct {
	NumEntries DWORD
	// FIXME hard code the array size
	// is not the right way to go, a
	// system call will fail along
	// with the needed bytes return,
	// we should re-allocate sufficient
	// size array and then call again.
	Table [1024]MIB_TCPROW_OWNER_PID
}

type MIB_UDP6ROW_OWNER_PID

type MIB_UDP6ROW_OWNER_PID struct {
	LocalAddr    [16]uint8
	LocalScopeId DWORD
	LocalPort    DWORD
	OwningPid    DWORD
}

type MIB_UDP6TABLE_OWNER_PID

type MIB_UDP6TABLE_OWNER_PID struct {
	NumEntries DWORD
	Table      [1024]MIB_UDP6ROW_OWNER_PID // FIXME
}

type MIB_UDPROW_OWNER_PID

type MIB_UDPROW_OWNER_PID struct {
	LocalAddr DWORD
	LocalPort DWORD
	OwningPid DWORD
}

type MIB_UDPTABLE_OWNER_PID

type MIB_UDPTABLE_OWNER_PID struct {
	NumEntries DWORD
	Table      [1024]MIB_UDPROW_OWNER_PID // FIXME
}

type MODULEENTRY32

type MODULEENTRY32 struct {
	Size         uint32
	ModuleID     uint32
	ProcessID    uint32
	GlblcntUsage uint32
	ProccntUsage uint32
	ModBaseAddr  *uint8
	ModBaseSize  uint32
	HModule      HMODULE
	Module       [MAX_MODULE_NAME32 + 1]uint16
	ExePath      [MAX_PATH]uint16
}

type PDWORD

type PDWORD uintptr

type PROCESSENTRY32

type PROCESSENTRY32 struct {
	Size            uint32
	Usage           uint32
	ProcessID       uint32
	DefaultHeapID   ULONG_PTR
	ModuleID        uint32
	Threads         uint32
	ParentProcessID uint32
	PriClassBase    int32
	Flags           uint32
	ExeFile         [MAX_PATH]uint16
}

type TCP_TABLE_CLASS

type TCP_TABLE_CLASS DWORD
const (
	TCP_TABLE_BASIC_LISTENER TCP_TABLE_CLASS = iota
	TCP_TABLE_BASIC_CONNECTIONS
	TCP_TABLE_BASIC_ALL
	TCP_TABLE_OWNER_PID_LISTENER
	TCP_TABLE_OWNER_PID_CONNECTIONS
	TCP_TABLE_OWNER_PID_ALL
	TCP_TABLE_OWNER_MODULE_LISTENER
	TCP_TABLE_OWNER_MODULE_CONNECTIONS
	TCP_TABLE_OWNER_MODULE_ALL
)

type UDP_TABLE_CLASS

type UDP_TABLE_CLASS DWORD
const (
	UDP_TABLE_BASIC UDP_TABLE_CLASS = iota
	UDP_TABLE_OWNER_PID
	UDP_TABLE_OWNER_MODULE
)

type ULONG

type ULONG uint32

type ULONG_PTR

type ULONG_PTR uintptr

Jump to

Keyboard shortcuts

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