|
|
@@ -172,6 +172,7 @@ func NewCallbackCDecl(fn interface{}) uintptr {
|
|
|
//sys GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error)
|
|
|
//sys DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetProcessHandle Handle, lpTargetHandle *Handle, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (err error)
|
|
|
//sys WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, err error) [failretval==0xffffffff]
|
|
|
+//sys waitForMultipleObjects(count uint32, handles uintptr, waitAll bool, waitMilliseconds uint32) (event uint32, err error) [failretval==0xffffffff] = WaitForMultipleObjects
|
|
|
//sys GetTempPath(buflen uint32, buf *uint16) (n uint32, err error) = GetTempPathW
|
|
|
//sys CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, size uint32) (err error)
|
|
|
//sys GetFileType(filehandle Handle) (n uint32, err error)
|
|
|
@@ -589,6 +590,18 @@ func LoadSetFileCompletionNotificationModes() error {
|
|
|
return procSetFileCompletionNotificationModes.Find()
|
|
|
}
|
|
|
|
|
|
+func WaitForMultipleObjects(handles []Handle, waitAll bool, waitMilliseconds uint32) (event uint32, err error) {
|
|
|
+ // Every other win32 array API takes arguments as "pointer, count", except for this function. So we
|
|
|
+ // can't declare it as a usual [] type, because mksyscall will use the opposite order. We therefore
|
|
|
+ // trivially stub this ourselves.
|
|
|
+
|
|
|
+ var handlePtr *Handle
|
|
|
+ if len(handles) > 0 {
|
|
|
+ handlePtr = &handles[0]
|
|
|
+ }
|
|
|
+ return waitForMultipleObjects(uint32(len(handles)), uintptr(unsafe.Pointer(handlePtr)), waitAll, waitMilliseconds)
|
|
|
+}
|
|
|
+
|
|
|
// net api calls
|
|
|
|
|
|
const socket_error = uintptr(^uint32(0))
|