mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[SERVICES_WINETEST] Sync with Wine Staging 1.9.18.
svn path=/trunk/; revision=72613
This commit is contained in:
parent
ae503d62cc
commit
4ec63eee1b
1 changed files with 45 additions and 8 deletions
|
@ -82,6 +82,9 @@ static DWORD WINAPI service_handler(DWORD ctrl, DWORD event_type, void *event_da
|
|||
SetServiceStatus(service_handle, &status);
|
||||
SetEvent(service_stop_event);
|
||||
return NO_ERROR;
|
||||
case 128:
|
||||
service_event("CUSTOM");
|
||||
return 0xdeadbeef;
|
||||
default:
|
||||
status.dwCurrentState = SERVICE_RUNNING;
|
||||
SetServiceStatus( service_handle, &status );
|
||||
|
@ -92,11 +95,17 @@ static DWORD WINAPI service_handler(DWORD ctrl, DWORD event_type, void *event_da
|
|||
static void WINAPI service_main(DWORD argc, char **argv)
|
||||
{
|
||||
SERVICE_STATUS status;
|
||||
char buf[64];
|
||||
BOOL res;
|
||||
|
||||
service_ok(argc == 1, "argc = %d\n", argc);
|
||||
if(argc)
|
||||
service_ok(!strcmp(argv[0], service_name), "argv[0] = %s, expected %s\n", argv[0], service_name);
|
||||
service_ok(argc == 3, "argc = %u, expected 3\n", argc);
|
||||
service_ok(!strcmp(argv[0], service_name), "argv[0] = '%s', expected '%s'\n", argv[0], service_name);
|
||||
service_ok(!strcmp(argv[1], "param1"), "argv[1] = '%s', expected 'param1'\n", argv[1]);
|
||||
service_ok(!strcmp(argv[2], "param2"), "argv[2] = '%s', expected 'param2'\n", argv[2]);
|
||||
|
||||
buf[0] = 0;
|
||||
GetEnvironmentVariableA("PATHEXT", buf, sizeof(buf));
|
||||
service_ok(buf[0], "did not find PATHEXT environment variable\n");
|
||||
|
||||
service_handle = pRegisterServiceCtrlHandlerExA(service_name, service_handler, NULL);
|
||||
service_ok(service_handle != NULL, "RegisterServiceCtrlHandlerEx failed: %u\n", GetLastError());
|
||||
|
@ -190,9 +199,8 @@ static void WINAPI no_stop_main(DWORD argc, char **argv)
|
|||
SERVICE_STATUS status;
|
||||
BOOL res;
|
||||
|
||||
service_ok(argc == 1, "argc = %d\n", argc);
|
||||
if(argc)
|
||||
service_ok(!strcmp(argv[0], service_name), "argv[0] = %s, expected %s\n", argv[0], service_name);
|
||||
service_ok(argc == 1, "argc = %u, expected 1\n", argc);
|
||||
service_ok(!strcmp(argv[0], service_name), "argv[0] = '%s', expected '%s'\n", argv[0], service_name);
|
||||
|
||||
service_handle = pRegisterServiceCtrlHandlerExA(service_name, no_stop_handler, NULL);
|
||||
service_ok(service_handle != NULL, "RegisterServiceCtrlHandlerEx failed: %u\n", GetLastError());
|
||||
|
@ -274,7 +282,7 @@ static void expect_event(const char *event_name)
|
|||
|
||||
static DWORD WINAPI pipe_thread(void *arg)
|
||||
{
|
||||
char buf[257], *ptr;
|
||||
char buf[512], *ptr;
|
||||
DWORD read;
|
||||
BOOL res;
|
||||
|
||||
|
@ -316,15 +324,18 @@ static DWORD WINAPI pipe_thread(void *arg)
|
|||
|
||||
static void test_service(void)
|
||||
{
|
||||
static const char *argv[2] = {"param1", "param2"};
|
||||
SC_HANDLE service_handle = register_service("simple_service");
|
||||
SERVICE_STATUS_PROCESS status2;
|
||||
SERVICE_STATUS status;
|
||||
DWORD bytes;
|
||||
BOOL res;
|
||||
|
||||
if(!service_handle)
|
||||
return;
|
||||
|
||||
trace("starting...\n");
|
||||
res = StartServiceA(service_handle, 0, NULL);
|
||||
res = StartServiceA(service_handle, 2, argv);
|
||||
ok(res, "StartService failed: %u\n", GetLastError());
|
||||
if(!res) {
|
||||
DeleteService(service_handle);
|
||||
|
@ -345,6 +356,15 @@ static void test_service(void)
|
|||
ok(status.dwCheckPoint == 0, "status.dwCheckPoint = %d\n", status.dwCheckPoint);
|
||||
todo_wine ok(status.dwWaitHint == 0, "status.dwWaitHint = %d\n", status.dwWaitHint);
|
||||
|
||||
res = QueryServiceStatusEx(service_handle, SC_STATUS_PROCESS_INFO, (BYTE *)&status2, sizeof(status2), &bytes);
|
||||
ok(res, "QueryServiceStatusEx failed: %u\n", GetLastError());
|
||||
ok(status2.dwCurrentState == SERVICE_RUNNING, "status2.dwCurrentState = %x\n", status2.dwCurrentState);
|
||||
ok(status2.dwProcessId != 0, "status2.dwProcessId = %d\n", status2.dwProcessId);
|
||||
|
||||
res = ControlService(service_handle, 128, &status);
|
||||
ok(res, "ControlService failed: %u\n", GetLastError());
|
||||
expect_event("CUSTOM");
|
||||
|
||||
res = ControlService(service_handle, SERVICE_CONTROL_STOP, &status);
|
||||
ok(res, "ControlService failed: %u\n", GetLastError());
|
||||
expect_event("STOP");
|
||||
|
@ -358,7 +378,9 @@ static void test_service(void)
|
|||
static inline void test_no_stop(void)
|
||||
{
|
||||
SC_HANDLE service_handle = register_service("no_stop");
|
||||
SERVICE_STATUS_PROCESS status2;
|
||||
SERVICE_STATUS status;
|
||||
DWORD bytes;
|
||||
BOOL res;
|
||||
|
||||
if(!service_handle)
|
||||
|
@ -389,6 +411,11 @@ static inline void test_no_stop(void)
|
|||
ok(status.dwCheckPoint == 0, "status.dwCheckPoint = %d\n", status.dwCheckPoint);
|
||||
todo_wine ok(status.dwWaitHint == 0, "status.dwWaitHint = %d\n", status.dwWaitHint);
|
||||
|
||||
res = QueryServiceStatusEx(service_handle, SC_STATUS_PROCESS_INFO, (BYTE *)&status2, sizeof(status2), &bytes);
|
||||
ok(res, "QueryServiceStatusEx failed: %u\n", GetLastError());
|
||||
ok(status2.dwCurrentState == SERVICE_RUNNING, "status2.dwCurrentState = %x\n", status2.dwCurrentState);
|
||||
ok(status2.dwProcessId != 0, "status2.dwProcessId = %d\n", status2.dwProcessId);
|
||||
|
||||
res = ControlService(service_handle, SERVICE_CONTROL_STOP, &status);
|
||||
ok(res, "ControlService failed: %u\n", GetLastError());
|
||||
expect_event("STOP");
|
||||
|
@ -405,6 +432,11 @@ static inline void test_no_stop(void)
|
|||
ok(status.dwCheckPoint == 0, "status.dwCheckPoint = %d\n", status.dwCheckPoint);
|
||||
ok(status.dwWaitHint == 0, "status.dwWaitHint = %d\n", status.dwWaitHint);
|
||||
|
||||
res = QueryServiceStatusEx(service_handle, SC_STATUS_PROCESS_INFO, (BYTE *)&status2, sizeof(status2), &bytes);
|
||||
ok(res, "QueryServiceStatusEx failed: %u\n", GetLastError());
|
||||
ok(status2.dwProcessId == 0 || broken(status2.dwProcessId != 0),
|
||||
"status2.dwProcessId = %d\n", status2.dwProcessId);
|
||||
|
||||
res = DeleteService(service_handle);
|
||||
ok(res, "DeleteService failed: %u\n", GetLastError());
|
||||
|
||||
|
@ -420,6 +452,11 @@ static inline void test_no_stop(void)
|
|||
ok(status.dwCheckPoint == 0, "status.dwCheckPoint = %d\n", status.dwCheckPoint);
|
||||
ok(status.dwWaitHint == 0, "status.dwWaitHint = %d\n", status.dwWaitHint);
|
||||
|
||||
res = QueryServiceStatusEx(service_handle, SC_STATUS_PROCESS_INFO, (BYTE *)&status2, sizeof(status2), &bytes);
|
||||
ok(res, "QueryServiceStatusEx failed: %u\n", GetLastError());
|
||||
ok(status2.dwProcessId == 0 || broken(status2.dwProcessId != 0),
|
||||
"status2.dwProcessId = %d\n", status2.dwProcessId);
|
||||
|
||||
CloseServiceHandle(service_handle);
|
||||
|
||||
res = QueryServiceStatus(service_handle, &status);
|
||||
|
|
Loading…
Reference in a new issue