Author: akhaldi
Date: Wed Sep 7 22:35:17 2016
New Revision: 72613
URL:
http://svn.reactos.org/svn/reactos?rev=72613&view=rev
Log:
[SERVICES_WINETEST] Sync with Wine Staging 1.9.18.
Modified:
trunk/rostests/winetests/services/service.c
Modified: trunk/rostests/winetests/services/service.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/services/servic…
==============================================================================
--- trunk/rostests/winetests/services/service.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/services/service.c [iso-8859-1] Wed Sep 7 22:35:17 2016
@@ -82,6 +82,9 @@
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 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 @@
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 DWORD WINAPI pipe_thread(void *arg)
{
- char buf[257], *ptr;
+ char buf[512], *ptr;
DWORD read;
BOOL res;
@@ -316,15 +324,18 @@
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 @@
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 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 @@
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 @@
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 @@
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);