|
|
@@ -205,6 +205,7 @@ var (
|
|
|
procGetPriorityClass = modkernel32.NewProc("GetPriorityClass")
|
|
|
procSetInformationJobObject = modkernel32.NewProc("SetInformationJobObject")
|
|
|
procGenerateConsoleCtrlEvent = modkernel32.NewProc("GenerateConsoleCtrlEvent")
|
|
|
+ procGetProcessId = modkernel32.NewProc("GetProcessId")
|
|
|
procDefineDosDeviceW = modkernel32.NewProc("DefineDosDeviceW")
|
|
|
procDeleteVolumeMountPointW = modkernel32.NewProc("DeleteVolumeMountPointW")
|
|
|
procFindFirstVolumeW = modkernel32.NewProc("FindFirstVolumeW")
|
|
|
@@ -2209,6 +2210,19 @@ func GenerateConsoleCtrlEvent(ctrlEvent uint32, processGroupID uint32) (err erro
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+func GetProcessId(process Handle) (id uint32, err error) {
|
|
|
+ r0, _, e1 := syscall.Syscall(procGetProcessId.Addr(), 1, uintptr(process), 0, 0)
|
|
|
+ id = uint32(r0)
|
|
|
+ if id == 0 {
|
|
|
+ if e1 != 0 {
|
|
|
+ err = errnoErr(e1)
|
|
|
+ } else {
|
|
|
+ err = syscall.EINVAL
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
func DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) {
|
|
|
r1, _, e1 := syscall.Syscall(procDefineDosDeviceW.Addr(), 3, uintptr(flags), uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath)))
|
|
|
if r1 == 0 {
|