64 status.dwWin32ExitCode = 0;
65 status.dwServiceSpecificExitCode = 0;
73 status.dwControlsAccepted = 0;
94 status.dwWin32ExitCode = 0;
95 status.dwServiceSpecificExitCode = 0;
104 status.dwControlsAccepted = 0;
128 char *next_arg_aligned;
130 service_ok(service_argc ==
argc - 3,
"service_argc = %d, expected %d", service_argc,
argc - 3);
131 if (service_argc ==
argc - 3)
134 service_ok(service_argv[0] == (
char *)&service_argv[service_argc] ||
135 service_argv[1] == (
char *)&service_argv[service_argc] ||
136 service_argv[1] == (
char *)(((
ULONG_PTR)&service_argv[service_argc] + 7) & ~7),
"service_argv[0] = %p, [1] = %p, expected one of them to be %p", service_argv[0], service_argv[1], &service_argv[service_argc]);
139 for (
i = 1;
i < service_argc;
i++)
145 service_argv[
i] == next_arg_aligned,
"service_argv[%d] = %p, expected %p or %p",
i, service_argv[
i],
next_arg, next_arg_aligned);
160 WCHAR *next_arg_aligned;
162 service_ok(service_argc ==
argc - 3,
"service_argc = %d, expected %d", service_argc,
argc - 3);
163 if (service_argc ==
argc - 3)
167 service_argv[1] == (
WCHAR *)&service_argv[service_argc] ||
168 service_argv[1] == (
WCHAR *)(((
ULONG_PTR)&service_argv[service_argc] + 7) & ~7),
"service_argv[0] = %p, [1] = %p, expected one of them to be %p", service_argv[0], service_argv[1], &service_argv[service_argc]);
171 for (
i = 1;
i < service_argc;
i++)
175 service_ok(!
wcscmp(service_argv[
i], argW),
"service_argv[%d] = %ls, expected %ls",
i, service_argv[
i], argW);
178 service_argv[
i] == next_arg_aligned,
"service_argv[%d] = %p, expected %p or %p",
i, service_argv[
i],
next_arg, next_arg_aligned);
233 StringCbCatW(service_cmd,
sizeof(service_cmd),
L" ServiceArgs ");
235 StringCbCatW(service_cmd,
sizeof(service_cmd), extra_args);
237 trace(
"service_cmd \"%ls\"\n", service_cmd);
244 skip(
"Not enough access right to create service\n");
273 trace(
"service trace: %s\n",
buf+6);
277 ok(1,
"service: %s\n",
buf+3);
281 ok(0,
"service: %s\n",
buf+5);
285 ok(0,
"malformed service message: %s\n",
buf);
390 skip(
"Failed to open service control manager. Skipping test\n");
396 char *service_argvA[10];
397 WCHAR *service_argvW[10];
404 service_argvA[0] =
"x";
405 service_argvW[0] =
L"x";
411 service_argvA[1] =
"y";
412 service_argvW[1] =
L"y";
418 service_argvA[0] =
"ab";
419 service_argvW[0] =
L"ab";
425 service_argvA[0] =
"abc";
426 service_argvW[0] =
L"abc";
432 service_argvA[0] =
"abcd";
433 service_argvW[0] =
L"abcd";
439 service_argvA[0] =
"abcde";
440 service_argvW[0] =
L"abcde";
446 service_argvA[0] =
"abcdef";
447 service_argvW[0] =
L"abcdef";
453 service_argvA[0] =
"abcdefg";
454 service_argvW[0] =
L"abcdefg";
460 service_argvA[0] =
"";
461 service_argvW[0] =
L"";
static SERVICE_STATUS_HANDLE(WINAPI *pRegisterServiceCtrlHandlerExA)(LPCSTR
static void service_ok(int cnd, const char *msg,...)
static void send_msg(const char *type, const char *msg)
static void test_runner(BOOLEAN unicode, PCWSTR extra_args, int service_argc, void *service_argv)
static VOID WINAPI service_handler(DWORD ctrl)
static void WINAPI service_mainW(DWORD service_argc, WCHAR **service_argv)
static DWORD WINAPI pipe_thread(void *arg)
static char service_nameA[100]
static HANDLE pipe_handle
static void WINAPI service_mainA(DWORD service_argc, char **service_argv)
static void test_startW(SC_HANDLE service_handle, int service_argc, const WCHAR **service_argv)
static WCHAR service_nameW[100]
static void service_process(BOOLEAN unicode)
static void test_startA(SC_HANDLE service_handle, int service_argc, const char **service_argv)
static SERVICE_STATUS_HANDLE service_handle
static SC_HANDLE scm_handle
static void service_main_common(void)
static WCHAR named_pipe_name[100]
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)
char * next_arg(char *src, char needle)
#define ReadFile(a, b, c, d, e)
#define INVALID_HANDLE_VALUE
#define ERROR_INVALID_HANDLE
#define FILE_ATTRIBUTE_NORMAL
#define WideCharToMultiByte
#define MultiByteToWideChar
#define ERROR_ACCESS_DENIED
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
DWORD WINAPI GetModuleFileNameW(HINSTANCE hModule, LPWSTR 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
GLenum GLuint GLenum GLsizei const GLchar * buf
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
int WINAPI lstrlenA(LPCSTR lpString)
static __ms_va_list valist
BOOL WINAPI ConnectNamedPipe(IN HANDLE hNamedPipe, IN LPOVERLAPPED lpOverlapped)
BOOL WINAPI DisconnectNamedPipe(HANDLE hNamedPipe)
HANDLE WINAPI CreateNamedPipeW(LPCWSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances, DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut, LPSECURITY_ATTRIBUTES lpSecurityAttributes)
BOOL WINAPI WaitNamedPipeW(LPCWSTR lpNamedPipeName, DWORD nTimeOut)
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)
SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, DWORD dwDesiredAccess)
SC_HANDLE WINAPI CreateServiceW(SC_HANDLE hSCManager, LPCWSTR lpServiceName, LPCWSTR lpDisplayName, DWORD dwDesiredAccess, DWORD dwServiceType, DWORD dwStartType, DWORD dwErrorControl, LPCWSTR lpBinaryPathName, LPCWSTR lpLoadOrderGroup, LPDWORD lpdwTagId, LPCWSTR lpDependencies, LPCWSTR lpServiceStartName, LPCWSTR lpPassword)
BOOL WINAPI StartServiceW(SC_HANDLE hService, DWORD dwNumServiceArgs, LPCWSTR *lpServiceArgVectors)
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
BOOL WINAPI StartServiceCtrlDispatcherA(const SERVICE_TABLE_ENTRYA *lpServiceStartTable)
BOOL WINAPI StartServiceCtrlDispatcherW(const SERVICE_TABLE_ENTRYW *lpServiceStartTable)
SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerW(LPCWSTR lpServiceName, LPHANDLER_FUNCTION lpHandlerProc)
BOOL WINAPI SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus, LPSERVICE_STATUS lpServiceStatus)
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
int winetest_get_mainargs(char ***pargv)
STRSAFEAPI StringCbVPrintfA(STRSAFE_LPSTR pszDest, size_t cbDest, STRSAFE_LPCSTR pszFormat, va_list argList)
STRSAFEAPI StringCbPrintfW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat,...)
STRSAFEAPI StringCbCatW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
STRSAFEAPI StringCbPrintfA(STRSAFE_LPSTR pszDest, size_t cbDest, STRSAFE_LPCSTR pszFormat,...)
void service_trace(const char *msg,...)
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
#define PIPE_ACCESS_INBOUND
DWORD WINAPI GetLastError(void)
#define NMPWAIT_USE_DEFAULT_WAIT
#define PIPE_READMODE_MESSAGE
#define PIPE_TYPE_MESSAGE
#define ERROR_BROKEN_PIPE
#define ERROR_PIPE_CONNECTED
#define SERVICE_ACCEPT_STOP
#define SERVICE_ALL_ACCESS
#define SERVICE_STOP_PENDING
#define SERVICE_CONTROL_STOP
#define SERVICE_ACCEPT_SHUTDOWN
#define SC_MANAGER_ALL_ACCESS
#define SERVICE_DEMAND_START
#define SERVICE_WIN32_OWN_PROCESS
#define SERVICE_ERROR_IGNORE