ReactOS  0.4.14-dev-98-gb0d4763
HidP_user.c File Reference
#include <kmt_test.h>
#include "HidP.h"
Include dependency graph for HidP_user.c:

Go to the source code of this file.

Functions

DWORD KmtStartService (IN PCWSTR ServiceName OPTIONAL, IN OUT SC_HANDLE *ServiceHandle)
 
 START_TEST (HidPDescription)
 

Function Documentation

◆ KmtStartService()

DWORD KmtStartService ( IN PCWSTR ServiceName  OPTIONAL,
IN OUT SC_HANDLE *  ServiceHandle 
)

Definition at line 217 of file service.c.

220 {
222 
223  assert(ServiceHandle);
224  assert(ServiceName || *ServiceHandle);
225 
226  if (!*ServiceHandle)
227  *ServiceHandle = OpenService(ScmHandle, ServiceName, SERVICE_ACCESS);
228 
229  if (!*ServiceHandle)
231 
232  if (!StartService(*ServiceHandle, 0, NULL))
234 
236  if (Error)
237  goto cleanup;
238 
239 cleanup:
240  return Error;
241 }
#define StartService
Definition: winsvc.h:585
#define SERVICE_ACCESS
Definition: service.c:15
#define ERROR_SUCCESS
Definition: deptool.c:10
#define error_goto(Error, label)
Definition: kmtest.h:21
#define assert(x)
Definition: debug.h:53
#define OpenService
Definition: winsvc.h:576
#define SERVICE_RUNNING
Definition: winsvc.h:24
smooth NULL
Definition: ftsmooth.c:416
LPTSTR ServiceName
Definition: ServiceMain.c:15
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL Error
Definition: chkdsk.c:66
static DWORD KmtEnsureServiceState(IN PCWSTR ServiceName OPTIONAL, IN SC_HANDLE ServiceHandle, IN DWORD ExpectedServiceState)
Definition: service.c:155
char * cleanup(char *str)
Definition: wpickclick.c:99
static SC_HANDLE ScmHandle
Definition: service.c:30

Referenced by main(), and START_TEST().

◆ START_TEST()

START_TEST ( HidPDescription  )

Definition at line 16 of file HidP_user.c.

17 {
18  SC_HANDLE ServiceHandle;
19  DWORD Error;
20 
21  ServiceHandle = NULL;
22  KmtStartService(L"hidusb", &ServiceHandle);
23  CloseServiceHandle(ServiceHandle);
24 
25  KmtLoadDriver(L"HidP", FALSE);
26  KmtOpenDriver();
27 
29  ok(Error == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %lx\n", Error);
30 
33 }
#define ERROR_SUCCESS
Definition: deptool.c:10
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:577
smooth NULL
Definition: ftsmooth.c:416
VOID KmtCloseDriver(VOID)
Definition: support.c:200
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL Error
Definition: chkdsk.c:66
static const WCHAR L[]
Definition: oid.c:1250
#define IOCTL_TEST_DESCRIPTION
Definition: HidP.h:11
DWORD KmtSendToDriver(IN DWORD ControlCode)
Definition: support.c:224
VOID KmtUnloadDriver(VOID)
Definition: support.c:155
#define ok(value,...)
Definition: atltest.h:57
VOID KmtLoadDriver(IN PCWSTR ServiceName, IN BOOLEAN RestartIfRunning)
Definition: support.c:127
DWORD KmtStartService(IN PCWSTR ServiceName OPTIONAL, IN OUT SC_HANDLE *ServiceHandle)
Definition: service.c:217
VOID KmtOpenDriver(VOID)
Definition: support.c:174