Commit 21a4bd7b authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

httpapi: Use wide-char string literals.

parent 403b5127
......@@ -27,8 +27,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(http);
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;
......@@ -53,7 +51,6 @@ static WCHAR *heap_strdupW(const WCHAR *str)
*/
ULONG WINAPI HttpInitialize(HTTPAPI_VERSION version, ULONG flags, void *reserved)
{
static const WCHAR httpW[] = {'h','t','t','p',0};
SC_HANDLE manager, service;
TRACE("version %u.%u, flags %#x, reserved %p.\n", version.HttpApiMajorVersion,
......@@ -68,7 +65,7 @@ ULONG WINAPI HttpInitialize(HTTPAPI_VERSION version, ULONG flags, void *reserved
if (!(manager = OpenSCManagerW(NULL, NULL, SC_MANAGER_CONNECT)))
return GetLastError();
if (!(service = OpenServiceW(manager, httpW, SERVICE_START)))
if (!(service = OpenServiceW(manager, L"http", SERVICE_START)))
{
ERR("Failed to open HTTP service, error %u.\n", GetLastError());
CloseServiceHandle(manager);
......@@ -205,7 +202,7 @@ ULONG WINAPI HttpCreateHttpHandle(HANDLE *handle, ULONG reserved)
if (!handle)
return ERROR_INVALID_PARAMETER;
RtlInitUnicodeString(&string, device_nameW);
RtlInitUnicodeString(&string, L"\\Device\\Http\\ReqQueue");
attr.ObjectName = &string;
return RtlNtStatusToDosError(NtCreateFile(handle, 0, &attr, &iosb, NULL,
FILE_ATTRIBUTE_NORMAL, 0, FILE_OPEN, FILE_NON_DIRECTORY_FILE, NULL, 0));
......@@ -752,7 +749,7 @@ ULONG WINAPI HttpCreateRequestQueue(HTTPAPI_VERSION version, const WCHAR *name,
if (flags)
FIXME("Unhandled flags %#x.\n", flags);
RtlInitUnicodeString(&string, device_nameW);
RtlInitUnicodeString(&string, L"\\Device\\Http\\ReqQueue");
attr.ObjectName = &string;
if (sa && sa->bInheritHandle)
attr.Attributes |= OBJ_INHERIT;
......
......@@ -33,13 +33,6 @@
#include "wine/test.h"
static const WCHAR invalid_url1[] = {'h','t','t','p',':','/','/','l','o','c','a','l','h','o','s','t',':','5','0','0','0','0',0};
static const WCHAR invalid_url2[] = {'l','o','c','a','l','h','o','s','t',':','5','0','0','0','0',0};
static const WCHAR invalid_url3[] = {'l','o','c','a','l','h','o','s','t',':','5','0','0','0','0','/',0};
static const WCHAR invalid_url4[] = {'h','t','t','p',':','/','/','l','o','c','a','l','h','o','s','t','/',0};
static const WCHAR invalid_url5[] = {'h','t','t','p',':','/','/','l','o','c','a','l','h','o','s','t',':','/',0};
static const WCHAR invalid_url6[] = {'h','t','t','p',':','/','/','l','o','c','a','l','h','o','s','t',':','0','/',0};
static ULONG (WINAPI *pHttpAddUrlToUrlGroup)(HTTP_URL_GROUP_ID id, const WCHAR *url, HTTP_URL_CONTEXT context, ULONG reserved);
static ULONG (WINAPI *pHttpCreateServerSession)(HTTPAPI_VERSION version, HTTP_SERVER_SESSION_ID *session_id, ULONG reserved);
static ULONG (WINAPI *pHttpCreateRequestQueue)(HTTPAPI_VERSION version, const WCHAR *name, SECURITY_ATTRIBUTES *sa, ULONG flags, HANDLE *handle);
......@@ -205,17 +198,17 @@ static void test_v1_server(void)
ret = HttpAddUrl(NULL, L"http://localhost:50000/", NULL);
ok(ret == ERROR_INVALID_HANDLE || ret == ERROR_INVALID_PARAMETER /* < Vista */, "Got error %u.\n", ret);
ret = HttpAddUrl(queue, invalid_url1, NULL);
ret = HttpAddUrl(queue, L"http://localhost:50000", NULL);
ok(ret == ERROR_INVALID_PARAMETER, "Got error %u.\n", ret);
ret = HttpAddUrl(queue, invalid_url2, NULL);
ret = HttpAddUrl(queue, L"localhost:50000", NULL);
ok(ret == ERROR_INVALID_PARAMETER, "Got error %u.\n", ret);
ret = HttpAddUrl(queue, invalid_url3, NULL);
ret = HttpAddUrl(queue, L"localhost:50000/", NULL);
ok(ret == ERROR_INVALID_PARAMETER, "Got error %u.\n", ret);
ret = HttpAddUrl(queue, invalid_url4, NULL);
ret = HttpAddUrl(queue, L"http://localhost/", NULL);
ok(ret == ERROR_INVALID_PARAMETER, "Got error %u.\n", ret);
ret = HttpAddUrl(queue, invalid_url5, NULL);
ret = HttpAddUrl(queue, L"http://localhost:/", NULL);
ok(ret == ERROR_INVALID_PARAMETER, "Got error %u.\n", ret);
ret = HttpAddUrl(queue, invalid_url6, NULL);
ret = HttpAddUrl(queue, L"http://localhost:0/", NULL);
ok(ret == ERROR_INVALID_PARAMETER, "Got error %u.\n", ret);
port = add_url_v1(queue);
swprintf(url, ARRAY_SIZE(url), L"http://localhost:%u/", port);
......@@ -1273,17 +1266,17 @@ static void test_v2_server(void)
port = add_url_v2(group);
ret = pHttpAddUrlToUrlGroup(group, invalid_url1, 0xdeadbeef, 0);
ret = pHttpAddUrlToUrlGroup(group, L"http://localhost:50000", 0xdeadbeef, 0);
todo_wine ok(ret == ERROR_INVALID_PARAMETER, "Got error %u.\n", ret);
ret = pHttpAddUrlToUrlGroup(group, invalid_url2, 0xdeadbeef, 0);
ret = pHttpAddUrlToUrlGroup(group, L"localhost:50000", 0xdeadbeef, 0);
todo_wine ok(ret == ERROR_INVALID_PARAMETER, "Got error %u.\n", ret);
ret = pHttpAddUrlToUrlGroup(group, invalid_url3, 0xdeadbeef, 0);
ret = pHttpAddUrlToUrlGroup(group, L"localhost:50000/", 0xdeadbeef, 0);
todo_wine ok(ret == ERROR_INVALID_PARAMETER, "Got error %u.\n", ret);
ret = pHttpAddUrlToUrlGroup(group, invalid_url4, 0xdeadbeef, 0);
ret = pHttpAddUrlToUrlGroup(group, L"http://localhost/", 0xdeadbeef, 0);
todo_wine ok(ret == ERROR_INVALID_PARAMETER, "Got error %u.\n", ret);
ret = pHttpAddUrlToUrlGroup(group, invalid_url5, 0xdeadbeef, 0);
ret = pHttpAddUrlToUrlGroup(group, L"http://localhost:/", 0xdeadbeef, 0);
todo_wine ok(ret == ERROR_INVALID_PARAMETER, "Got error %u.\n", ret);
ret = pHttpAddUrlToUrlGroup(group, invalid_url6, 0xdeadbeef, 0);
ret = pHttpAddUrlToUrlGroup(group, L"http://localhost:0/", 0xdeadbeef, 0);
todo_wine ok(ret == ERROR_INVALID_PARAMETER, "Got error %u.\n", ret);
swprintf(url, ARRAY_SIZE(url), L"http://localhost:%u/", port);
ret = pHttpAddUrlToUrlGroup(group, url, 0xdeadbeef, 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment