From b19f4488f6d73e5c4ebdeee44845c54832477ecb Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Thu, 29 Aug 2019 19:58:06 -0500 Subject: [PATCH] httpapi: Implement HttpCreateRequestQueue() and HttpCloseRequestQueue(). Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47476 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46549 Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/httpapi/httpapi.spec | 2 ++ dlls/httpapi/httpapi_main.c | 42 ++++++++++++++++++++++++++++++++++++- include/http.h | 5 +++++ 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/dlls/httpapi/httpapi.spec b/dlls/httpapi/httpapi.spec index ae3406f44ee..e2f165c6880 100644 --- a/dlls/httpapi/httpapi.spec +++ b/dlls/httpapi/httpapi.spec @@ -7,8 +7,10 @@ @ stub HttpCreateConfigGroup @ stub HttpCreateFilter @ stdcall HttpCreateHttpHandle(ptr long) +@ stdcall HttpCreateRequestQueue(long wstr ptr long ptr) @ stdcall HttpCreateServerSession(long ptr long) @ stdcall HttpCreateUrlGroup(int64 ptr long) +@ stdcall HttpCloseRequestQueue(ptr) @ stdcall HttpCloseServerSession(int64) @ stdcall HttpCloseUrlGroup(int64) @ stub HttpDeleteConfigGroup diff --git a/dlls/httpapi/httpapi_main.c b/dlls/httpapi/httpapi_main.c index 353632e7f04..3b0b86fb4d3 100644 --- a/dlls/httpapi/httpapi_main.c +++ b/dlls/httpapi/httpapi_main.c @@ -27,6 +27,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(httpapi); +static const WCHAR device_nameW[] = {'\\','D','e','v','i','c','e','\\','H','t','t','p','\\','R','e','q','Q','u','e','u','e',0}; + static WCHAR *heap_strdupW(const WCHAR *str) { int len = wcslen(str) + 1; @@ -207,7 +209,6 @@ ULONG WINAPI HttpSetServiceConfiguration( HANDLE handle, HTTP_SERVICE_CONFIG_ID */ ULONG WINAPI HttpCreateHttpHandle(HANDLE *handle, ULONG reserved) { - static const WCHAR device_nameW[] = {'\\','D','e','v','i','c','e','\\','H','t','t','p','\\','R','e','q','Q','u','e','u','e',0}; OBJECT_ATTRIBUTES attr = {sizeof(attr)}; UNICODE_STRING string; IO_STATUS_BLOCK iosb; @@ -693,3 +694,42 @@ ULONG WINAPI HttpRemoveUrlFromUrlGroup(HTTP_URL_GROUP_ID id, const WCHAR *url, U return ERROR_SUCCESS; } + +/*********************************************************************** + * HttpCreateRequestQueue (HTTPAPI.@) + */ +ULONG WINAPI HttpCreateRequestQueue(HTTPAPI_VERSION version, const WCHAR *name, + SECURITY_ATTRIBUTES *sa, ULONG flags, HANDLE *handle) +{ + OBJECT_ATTRIBUTES attr = {sizeof(attr)}; + UNICODE_STRING string; + IO_STATUS_BLOCK iosb; + + TRACE("version %u.%u, name %s, sa %p, flags %#x, handle %p.\n", + version.HttpApiMajorVersion, version.HttpApiMinorVersion, + debugstr_w(name), sa, flags, handle); + + if (name) + FIXME("Unhandled name %s.\n", debugstr_w(name)); + if (flags) + FIXME("Unhandled flags %#x.\n", flags); + + RtlInitUnicodeString(&string, device_nameW); + attr.ObjectName = &string; + if (sa && sa->bInheritHandle) + attr.Attributes |= OBJ_INHERIT; + attr.SecurityDescriptor = sa ? sa->lpSecurityDescriptor : NULL; + return RtlNtStatusToDosError(NtCreateFile(handle, 0, &attr, &iosb, NULL, + FILE_ATTRIBUTE_NORMAL, 0, FILE_OPEN, FILE_NON_DIRECTORY_FILE, NULL, 0)); +} + +/*********************************************************************** + * HttpCloseRequestQueue (HTTPAPI.@) + */ +ULONG WINAPI HttpCloseRequestQueue(HANDLE handle) +{ + TRACE("handle %p.\n", handle); + if (!CloseHandle(handle)) + return GetLastError(); + return ERROR_SUCCESS; +} diff --git a/include/http.h b/include/http.h index c4bb107dd18..7586d0cbe01 100644 --- a/include/http.h +++ b/include/http.h @@ -37,6 +37,9 @@ typedef struct _HTTPAPI_VERSION #define HTTPAPI_VERSION_1 {1,0} #define HTTPAPI_VERSION_2 {2,0} +#define HTTP_CREATE_REQUEST_QUEUE_FLAG_OPEN_EXISTING 0x00000001 +#define HTTP_CREATE_REQUEST_QUEUE_FLAG_CONTROLLER 0x00000002 + #define HTTP_INITIALIZE_SERVER 0x00000001 #define HTTP_INITIALIZE_CONFIG 0x00000002 @@ -426,9 +429,11 @@ typedef struct _HTTP_BINDING_INFO ULONG WINAPI HttpAddUrl(HANDLE,PCWSTR,PVOID); ULONG WINAPI HttpAddUrlToUrlGroup(HTTP_URL_GROUP_ID id, const WCHAR *url, HTTP_URL_CONTEXT context, ULONG reserved); +ULONG WINAPI HttpCloseRequestQueue(HANDLE handle); ULONG WINAPI HttpCloseServerSession(HTTP_SERVER_SESSION_ID id); ULONG WINAPI HttpCloseUrlGroup(HTTP_URL_GROUP_ID id); ULONG WINAPI HttpCreateHttpHandle(PHANDLE,ULONG); +ULONG WINAPI HttpCreateRequestQueue(HTTPAPI_VERSION version, const WCHAR *name, SECURITY_ATTRIBUTES *sa, ULONG flags, HANDLE *handle); ULONG WINAPI HttpCreateServerSession(HTTPAPI_VERSION,PHTTP_SERVER_SESSION_ID,ULONG); ULONG WINAPI HttpCreateUrlGroup(HTTP_SERVER_SESSION_ID session_id, HTTP_URL_GROUP_ID *group_id, ULONG reserved); ULONG WINAPI HttpDeleteServiceConfiguration(HANDLE,HTTP_SERVICE_CONFIG_ID,PVOID,ULONG,LPOVERLAPPED);