private unsafe void CreateRequestQueueHandle()
{
uint statusCode = Interop.HttpApi.ERROR_SUCCESS;
HttpRequestQueueV2Handle requestQueueHandle = null;
statusCode =
Interop.HttpApi.HttpCreateRequestQueue(
Interop.HttpApi.s_version, null, null, 0, out requestQueueHandle);
if (statusCode != Interop.HttpApi.ERROR_SUCCESS)
{
throw new HttpListenerException((int)statusCode);
}
// Disabling callbacks when IO operation completes synchronously (returns ErrorCodes.ERROR_SUCCESS)
if (SkipIOCPCallbackOnSuccess &&
!Interop.HttpApi.SetFileCompletionNotificationModes(
requestQueueHandle,
Interop.HttpApi.FileCompletionNotificationModes.SkipCompletionPortOnSuccess |
Interop.HttpApi.FileCompletionNotificationModes.SkipSetEventOnHandle))
{
throw new HttpListenerException(Marshal.GetLastWin32Error());
}
_requestQueueHandle = requestQueueHandle;
}