6 Appendix A: Full IDL

For ease of implementation, the full Interface Definition Language (IDL) is provided as follows, where "ms-dtyp.idl" is the IDL found in [MS-DTYP] Appendix A.

  
 import "ms-dtyp.idl";
 [
    uuid(367ABB81-9844-35F1-AD32-98F038001003),
    version(2.0),
    ms_union,
    pointer_default(unique)
 ]
  
 interface svcctl{
  
 const unsigned int MAX_SERVICE_NAME_LENGTH = 256;
 const unsigned short SC_MAX_DEPEND_SIZE = 4 * 1024; 
 const unsigned short SC_MAX_NAME_LENGTH = MAX_SERVICE_NAME_LENGTH + 1;
 const unsigned short SC_MAX_PATH_LENGTH = 32 * 1024;
 const unsigned short SC_MAX_PWD_SIZE = 514;
 const unsigned short SC_MAX_COMPUTER_NAME_LENGTH = 1024;
 const unsigned short SC_MAX_ACCOUNT_NAME_LENGTH = 2 * 1024;
 const unsigned short SC_MAX_COMMENT_LENGTH = 128;
 const unsigned short SC_MAX_ARGUMENT_LENGTH = 1024;
 const unsigned short SC_MAX_ARGUMENTS = 1024;
  
 typedef [handle]
             wchar_t*  SVCCTL_HANDLEW;
 typedef [handle]
             LPSTR     SVCCTL_HANDLEA;
 typedef [context_handle]    PVOID       SC_RPC_HANDLE;
 typedef [context_handle]    PVOID       SC_RPC_LOCK;
 typedef [context_handle]    PVOID       SC_NOTIFY_RPC_HANDLE;
  
 typedef SC_RPC_HANDLE           *       LPSC_RPC_HANDLE;
 typedef SC_RPC_LOCK             *       LPSC_RPC_LOCK;
 typedef SC_NOTIFY_RPC_HANDLE    *       LPSC_NOTIFY_RPC_HANDLE;
  
 typedef struct _STRING_PTRSA {
     [string, range(0, SC_MAX_ARGUMENT_LENGTH)] LPSTR  StringPtr;
 } STRING_PTRSA, *PSTRING_PTRSA, *LPSTRING_PTRSA;
  
 typedef struct _STRING_PTRSW {
     [string, range(0, SC_MAX_ARGUMENT_LENGTH)] wchar_t*  StringPtr;
 } STRING_PTRSW, *PSTRING_PTRSW, *LPSTRING_PTRSW;
  
 typedef [range(0, 1024 * 4)] DWORD BOUNDED_DWORD_4K;
 typedef BOUNDED_DWORD_4K * LPBOUNDED_DWORD_4K;
  
 typedef [range(0, 1024 * 8)] DWORD BOUNDED_DWORD_8K;
 typedef BOUNDED_DWORD_8K * LPBOUNDED_DWORD_8K;
  
 typedef [range(0, 1024 * 256)] DWORD BOUNDED_DWORD_256K;
 typedef BOUNDED_DWORD_256K * LPBOUNDED_DWORD_256K;
  
 typedef struct {
   DWORD dwServiceType;
   DWORD dwCurrentState;
   DWORD dwControlsAccepted;
   DWORD dwWin32ExitCode;
   DWORD dwServiceSpecificExitCode;
   DWORD dwCheckPoint;
   DWORD dwWaitHint;
 } SERVICE_STATUS, 
  *LPSERVICE_STATUS;
  
 typedef struct {
   DWORD dwServiceType;
   DWORD dwCurrentState;
   DWORD dwControlsAccepted;
   DWORD dwWin32ExitCode;
   DWORD dwServiceSpecificExitCode;
   DWORD dwCheckPoint;
   DWORD dwWaitHint;
   DWORD dwProcessId;
   DWORD dwServiceFlags;
 } SERVICE_STATUS_PROCESS, 
  *LPSERVICE_STATUS_PROCESS;
  
 typedef struct _QUERY_SERVICE_CONFIGW {
   DWORD dwServiceType;
   DWORD dwStartType;
   DWORD dwErrorControl;
   [string,range(0, 8 * 1024)] LPWSTR lpBinaryPathName;
   [string,range(0, 8 * 1024)] LPWSTR lpLoadOrderGroup;
   DWORD dwTagId;
   [string,range(0, 8 * 1024)] LPWSTR lpDependencies;
   [string,range(0, 8 * 1024)] LPWSTR lpServiceStartName;
   [string,range(0, 8 * 1024)] LPWSTR lpDisplayName;
 } QUERY_SERVICE_CONFIGW, 
  *LPQUERY_SERVICE_CONFIGW;
  
 typedef struct _QUERY_SERVICE_LOCK_STATUSW {
   DWORD fIsLocked;
   [string,range(0, 8 * 1024)] LPWSTR lpLockOwner;
   DWORD dwLockDuration;
 } QUERY_SERVICE_LOCK_STATUSW, 
  *LPQUERY_SERVICE_LOCK_STATUSW;
  
 typedef struct _QUERY_SERVICE_CONFIGA {
   DWORD dwServiceType;
   DWORD dwStartType;
   DWORD dwErrorControl;
   [string,range(0, 8 * 1024)] LPSTR lpBinaryPathName;
   [string,range(0, 8 * 1024)] LPSTR lpLoadOrderGroup;
   DWORD dwTagId;
   [string,range(0, 8 * 1024)] LPSTR lpDependencies;
   [string,range(0, 8 * 1024)] LPSTR lpServiceStartName;
   [string,range(0, 8 * 1024)] LPSTR lpDisplayName;
 } QUERY_SERVICE_CONFIGA, 
  *LPQUERY_SERVICE_CONFIGA;
  
 typedef struct {
   DWORD fIsLocked;
   [string,range(0, 8 * 1024)] char* lpLockOwner;
   DWORD dwLockDuration;
 } QUERY_SERVICE_LOCK_STATUSA, 
  *LPQUERY_SERVICE_LOCK_STATUSA;
  
 typedef struct _SERVICE_DESCRIPTIONA {
   [string,range(0, 8 * 1024)] LPSTR lpDescription;
 } SERVICE_DESCRIPTIONA, 
  *LPSERVICE_DESCRIPTIONA;
  
 typedef [v1_enum] enum _SC_ACTION_TYPE {
   SC_ACTION_NONE = 0,
   SC_ACTION_RESTART = 1,
   SC_ACTION_REBOOT = 2,
   SC_ACTION_RUN_COMMAND = 3
 } SC_ACTION_TYPE;
  
 typedef struct {
   SC_ACTION_TYPE Type;
   DWORD Delay;
 } SC_ACTION, 
  *LPSC_ACTION;
  
 typedef struct _SERVICE_FAILURE_ACTIONSA {
   DWORD dwResetPeriod;
   [string,range(0, 8 * 1024)] LPSTR lpRebootMsg;
   [string,range(0, 8 * 1024)] LPSTR lpCommand;
   [range(0, 1024)] DWORD cActions;
   [size_is(cActions)] SC_ACTION * lpsaActions;
 } SERVICE_FAILURE_ACTIONSA, 
  *LPSERVICE_FAILURE_ACTIONSA;
  
 typedef struct _SERVICE_DELAYED_AUTO_START_INFO {
   BOOL fDelayedAutostart;
 } SERVICE_DELAYED_AUTO_START_INFO, 
  *LPSERVICE_DELAYED_AUTO_START_INFO;
  
 typedef struct _SERVICE_FAILURE_ACTIONS_FLAG {
   BOOL fFailureActionsOnNonCrashFailures;
 } SERVICE_FAILURE_ACTIONS_FLAG, 
  *LPSERVICE_FAILURE_ACTIONS_FLAG;
  
 typedef struct _SERVICE_SID_INFO {
   DWORD dwServiceSidType;
 } SERVICE_SID_INFO, 
  *LPSERVICE_SID_INFO;
  
 typedef struct _SERVICE_PRESHUTDOWN_INFO {
   DWORD dwPreshutdownTimeout;
 } SERVICE_PRESHUTDOWN_INFO, 
  *LPSERVICE_PRESHUTDOWN_INFO;
  
 typedef struct _SERVICE_DESCRIPTIONW {
   [string,range(0, 8 * 1024)] LPWSTR lpDescription;
 } SERVICE_DESCRIPTIONW, 
  *LPSERVICE_DESCRIPTIONW;
  
 typedef struct _SERVICE_FAILURE_ACTIONSW {
   DWORD dwResetPeriod;
   [string,range(0, 8 * 1024)] LPWSTR lpRebootMsg;
   [string,range(0, 8 * 1024)] LPWSTR lpCommand;
   [range(0, 1024)] DWORD cActions;
   [size_is(cActions)] SC_ACTION * lpsaActions;
 } SERVICE_FAILURE_ACTIONSW, 
  *LPSERVICE_FAILURE_ACTIONSW;
  
 typedef [v1_enum] enum 
 {
   SC_STATUS_PROCESS_INFO = 0
 } SC_STATUS_TYPE;
  
 typedef [v1_enum] enum 
 {
   SC_ENUM_PROCESS_INFO = 0
 } SC_ENUM_TYPE;
  
 typedef struct _SERVICE_PREFERRED_NODE_INFO {
     USHORT                  usPreferredNode;    
     BOOLEAN                 fDelete;
 } SERVICE_PREFERRED_NODE_INFO, *LPSERVICE_PREFERRED_NODE_INFO;
  
 typedef struct _SERVICE_TRIGGER_SPECIFIC_DATA_ITEM {
     DWORD                       dwDataType;              
     [range(0, 1024)]
     DWORD                       cbData;                 
     [size_is(cbData)]
     PBYTE  pData;       
 } SERVICE_TRIGGER_SPECIFIC_DATA_ITEM, *PSERVICE_TRIGGER_SPECIFIC_DATA_ITEM;
  
 typedef struct _SERVICE_TRIGGER {
     DWORD                       dwTriggerType;              
     DWORD                       dwAction;                   
     GUID    *                   pTriggerSubtype;            
     [range(0, 64)]
     DWORD                       cDataItems;                 
     [size_is(cDataItems)]
     PSERVICE_TRIGGER_SPECIFIC_DATA_ITEM  pDataItems;       
 } SERVICE_TRIGGER, *PSERVICE_TRIGGER;
  
 typedef struct _SERVICE_TRIGGER_INFO {
     [range(0, 64)] DWORD    cTriggers;  
     [size_is(cTriggers)]
     PSERVICE_TRIGGER        pTriggers;  
     PBYTE                   pReserved;  
 } SERVICE_TRIGGER_INFO, *PSERVICE_TRIGGER_INFO;
  
 typedef ULONG SECURITY_INFORMATION, *PSECURITY_INFORMATION;
  
     typedef struct _ENUM_SERVICE_STATUSA {
         LPSTR             lpServiceName;
         LPSTR             lpDisplayName;
         SERVICE_STATUS    ServiceStatus;
     } ENUM_SERVICE_STATUSA, *LPENUM_SERVICE_STATUSA;
  
 typedef struct _ENUM_SERVICE_STATUSW {
         LPWSTR            lpServiceName;
         LPWSTR            lpDisplayName;
         SERVICE_STATUS    ServiceStatus;
     } ENUM_SERVICE_STATUSW, *LPENUM_SERVICE_STATUSW;
  
 typedef struct _ENUM_SERVICE_STATUS_PROCESSA {
         LPSTR                     lpServiceName;
         LPSTR                     lpDisplayName;
         SERVICE_STATUS_PROCESS    ServiceStatusProcess;
     } ENUM_SERVICE_STATUS_PROCESSA, *LPENUM_SERVICE_STATUS_PROCESSA;
  
 typedef struct _ENUM_SERVICE_STATUS_PROCESSW {
         LPWSTR                    lpServiceName;
         LPWSTR                    lpDisplayName;
         SERVICE_STATUS_PROCESS    ServiceStatusProcess;
 } ENUM_SERVICE_STATUS_PROCESSW, *LPENUM_SERVICE_STATUS_PROCESSW;
  
 typedef struct _SERVICE_DESCRIPTION_WOW64
     {
         DWORD    dwDescriptionOffset;
     } SERVICE_DESCRIPTION_WOW64, *LPSERVICE_DESCRIPTION_WOW64;
  
 typedef struct _SERVICE_FAILURE_ACTIONS_WOW64
     {
         DWORD    dwResetPeriod;
         DWORD    dwRebootMsgOffset;
         DWORD    dwCommandOffset;
         DWORD    cActions;
         DWORD    dwsaActionsOffset;
     } SERVICE_FAILURE_ACTIONS_WOW64, *LPSERVICE_FAILURE_ACTIONS_WOW64;
  
 typedef struct _SERVICE_REQUIRED_PRIVILEGES_INFO_WOW64
     {
         DWORD    dwRequiredPrivilegesOffset;
     } SERVICE_REQUIRED_PRIVILEGES_INFO_WOW64, *LPSERVICE_REQUIRED_PRIVILEGES_INFO_WOW64;    
  
 DWORD
 RCloseServiceHandle(
     [in,out] LPSC_RPC_HANDLE  hSCObject
     );
  
 DWORD
 RControlService(
     [in] SC_RPC_HANDLE  hService,
     [in] DWORD  dwControl,
     [out] LPSERVICE_STATUS  lpServiceStatus
     );
  
 DWORD
 RDeleteService(
     [in] SC_RPC_HANDLE  hService
     );
  
 DWORD
 RLockServiceDatabase(
     [in] SC_RPC_HANDLE  hSCManager,
     [out] LPSC_RPC_LOCK  lpLock
     );
  
 DWORD
 RQueryServiceObjectSecurity(
     [in] SC_RPC_HANDLE  hService,
     [in] SECURITY_INFORMATION  dwSecurityInformation,
     [out, size_is(cbBufSize)] LPBYTE  lpSecurityDescriptor,
     [in, range(0, 1024 * 256)] DWORD  cbBufSize,
     [out] LPBOUNDED_DWORD_256K  pcbBytesNeeded
     );
  
 DWORD
 RSetServiceObjectSecurity(
     [in] SC_RPC_HANDLE  hService,
     [in] SECURITY_INFORMATION dwSecurityInformation,
     [in,size_is(cbBufSize)] LPBYTE  lpSecurityDescriptor,
     [in] DWORD  cbBufSize
     );
  
 DWORD
 RQueryServiceStatus(
     [in] SC_RPC_HANDLE  hService,
     [out] LPSERVICE_STATUS  lpServiceStatus
     );
  
 DWORD
 RSetServiceStatus(
     [in] SC_RPC_HANDLE  hServiceStatus,
     [in] LPSERVICE_STATUS  lpServiceStatus
     );
  
 DWORD
 RUnlockServiceDatabase(
     [in,out] LPSC_RPC_LOCK  Lock
     );
  
 DWORD
 RNotifyBootConfigStatus(
     [in,string,unique,range(0, SC_MAX_COMPUTER_NAME_LENGTH)] 
                        SVCCTL_HANDLEW  lpMachineName,
     [in] DWORD  BootAcceptable
     );
  
  
 void Opnum10NotUsedOnWire(void);
  
 DWORD
 RChangeServiceConfigW(
     [in] SC_RPC_HANDLE  hService,
     [in] DWORD  dwServiceType,
     [in] DWORD  dwStartType,
     [in] DWORD  dwErrorControl,
     [in,string,unique,range(0, SC_MAX_PATH_LENGTH)] 
             wchar_t *  lpBinaryPathName,
     [in,string,unique,range(0, SC_MAX_NAME_LENGTH)] 
             wchar_t *  lpLoadOrderGroup,
     [in,out,unique] LPDWORD  lpdwTagId,
     [in,unique,size_is(dwDependSize)] LPBYTE  lpDependencies,
     [in, range (0, SC_MAX_DEPEND_SIZE)] DWORD  dwDependSize,
     [in,string,unique,range(0, SC_MAX_ACCOUNT_NAME_LENGTH)] 
                 wchar_t *  lpServiceStartName,
     [in,unique,size_is(dwPwSize)] LPBYTE  lpPassword,
     [in, range(0, SC_MAX_PWD_SIZE)] DWORD  dwPwSize,
     [in,string,unique,range(0, SC_MAX_NAME_LENGTH)] 
                 wchar_t * lpDisplayName
     );
  
 DWORD
 RCreateServiceW(
     [in] SC_RPC_HANDLE  hSCManager,
     [in,string,range(0, SC_MAX_NAME_LENGTH)] 
                 wchar_t *  lpServiceName,
     [in,string,unique,range(0, SC_MAX_NAME_LENGTH)] 
                 wchar_t *  lpDisplayName,
     [in] DWORD   dwDesiredAccess,
     [in] DWORD   dwServiceType,
     [in] DWORD   dwStartType,
     [in] DWORD   dwErrorControl,
     [in,string, range(0, SC_MAX_PATH_LENGTH)] 
                 wchar_t *  lpBinaryPathName,
     [in,string,unique,range(0, SC_MAX_NAME_LENGTH)] 
                 wchar_t *  lpLoadOrderGroup,
     [in,out,unique] LPDWORD  lpdwTagId,
     [in,unique,size_is(dwDependSize)] LPBYTE  lpDependencies,
     [in, range (0, SC_MAX_DEPEND_SIZE)] DWORD  dwDependSize,
     [in,string,unique,range(0, SC_MAX_ACCOUNT_NAME_LENGTH)] 
                 wchar_t *  lpServiceStartName,
     [in,unique,size_is(dwPwSize)] LPBYTE  lpPassword,
     [in, range(0, SC_MAX_PWD_SIZE)] DWORD   dwPwSize,
     [out] LPSC_RPC_HANDLE lpServiceHandle
     );
  
 DWORD
 REnumDependentServicesW(
     [in] SC_RPC_HANDLE hService,
     [in] DWORD  dwServiceState,
     [out, size_is(cbBufSize)] LPBYTE  lpServices,
     [in, range(0, 1024 * 256)] DWORD  cbBufSize,
     [out] LPBOUNDED_DWORD_256K  pcbBytesNeeded,
     [out] LPBOUNDED_DWORD_256K  lpServicesReturned
     );
  
 DWORD
 REnumServicesStatusW(
     [in] SC_RPC_HANDLE  hSCManager,
     [in] DWORD  dwServiceType,
     [in] DWORD  dwServiceState,
     [out, size_is(cbBufSize)]  LPBYTE  lpBuffer,
     [in, range(0, 1024 * 256)] DWORD  cbBufSize,
     [out] LPBOUNDED_DWORD_256K  pcbBytesNeeded,
     [out] LPBOUNDED_DWORD_256K  lpServicesReturned,
     [in,out,unique] LPBOUNDED_DWORD_256K lpResumeIndex
     );
  
 DWORD
 ROpenSCManagerW(
     [in,string,unique,range(0, SC_MAX_COMPUTER_NAME_LENGTH)] 
                 SVCCTL_HANDLEW  lpMachineName,
     [in,string,unique,range(0, SC_MAX_NAME_LENGTH)] 
                 wchar_t *  lpDatabaseName,
     [in] DWORD  dwDesiredAccess,
     [out] LPSC_RPC_HANDLE  lpScHandle
     );
  
 DWORD
 ROpenServiceW(
     [in] SC_RPC_HANDLE  hSCManager,
     [in,string,range(0, SC_MAX_NAME_LENGTH)] 
                 wchar_t *  lpServiceName,
     [in] DWORD  dwDesiredAccess,
     [out] LPSC_RPC_HANDLE lpServiceHandle
     );
  
 DWORD
 RQueryServiceConfigW(
     [in] SC_RPC_HANDLE  hService,
     [out] LPQUERY_SERVICE_CONFIGW lpServiceConfig,
     [in, range(0, 1024 * 8)] DWORD  cbBufSize,
     [out] LPBOUNDED_DWORD_8K  pcbBytesNeeded
     );
  
 DWORD
 RQueryServiceLockStatusW(
     [in] SC_RPC_HANDLE  hSCManager,
     [out] LPQUERY_SERVICE_LOCK_STATUSW  lpLockStatus,
     [in, range(0, 1024 * 4)] DWORD  cbBufSize,
     [out] LPBOUNDED_DWORD_4K  pcbBytesNeeded
     );
  
 DWORD
 RStartServiceW(
     [in] SC_RPC_HANDLE  hService,
     [in, range(0, SC_MAX_ARGUMENTS)] DWORD  argc,
     [in,unique,size_is(argc)] LPSTRING_PTRSW  argv
     );
  
 DWORD
 RGetServiceDisplayNameW(
     [in] SC_RPC_HANDLE  hSCManager,
     [in,string,range(0, SC_MAX_NAME_LENGTH)]                           
             wchar_t *  lpServiceName,
     [out,string, range(1, 4*1024+1), size_is(*lpcchBuffer+1)] 
             wchar_t *  lpDisplayName,
     [in,out] DWORD *  lpcchBuffer
     );
  
 DWORD
 RGetServiceKeyNameW(
     [in] SC_RPC_HANDLE  hSCManager,
     [in,string,range(0, SC_MAX_NAME_LENGTH)]                         
             wchar_t *  lpDisplayName,
     [out,string, range(1, 4*1024+1), size_is(*lpcchBuffer+1)] 
             wchar_t *  lpServiceName,
     [in,out] DWORD *  lpcchBuffer
     );
  
  
 void Opnum22NotUsedOnWire(void);
  
  
 DWORD
 RChangeServiceConfigA(
     [in] SC_RPC_HANDLE  hService,
     [in] DWORD  dwServiceType,
     [in] DWORD  dwStartType,
     [in] DWORD  dwErrorControl,
     [in,string,unique,range(0, SC_MAX_PATH_LENGTH)] 
             LPSTR  lpBinaryPathName,
     [in,string,unique,range(0, SC_MAX_NAME_LENGTH)] 
             LPSTR  lpLoadOrderGroup,
     [in,out,unique] LPDWORD  lpdwTagId,
     [in,unique,size_is(dwDependSize)] LPBYTE  lpDependencies,
     [in, range (0, SC_MAX_DEPEND_SIZE)] DWORD dwDependSize,
     [in,string,unique,range(0, SC_MAX_ACCOUNT_NAME_LENGTH)] 
             LPSTR  lpServiceStartName,
     [in,unique,size_is(dwPwSize)] LPBYTE  lpPassword,
     [in, range(0, SC_MAX_PWD_SIZE)] DWORD  dwPwSize,
     [in,string,unique,range(0, SC_MAX_NAME_LENGTH)] 
             LPSTR  lpDisplayName
     );
  
 DWORD
 RCreateServiceA(
     [in] SC_RPC_HANDLE  hSCManager,
     [in,string,range(0, SC_MAX_NAME_LENGTH)] 
                 LPSTR  lpServiceName,
     [in,string,unique,range(0, SC_MAX_NAME_LENGTH)] 
                 LPSTR  lpDisplayName,
     [in] DWORD  dwDesiredAccess,
     [in] DWORD  dwServiceType,
     [in] DWORD  dwStartType,
     [in] DWORD  dwErrorControl,
     [in,string, range(0, SC_MAX_PATH_LENGTH)] 
                 LPSTR  lpBinaryPathName,
     [in,string,unique,range(0, SC_MAX_NAME_LENGTH)] 
                 LPSTR  lpLoadOrderGroup,
     [in,out,unique] LPDWORD  lpdwTagId,
     [in,unique,size_is(dwDependSize)] LPBYTE  lpDependencies,
     [in, range (0, SC_MAX_DEPEND_SIZE)] DWORD  dwDependSize,
     [in,string,unique,range(0, SC_MAX_ACCOUNT_NAME_LENGTH)] 
                 LPSTR  lpServiceStartName,
     [in,unique,size_is(dwPwSize)] LPBYTE  lpPassword,
     [in, range(0, SC_MAX_PWD_SIZE)] DWORD  dwPwSize,
     [out] LPSC_RPC_HANDLE  lpServiceHandle
     );
  
 DWORD
 REnumDependentServicesA(
     [in] SC_RPC_HANDLE  hService,
     [in] DWORD  dwServiceState,
     [out, size_is(cbBufSize)] LPBYTE  lpServices,
     [in, range(0, 1024 * 256)] DWORD  cbBufSize,
     [out] LPBOUNDED_DWORD_256K  pcbBytesNeeded,
     [out] LPBOUNDED_DWORD_256K  lpServicesReturned
     );
  
 DWORD
 REnumServicesStatusA(
     [in] SC_RPC_HANDLE  hSCManager,
     [in] DWORD  dwServiceType,
     [in] DWORD  dwServiceState,
     [out, size_is(cbBufSize)] LPBYTE  lpBuffer,
     [in, range(0, 1024 * 256)] DWORD  cbBufSize,
     [out] LPBOUNDED_DWORD_256K  pcbBytesNeeded,
     [out] LPBOUNDED_DWORD_256K  lpServicesReturned,
     [in,out,unique] LPBOUNDED_DWORD_256K lpResumeIndex
     );
  
 DWORD
 ROpenSCManagerA(
     [in,string,unique,range(0, SC_MAX_COMPUTER_NAME_LENGTH)] 
                 SVCCTL_HANDLEA  lpMachineName,
     [in,string,unique,range(0, SC_MAX_NAME_LENGTH)] 
                 LPSTR  lpDatabaseName,
     [in] DWORD  dwDesiredAccess,
     [out] LPSC_RPC_HANDLE  lpScHandle
     );
  
 DWORD
 ROpenServiceA(
     [in] SC_RPC_HANDLE  hSCManager,
     [in,string,range(0, SC_MAX_NAME_LENGTH)] 
                 LPSTR  lpServiceName,
     [in] DWORD  dwDesiredAccess,
     [out] LPSC_RPC_HANDLE lpServiceHandle
     );
  
 DWORD
 RQueryServiceConfigA(
     [in] SC_RPC_HANDLE   hService,
     [out] LPQUERY_SERVICE_CONFIGA lpServiceConfig,
     [in, range(0, 1024 * 8)] DWORD  cbBufSize,
     [out] LPBOUNDED_DWORD_8K  pcbBytesNeeded
     );
  
 DWORD
 RQueryServiceLockStatusA(
     [in] SC_RPC_HANDLE   hSCManager,
     [out] LPQUERY_SERVICE_LOCK_STATUSA  lpLockStatus,
     [in, range(0, 1024 * 4)] DWORD  cbBufSize,
     [out] LPBOUNDED_DWORD_4K  pcbBytesNeeded
     );
  
 DWORD
 RStartServiceA(
     [in] SC_RPC_HANDLE  hService,
     [in, range(0, SC_MAX_ARGUMENTS)] DWORD argc,
     [in,unique,size_is(argc)] LPSTRING_PTRSA argv
     );
  
 DWORD
 RGetServiceDisplayNameA(
     [in] SC_RPC_HANDLE hSCManager,
     [in,string,range(0, SC_MAX_NAME_LENGTH)] LPSTR  lpServiceName,
     [out,string, size_is(*lpcchBuffer)] LPSTR  lpDisplayName,
     [in,out] LPBOUNDED_DWORD_4K  lpcchBuffer
     );
  
 DWORD
 RGetServiceKeyNameA(
     [in] SC_RPC_HANDLE  hSCManager,
     [in,string,range(0, SC_MAX_NAME_LENGTH)] LPSTR  lpDisplayName,
     [out,string, size_is(*lpcchBuffer)] LPSTR  lpKeyName,
     [in,out] LPBOUNDED_DWORD_4K  lpcchBuffer
     );
  
  
 void Opnum34NotUsedOnWire(void);
  
  
 DWORD
 REnumServiceGroupW(
     [in] SC_RPC_HANDLE  hSCManager,
     [in] DWORD  dwServiceType,
     [in] DWORD  dwServiceState,
     [out, size_is(cbBufSize)] LPBYTE  lpBuffer,
     [in, range(0, 1024 * 256)] DWORD  cbBufSize,
     [out] LPBOUNDED_DWORD_256K  pcbBytesNeeded,
     [out] LPBOUNDED_DWORD_256K  lpServicesReturned,
     [in,out,unique] LPBOUNDED_DWORD_256K  lpResumeIndex,
     [in,string,unique,range(0, SC_MAX_NAME_LENGTH)] 
             LPCWSTR  pszGroupName
     );
  
  
 typedef struct _SERVICE_RPC_REQUIRED_PRIVILEGES_INFO
 {
     [range(0, 1024 * 4)] DWORD  cbRequiredPrivileges;
     [size_is(cbRequiredPrivileges)] PBYTE  pRequiredPrivileges;
 } SERVICE_RPC_REQUIRED_PRIVILEGES_INFO, 
   *LPSERVICE_RPC_REQUIRED_PRIVILEGES_INFO;
  
  
 typedef struct _SC_RPC_CONFIG_INFOA
 {
     DWORD  dwInfoLevel;
     [switch_is(dwInfoLevel)] union
     {
     [case(1)]                       
         LPSERVICE_DESCRIPTIONA  psd;
     [case(2)]                       
         LPSERVICE_FAILURE_ACTIONSA  psfa;
     [case(3)]                       
         LPSERVICE_DELAYED_AUTO_START_INFO  psda;
     [case(4)]                       
         LPSERVICE_FAILURE_ACTIONS_FLAG  psfaf;
     [case(5)]                       
         LPSERVICE_SID_INFO  pssid;
     [case(6)]                       
         LPSERVICE_RPC_REQUIRED_PRIVILEGES_INFO  psrp;
     [case(7)]                       
         LPSERVICE_PRESHUTDOWN_INFO  psps;
     [case(8)]                       
        PSERVICE_TRIGGER_INFO psti;
    [case(9)]                       
        LPSERVICE_PREFERRED_NODE_INFO pspn;
     };
 } SC_RPC_CONFIG_INFOA;
  
 typedef struct _SC_RPC_CONFIG_INFOW
 {
     DWORD   dwInfoLevel;
     [switch_is(dwInfoLevel)] union
     {
     [case(1)]                      
         LPSERVICE_DESCRIPTIONW  psd;
     [case(2)]                      
         LPSERVICE_FAILURE_ACTIONSW  psfa;
     [case(3)]                       
         LPSERVICE_DELAYED_AUTO_START_INFO  psda;
     [case(4)]                      
         LPSERVICE_FAILURE_ACTIONS_FLAG  psfaf;
     [case(5)]                       
         LPSERVICE_SID_INFO  pssid;
     [case(6)]                       
         LPSERVICE_RPC_REQUIRED_PRIVILEGES_INFO  psrp;
     [case(7)]                       
         LPSERVICE_PRESHUTDOWN_INFO  psps;
     [case(8)]                       
        PSERVICE_TRIGGER_INFO psti;
    [case(9)]                       
        LPSERVICE_PREFERRED_NODE_INFO pspn;
     };
 } SC_RPC_CONFIG_INFOW;
  
 DWORD
 RChangeServiceConfig2A(
     [in] SC_RPC_HANDLE  hService,
     [in] SC_RPC_CONFIG_INFOA  Info
     );
  
 DWORD
 RChangeServiceConfig2W(
     [in] SC_RPC_HANDLE  hService,
     [in] SC_RPC_CONFIG_INFOW  Info
     );
  
 DWORD
 RQueryServiceConfig2A(
     [in] SC_RPC_HANDLE  hService,
     [in] DWORD  dwInfoLevel,
     [out, size_is(cbBufSize)] LPBYTE  lpBuffer,
     [in, range(0, 1024 * 8)] DWORD  cbBufSize,
     [out] LPBOUNDED_DWORD_8K  pcbBytesNeeded
     );
  
 DWORD
 RQueryServiceConfig2W(
     [in] SC_RPC_HANDLE  hService,
     [in] DWORD  dwInfoLevel,
     [out, size_is(cbBufSize)] LPBYTE lpBuffer,
     [in, range(0, 1024 * 8)] DWORD  cbBufSize,
     [out] LPBOUNDED_DWORD_8K  pcbBytesNeeded
     );
  
 DWORD
 RQueryServiceStatusEx(
     [in] SC_RPC_HANDLE  hService,
     [in] SC_STATUS_TYPE  InfoLevel,
     [out, size_is(cbBufSize)] LPBYTE  lpBuffer,
     [in, range(0, 1024 * 8)] DWORD  cbBufSize,
     [out] LPBOUNDED_DWORD_8K  pcbBytesNeeded
     );
  
 DWORD
 REnumServicesStatusExA (
     [in] SC_RPC_HANDLE  hSCManager,
     [in] SC_ENUM_TYPE  InfoLevel,
     [in] DWORD  dwServiceType,
     [in] DWORD  dwServiceState,
     [out, size_is(cbBufSize)] LPBYTE  lpBuffer,
     [in, range(0, 1024 * 256)] DWORD  cbBufSize,
     [out] LPBOUNDED_DWORD_256K  pcbBytesNeeded,
     [out] LPBOUNDED_DWORD_256K  lpServicesReturned,
     [in,out,unique] LPBOUNDED_DWORD_256K  lpResumeIndex,
     [in,string,unique,range(0, SC_MAX_NAME_LENGTH)] 
             LPCSTR  pszGroupName
     );
  
 DWORD
 REnumServicesStatusExW (
     [in] SC_RPC_HANDLE  hSCManager,
     [in] SC_ENUM_TYPE  InfoLevel,
     [in] DWORD  dwServiceType,
     [in] DWORD  dwServiceState,
     [out, size_is(cbBufSize)] LPBYTE  lpBuffer,
     [in, range(0, 1024 * 256)] DWORD  cbBufSize,
     [out] LPBOUNDED_DWORD_256K  pcbBytesNeeded,
     [out] LPBOUNDED_DWORD_256K  lpServicesReturned,
     [in,out,unique] LPBOUNDED_DWORD_256K  lpResumeIndex,
     [in,string,unique,range(0, SC_MAX_NAME_LENGTH)] 
             LPCWSTR  pszGroupName
     );
  
  
 void Opnum43NotUsedOnWire(void);
  
  
 DWORD
 RCreateServiceWOW64A(
     [in] SC_RPC_HANDLE   hSCManager,
     [in,string,range(0, SC_MAX_NAME_LENGTH)] 
                 LPSTR  lpServiceName,
     [in,string,unique,range(0, SC_MAX_NAME_LENGTH)] 
                 LPSTR  lpDisplayName,
     [in] DWORD  dwDesiredAccess,
     [in] DWORD  dwServiceType,
     [in] DWORD  dwStartType,
     [in] DWORD  dwErrorControl,
     [in,string, range(0, SC_MAX_PATH_LENGTH)] 
                 LPSTR  lpBinaryPathName,
     [in,string,unique,range(0, SC_MAX_NAME_LENGTH)] 
                 LPSTR  lpLoadOrderGroup,
     [in,out,unique] LPDWORD  lpdwTagId,
     [in,unique,size_is(dwDependSize)] LPBYTE  lpDependencies,
     [in, range (0, SC_MAX_DEPEND_SIZE)] DWORD  dwDependSize,
     [in,string,unique,range(0, SC_MAX_ACCOUNT_NAME_LENGTH)] 
                 LPSTR  lpServiceStartName,
     [in,unique,size_is(dwPwSize)] LPBYTE  lpPassword,
     [in, range(0, SC_MAX_PWD_SIZE)] DWORD  dwPwSize,
     [out] LPSC_RPC_HANDLE  lpServiceHandle
     );
  
 DWORD
 RCreateServiceWOW64W(
     [in] SC_RPC_HANDLE  hSCManager,
     [in,string,range(0, SC_MAX_NAME_LENGTH)] 
                 wchar_t *  lpServiceName,
     [in,string,unique,range(0, SC_MAX_NAME_LENGTH)] 
                 wchar_t *  lpDisplayName,
     [in] DWORD  dwDesiredAccess,
     [in] DWORD  dwServiceType,
     [in] DWORD  dwStartType,
     [in] DWORD  dwErrorControl,
     [in,string,range(0, SC_MAX_PATH_LENGTH)] 
                 wchar_t *  lpBinaryPathName,
     [in,string,unique,range(0, SC_MAX_NAME_LENGTH)] 
                 wchar_t *  lpLoadOrderGroup,
     [in,out,unique] LPDWORD  lpdwTagId,
     [in,unique,size_is(dwDependSize)] LPBYTE  lpDependencies,
     [in, range (0, SC_MAX_DEPEND_SIZE)] DWORD  dwDependSize,
     [in,string,unique,range(0, SC_MAX_ACCOUNT_NAME_LENGTH)] 
                 wchar_t *  lpServiceStartName,
     [in,unique,size_is(dwPwSize)] LPBYTE  lpPassword,
     [in, range(0, SC_MAX_PWD_SIZE)] DWORD  dwPwSize,
     [out] LPSC_RPC_HANDLE  lpServiceHandle
     );
  
  
 void Opnum46NotUsedOnWire(void);
     
  
 typedef struct _SERVICE_NOTIFY_STATUS_CHANGE_PARAMS_1
 {
     ULONGLONG  ullThreadId;                                             
     DWORD  dwNotifyMask;                       
     UCHAR  CallbackAddressArray [ 16 ];        
     UCHAR  CallbackParamAddressArray [ 16 ];   
     SERVICE_STATUS_PROCESS  ServiceStatus;                      
     DWORD  dwNotificationStatus;               
     DWORD  dwSequence;                         
 } SERVICE_NOTIFY_STATUS_CHANGE_PARAMS_1, 
   *PSERVICE_NOTIFY_STATUS_CHANGE_PARAMS_1;
  
 typedef struct _SERVICE_NOTIFY_STATUS_CHANGE_PARAMS_2
 {
     ULONGLONG  ullThreadId;                                             
     DWORD  dwNotifyMask;                       
     UCHAR  CallbackAddressArray [ 16 ];        
     UCHAR  CallbackParamAddressArray [ 16 ];   
     SERVICE_STATUS_PROCESS  ServiceStatus;                      
     DWORD  dwNotificationStatus;               
     DWORD  dwSequence;                         
     DWORD  dwNotificationTriggered;            
     [string, range(0, 64*1024)] PWSTR  pszServiceNames;                    
 } SERVICE_NOTIFY_STATUS_CHANGE_PARAMS_2, 
   *PSERVICE_NOTIFY_STATUS_CHANGE_PARAMS_2;
  
  
 typedef SERVICE_NOTIFY_STATUS_CHANGE_PARAMS_2 
         SERVICE_NOTIFY_STATUS_CHANGE_PARAMS, 
         *PSERVICE_NOTIFY_STATUS_CHANGE_PARAMS;
  
 typedef struct _SC_RPC_NOTIFY_PARAMS
 {
     DWORD  dwInfoLevel;
     [ switch_is ( dwInfoLevel ) ] 
     union
     {
      [case(1)]                       
          PSERVICE_NOTIFY_STATUS_CHANGE_PARAMS_1  pStatusChangeParam1;
  
       [case(2)]                      
          PSERVICE_NOTIFY_STATUS_CHANGE_PARAMS_2  pStatusChangeParams;
     };
 } SC_RPC_NOTIFY_PARAMS;
  
 typedef struct _SC_RPC_NOTIFY_PARAMS_LIST 
 {
     BOUNDED_DWORD_4K cElements;
     [size_is(cElements)] SC_RPC_NOTIFY_PARAMS NotifyParamsArray [*];
 } SC_RPC_NOTIFY_PARAMS_LIST, *PSC_RPC_NOTIFY_PARAMS_LIST;
  
  
 DWORD
 RNotifyServiceStatusChange(
     [in] SC_RPC_HANDLE  hService,
     [in] SC_RPC_NOTIFY_PARAMS  NotifyParams,
     [in] GUID *  pClientProcessGuid,
     [out] GUID *  pSCMProcessGuid,
     [out] PBOOL  pfCreateRemoteQueue,
     [out] LPSC_NOTIFY_RPC_HANDLE  phNotify
     );
  
 error_status_t
 RGetNotifyResults(
     [in] SC_NOTIFY_RPC_HANDLE  hNotify,
     [out] PSC_RPC_NOTIFY_PARAMS_LIST *ppNotifyParams
     );
  
 DWORD
 RCloseNotifyHandle(
     [in, out] LPSC_NOTIFY_RPC_HANDLE  phNotify,
     [out] PBOOL  pfApcFired
     );
  
 typedef struct _SERVICE_CONTROL_STATUS_REASON_IN_PARAMSA
 {
     DWORD dwReason;
     [string,range(0, SC_MAX_COMMENT_LENGTH)] LPSTR pszComment;
 } SERVICE_CONTROL_STATUS_REASON_IN_PARAMSA, 
   *PSERVICE_CONTROL_STATUS_REASON_IN_PARAMSA;
  
 typedef struct _SERVICE_CONTROL_STATUS_REASON_OUT_PARAMS
 {
     SERVICE_STATUS_PROCESS ServiceStatus;
 } SERVICE_CONTROL_STATUS_REASON_OUT_PARAMS, 
   *PSERVICE_CONTROL_STATUS_REASON_OUT_PARAMS;
  
 typedef [switch_type(DWORD)] 
      union _SC_RPC_SERVICE_CONTROL_IN_PARAMSA
 {
     [case(1)]                       
         PSERVICE_CONTROL_STATUS_REASON_IN_PARAMSA  psrInParams;
 } SC_RPC_SERVICE_CONTROL_IN_PARAMSA, 
   *PSC_RPC_SERVICE_CONTROL_IN_PARAMSA;
  
 typedef [switch_type(DWORD)] 
      union _SC_RPC_SERVICE_CONTROL_OUT_PARAMSA
 {
     [case(1)]                      
         PSERVICE_CONTROL_STATUS_REASON_OUT_PARAMS  psrOutParams;
 } SC_RPC_SERVICE_CONTROL_OUT_PARAMSA, 
   *PSC_RPC_SERVICE_CONTROL_OUT_PARAMSA;
  
 DWORD
 RControlServiceExA (
     [in] SC_RPC_HANDLE  hService,
     [in] DWORD  dwControl,
     [in] DWORD  dwInfoLevel,
     [in, switch_is(dwInfoLevel)] 
          PSC_RPC_SERVICE_CONTROL_IN_PARAMSA  pControlInParams,
     [out, switch_is(dwInfoLevel)] 
          PSC_RPC_SERVICE_CONTROL_OUT_PARAMSA  pControlOutParams       
     );
  
  
 typedef struct _SERVICE_CONTROL_STATUS_REASON_IN_PARAMSW
 {
     DWORD dwReason;
     [string,range(0, SC_MAX_COMMENT_LENGTH)] LPWSTR pszComment;
 } SERVICE_CONTROL_STATUS_REASON_IN_PARAMSW, 
   *PSERVICE_CONTROL_STATUS_REASON_IN_PARAMSW;
  
 typedef [switch_type(DWORD)] 
      union _SC_RPC_SERVICE_CONTROL_IN_PARAMSW
 {
     [case(1)]                   
         PSERVICE_CONTROL_STATUS_REASON_IN_PARAMSW  psrInParams;
 } SC_RPC_SERVICE_CONTROL_IN_PARAMSW, 
   *PSC_RPC_SERVICE_CONTROL_IN_PARAMSW;
  
 typedef [switch_type(DWORD)] 
      union _SC_RPC_SERVICE_CONTROL_OUT_PARAMSW
 {
     [case(1)]                       
         PSERVICE_CONTROL_STATUS_REASON_OUT_PARAMS  psrOutParams;
 } SC_RPC_SERVICE_CONTROL_OUT_PARAMSW, 
   *PSC_RPC_SERVICE_CONTROL_OUT_PARAMSW;
  
 DWORD
 RControlServiceExW (
     [in] SC_RPC_HANDLE  hService,
     [in] DWORD  dwControl,
     [in] DWORD  dwInfoLevel,
     [in, switch_is(dwInfoLevel)] 
          PSC_RPC_SERVICE_CONTROL_IN_PARAMSW  pControlInParams,
     [out, switch_is(dwInfoLevel)] 
          PSC_RPC_SERVICE_CONTROL_OUT_PARAMSW  pControlOutParams       
     );
  
 void Opnum52NotUsedOnWire(void);
  
 void Opnum53NotUsedOnWire(void);
  
 void Opnum54NotUsedOnWire(void);
  
 void Opnum55NotUsedOnWire(void);
  
 DWORD
 RQueryServiceConfigEx (
     [in]    SC_RPC_HANDLE           hService,
     [in]    DWORD                   dwInfoLevel,
     [out]   SC_RPC_CONFIG_INFOW  *  pInfo
     );
 }
  
 void Opnum57NotUsedOnWire(void);
 void Opnum58NotUsedOnWire(void);
 void Opnum59NotUsedOnWire(void);
  
 DWORD
 RCreateWowService(
     [in]        SC_RPC_HANDLE       hSCManager,
     [in,string,range(0, SC_MAX_NAME_LENGTH)]
                 wchar_t *           lpServiceName,
     [in,string,unique,range(0, SC_MAX_NAME_LENGTH)]
                 wchar_t *           lpDisplayName,
     [in]        DWORD               dwDesiredAccess,
     [in]        DWORD               dwServiceType,
     [in]        DWORD               dwStartType,
     [in]        DWORD               dwErrorControl,
     [in,string,range(0, SC_MAX_PATH_LENGTH)]
                 wchar_t *           lpBinaryPathName,
     [in,string,unique,range(0, SC_MAX_NAME_LENGTH)]
                 wchar_t *           lpLoadOrderGroup,
     [in,out,unique]
                 LPDWORD             lpdwTagId,
     [in,unique,size_is(dwDependSize)]
                 LPBYTE              lpDependencies,
     [in, range (0, SC_MAX_DEPEND_SIZE)]
                 DWORD               dwDependSize,
     [in,string,unique,range(0, SC_MAX_ACCOUNT_NAME_LENGTH)]
                 wchar_t *           lpServiceStartName,
     [in,unique,size_is(dwPwSize)]
                 LPBYTE              lpPassword,
     [in, range(0, SC_MAX_PWD_SIZE)]
                 DWORD               dwPwSize,
     [in]        USHORT              dwServiceWowType,
     [out]       LPSC_RPC_HANDLE     lpServiceHandle
     );
  
 void Opnum61NotUsedOnWire(void);
 void Opnum62NotUsedOnWire(void);
 void Opnum63NotUsedOnWire(void);
  
 DWORD
 ROpenSCManager2(
     [in] handle_t BindingHandle,
     [in,string,unique,range(0, SC_MAX_NAME_LENGTH)]
     wchar_t *DatabaseName,
     [in] DWORD DesiredAccess,
     [out] LPSC_RPC_HANDLE ScmHandle
 );