Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

607 lines
19 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. svcctl.idl
  5. Abstract:
  6. This is the IDL file that describes the RPC interface for the
  7. remotable NetService API.
  8. Author:
  9. Dan Lafferty (danl) 03-Feb-1992
  10. Environment:
  11. User Mode -Win32
  12. Revision History:
  13. 03-Feb-1992 danl
  14. Created
  15. --*/
  16. //
  17. // Interface Attributes
  18. //
  19. [
  20. uuid(367ABB81-9844-35F1-AD32-98F038001003),
  21. version(2.0),
  22. #ifdef __midl
  23. ms_union,
  24. #endif // __midl
  25. pointer_default(unique)
  26. ]
  27. //
  28. // Interface Keyword
  29. //
  30. interface svcctl
  31. //
  32. // Interface Body
  33. //
  34. {
  35. import "imports.idl";
  36. //
  37. // Define handle types
  38. //
  39. typedef [handle] wchar_t * SVCCTL_HANDLEW;
  40. typedef [handle] LPSTR SVCCTL_HANDLEA;
  41. typedef [context_handle] PVOID SC_RPC_HANDLE;
  42. typedef [context_handle] PVOID SC_RPC_LOCK;
  43. typedef SC_RPC_HANDLE *LPSC_RPC_HANDLE;
  44. typedef SC_RPC_LOCK *LPSC_RPC_LOCK;
  45. //
  46. // This Data Structure is used in specifying an array of string pointers
  47. // used to pass command line arguments into StartService.
  48. //
  49. typedef struct _STRING_PTRSA {
  50. [string] LPSTR StringPtr;
  51. } STRING_PTRSA, *PSTRING_PTRSA, *LPSTRING_PTRSA;
  52. typedef struct _STRING_PTRSW {
  53. [string] wchar_t * StringPtr;
  54. } STRING_PTRSW, *PSTRING_PTRSW, *LPSTRING_PTRSW;
  55. //////////////////////////////////////////////////////////////////////////////
  56. // FUNCTION PROTOTYPES
  57. //////////////////////////////////////////////////////////////////////////////
  58. DWORD
  59. RCloseServiceHandle(
  60. [in,out] LPSC_RPC_HANDLE hSCObject
  61. );
  62. DWORD
  63. RControlService(
  64. [in] SC_RPC_HANDLE hService,
  65. [in] DWORD dwControl,
  66. [out] LPSERVICE_STATUS lpServiceStatus
  67. );
  68. DWORD
  69. RDeleteService(
  70. [in] SC_RPC_HANDLE hService
  71. );
  72. DWORD
  73. RLockServiceDatabase(
  74. [in] SC_RPC_HANDLE hSCManager,
  75. [out] LPSC_RPC_LOCK lpLock
  76. );
  77. DWORD
  78. RQueryServiceObjectSecurity(
  79. [in] SC_RPC_HANDLE hService,
  80. [in] SECURITY_INFORMATION dwSecurityInformation,
  81. [out,size_is(cbBufSize)] LPBYTE lpSecurityDescriptor,
  82. [in] DWORD cbBufSize,
  83. [out] LPDWORD pcbBytesNeeded
  84. );
  85. DWORD
  86. RSetServiceObjectSecurity(
  87. [in] SC_RPC_HANDLE hService,
  88. [in] SECURITY_INFORMATION dwSecurityInformation,
  89. [in,size_is(cbBufSize)] LPBYTE lpSecurityDescriptor,
  90. [in] DWORD cbBufSize
  91. );
  92. DWORD
  93. RQueryServiceStatus(
  94. [in] SC_RPC_HANDLE hService,
  95. [out] LPSERVICE_STATUS lpServiceStatus
  96. );
  97. DWORD
  98. RSetServiceStatus(
  99. [in] SC_RPC_HANDLE hServiceStatus,
  100. [in] LPSERVICE_STATUS lpServiceStatus
  101. );
  102. DWORD
  103. RUnlockServiceDatabase(
  104. [in,out] LPSC_RPC_LOCK Lock
  105. );
  106. DWORD
  107. RNotifyBootConfigStatus(
  108. [in,string,unique] SVCCTL_HANDLEW lpMachineName,
  109. [in] DWORD BootAcceptable
  110. );
  111. //////////////////////////////////////////////////////////////////////////////
  112. // UNICODE FUNCTION PROTOTYPES
  113. //////////////////////////////////////////////////////////////////////////////
  114. DWORD
  115. RI_ScSetServiceBitsW(
  116. [in] SC_RPC_HANDLE hServiceStatus,
  117. [in] DWORD dwServiceBits,
  118. [in] DWORD bSetBitsOn,
  119. [in] DWORD bUpdateImmediately,
  120. [in,string,unique] wchar_t * pszTransportName
  121. );
  122. DWORD
  123. RChangeServiceConfigW(
  124. [in] SC_RPC_HANDLE hService,
  125. [in] DWORD dwServiceType,
  126. [in] DWORD dwStartType,
  127. [in] DWORD dwErrorControl,
  128. [in,string,unique] wchar_t * lpBinaryPathName,
  129. [in,string,unique] wchar_t * lpLoadOrderGroup,
  130. [in,out,unique] LPDWORD lpdwTagId,
  131. [in,unique,size_is(dwDependSize)] LPBYTE lpDependencies,
  132. [in] DWORD dwDependSize,
  133. [in,string,unique] wchar_t * lpServiceStartName,
  134. [in,unique,size_is(dwPwSize)] LPBYTE lpPassword,
  135. [in] DWORD dwPwSize,
  136. [in,string,unique] wchar_t * lpDisplayName
  137. );
  138. DWORD
  139. RCreateServiceW(
  140. [in] SC_RPC_HANDLE hSCManager,
  141. [in,string] wchar_t * lpServiceName,
  142. [in,string,unique] wchar_t * lpDisplayName,
  143. [in] DWORD dwDesiredAccess,
  144. [in] DWORD dwServiceType,
  145. [in] DWORD dwStartType,
  146. [in] DWORD dwErrorControl,
  147. [in,string] wchar_t * lpBinaryPathName,
  148. [in,string,unique] wchar_t * lpLoadOrderGroup,
  149. [in,out,unique] LPDWORD lpdwTagId,
  150. [in,unique,size_is(dwDependSize)] LPBYTE lpDependencies,
  151. [in] DWORD dwDependSize,
  152. [in,string,unique] wchar_t * lpServiceStartName,
  153. [in,unique,size_is(dwPwSize)] LPBYTE lpPassword,
  154. [in] DWORD dwPwSize,
  155. [out] LPSC_RPC_HANDLE lpServiceHandle
  156. );
  157. DWORD
  158. REnumDependentServicesW(
  159. [in] SC_RPC_HANDLE hService,
  160. [in] DWORD dwServiceState,
  161. [out,size_is(cbBufSize)] LPBYTE lpServices,
  162. [in] DWORD cbBufSize,
  163. [out] LPDWORD pcbBytesNeeded,
  164. [out] LPDWORD lpServicesReturned
  165. );
  166. DWORD
  167. REnumServicesStatusW(
  168. [in] SC_RPC_HANDLE hSCManager,
  169. [in] DWORD dwServiceType,
  170. [in] DWORD dwServiceState,
  171. [out,size_is(cbBufSize)] LPBYTE lpBuffer,
  172. [in] DWORD cbBufSize,
  173. [out] LPDWORD pcbBytesNeeded,
  174. [out] LPDWORD lpServicesReturned,
  175. [in,out,unique] LPDWORD lpResumeIndex
  176. );
  177. DWORD
  178. ROpenSCManagerW(
  179. [in,string,unique] SVCCTL_HANDLEW lpMachineName,
  180. [in,string,unique] wchar_t * lpDatabaseName,
  181. [in] DWORD dwDesiredAccess,
  182. [out] LPSC_RPC_HANDLE lpScHandle
  183. );
  184. DWORD
  185. ROpenServiceW(
  186. [in] SC_RPC_HANDLE hSCManager,
  187. [in,string] wchar_t * lpServiceName,
  188. [in] DWORD dwDesiredAccess,
  189. [out] LPSC_RPC_HANDLE lpServiceHandle
  190. );
  191. DWORD
  192. RQueryServiceConfigW(
  193. [in] SC_RPC_HANDLE hService,
  194. [out] LPQUERY_SERVICE_CONFIGW lpServiceConfig,
  195. [in] DWORD cbBufSize,
  196. [out] LPDWORD pcbBytesNeeded
  197. );
  198. DWORD
  199. RQueryServiceLockStatusW(
  200. [in] SC_RPC_HANDLE hSCManager,
  201. [out] LPQUERY_SERVICE_LOCK_STATUSW lpLockStatus,
  202. [in] DWORD cbBufSize,
  203. [out] LPDWORD pcbBytesNeeded
  204. );
  205. DWORD
  206. RStartServiceW(
  207. [in] SC_RPC_HANDLE hService,
  208. [in] DWORD argc,
  209. [in,unique,size_is(argc)] LPSTRING_PTRSW argv
  210. );
  211. DWORD
  212. RGetServiceDisplayNameW(
  213. [in] SC_RPC_HANDLE hSCManager,
  214. [in,string] wchar_t * lpServiceName,
  215. [out,string, size_is(*lpcchBuffer+1)] wchar_t * lpDisplayName,
  216. [in,out] LPDWORD lpcchBuffer
  217. );
  218. DWORD
  219. RGetServiceKeyNameW(
  220. [in] SC_RPC_HANDLE hSCManager,
  221. [in,string] wchar_t * lpDisplayName,
  222. [out,string, size_is(*lpcchBuffer+1)] wchar_t * lpServiceName,
  223. [in,out] LPDWORD lpcchBuffer
  224. );
  225. //////////////////////////////////////////////////////////////////////////////
  226. // ANSI FUNCTION PROTOTYPES
  227. //////////////////////////////////////////////////////////////////////////////
  228. DWORD
  229. RI_ScSetServiceBitsA(
  230. [in] SC_RPC_HANDLE hServiceStatus,
  231. [in] DWORD dwServiceBits,
  232. [in] DWORD bSetBitsOn,
  233. [in] DWORD bUpdateImmediately,
  234. [in,out,string,unique] LPSTR pszTransportName
  235. );
  236. DWORD
  237. RChangeServiceConfigA(
  238. [in] SC_RPC_HANDLE hService,
  239. [in] DWORD dwServiceType,
  240. [in] DWORD dwStartType,
  241. [in] DWORD dwErrorControl,
  242. [in,string,unique] LPSTR lpBinaryPathName,
  243. [in,string,unique] LPSTR lpLoadOrderGroup,
  244. [in,out,unique] LPDWORD lpdwTagId,
  245. [in,unique,size_is(dwDependSize)] LPBYTE lpDependencies,
  246. [in] DWORD dwDependSize,
  247. [in,string,unique] LPSTR lpServiceStartName,
  248. [in,unique,size_is(dwPwSize)] LPBYTE lpPassword,
  249. [in] DWORD dwPwSize,
  250. [in,string,unique] LPSTR lpDisplayName
  251. );
  252. DWORD
  253. RCreateServiceA(
  254. [in] SC_RPC_HANDLE hSCManager,
  255. [in,string] LPSTR lpServiceName,
  256. [in,string,unique] LPSTR lpDisplayName,
  257. [in] DWORD dwDesiredAccess,
  258. [in] DWORD dwServiceType,
  259. [in] DWORD dwStartType,
  260. [in] DWORD dwErrorControl,
  261. [in,string] LPSTR lpBinaryPathName,
  262. [in,string,unique] LPSTR lpLoadOrderGroup,
  263. [in,out,unique] LPDWORD lpdwTagId,
  264. [in,unique,size_is(dwDependSize)] LPBYTE lpDependencies,
  265. [in] DWORD dwDependSize,
  266. [in,string,unique] LPSTR lpServiceStartName,
  267. [in,unique,size_is(dwPwSize)] LPBYTE lpPassword,
  268. [in] DWORD dwPwSize,
  269. [out] LPSC_RPC_HANDLE lpServiceHandle
  270. );
  271. DWORD
  272. REnumDependentServicesA(
  273. [in] SC_RPC_HANDLE hService,
  274. [in] DWORD dwServiceState,
  275. [out,size_is(cbBufSize)] LPBYTE lpServices,
  276. [in] DWORD cbBufSize,
  277. [out] LPDWORD pcbBytesNeeded,
  278. [out] LPDWORD lpServicesReturned
  279. );
  280. DWORD
  281. REnumServicesStatusA(
  282. [in] SC_RPC_HANDLE hSCManager,
  283. [in] DWORD dwServiceType,
  284. [in] DWORD dwServiceState,
  285. [out,size_is(cbBufSize)] LPBYTE lpBuffer,
  286. [in] DWORD cbBufSize,
  287. [out] LPDWORD pcbBytesNeeded,
  288. [out] LPDWORD lpServicesReturned,
  289. [in,out,unique] LPDWORD lpResumeIndex
  290. );
  291. DWORD
  292. ROpenSCManagerA(
  293. [in,string,unique] SVCCTL_HANDLEA lpMachineName,
  294. [in,string,unique] LPSTR lpDatabaseName,
  295. [in] DWORD dwDesiredAccess,
  296. [out] LPSC_RPC_HANDLE lpScHandle
  297. );
  298. DWORD
  299. ROpenServiceA(
  300. [in] SC_RPC_HANDLE hSCManager,
  301. [in,string] LPSTR lpServiceName,
  302. [in] DWORD dwDesiredAccess,
  303. [out] LPSC_RPC_HANDLE lpServiceHandle
  304. );
  305. DWORD
  306. RQueryServiceConfigA(
  307. [in] SC_RPC_HANDLE hService,
  308. [out] LPQUERY_SERVICE_CONFIGA lpServiceConfig,
  309. [in] DWORD cbBufSize,
  310. [out] LPDWORD pcbBytesNeeded
  311. );
  312. DWORD
  313. RQueryServiceLockStatusA(
  314. [in] SC_RPC_HANDLE hSCManager,
  315. [out] LPQUERY_SERVICE_LOCK_STATUSA lpLockStatus,
  316. [in] DWORD cbBufSize,
  317. [out] LPDWORD pcbBytesNeeded
  318. );
  319. DWORD
  320. RStartServiceA(
  321. [in] SC_RPC_HANDLE hService,
  322. [in] DWORD argc,
  323. [in,unique,size_is(argc)] LPSTRING_PTRSA argv
  324. );
  325. DWORD
  326. RGetServiceDisplayNameA(
  327. [in] SC_RPC_HANDLE hSCManager,
  328. [in,string] LPSTR lpServiceName,
  329. [out,string,
  330. size_is(*lpcchBuffer)] LPSTR lpDisplayName,
  331. [in,out] LPDWORD lpcchBuffer
  332. );
  333. DWORD
  334. RGetServiceKeyNameA(
  335. [in] SC_RPC_HANDLE hSCManager,
  336. [in,string] LPSTR lpDisplayName,
  337. [out,string,
  338. size_is(*lpcchBuffer)] LPSTR lpKeyName,
  339. [in,out] LPDWORD lpcchBuffer
  340. );
  341. /////////////////////////////////////////////////////////////////////////////
  342. // Functions below this point are not in Windows NT version 3.51 or earlier
  343. /////////////////////////////////////////////////////////////////////////////
  344. // Internal only
  345. DWORD
  346. RI_ScGetCurrentGroupStateW(
  347. [in] SC_RPC_HANDLE hSCManager,
  348. [in,string,unique] wchar_t * pszGroupName,
  349. [out] LPDWORD pdwCurrentState
  350. );
  351. // Internal only
  352. DWORD
  353. REnumServiceGroupW(
  354. [in] SC_RPC_HANDLE hSCManager,
  355. [in] DWORD dwServiceType,
  356. [in] DWORD dwServiceState,
  357. [out,size_is(cbBufSize)] LPBYTE lpBuffer,
  358. [in] DWORD cbBufSize,
  359. [out] LPDWORD pcbBytesNeeded,
  360. [out] LPDWORD lpServicesReturned,
  361. [in,out,unique] LPDWORD lpResumeIndex,
  362. [in,string,unique] LPCWSTR pszGroupName
  363. );
  364. /////////////////////////////////////////////////////////////////////////////
  365. // Functions below this point are not in Windows NT version 4.0 or earlier
  366. //
  367. // (Note that new functions must always be added at the end, otherwise
  368. // function calls are mismatched when client and server talk different
  369. // versions of the interface)
  370. /////////////////////////////////////////////////////////////////////////////
  371. //
  372. // This is a union of all the types of pointers to input data that can be
  373. // passed to ChangeServiceConfig2
  374. //
  375. typedef struct _SC_RPC_CONFIG_INFOA
  376. {
  377. DWORD dwInfoLevel;
  378. [switch_is(dwInfoLevel)] union
  379. {
  380. [case(1)] // SERVICE_CONFIG_DESCRIPTION
  381. LPSERVICE_DESCRIPTIONA psd;
  382. [case(2)] // SERVICE_CONFIG_FAILURE_ACTIONS
  383. LPSERVICE_FAILURE_ACTIONSA psfa;
  384. };
  385. } SC_RPC_CONFIG_INFOA;
  386. typedef struct _SC_RPC_CONFIG_INFOW
  387. {
  388. DWORD dwInfoLevel;
  389. [switch_is(dwInfoLevel)] union
  390. {
  391. [case(1)] // SERVICE_CONFIG_DESCRIPTION
  392. LPSERVICE_DESCRIPTIONW psd;
  393. [case(2)] // SERVICE_CONFIG_FAILURE_ACTIONS
  394. LPSERVICE_FAILURE_ACTIONSW psfa;
  395. };
  396. } SC_RPC_CONFIG_INFOW;
  397. DWORD
  398. RChangeServiceConfig2A(
  399. [in] SC_RPC_HANDLE hService,
  400. [in] SC_RPC_CONFIG_INFOA Info
  401. );
  402. DWORD
  403. RChangeServiceConfig2W(
  404. [in] SC_RPC_HANDLE hService,
  405. [in] SC_RPC_CONFIG_INFOW Info
  406. );
  407. DWORD
  408. RQueryServiceConfig2A(
  409. [in] SC_RPC_HANDLE hService,
  410. [in] DWORD dwInfoLevel,
  411. [out,size_is(cbBufSize)] LPBYTE lpBuffer,
  412. [in] DWORD cbBufSize,
  413. [out] LPDWORD pcbBytesNeeded
  414. );
  415. DWORD
  416. RQueryServiceConfig2W(
  417. [in] SC_RPC_HANDLE hService,
  418. [in] DWORD dwInfoLevel,
  419. [out,size_is(cbBufSize)] LPBYTE lpBuffer,
  420. [in] DWORD cbBufSize,
  421. [out] LPDWORD pcbBytesNeeded
  422. );
  423. DWORD
  424. RQueryServiceStatusEx(
  425. [in] SC_RPC_HANDLE hService,
  426. [in] SC_STATUS_TYPE InfoLevel,
  427. [out,size_is(cbBufSize)] LPBYTE lpBuffer,
  428. [in] DWORD cbBufSize,
  429. [out] LPDWORD pcbBytesNeeded
  430. );
  431. DWORD
  432. REnumServicesStatusExA (
  433. [in] SC_RPC_HANDLE hSCManager,
  434. [in] SC_ENUM_TYPE InfoLevel,
  435. [in] DWORD dwServiceType,
  436. [in] DWORD dwServiceState,
  437. [out,size_is(cbBufSize)] LPBYTE lpBuffer,
  438. [in] DWORD cbBufSize,
  439. [out] LPDWORD pcbBytesNeeded,
  440. [out] LPDWORD lpServicesReturned,
  441. [in,out,unique] LPDWORD lpResumeIndex,
  442. [in,string,unique] LPCSTR pszGroupName
  443. );
  444. DWORD
  445. REnumServicesStatusExW (
  446. [in] SC_RPC_HANDLE hSCManager,
  447. [in] SC_ENUM_TYPE InfoLevel,
  448. [in] DWORD dwServiceType,
  449. [in] DWORD dwServiceState,
  450. [out,size_is(cbBufSize)] LPBYTE lpBuffer,
  451. [in] DWORD cbBufSize,
  452. [out] LPDWORD pcbBytesNeeded,
  453. [out] LPDWORD lpServicesReturned,
  454. [in,out,unique] LPDWORD lpResumeIndex,
  455. [in,string,unique] LPCWSTR pszGroupName
  456. );
  457. /////////////////////////////////////////////////////////////////////////////
  458. // Functions below this point are not in Windows NT version 5.0 or earlier
  459. //
  460. // (Note that new functions must always be added at the end, otherwise
  461. // function calls are mismatched when client and server talk different
  462. // versions of the interface)
  463. /////////////////////////////////////////////////////////////////////////////
  464. DWORD
  465. RI_ScSendTSMessage (
  466. [in] SC_RPC_HANDLE hSCManager,
  467. [in] DWORD OpCode,
  468. [in] DWORD dwEvent,
  469. [in] DWORD cbData,
  470. [in,size_is(cbData)] LPBYTE lpData
  471. );
  472. /////////////////////////////////////////////////////////////////////////////
  473. //
  474. // IN THE FUTURE .....
  475. //
  476. // MIDL will support marshalling structures directly into the user's buffer.
  477. // To do this, the server side must know how big the buffer should be
  478. // for the server code. The server code must fill in the buffer.
  479. // The [byte_count(bufferSize)] attribute is used in the .acf file to tell
  480. // it the RPC server stub what size buffer needs to be allocated.
  481. //
  482. // byte_count is similar to all_nodes. all_nodes tells the MIDL client stubs
  483. // to allocate one buffer into which is unmarshall the entire tree.
  484. // byte_count tells the MIDL client stubs to unmarshall the entire tree into
  485. // the user-provided buffer using the buffer size limits specified with
  486. // the attribute.
  487. //
  488. //
  489. // The strange syntax below uses size_is to allow the .IDL file to stand
  490. // alone (without the .acf file) and operate correctly using a DEC or HP
  491. // MIDL compiler. However, without the .ACF file, the instructions in
  492. // the .IDL file indicate that the top level structures will be placed
  493. // in the users buffer, but the lower level data will be placed in MIDL
  494. // allocated buffers. - In a NON-all_nodes fashion.
  495. //
  496. // Note that cbBufSize/sizeof(ENUM_SERVICE_STATUS) will always be larger
  497. // than lpServicesReturned. The size_is attribute tells the server side
  498. // how much memory to allocate in the case where there is no .acf file.
  499. //
  500. // After the next drop of the MIDL complier, Donna will still need to
  501. // fix MIDL so that it allows size_is and byte_count to apply to the
  502. // same parameter. Perhaps we need approval from Dov.
  503. //
  504. //
  505. //
  506. //DWORD
  507. //REnumServicesStatusW(
  508. // [in] SC_RPC_HANDLE hSCManager,
  509. // [in] DWORD dwServiceType,
  510. // [in] DWORD dwServiceState,
  511. //
  512. // [out,size_is(cbBufSize/sizeof(ENUM_SERVICE_STATUS),
  513. // length_is(*lpServicesReturned)] LPENUM_SERVICE_STATUS lpServices,
  514. //
  515. // [out] PDWORD pcbReturned,
  516. // [in] DWORD cbBufSize,
  517. // [out] LPDWORD pcbBytesNeeded,
  518. // [out] LPDWORD lpServicesReturned,
  519. // [in,out,unique] LPDWORD lpResumeHandle
  520. // );
  521. }