From 1e42afee0f762ed3d76e6dd942e4181855fd1849 Mon Sep 17 00:00:00 2001 From: Takuto Ikuta Date: Mon, 10 Jun 2019 16:20:03 +0900 Subject: [PATCH] windows: expose GetCurrentProcessId function Change-Id: I537bce4415871f0d4669398bd72e4eb7c9c03481 Reviewed-on: https://go-review.googlesource.com/c/sys/+/180921 Run-TryBot: Alex Brainman TryBot-Result: Gobot Gobot Reviewed-by: Alex Brainman --- windows/syscall_windows.go | 4 ++-- windows/zsyscall_windows.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/windows/syscall_windows.go b/windows/syscall_windows.go index 1d1170ab..6abf4986 100644 --- a/windows/syscall_windows.go +++ b/windows/syscall_windows.go @@ -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: diff --git a/windows/zsyscall_windows.go b/windows/zsyscall_windows.go index 376bd048..23da089b 100644 --- a/windows/zsyscall_windows.go +++ b/windows/zsyscall_windows.go @@ -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