mirror of
https://github.com/golang/sys.git
synced 2026-02-09 04:06:04 +03:00
windows: expose GetCurrentProcessId function
Change-Id: I537bce4415871f0d4669398bd72e4eb7c9c03481 Reviewed-on: https://go-review.googlesource.com/c/sys/+/180921 Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
This commit is contained in:
committed by
Alex Brainman
parent
301114b31c
commit
1e42afee0f
@@ -234,7 +234,7 @@ func NewCallbackCDecl(fn interface{}) uintptr {
|
||||
//sys RegQueryInfoKey(key Handle, class *uint16, classLen *uint32, reserved *uint32, subkeysLen *uint32, maxSubkeyLen *uint32, maxClassLen *uint32, valuesLen *uint32, maxValueNameLen *uint32, maxValueLen *uint32, saLen *uint32, lastWriteTime *Filetime) (regerrno error) = advapi32.RegQueryInfoKeyW
|
||||
//sys RegEnumKeyEx(key Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, class *uint16, classLen *uint32, lastWriteTime *Filetime) (regerrno error) = advapi32.RegEnumKeyExW
|
||||
//sys RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) = advapi32.RegQueryValueExW
|
||||
//sys getCurrentProcessId() (pid uint32) = kernel32.GetCurrentProcessId
|
||||
//sys GetCurrentProcessId() (pid uint32) = kernel32.GetCurrentProcessId
|
||||
//sys GetConsoleMode(console Handle, mode *uint32) (err error) = kernel32.GetConsoleMode
|
||||
//sys SetConsoleMode(console Handle, mode uint32) (err error) = kernel32.SetConsoleMode
|
||||
//sys GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) = kernel32.GetConsoleScreenBufferInfo
|
||||
@@ -1118,7 +1118,7 @@ func SetsockoptIPv6Mreq(fd Handle, level, opt int, mreq *IPv6Mreq) (err error) {
|
||||
return syscall.EWINDOWS
|
||||
}
|
||||
|
||||
func Getpid() (pid int) { return int(getCurrentProcessId()) }
|
||||
func Getpid() (pid int) { return int(GetCurrentProcessId()) }
|
||||
|
||||
func FindFirstFile(name *uint16, data *Win32finddata) (handle Handle, err error) {
|
||||
// NOTE(rsc): The Win32finddata struct is wrong for the system call:
|
||||
|
||||
@@ -1841,7 +1841,7 @@ func RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32
|
||||
return
|
||||
}
|
||||
|
||||
func getCurrentProcessId() (pid uint32) {
|
||||
func GetCurrentProcessId() (pid uint32) {
|
||||
r0, _, _ := syscall.Syscall(procGetCurrentProcessId.Addr(), 0, 0, 0, 0)
|
||||
pid = uint32(r0)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user