Leaked source code of windows server 2003
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.

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