Commit efacf6f4 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

httpapi: Start the http service in HttpInitialize().

parent d73fc3e8
MODULE = httpapi.dll
IMPORTLIB = httpapi
IMPORTS = advapi32
EXTRADLLFLAGS = -mno-cygwin
......
......@@ -19,6 +19,7 @@
*/
#include "wine/http.h"
#include "winsvc.h"
#include "winternl.h"
#include "wine/debug.h"
#include "wine/heap.h"
......@@ -52,11 +53,41 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID lpv )
* NO_ERROR if function succeeds, or error code if function fails
*
*/
ULONG WINAPI HttpInitialize( HTTPAPI_VERSION version, ULONG flags, PVOID reserved )
ULONG WINAPI HttpInitialize(HTTPAPI_VERSION version, ULONG flags, void *reserved)
{
FIXME( "({%d,%d}, 0x%x, %p): stub!\n", version.HttpApiMajorVersion,
version.HttpApiMinorVersion, flags, reserved );
return NO_ERROR;
static const WCHAR httpW[] = {'h','t','t','p',0};
SC_HANDLE manager, service;
TRACE("version %u.%u, flags %#x, reserved %p.\n", version.HttpApiMajorVersion,
version.HttpApiMinorVersion, flags, reserved);
if (flags & ~HTTP_INITIALIZE_SERVER)
{
FIXME("Unhandled flags %#x.\n", flags);
return ERROR_CALL_NOT_IMPLEMENTED;
}
if (!(manager = OpenSCManagerW(NULL, NULL, SC_MANAGER_CONNECT)))
return GetLastError();
if (!(service = OpenServiceW(manager, httpW, SERVICE_START)))
{
ERR("Failed to open HTTP service, error %u.\n", GetLastError());
CloseServiceHandle(manager);
return GetLastError();
}
if (!StartServiceW(service, 0, NULL) && GetLastError() != ERROR_SERVICE_ALREADY_RUNNING)
{
ERR("Failed to start HTTP service, error %u.\n", GetLastError());
CloseServiceHandle(service);
CloseServiceHandle(manager);
return GetLastError();
}
CloseServiceHandle(service);
CloseServiceHandle(manager);
return ERROR_SUCCESS;
}
/***********************************************************************
......
......@@ -122,8 +122,7 @@ static void test_v1_server(void)
/* Non-zero reserved parameter is accepted on XP/2k3. */
queue = NULL;
ret = HttpCreateHttpHandle(&queue, 0);
todo_wine ok(!ret, "Unexpected ret value %u.\n", ret);
if (ret) return;
ok(!ret, "Unexpected ret value %u.\n", ret);
ok(!!queue, "Unexpected handle value %p.\n", queue);
queue2 = NULL;
......@@ -314,8 +313,7 @@ static void test_v1_completion_port(void)
ovl.hEvent = CreateEventA(NULL, TRUE, FALSE, NULL);
ret = HttpCreateHttpHandle(&queue, 0);
todo_wine ok(!ret, "Got error %u.\n", ret);
if (ret) return;
ok(!ret, "Got error %u.\n", ret);
port = CreateIoCompletionPort(queue, NULL, 123, 0);
ok(!!port, "Failed to create completion port, error %u.\n", GetLastError());
......@@ -391,8 +389,7 @@ static void test_v1_multiple_requests(void)
ovl2.hEvent = CreateEventA(NULL, TRUE, FALSE, NULL);
ret = HttpCreateHttpHandle(&queue, 0);
todo_wine ok(!ret, "Got error %u.\n", ret);
if (ret) return;
ok(!ret, "Got error %u.\n", ret);
ret = HttpAddUrl(queue, localhost_urlW, NULL);
ok(!ret, "Got error %u.\n", ret);
......@@ -493,8 +490,7 @@ static void test_v1_short_buffer(void)
ovl.hEvent = CreateEventA(NULL, TRUE, FALSE, NULL);
ret = HttpCreateHttpHandle(&queue, 0);
todo_wine ok(!ret, "Got error %u.\n", ret);
if (ret) return;
ok(!ret, "Got error %u.\n", ret);
ret = HttpAddUrl(queue, localhost_urlW, NULL);
ok(!ret, "Got error %u.\n", ret);
......@@ -569,8 +565,7 @@ static void test_v1_entity_body(void)
req_body[i] = i / 111;
ret = HttpCreateHttpHandle(&queue, 0);
todo_wine ok(!ret, "Got error %u.\n", ret);
if (ret) return;
ok(!ret, "Got error %u.\n", ret);
ret = HttpAddUrl(queue, localhost_urlW, NULL);
ok(!ret, "Got error %u.\n", ret);
......@@ -716,8 +711,7 @@ static void test_v1_bad_request(void)
SOCKET s;
ret = HttpCreateHttpHandle(&queue, 0);
todo_wine ok(!ret, "Got error %u.\n", ret);
if (ret) return;
ok(!ret, "Got error %u.\n", ret);
ret = HttpAddUrl(queue, localhost_urlW, NULL);
ok(!ret, "Got error %u.\n", ret);
......@@ -774,8 +768,7 @@ static void test_v1_cooked_url(void)
"\r\n";
ret = HttpCreateHttpHandle(&queue, 0);
todo_wine ok(!ret, "Got error %u.\n", ret);
if (ret) return;
ok(!ret, "Got error %u.\n", ret);
ret = HttpAddUrl(queue, localhost_urlW, NULL);
ok(!ret, "Got error %u.\n", ret);
......@@ -849,8 +842,7 @@ static void test_v1_unknown_tokens(void)
"\r\n";
ret = HttpCreateHttpHandle(&queue, 0);
todo_wine ok(!ret, "Got error %u.\n", ret);
if (ret) return;
ok(!ret, "Got error %u.\n", ret);
ret = HttpAddUrl(queue, localhost_urlW, NULL);
ok(!ret, "Got error %u.\n", ret);
......
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