ReactOS  0.4.14-dev-77-gd9e7c48
ServiceNetwork.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS api tests
3  * LICENSE: GPLv2+ - See COPYING in the top level directory
4  * PURPOSE: Test for service networking
5  * PROGRAMMER: Pierre Schweitzer
6  */
7 
8 #include "precomp.h"
9 
10 #include "svchlp.h"
11 
12 #define WIN32_NO_STATUS
13 #include <iphlpapi.h>
14 #include <winsock2.h>
15 
16 /*** Service part of the test ***/
17 
19 
20 static void
22  DWORD dwWin32ExitCode,
23  DWORD dwWaitHint)
24 {
25  BOOL res;
27 
28  status.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
29  status.dwCurrentState = dwCurrentState;
30  status.dwWin32ExitCode = dwWin32ExitCode;
31  status.dwWaitHint = dwWaitHint;
32 
33  status.dwServiceSpecificExitCode = 0;
34  status.dwCheckPoint = 0;
35 
36  if ( (dwCurrentState == SERVICE_START_PENDING) ||
37  (dwCurrentState == SERVICE_STOP_PENDING) ||
38  (dwCurrentState == SERVICE_STOPPED) )
39  {
40  status.dwControlsAccepted = 0;
41  }
42  else
43  {
44  status.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN;
45  }
46 
47 #if 0
48  if ( (dwCurrentState == SERVICE_RUNNING) || (dwCurrentState == SERVICE_STOPPED) )
49  status.dwCheckPoint = 0;
50  else
51  status.dwCheckPoint = dwCheckPoint++;
52 #endif
53 
55  service_ok(res, "SetServiceStatus(%d) failed: %lu\n", dwCurrentState, GetLastError());
56 }
57 
59 {
60  switch(ctrl)
61  {
65  default:
67  }
68 }
69 
71 {
72  DWORD ret;
73  DWORD Size = 0;
74 
75  *TcpTable = NULL;
76 
77  ret = GetExtendedTcpTable(*TcpTable, &Size, Order, Family, Class, 0);
79  {
80  *TcpTable = HeapAlloc(GetProcessHeap(), 0, Size);
81  if (*TcpTable == NULL)
82  {
83  return ERROR_OUTOFMEMORY;
84  }
85 
86  ret = GetExtendedTcpTable(*TcpTable, &Size, Order, Family, Class, 0);
87  if (ret != NO_ERROR)
88  {
89  HeapFree(GetProcessHeap(), 0, *TcpTable);
90  *TcpTable = NULL;
91  }
92  }
93 
94  return ret;
95 }
96 
98 {
99  DWORD ret;
100  DWORD Size = 0;
101 
102  *UdpTable = NULL;
103 
104  ret = GetExtendedUdpTable(*UdpTable, &Size, Order, Family, Class, 0);
106  {
107  *UdpTable = HeapAlloc(GetProcessHeap(), 0, Size);
108  if (*UdpTable == NULL)
109  {
110  return ERROR_OUTOFMEMORY;
111  }
112 
113  ret = GetExtendedUdpTable(*UdpTable, &Size, Order, Family, Class, 0);
114  if (ret != NO_ERROR)
115  {
116  HeapFree(GetProcessHeap(), 0, *UdpTable);
117  *UdpTable = NULL;
118  }
119  }
120 
121  return ret;
122 }
123 
124 static void
125 test_tcp(LPWSTR svc_name, DWORD service_tag)
126 {
127  SOCKET sock;
129  PMIB_TCPTABLE_OWNER_MODULE TcpTableOwnerMod;
130  DWORD i, ret;
131  BOOLEAN Found;
132  DWORD Pid = GetCurrentProcessId();
133 
135  service_ok(sock != INVALID_SOCKET, "Socket creation failed!\n");
136 
137  ZeroMemory(&server, sizeof(SOCKADDR_IN));
138  server.sin_family = AF_INET;
139  server.sin_addr.s_addr = htonl(INADDR_ANY);
140  server.sin_port = htons(9876);
141 
142  ret = bind(sock, (SOCKADDR*)&server, sizeof(SOCKADDR_IN));
143  service_ok(ret != SOCKET_ERROR, "binding failed\n");
144 
145  ret = listen(sock, SOMAXCONN);
146  service_ok(ret != SOCKET_ERROR, "listening failed\n");
147 
149  service_ok(ret == ERROR_SUCCESS, "GetExtendedTcpTableWithAlloc failed: %x\n", ret);
150  if (ret == ERROR_SUCCESS)
151  {
152  service_ok(TcpTableOwnerMod->dwNumEntries > 0, "No TCP connections?!\n");
153 
154  Found = FALSE;
155  for (i = 0; i < TcpTableOwnerMod->dwNumEntries; ++i)
156  {
157  if (TcpTableOwnerMod->table[i].dwState == MIB_TCP_STATE_LISTEN &&
158  TcpTableOwnerMod->table[i].dwLocalAddr == 0 &&
159  TcpTableOwnerMod->table[i].dwLocalPort == htons(9876) &&
160  TcpTableOwnerMod->table[i].dwRemoteAddr == 0)
161  {
162  Found = TRUE;
163  break;
164  }
165  }
166 
167  service_ok(Found, "Our socket wasn't found!\n");
168  if (Found)
169  {
170  DWORD Size = 0;
172 
173  service_ok(TcpTableOwnerMod->table[i].dwOwningPid == Pid, "Invalid owner\n");
174  service_ok((DWORD)(TcpTableOwnerMod->table[i].OwningModuleInfo[0]) == service_tag, "Invalid tag: %x - %x\n", (DWORD)TcpTableOwnerMod->table[i].OwningModuleInfo[0], service_tag);
175 
176  ret = GetOwnerModuleFromTcpEntry(&TcpTableOwnerMod->table[i], TCPIP_OWNER_MODULE_INFO_BASIC, BasicInfo, &Size);
177  service_ok(ret == ERROR_INSUFFICIENT_BUFFER, "GetOwnerModuleFromTcpEntry failed with: %x\n", ret);
179  {
181  service_ok(BasicInfo != NULL, "HeapAlloc failed\n");
182 
183  ret = GetOwnerModuleFromTcpEntry(&TcpTableOwnerMod->table[i], TCPIP_OWNER_MODULE_INFO_BASIC, BasicInfo, &Size);
184  service_ok(ret == ERROR_SUCCESS, "GetOwnerModuleFromTcpEntry failed with: %x\n", ret);
185  service_ok(_wcsicmp(svc_name, BasicInfo->pModulePath) == 0, "Mismatching names (%S, %S)\n", svc_name, BasicInfo->pModulePath);
186  service_ok(_wcsicmp(svc_name, BasicInfo->pModuleName) == 0, "Mismatching names (%S, %S)\n", svc_name, BasicInfo->pModuleName);
187  }
188  }
189 
190  HeapFree(GetProcessHeap(), 0, TcpTableOwnerMod);
191  }
192 
193  closesocket(sock);
194 }
195 
196 static void
197 test_udp(LPWSTR svc_name, DWORD service_tag)
198 {
199  SOCKET sock;
201  PMIB_UDPTABLE_OWNER_MODULE UdpTableOwnerMod;
202  DWORD i, ret;
203  BOOLEAN Found;
204  DWORD Pid = GetCurrentProcessId();
205 
207  service_ok(sock != INVALID_SOCKET, "Socket creation failed!\n");
208 
209  ZeroMemory(&server, sizeof(SOCKADDR_IN));
210  server.sin_family = AF_INET;
211  server.sin_addr.s_addr = htonl(INADDR_ANY);
212  server.sin_port = htons(9876);
213 
214  ret = bind(sock, (SOCKADDR*)&server, sizeof(SOCKADDR_IN));
215  service_ok(ret != SOCKET_ERROR, "binding failed\n");
216 
218  service_ok(ret == ERROR_SUCCESS, "GetExtendedUdpTableWithAlloc failed: %x\n", ret);
219  if (ret == ERROR_SUCCESS)
220  {
221  service_ok(UdpTableOwnerMod->dwNumEntries > 0, "No TCP connections?!\n");
222 
223  Found = FALSE;
224  for (i = 0; i < UdpTableOwnerMod->dwNumEntries; ++i)
225  {
226  if (UdpTableOwnerMod->table[i].dwLocalAddr == 0 &&
227  UdpTableOwnerMod->table[i].dwLocalPort == htons(9876))
228  {
229  Found = TRUE;
230  break;
231  }
232  }
233 
234  service_ok(Found, "Our socket wasn't found!\n");
235  if (Found)
236  {
237  DWORD Size = 0;
239 
240  service_ok(UdpTableOwnerMod->table[i].dwOwningPid == Pid, "Invalid owner\n");
241  service_ok((DWORD)(UdpTableOwnerMod->table[i].OwningModuleInfo[0]) == service_tag, "Invalid tag: %x - %x\n", (DWORD)UdpTableOwnerMod->table[i].OwningModuleInfo[0], service_tag);
242 
243  ret = GetOwnerModuleFromUdpEntry(&UdpTableOwnerMod->table[i], TCPIP_OWNER_MODULE_INFO_BASIC, BasicInfo, &Size);
244  service_ok(ret == ERROR_INSUFFICIENT_BUFFER, "GetOwnerModuleFromUdpEntry failed with: %x\n", ret);
246  {
248  service_ok(BasicInfo != NULL, "HeapAlloc failed\n");
249 
250  ret = GetOwnerModuleFromUdpEntry(&UdpTableOwnerMod->table[i], TCPIP_OWNER_MODULE_INFO_BASIC, BasicInfo, &Size);
251  service_ok(ret == ERROR_SUCCESS, "GetOwnerModuleFromUdpEntry failed with: %x\n", ret);
252  service_ok(_wcsicmp(svc_name, BasicInfo->pModulePath) == 0, "Mismatching names (%S, %S)\n", svc_name, BasicInfo->pModulePath);
253  service_ok(_wcsicmp(svc_name, BasicInfo->pModuleName) == 0, "Mismatching names (%S, %S)\n", svc_name, BasicInfo->pModuleName);
254  }
255  }
256 
257  HeapFree(GetProcessHeap(), 0, UdpTableOwnerMod);
258  }
259 
260  closesocket(sock);
261 }
262 
263 static void WINAPI
264 service_main(DWORD dwArgc, LPWSTR* lpszArgv)
265 {
266  // SERVICE_STATUS_HANDLE status_handle;
267  PTEB Teb;
268  WSADATA wsaData;
269 
270  UNREFERENCED_PARAMETER(dwArgc);
271 
272  /* Register our service for control (lpszArgv[0] holds the service name) */
274  service_ok(status_handle != NULL, "RegisterServiceCtrlHandler failed: %lu\n", GetLastError());
275  if (!status_handle)
276  return;
277 
278  /* Report SERVICE_RUNNING status */
280 
281  /* Check our tag is not 0 */
282  Teb = NtCurrentTeb();
283  service_ok(Teb->SubProcessTag != 0, "SubProcessTag is not defined!\n");
284 
285  if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0)
286  {
287  skip("Failed to init WS2\n");
288  goto quit;
289  }
290 
291  test_tcp(lpszArgv[0], PtrToUlong(Teb->SubProcessTag));
292  test_udp(lpszArgv[0], PtrToUlong(Teb->SubProcessTag));
293 
294  WSACleanup();
295 quit:
296  /* Work is done */
298 }
299 
301 {
302  BOOL res;
303 
304  SERVICE_TABLE_ENTRYW servtbl[] =
305  {
307  { NULL, NULL }
308  };
309 
310  res = StartServiceCtrlDispatcherW(servtbl);
311  service_ok(res, "StartServiceCtrlDispatcherW failed: %lu\n", GetLastError());
312  return res;
313 }
314 
315 
316 /*** Tester part of the test ***/
317 
318 static void
321  void *param)
322 {
323  BOOL res;
324  SC_HANDLE hSC = NULL;
325  SC_HANDLE hService = NULL;
327 
328  /* Open the SCM */
330  if (!hSC)
331  {
332  skip("OpenSCManagerW failed with error %lu!\n", GetLastError());
333  return;
334  }
335 
336  /* First create ourselves as a service running in the default LocalSystem account */
337  hService = register_service_exW(hSC, L"ServiceNetwork", service_nameW, NULL,
342  NULL, NULL, NULL,
343  NULL, NULL);
344  if (!hService)
345  {
346  skip("CreateServiceW failed with error %lu!\n", GetLastError());
347  goto Cleanup;
348  }
349 
350  /* Start it */
351  if (!StartServiceW(hService, 0, NULL))
352  {
353  skip("StartServiceW failed with error %lu!\n", GetLastError());
354  goto Cleanup;
355  }
356 
357  /* Wait for the service to stop by itself */
358  do
359  {
360  Sleep(100);
362  res = QueryServiceStatus(hService, &ServiceStatus);
364  ok(res, "QueryServiceStatus failed: %lu\n", GetLastError());
365  ok(ServiceStatus.dwCurrentState == SERVICE_STOPPED, "ServiceStatus.dwCurrentState = %lx\n", ServiceStatus.dwCurrentState);
366 
367  /* Be sure the service is really stopped */
372  {
373  skip("ControlService failed with error %lu!\n", GetLastError());
374  goto Cleanup;
375  }
376 
377 #if 0
378  trace("Service stopped. Going to restart it...\n");
379 
380  /* Now change the service configuration to make it start under the NetworkService account */
381  if (!ChangeServiceConfigW(hService,
385  NULL, NULL, NULL, NULL,
386  L"NT AUTHORITY\\NetworkService", L"",
387  NULL))
388  {
389  skip("ChangeServiceConfigW failed with error %lu!\n", GetLastError());
390  goto Cleanup;
391  }
392 
393  /* Start it */
394  if (!StartServiceW(hService, 0, NULL))
395  {
396  skip("StartServiceW failed with error %lu!\n", GetLastError());
397  goto Cleanup;
398  }
399 
400  /* Wait for the service to stop by itself */
401  do
402  {
403  Sleep(100);
405  res = QueryServiceStatus(hService, &ServiceStatus);
407  ok(res, "QueryServiceStatus failed: %lu\n", GetLastError());
408  ok(ServiceStatus.dwCurrentState == SERVICE_STOPPED, "ServiceStatus.dwCurrentState = %lx\n", ServiceStatus.dwCurrentState);
409 
410  /* Be sure the service is really stopped */
415  {
416  skip("ControlService failed with error %lu!\n", GetLastError());
417  goto Cleanup;
418  }
419 #endif
420 
421 Cleanup:
422  if (hService)
423  {
424  res = DeleteService(hService);
425  ok(res, "DeleteService failed: %lu\n", GetLastError());
426  CloseServiceHandle(hService);
427  }
428 
429  if (hSC)
430  CloseServiceHandle(hSC);
431 }
432 
433 START_TEST(ServiceNetwork)
434 {
435  int argc;
436  char** argv;
437 
438  /* Check whether this test is started as a separated service process */
440  if (argc >= 3)
441  {
443  return;
444  }
445 
446  /* We are started as the real test */
448  // trace("Returned from test_runner\n");
449 }
DWORD WINAPI GetOwnerModuleFromUdpEntry(PMIB_UDPROW_OWNER_MODULE pUdpEntry, TCPIP_OWNER_MODULE_INFO_CLASS Class, PVOID Buffer, PDWORD pdwSize)
#define SOCKET_ERROR
Definition: winsock.h:333
static void test_runner(BOOLEAN unicode, PCWSTR extra_args, int service_argc, void *service_argv)
Definition: ServiceArgs.c:334
static int argc
Definition: ServiceArgs.c:12
const uint16_t * PCWSTR
Definition: typedefs.h:55
#define SERVICE_ERROR_IGNORE
Definition: cmtypes.h:979
static void my_test_server(PCSTR service_nameA, PCWSTR service_nameW, void *param)
#define TRUE
Definition: types.h:120
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
static rfbScreenInfoPtr server
Definition: vnc.c:74
static SOCKET sock
Definition: syslog.c:45
SOCKET WSAAPI socket(IN INT af, IN INT type, IN INT protocol)
Definition: socklife.c:143
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD dwCurrentState
Definition: winsvc.h:100
#define htonl(x)
Definition: module.h:212
#define MAKEWORD(a, b)
Definition: typedefs.h:247
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
INT WSAAPI bind(IN SOCKET s, IN CONST struct sockaddr *name, IN INT namelen)
Definition: socklife.c:36
uint16_t * PWSTR
Definition: typedefs.h:54
#define SERVICE_INTERACTIVE_PROCESS
Definition: cmtypes.h:965
void quit(int argc, const char *argv[])
Definition: cmds.c:1606
static void service_process(BOOLEAN unicode)
Definition: ServiceArgs.c:188
static SERVICE_STATUS ServiceStatus
Definition: dcomlaunch.c:27
#define SERVICE_ACCEPT_STOP
Definition: winsvc.h:28
INT WSAAPI WSACleanup(VOID)
Definition: startup.c:60
START_TEST(ServiceNetwork)
#define INADDR_ANY
Definition: StrAddr.c:4
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1635
#define SERVICE_START_PENDING
Definition: winsvc.h:22
SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerW(LPCWSTR lpServiceName, LPHANDLER_FUNCTION lpHandlerProc)
Definition: sctrl.c:740
static BOOL start_service(PCSTR service_nameA, PCWSTR service_nameW)
#define SERVICE_ALL_ACCESS
Definition: winsvc.h:62
BOOL WINAPI DeleteService(SC_HANDLE hService)
Definition: scm.c:916
#define argv
Definition: mplay32.c:18
#define NO_ERROR
Definition: dderror.h:5
BOOL WINAPI StartServiceCtrlDispatcherW(const SERVICE_TABLE_ENTRYW *lpServiceStartTable)
Definition: sctrl.c:1132
#define ERROR_SERVICE_NOT_ACTIVE
Definition: winerror.h:613
static void WINAPI service_main(DWORD dwArgc, LPWSTR *lpszArgv)
#define SERVICE_NO_CHANGE
Definition: winsvc.h:20
BOOL WINAPI SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus, LPSERVICE_STATUS lpServiceStatus)
Definition: sctrl.c:995
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
Definition: glfuncs.h:248
#define SERVICE_STOPPED
Definition: winsvc.h:21
static int Family
Definition: ping.c:62
#define SOMAXCONN
Definition: winsock.h:399
#define closesocket
Definition: main.c:39
unsigned int BOOL
Definition: ntddk_ex.h:94
#define SERVICE_RUNNING
Definition: winsvc.h:24
BOOL WINAPI ChangeServiceConfigW(SC_HANDLE hService, DWORD dwServiceType, DWORD dwStartType, DWORD dwErrorControl, LPCWSTR lpBinaryPathName, LPCWSTR lpLoadOrderGroup, LPDWORD lpdwTagId, LPCWSTR lpDependencies, LPCWSTR lpServiceStartName, LPCWSTR lpPassword, LPCWSTR lpDisplayName)
Definition: scm.c:480
DWORD WINAPI GetOwnerModuleFromTcpEntry(PMIB_TCPROW_OWNER_MODULE pTcpEntry, TCPIP_OWNER_MODULE_INFO_CLASS Class, PVOID Buffer, PDWORD pdwSize)
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:577
unsigned char BOOLEAN
INT WINAPI WSAStartup(IN WORD wVersionRequested, OUT LPWSADATA lpWSAData)
Definition: startup.c:113
smooth NULL
Definition: ftsmooth.c:416
static void test_tcp(LPWSTR svc_name, DWORD service_tag)
enum _UDP_TABLE_CLASS UDP_TABLE_CLASS
return Found
Definition: dirsup.c:1270
#define SERVICE_WIN32_OWN_PROCESS
Definition: cmtypes.h:960
#define PtrToUlong(u)
Definition: config.h:107
#define ctrl
Definition: input.c:1669
static SERVICE_STATUS_HANDLE(WINAPI *pRegisterServiceCtrlHandlerExA)(LPCSTR
enum _TCP_TABLE_CLASS TCP_TABLE_CLASS
#define SERVICE_ACCEPT_SHUTDOWN
Definition: winsvc.h:30
BOOL WINAPI StartServiceW(SC_HANDLE hService, DWORD dwNumServiceArgs, LPCWSTR *lpServiceArgVectors)
Definition: scm.c:2923
#define GetProcessHeap()
Definition: compat.h:395
#define trace
Definition: atltest.h:70
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define INVALID_SOCKET
Definition: winsock.h:332
static void service_ok(int cnd, const char *msg,...)
Definition: ServiceArgs.c:46
GLfloat param
Definition: glext.h:5796
#define WINAPI
Definition: msvc.h:8
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI QueryServiceStatus(SC_HANDLE hService, LPSERVICE_STATUS lpServiceStatus)
Definition: scm.c:2788
int winetest_get_mainargs(char ***pargv)
int ret
static const WCHAR L[]
Definition: oid.c:1250
SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, DWORD dwDesiredAccess)
Definition: scm.c:2011
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
static const WCHAR Cleanup[]
Definition: register.c:80
static VOID WINAPI service_handler(DWORD ctrl)
static void test_udp(LPWSTR svc_name, DWORD service_tag)
Definition: compat.h:484
static void report_service_status(DWORD dwCurrentState, DWORD dwWin32ExitCode, DWORD dwWaitHint)
FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
Definition: psfuncs.h:420
#define ok(value,...)
Definition: atltest.h:57
DWORD WINAPI GetExtendedUdpTable(PVOID pUdpTable, PDWORD pdwSize, BOOL bOrder, ULONG ulAf, UDP_TABLE_CLASS TableClass, ULONG Reserved)
BOOL WINAPI ControlService(SC_HANDLE hService, DWORD dwControl, LPSERVICE_STATUS lpServiceStatus)
Definition: scm.c:619
static char service_nameA[100]
Definition: ServiceArgs.c:15
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define SC_MANAGER_ALL_ACCESS
Definition: winsvc.h:13
INT WSAAPI listen(IN SOCKET s, IN INT backlog)
Definition: sockctrl.c:123
Definition: tcpcore.h:1455
#define skip(...)
Definition: atltest.h:64
DWORD WINAPI GetExtendedTcpTable(PVOID pTcpTable, PDWORD pdwSize, BOOL bOrder, ULONG ulAf, TCP_TABLE_CLASS TableClass, ULONG Reserved)
static WCHAR service_nameW[100]
Definition: ServiceArgs.c:16
GLuint res
Definition: glext.h:9613
#define AF_INET
Definition: tcpip.h:117
#define SERVICE_CONTROL_STOP
Definition: winsvc.h:36
static DWORD GetExtendedTcpTableWithAlloc(PVOID *TcpTable, BOOL Order, DWORD Family, TCP_TABLE_CLASS Class)
UINT_PTR SOCKET
Definition: winsock.h:47
const char * PCSTR
Definition: typedefs.h:51
#define SOCK_STREAM
Definition: tcpip.h:118
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define htons(x)
Definition: module.h:213
#define SERVICE_DEMAND_START
Definition: cmtypes.h:976
#define SOCK_DGRAM
Definition: winsock.h:336
static SERVICE_STATUS status
Definition: service.c:31
#define SERVICE_STOP_PENDING
Definition: winsvc.h:23
#define HeapFree(x, y, z)
Definition: compat.h:394
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
DWORD WINAPI GetCurrentProcessId(VOID)
Definition: proc.c:1158
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
SC_HANDLE register_service_exW(SC_HANDLE scm_handle, PCWSTR test_name, PCWSTR service_name, PCWSTR extra_args OPTIONAL, DWORD dwDesiredAccess, DWORD dwServiceType, DWORD dwStartType, DWORD dwErrorControl, LPCWSTR lpLoadOrderGroup OPTIONAL, LPDWORD lpdwTagId OPTIONAL, LPCWSTR lpDependencies OPTIONAL, LPCWSTR lpServiceStartName OPTIONAL, LPCWSTR lpPassword OPTIONAL)
Definition: svchlp.c:142
static SERVICE_STATUS_HANDLE status_handle
#define SERVICE_CONTROL_SHUTDOWN
Definition: winsvc.h:40
static DWORD GetExtendedUdpTableWithAlloc(PVOID *UdpTable, BOOL Order, DWORD Family, UDP_TABLE_CLASS Class)
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
Definition: ps.c:97