146 service_ok(!
r,
"GetMonitorInfo with NULL HMONITOR succeeded.\n");
152 "Unexpected monitor rcMonitor values: {%d,%d,%d,%d}\n",
156 "Unexpected monitor rcWork values: {%d,%d,%d,%d}\n",
160 "Unexpected szDevice received: %s\n",
mi.szDevice);
183 status.dwWin32ExitCode = 0;
184 status.dwServiceSpecificExitCode = 0;
194 status.dwControlsAccepted = 0;
224 service_ok(
buf[0],
"did not find PATHEXT environment variable\n");
234 status.dwWin32ExitCode = 0;
235 status.dwServiceSpecificExitCode = 0;
237 status.dwWaitHint = 10000;
246 status.dwControlsAccepted = 0;
291 status.dwWin32ExitCode = 0;
292 status.dwServiceSpecificExitCode = 0;
302 status.dwControlsAccepted = 0;
329 status.dwWin32ExitCode = 0;
330 status.dwServiceSpecificExitCode = 0;
332 status.dwWaitHint = 10000;
365 trace(
"service_cmd \"%s\"\n", service_cmd);
371 skip(
"Not enough access right to create service\n");
384 trace(
"waiting for %s\n", event_name);
396 ok(!
strcmp(evt, event_name),
"Unexpected event: %s, expected %s\n", evt, event_name);
420 ok(1,
"service: %s",
ptr+3);
422 ok(0,
"service: %s",
ptr+5);
424 trace(
"service event: %s\n",
ptr+6);
431 ok(0,
"malformed service message: %s\n",
ptr);
437 trace(
"pipe disconnected\n");
443 static const char *
argv[2] = {
"param1",
"param2"};
453 trace(
"starting...\n");
468 "status.dwControlsAccepted = %x\n",
status.dwControlsAccepted);
469 ok(
status.dwWin32ExitCode == 0,
"status.dwExitCode = %d\n",
status.dwWin32ExitCode);
470 ok(
status.dwServiceSpecificExitCode == 0,
"status.dwServiceSpecificExitCode = %d\n",
471 status.dwServiceSpecificExitCode);
472 ok(
status.dwCheckPoint == 0,
"status.dwCheckPoint = %d\n",
status.dwCheckPoint);
505 trace(
"starting...\n");
523 "status.dwControlsAccepted = %x\n",
status.dwControlsAccepted);
524 ok(
status.dwWin32ExitCode == 0,
"status.dwExitCode = %d\n",
status.dwWin32ExitCode);
525 ok(
status.dwServiceSpecificExitCode == 0,
"status.dwServiceSpecificExitCode = %d\n",
526 status.dwServiceSpecificExitCode);
527 ok(
status.dwCheckPoint == 0,
"status.dwCheckPoint = %d\n",
status.dwCheckPoint);
543 "status.dwCurrentState = %x\n",
status.dwCurrentState);
544 ok(
status.dwControlsAccepted == 0,
"status.dwControlsAccepted = %x\n",
status.dwControlsAccepted);
545 ok(
status.dwWin32ExitCode == 0,
"status.dwExitCode = %d\n",
status.dwWin32ExitCode);
546 ok(
status.dwServiceSpecificExitCode == 0,
"status.dwServiceSpecificExitCode = %d\n",
547 status.dwServiceSpecificExitCode);
548 ok(
status.dwCheckPoint == 0,
"status.dwCheckPoint = %d\n",
status.dwCheckPoint);
549 ok(
status.dwWaitHint == 0,
"status.dwWaitHint = %d\n",
status.dwWaitHint);
554 "status2.dwProcessId = %d\n", status2.
dwProcessId);
563 "status.dwCurrentState = %x\n",
status.dwCurrentState);
564 ok(
status.dwControlsAccepted == 0,
"status.dwControlsAccepted = %x\n",
status.dwControlsAccepted);
565 ok(
status.dwWin32ExitCode == 0,
"status.dwExitCode = %d\n",
status.dwWin32ExitCode);
566 ok(
status.dwServiceSpecificExitCode == 0,
"status.dwServiceSpecificExitCode = %d\n",
567 status.dwServiceSpecificExitCode);
568 ok(
status.dwCheckPoint == 0,
"status.dwCheckPoint = %d\n",
status.dwCheckPoint);
569 ok(
status.dwWaitHint == 0,
"status.dwWaitHint = %d\n",
status.dwWaitHint);
574 "status2.dwProcessId = %d\n", status2.
dwProcessId);
579 ok(!
res,
"QueryServiceStatus should have failed\n");
623 if(!pRegisterServiceCtrlHandlerExA) {
624 win_skip(
"RegisterServiceCtrlHandlerExA not available, skipping tests\n");
631 skip(
"OpenSCManager failed, skipping tests\n");
static SERVICE_STATUS_HANDLE(WINAPI *pRegisterServiceCtrlHandlerExA)(LPCSTR
static char service_name[100]
static SC_HANDLE scm_handle
int strcmp(const char *String1, const char *String2)
ACPI_SIZE strlen(const char *String)
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
char * strcpy(char *DstString, const char *SrcString)
static unsigned char bytes[4]
VOID WINAPI service_main(DWORD dwArgc, LPTSTR *lpszArgv)
#define ReadFile(a, b, c, d, e)
#define GetProcAddress(x, y)
#define INVALID_HANDLE_VALUE
#define CreateFileA(a, b, c, d, e, f, g)
#define ERROR_INVALID_HANDLE
#define FILE_ATTRIBUTE_NORMAL
#define GetEnvironmentVariableA(x, y, z)
#define ERROR_ACCESS_DENIED
DWORD WINAPI GetFileAttributesA(LPCSTR lpFileName)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
DWORD WINAPI GetModuleFileNameA(HINSTANCE hModule, LPSTR lpFilename, DWORD nSize)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
DWORD WINAPI GetTickCount(VOID)
GLuint GLuint GLsizei GLenum type
GLdouble GLdouble GLdouble r
GLenum GLuint GLenum GLsizei const GLchar * buf
int __cdecl vsprintf(char *_Dest, const char *_Format, va_list _Args)
#define sprintf(buf, format,...)
static const char * test_name
static __ms_va_list valist
static void service_ok(int cnd, const char *msg,...)
static void service_trace(const char *msg)
static void send_msg(const char *type, const char *msg)
static char named_pipe_name[100]
static void expect_event(const char *event_name)
static BOOL CALLBACK monitor_enum_proc(HMONITOR hmon, HDC hdc, LPRECT lprc, LPARAM lparam)
static void service_process(void(WINAPI *p_service_main)(DWORD, char **))
static void test_runner(void(*p_run_test)(void))
static HANDLE event_handle
static DWORD WINAPI pipe_thread(void *arg)
static char current_event[32]
static HANDLE pipe_handle
static void WINAPI no_stop_main(DWORD argc, char **argv)
static void test_monitors(void)
static void test_no_stop(void)
static DWORD WINAPI service_handler(DWORD ctrl, DWORD event_type, void *event_data, void *context)
static HANDLE service_stop_event
static void test_create_window(void)
static SERVICE_STATUS_HANDLE service_handle
static DWORD WINAPI no_stop_handler(DWORD ctrl, DWORD event_type, void *event_data, void *context)
static void test_service(void)
static CRITICAL_SECTION event_cs
static LPHANDLER_FUNCTION_EX
static void test_winstation(void)
static void service_event(const char *event)
BOOL WINAPI ConnectNamedPipe(IN HANDLE hNamedPipe, IN LPOVERLAPPED lpOverlapped)
BOOL WINAPI WaitNamedPipeA(LPCSTR lpNamedPipeName, DWORD nTimeOut)
BOOL WINAPI DisconnectNamedPipe(HANDLE hNamedPipe)
HANDLE WINAPI CreateNamedPipeA(LPCSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances, DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut, LPSECURITY_ATTRIBUTES lpSecurityAttributes)
#define WS_OVERLAPPEDWINDOW
BOOL WINAPI QueryServiceStatus(SC_HANDLE hService, LPSERVICE_STATUS lpServiceStatus)
BOOL WINAPI DeleteService(SC_HANDLE hService)
BOOL WINAPI StartServiceA(SC_HANDLE hService, DWORD dwNumServiceArgs, LPCSTR *lpServiceArgVectors)
BOOL WINAPI ControlService(SC_HANDLE hService, DWORD dwControl, LPSERVICE_STATUS lpServiceStatus)
BOOL WINAPI QueryServiceStatusEx(SC_HANDLE hService, SC_STATUS_TYPE InfoLevel, LPBYTE lpBuffer, DWORD cbBufSize, LPDWORD pcbBytesNeeded)
SC_HANDLE WINAPI CreateServiceA(SC_HANDLE hSCManager, LPCSTR lpServiceName, LPCSTR lpDisplayName, DWORD dwDesiredAccess, DWORD dwServiceType, DWORD dwStartType, DWORD dwErrorControl, LPCSTR lpBinaryPathName, LPCSTR lpLoadOrderGroup, LPDWORD lpdwTagId, LPCSTR lpDependencies, LPCSTR lpServiceStartName, LPCSTR lpPassword)
SC_HANDLE WINAPI OpenSCManagerA(LPCSTR lpMachineName, LPCSTR lpDatabaseName, DWORD dwDesiredAccess)
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
BOOL WINAPI StartServiceCtrlDispatcherA(const SERVICE_TABLE_ENTRYA *lpServiceStartTable)
BOOL WINAPI SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus, LPSERVICE_STATUS lpServiceStatus)
int winetest_get_mainargs(char ***pargv)
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventA(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCSTR lpName OPTIONAL)
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
#define INVALID_FILE_ATTRIBUTES
#define PIPE_ACCESS_INBOUND
DWORD WINAPI GetLastError(void)
#define NMPWAIT_USE_DEFAULT_WAIT
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
HWINSTA WINAPI GetProcessWindowStation(void)
#define PIPE_READMODE_MESSAGE
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define PIPE_TYPE_MESSAGE
#define ERROR_BROKEN_PIPE
#define ERROR_INVALID_MONITOR_HANDLE
#define ERROR_PIPE_CONNECTED
#define SERVICE_ACCEPT_STOP
#define SERVICE_STOP_PENDING
#define SERVICE_CONTROL_SHUTDOWN
#define SERVICE_CONTROL_STOP
#define SERVICE_ACCEPT_SHUTDOWN
BOOL WINAPI IsWindow(_In_opt_ HWND)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
BOOL WINAPI EnumDisplayMonitors(_In_opt_ HDC, _In_opt_ LPCRECT, _In_ MONITORENUMPROC, _In_ LPARAM)
HWND WINAPI GetDesktopWindow(void)
ATOM WINAPI RegisterClassExA(_In_ CONST WNDCLASSEXA *)
BOOL WINAPI GetMonitorInfoA(_In_ HMONITOR, _Inout_ LPMONITORINFO)
_In_ int _Inout_ LPRECT lprc
BOOL WINAPI GetUserObjectInformationA(_In_ HANDLE hObj, _In_ int nIndex, _Out_writes_bytes_opt_(nLength) PVOID pvInfo, _In_ DWORD nLength, _Out_opt_ LPDWORD lpnLengthNeeded)
struct _WNDCLASSEXA WNDCLASSEXA
BOOL WINAPI DestroyWindow(_In_ HWND)
#define SERVICE_DEMAND_START
#define SERVICE_WIN32_OWN_PROCESS
#define SERVICE_ERROR_IGNORE