fd = *((void**) buffer);
WTSFreeMemory(buffer);
- thread->signals[thread->num_signals++] = CreateFileDescriptorEvent(NULL, TRUE, FALSE, ((int) (long) fd));
+ thread->signals[thread->num_signals++] = CreateWaitObjectEvent(NULL, TRUE, FALSE, fd);
}
/* Wait for the client to confirm that the Audio Input dynamic channel is ready */
fd = *((void**) buffer);
WTSFreeMemory(buffer);
- thread->signals[thread->num_signals++] = CreateFileDescriptorEvent(NULL, TRUE, FALSE, ((int) (long) fd));
+ thread->signals[thread->num_signals++] = CreateWaitObjectEvent(NULL, TRUE, FALSE, fd);
}
s = stream_new(4096);
BOOL bManualReset, BOOL bInitialState, int FileDescriptor);
WINPR_API HANDLE CreateFileDescriptorEventA(LPSECURITY_ATTRIBUTES lpEventAttributes,
BOOL bManualReset, BOOL bInitialState, int FileDescriptor);
+WINPR_API HANDLE CreateWaitObjectEvent(LPSECURITY_ATTRIBUTES lpEventAttributes,
+ BOOL bManualReset, BOOL bInitialState, void* pObject);
#ifdef UNICODE
#define CreateFileDescriptorEvent CreateFileDescriptorEventW
return CreateFileDescriptorEventW(lpEventAttributes, bManualReset, bInitialState, FileDescriptor);
}
+/**
+ * Returns an event based on the handle returned by GetEventWaitObject()
+ */
+HANDLE CreateWaitObjectEvent(LPSECURITY_ATTRIBUTES lpEventAttributes,
+ BOOL bManualReset, BOOL bInitialState, void* pObject)
+{
+#ifndef _WIN32
+ return CreateFileDescriptorEventW(lpEventAttributes, bManualReset, bInitialState, (int) (ULONG_PTR) pObject);
+#else
+ HANDLE hEvent = NULL;
+
+ DuplicateHandle(GetCurrentProcess(), pObject, GetCurrentProcess(), &hEvent, 0, FALSE, DUPLICATE_SAME_ACCESS);
+
+ return hEvent;
+#endif
+}
+
/*
* Returns inner file descriptor for usage with select()
* This file descriptor is not usable on Windows