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.

1401 lines
38 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. ioctl.c
  5. Abstract:
  6. Implements server side of the resource and resource type
  7. IOCTL interfaces in the CLUSAPI.
  8. Author:
  9. John Vert (jvert) 10/16/1996
  10. Revision History:
  11. --*/
  12. #include "apip.h"
  13. error_status_t
  14. s_ApiNodeResourceControl(
  15. IN HRES_RPC hResource,
  16. IN HNODE_RPC hNode,
  17. IN DWORD dwControlCode,
  18. IN UCHAR *lpInBuffer,
  19. IN DWORD dwInBufferSize,
  20. OUT UCHAR *lpOutBuffer,
  21. IN DWORD nOutBufferSize,
  22. OUT DWORD *lpBytesReturned,
  23. OUT DWORD *lpcbRequired
  24. )
  25. /*++
  26. Routine Description:
  27. Provides for arbitrary communication and control between an application
  28. and a specific instance of a resource.
  29. Arguments:
  30. hResource - Supplies a handle to the resource to be controlled.
  31. hNode - Supplies a handle to the node on which the resource
  32. control should be delivered. If this is NULL, the node where
  33. the resource is online is used.
  34. dwControlCode- Supplies the control code that defines the
  35. structure and action of the resource control.
  36. Values of dwControlCode between 0 and 0x10000000 are reserved
  37. for future definition and use by Microsoft. All other values
  38. are available for use by ISVs
  39. lpInBuffer- Supplies a pointer to the input buffer to be passed
  40. to the resource.
  41. nInBufferSize- Supplies the size, in bytes, of the data pointed
  42. to by lpInBuffer..
  43. lpOutBuffer- Supplies a pointer to the output buffer to be
  44. filled in by the resource..
  45. nOutBufferSize- Supplies the size, in bytes, of the available
  46. space pointed to by lpOutBuffer.
  47. lpBytesReturned - Returns the number of bytes of lpOutBuffer
  48. actually filled in by the resource..
  49. lpcbRequired - Returns the number of bytes required if OutBuffer
  50. is not large enough.
  51. Return Value:
  52. ERROR_SUCCESS if successful
  53. Win32 error code otherwise
  54. --*/
  55. {
  56. PFM_RESOURCE Resource;
  57. PNM_NODE Node;
  58. API_CHECK_INIT();
  59. VALIDATE_RESOURCE_EXISTS(Resource, hResource);
  60. VALIDATE_NODE(Node, hNode);
  61. //
  62. // Check if this is an internal, private control code.
  63. //
  64. if ( dwControlCode & CLCTL_INTERNAL_MASK )
  65. {
  66. return(ERROR_PRIVILEGE_NOT_HELD);
  67. }
  68. //
  69. // Since lpInBuffer is declared as [unique] in the IDL file, it can be NULL while dwBufferSize
  70. // is non-zero and vice-versa. To avoid confusion in the following code, we make them consistent
  71. // right here.
  72. //
  73. if ( lpInBuffer == NULL )
  74. {
  75. dwInBufferSize = 0;
  76. }
  77. else if ( dwInBufferSize == 0 )
  78. {
  79. lpInBuffer = NULL;
  80. }
  81. return(FmResourceControl( Resource,
  82. Node,
  83. dwControlCode,
  84. lpInBuffer,
  85. dwInBufferSize,
  86. lpOutBuffer,
  87. nOutBufferSize,
  88. lpBytesReturned,
  89. lpcbRequired ));
  90. }
  91. error_status_t
  92. s_ApiResourceControl(
  93. IN HRES_RPC hResource,
  94. IN DWORD dwControlCode,
  95. IN UCHAR *lpInBuffer,
  96. IN DWORD dwInBufferSize,
  97. OUT UCHAR *lpOutBuffer,
  98. IN DWORD nOutBufferSize,
  99. OUT DWORD *lpBytesReturned,
  100. OUT DWORD *lpcbRequired
  101. )
  102. /*++
  103. Routine Description:
  104. Provides for arbitrary communication and control between an application
  105. and a specific instance of a resource.
  106. Arguments:
  107. hResource - Supplies a handle to the resource to be controlled.
  108. dwControlCode- Supplies the control code that defines the
  109. structure and action of the resource control.
  110. Values of dwControlCode between 0 and 0x10000000 are reserved
  111. for future definition and use by Microsoft. All other values
  112. are available for use by ISVs
  113. lpInBuffer- Supplies a pointer to the input buffer to be passed
  114. to the resource.
  115. nInBufferSize- Supplies the size, in bytes, of the data pointed
  116. to by lpInBuffer..
  117. lpOutBuffer- Supplies a pointer to the output buffer to be
  118. filled in by the resource..
  119. nOutBufferSize- Supplies the size, in bytes, of the available
  120. space pointed to by lpOutBuffer.
  121. lpBytesReturned - Returns the number of bytes of lpOutBuffer
  122. actually filled in by the resource..
  123. lpcbRequired - Returns the number of bytes required if OutBuffer
  124. is not large enough.
  125. Return Value:
  126. ERROR_SUCCESS if successful
  127. Win32 error code otherwise
  128. --*/
  129. {
  130. PFM_RESOURCE Resource;
  131. API_CHECK_INIT();
  132. VALIDATE_RESOURCE_EXISTS(Resource, hResource);
  133. //
  134. // Check if this is an internal, private control code.
  135. //
  136. if ( dwControlCode & CLCTL_INTERNAL_MASK )
  137. {
  138. return(ERROR_PRIVILEGE_NOT_HELD);
  139. }
  140. //
  141. // Since lpInBuffer is declared as [unique] in the IDL file, it can be NULL while dwBufferSize
  142. // is non-zero and vice-versa. To avoid confusion in the following code, we make them consistent
  143. // right here.
  144. //
  145. if ( lpInBuffer == NULL )
  146. {
  147. dwInBufferSize = 0;
  148. }
  149. else if ( dwInBufferSize == 0 )
  150. {
  151. lpInBuffer = NULL;
  152. }
  153. return(FmResourceControl( Resource,
  154. NULL,
  155. dwControlCode,
  156. lpInBuffer,
  157. dwInBufferSize,
  158. lpOutBuffer,
  159. nOutBufferSize,
  160. lpBytesReturned,
  161. lpcbRequired ));
  162. }
  163. error_status_t
  164. s_ApiNodeResourceTypeControl(
  165. IN HCLUSTER_RPC hCluster,
  166. IN LPCWSTR lpszResourceTypeName,
  167. IN HNODE_RPC hNode,
  168. IN DWORD dwControlCode,
  169. IN UCHAR *lpInBuffer,
  170. IN DWORD dwInBufferSize,
  171. OUT UCHAR *lpOutBuffer,
  172. IN DWORD nOutBufferSize,
  173. OUT DWORD *lpBytesReturned,
  174. OUT DWORD *lpcbRequired
  175. )
  176. /*++
  177. Routine Description:
  178. Provides for arbitrary communication and control between an application
  179. and a specific instance of a resource type.
  180. Arguments:
  181. hCluster - Supplies a handle to the cluster to be controlled. Not used.
  182. lpszResourceTypename - Supplies the name of the resource type to be
  183. controlled.
  184. hNode - Supplies a handle to the node on which the resource
  185. control should be delivered. If this is NULL, the node where
  186. the resource is online is used.
  187. dwControlCode- Supplies the control code that defines the
  188. structure and action of the resource type control.
  189. Values of dwControlCode between 0 and 0x10000000 are reserved
  190. for future definition and use by Microsoft. All other values
  191. are available for use by ISVs
  192. lpInBuffer- Supplies a pointer to the input buffer to be passed
  193. to the resource.
  194. nInBufferSize- Supplies the size, in bytes, of the data pointed
  195. to by lpInBuffer..
  196. lpOutBuffer- Supplies a pointer to the output buffer to be
  197. filled in by the resource..
  198. nOutBufferSize- Supplies the size, in bytes, of the available
  199. space pointed to by lpOutBuffer.
  200. lpBytesReturned - Returns the number of bytes of lpOutBuffer
  201. actually filled in by the resource..
  202. lpcbRequired - Returns the number of bytes required if OutBuffer
  203. is not large enough.
  204. Return Value:
  205. ERROR_SUCCESS if successful
  206. Win32 error code otherwise
  207. --*/
  208. {
  209. PNM_NODE Node;
  210. API_CHECK_INIT();
  211. VALIDATE_NODE(Node, hNode);
  212. //
  213. // Check if this is an internal, private control code.
  214. //
  215. if ( dwControlCode & CLCTL_INTERNAL_MASK ) {
  216. return (ERROR_PRIVILEGE_NOT_HELD);
  217. }
  218. //
  219. // Since lpInBuffer is declared as [unique] in the IDL file, it can be NULL while dwBufferSize
  220. // is non-zero and vice-versa. To avoid confusion in the following code, we make them consistent
  221. // right here.
  222. //
  223. if ( lpInBuffer == NULL )
  224. {
  225. dwInBufferSize = 0;
  226. }
  227. else if ( dwInBufferSize == 0 )
  228. {
  229. lpInBuffer = NULL;
  230. }
  231. return(FmResourceTypeControl( lpszResourceTypeName,
  232. Node,
  233. dwControlCode,
  234. lpInBuffer,
  235. dwInBufferSize,
  236. lpOutBuffer,
  237. nOutBufferSize,
  238. lpBytesReturned,
  239. lpcbRequired ));
  240. }
  241. error_status_t
  242. s_ApiResourceTypeControl(
  243. IN HCLUSTER_RPC hCluster,
  244. IN LPCWSTR lpszResourceTypeName,
  245. IN DWORD dwControlCode,
  246. IN UCHAR *lpInBuffer,
  247. IN DWORD dwInBufferSize,
  248. OUT UCHAR *lpOutBuffer,
  249. IN DWORD nOutBufferSize,
  250. OUT DWORD *lpBytesReturned,
  251. OUT DWORD *lpcbRequired
  252. )
  253. /*++
  254. Routine Description:
  255. Provides for arbitrary communication and control between an application
  256. and a specific instance of a resource type.
  257. Arguments:
  258. hCluster - Supplies a handle to the cluster to be controlled. Not used.
  259. lpszResourceTypename - Supplies the name of the resource type to be
  260. controlled.
  261. hNode - Supplies a handle to the node on which the resource
  262. control should be delivered. If this is NULL, the node where
  263. the resource is online is used.
  264. dwControlCode- Supplies the control code that defines the
  265. structure and action of the resource type control.
  266. Values of dwControlCode between 0 and 0x10000000 are reserved
  267. for future definition and use by Microsoft. All other values
  268. are available for use by ISVs
  269. lpInBuffer- Supplies a pointer to the input buffer to be passed
  270. to the resource.
  271. nInBufferSize- Supplies the size, in bytes, of the data pointed
  272. to by lpInBuffer..
  273. lpOutBuffer- Supplies a pointer to the output buffer to be
  274. filled in by the resource..
  275. nOutBufferSize- Supplies the size, in bytes, of the available
  276. space pointed to by lpOutBuffer.
  277. lpBytesReturned - Returns the number of bytes of lpOutBuffer
  278. actually filled in by the resource..
  279. lpcbRequired - Returns the number of bytes required if OutBuffer
  280. is not large enough.
  281. Return Value:
  282. ERROR_SUCCESS if successful
  283. Win32 error code otherwise
  284. --*/
  285. {
  286. API_CHECK_INIT();
  287. //
  288. // Check if this is an internal, private control code.
  289. //
  290. if ( dwControlCode & CLCTL_INTERNAL_MASK ) {
  291. return (ERROR_PRIVILEGE_NOT_HELD);
  292. }
  293. //
  294. // Since lpInBuffer is declared as [unique] in the IDL file, it can be NULL while dwBufferSize
  295. // is non-zero and vice-versa. To avoid confusion in the following code, we make them consistent
  296. // right here.
  297. //
  298. if ( lpInBuffer == NULL )
  299. {
  300. dwInBufferSize = 0;
  301. }
  302. else if ( dwInBufferSize == 0 )
  303. {
  304. lpInBuffer = NULL;
  305. }
  306. return(FmResourceTypeControl( lpszResourceTypeName,
  307. NULL,
  308. dwControlCode,
  309. lpInBuffer,
  310. dwInBufferSize,
  311. lpOutBuffer,
  312. nOutBufferSize,
  313. lpBytesReturned,
  314. lpcbRequired ));
  315. }
  316. error_status_t
  317. s_ApiNodeGroupControl(
  318. IN HGROUP_RPC hGroup,
  319. IN HNODE_RPC hNode,
  320. IN DWORD dwControlCode,
  321. IN UCHAR *lpInBuffer,
  322. IN DWORD dwInBufferSize,
  323. OUT UCHAR *lpOutBuffer,
  324. IN DWORD nOutBufferSize,
  325. OUT DWORD *lpBytesReturned,
  326. OUT DWORD *lpcbRequired
  327. )
  328. /*++
  329. Routine Description:
  330. Provides for arbitrary communication and control between an application
  331. and a specific instance of a group.
  332. Arguments:
  333. hGroup - Supplies a handle to the group to be controlled.
  334. hNode - Supplies a handle to the node on which the group
  335. control should be delivered. If this is NULL, the node where
  336. the application is bound performs the request.
  337. dwControlCode- Supplies the control code that defines the
  338. structure and action of the group control.
  339. Values of dwControlCode between 0 and 0x10000000 are reserved
  340. for future definition and use by Microsoft. All other values
  341. are available for use by ISVs.
  342. lpInBuffer- Supplies a pointer to the input buffer to be passed
  343. to the group.
  344. nInBufferSize- Supplies the size, in bytes, of the data pointed
  345. to by lpInBuffer.
  346. lpOutBuffer- Supplies a pointer to the output buffer to be
  347. filled in by the group.
  348. nOutBufferSize- Supplies the size, in bytes, of the available
  349. space pointed to by lpOutBuffer.
  350. lpBytesReturned - Returns the number of bytes of lpOutBuffer
  351. actually filled in by the group.
  352. lpcbRequired - Returns the number of bytes required if OutBuffer
  353. is not large enough.
  354. Return Value:
  355. ERROR_SUCCESS if successful
  356. Win32 error code otherwise
  357. --*/
  358. {
  359. PFM_GROUP Group;
  360. PNM_NODE Node;
  361. API_CHECK_INIT();
  362. VALIDATE_GROUP_EXISTS(Group, hGroup);
  363. VALIDATE_NODE(Node, hNode);
  364. //
  365. // Check if this is an internal, private control code.
  366. //
  367. if ( dwControlCode & CLCTL_INTERNAL_MASK ) {
  368. return(ERROR_PRIVILEGE_NOT_HELD);
  369. }
  370. //
  371. // Since lpInBuffer is declared as [unique] in the IDL file, it can be NULL while dwBufferSize
  372. // is non-zero and vice-versa. To avoid confusion in the following code, we make them consistent
  373. // right here.
  374. //
  375. if ( lpInBuffer == NULL )
  376. {
  377. dwInBufferSize = 0;
  378. }
  379. else if ( dwInBufferSize == 0 )
  380. {
  381. lpInBuffer = NULL;
  382. }
  383. return(FmGroupControl( Group,
  384. Node,
  385. dwControlCode,
  386. lpInBuffer,
  387. dwInBufferSize,
  388. lpOutBuffer,
  389. nOutBufferSize,
  390. lpBytesReturned,
  391. lpcbRequired ));
  392. }
  393. error_status_t
  394. s_ApiGroupControl(
  395. IN HGROUP_RPC hGroup,
  396. IN DWORD dwControlCode,
  397. IN UCHAR *lpInBuffer,
  398. IN DWORD dwInBufferSize,
  399. OUT UCHAR *lpOutBuffer,
  400. IN DWORD nOutBufferSize,
  401. OUT DWORD *lpBytesReturned,
  402. OUT DWORD *lpcbRequired
  403. )
  404. /*++
  405. Routine Description:
  406. Provides for arbitrary communication and control between an application
  407. and a specific instance of a group.
  408. Arguments:
  409. hGroup - Supplies a handle to the group to be controlled.
  410. dwControlCode- Supplies the control code that defines the
  411. structure and action of the group control.
  412. Values of dwControlCode between 0 and 0x10000000 are reserved
  413. for future definition and use by Microsoft. All other values
  414. are available for use by ISVs.
  415. lpInBuffer- Supplies a pointer to the input buffer to be passed
  416. to the group.
  417. nInBufferSize- Supplies the size, in bytes, of the data pointed
  418. to by lpInBuffer.
  419. lpOutBuffer- Supplies a pointer to the output buffer to be
  420. filled in by the group.
  421. nOutBufferSize- Supplies the size, in bytes, of the available
  422. space pointed to by lpOutBuffer.
  423. lpBytesReturned - Returns the number of bytes of lpOutBuffer
  424. actually filled in by the group.
  425. lpcbRequired - Returns the number of bytes required if OutBuffer
  426. is not large enough.
  427. Return Value:
  428. ERROR_SUCCESS if successful
  429. Win32 error code otherwise
  430. --*/
  431. {
  432. PFM_GROUP Group;
  433. API_CHECK_INIT();
  434. VALIDATE_GROUP_EXISTS(Group, hGroup);
  435. //
  436. // Check if this is an internal, private control code.
  437. //
  438. if ( dwControlCode & CLCTL_INTERNAL_MASK ) {
  439. return(ERROR_PRIVILEGE_NOT_HELD);
  440. }
  441. //
  442. // Since lpInBuffer is declared as [unique] in the IDL file, it can be NULL while dwBufferSize
  443. // is non-zero and vice-versa. To avoid confusion in the following code, we make them consistent
  444. // right here.
  445. //
  446. if ( lpInBuffer == NULL )
  447. {
  448. dwInBufferSize = 0;
  449. }
  450. else if ( dwInBufferSize == 0 )
  451. {
  452. lpInBuffer = NULL;
  453. }
  454. return(FmGroupControl( Group,
  455. NULL,
  456. dwControlCode,
  457. lpInBuffer,
  458. dwInBufferSize,
  459. lpOutBuffer,
  460. nOutBufferSize,
  461. lpBytesReturned,
  462. lpcbRequired ));
  463. }
  464. error_status_t
  465. s_ApiNodeNetworkControl(
  466. IN HNETWORK_RPC hNetwork,
  467. IN HNODE_RPC hNode,
  468. IN DWORD dwControlCode,
  469. IN UCHAR *lpInBuffer,
  470. IN DWORD dwInBufferSize,
  471. OUT UCHAR *lpOutBuffer,
  472. IN DWORD nOutBufferSize,
  473. OUT DWORD *lpBytesReturned,
  474. OUT DWORD *lpcbRequired
  475. )
  476. /*++
  477. Routine Description:
  478. Provides for arbitrary communication and control between an application
  479. and a specific instance of a network.
  480. Arguments:
  481. hNetwork - Supplies a handle to the network to be controlled.
  482. hNode - Supplies a handle to the node on which the network
  483. control should be delivered. If this is NULL, the node where
  484. the application is bound performs the request.
  485. dwControlCode- Supplies the control code that defines the
  486. structure and action of the network control.
  487. Values of dwControlCode between 0 and 0x10000000 are reserved
  488. for future definition and use by Microsoft. All other values
  489. are available for use by ISVs.
  490. lpInBuffer- Supplies a pointer to the input buffer to be passed
  491. to the network.
  492. nInBufferSize- Supplies the size, in bytes, of the data pointed
  493. to by lpInBuffer.
  494. lpOutBuffer- Supplies a pointer to the output buffer to be
  495. filled in by the network.
  496. nOutBufferSize- Supplies the size, in bytes, of the available
  497. space pointed to by lpOutBuffer.
  498. lpBytesReturned - Returns the number of bytes of lpOutBuffer
  499. actually filled in by the network.
  500. lpcbRequired - Returns the number of bytes required if OutBuffer
  501. is not large enough.
  502. Return Value:
  503. ERROR_SUCCESS if successful
  504. Win32 error code otherwise
  505. --*/
  506. {
  507. PNM_NETWORK Network;
  508. PNM_NODE Node;
  509. API_CHECK_INIT();
  510. VALIDATE_NETWORK_EXISTS(Network, hNetwork);
  511. VALIDATE_NODE(Node, hNode);
  512. //
  513. // Check if this is an internal, private control code.
  514. //
  515. if ( dwControlCode & CLCTL_INTERNAL_MASK )
  516. {
  517. return(ERROR_PRIVILEGE_NOT_HELD);
  518. }
  519. //
  520. // Since lpInBuffer is declared as [unique] in the IDL file, it can be NULL while dwBufferSize
  521. // is non-zero and vice-versa. To avoid confusion in the following code, we make them consistent
  522. // right here.
  523. //
  524. if ( lpInBuffer == NULL )
  525. {
  526. dwInBufferSize = 0;
  527. }
  528. else if ( dwInBufferSize == 0 )
  529. {
  530. lpInBuffer = NULL;
  531. }
  532. return(NmNetworkControl(Network,
  533. Node,
  534. dwControlCode,
  535. lpInBuffer,
  536. dwInBufferSize,
  537. lpOutBuffer,
  538. nOutBufferSize,
  539. lpBytesReturned,
  540. lpcbRequired ));
  541. }
  542. error_status_t
  543. s_ApiNetworkControl(
  544. IN HNETWORK_RPC hNetwork,
  545. IN DWORD dwControlCode,
  546. IN UCHAR *lpInBuffer,
  547. IN DWORD dwInBufferSize,
  548. OUT UCHAR *lpOutBuffer,
  549. IN DWORD nOutBufferSize,
  550. OUT DWORD *lpBytesReturned,
  551. OUT DWORD *lpcbRequired
  552. )
  553. /*++
  554. Routine Description:
  555. Provides for arbitrary communication and control between an application
  556. and a specific instance of a network.
  557. Arguments:
  558. hNetwork - Supplies a handle to the network to be controlled.
  559. dwControlCode- Supplies the control code that defines the
  560. structure and action of the network control.
  561. Values of dwControlCode between 0 and 0x10000000 are reserved
  562. for future definition and use by Microsoft. All other values
  563. are available for use by ISVs.
  564. lpInBuffer- Supplies a pointer to the input buffer to be passed
  565. to the network.
  566. nInBufferSize- Supplies the size, in bytes, of the data pointed
  567. to by lpInBuffer.
  568. lpOutBuffer- Supplies a pointer to the output buffer to be
  569. filled in by the network.
  570. nOutBufferSize- Supplies the size, in bytes, of the available
  571. space pointed to by lpOutBuffer.
  572. lpBytesReturned - Returns the number of bytes of lpOutBuffer
  573. actually filled in by the network.
  574. lpcbRequired - Returns the number of bytes required if OutBuffer
  575. is not large enough.
  576. Return Value:
  577. ERROR_SUCCESS if successful
  578. Win32 error code otherwise
  579. --*/
  580. {
  581. PNM_NETWORK Network;
  582. API_CHECK_INIT();
  583. VALIDATE_NETWORK_EXISTS(Network, hNetwork);
  584. //
  585. // Check if this is an internal, private control code.
  586. //
  587. if ( dwControlCode & CLCTL_INTERNAL_MASK )
  588. {
  589. return(ERROR_PRIVILEGE_NOT_HELD);
  590. }
  591. //
  592. // Since lpInBuffer is declared as [unique] in the IDL file, it can be NULL while dwBufferSize
  593. // is non-zero and vice-versa. To avoid confusion in the following code, we make them consistent
  594. // right here.
  595. //
  596. if ( lpInBuffer == NULL )
  597. {
  598. dwInBufferSize = 0;
  599. }
  600. else if ( dwInBufferSize == 0 )
  601. {
  602. lpInBuffer = NULL;
  603. }
  604. return(NmNetworkControl(Network,
  605. NULL,
  606. dwControlCode,
  607. lpInBuffer,
  608. dwInBufferSize,
  609. lpOutBuffer,
  610. nOutBufferSize,
  611. lpBytesReturned,
  612. lpcbRequired ));
  613. }
  614. error_status_t
  615. s_ApiNodeNetInterfaceControl(
  616. IN HNETINTERFACE_RPC hNetInterface,
  617. IN HNODE_RPC hNode,
  618. IN DWORD dwControlCode,
  619. IN UCHAR *lpInBuffer,
  620. IN DWORD dwInBufferSize,
  621. OUT UCHAR *lpOutBuffer,
  622. IN DWORD nOutBufferSize,
  623. OUT DWORD *lpBytesReturned,
  624. OUT DWORD *lpcbRequired
  625. )
  626. /*++
  627. Routine Description:
  628. Provides for arbitrary communication and control between an application
  629. and a specific instance of a network interface.
  630. Arguments:
  631. hNetInterface - Supplies a handle to the network interface to be controlled.
  632. hNode - Supplies a handle to the node on which the network
  633. control should be delivered. If this is NULL, the node where
  634. the application is bound performs the request.
  635. dwControlCode- Supplies the control code that defines the
  636. structure and action of the network control.
  637. Values of dwControlCode between 0 and 0x10000000 are reserved
  638. for future definition and use by Microsoft. All other values
  639. are available for use by ISVs.
  640. lpInBuffer- Supplies a pointer to the input buffer to be passed
  641. to the network.
  642. nInBufferSize- Supplies the size, in bytes, of the data pointed
  643. to by lpInBuffer.
  644. lpOutBuffer- Supplies a pointer to the output buffer to be
  645. filled in by the network.
  646. nOutBufferSize- Supplies the size, in bytes, of the available
  647. space pointed to by lpOutBuffer.
  648. lpBytesReturned - Returns the number of bytes of lpOutBuffer
  649. actually filled in by the network.
  650. lpcbRequired - Returns the number of bytes required if OutBuffer
  651. is not large enough.
  652. Return Value:
  653. ERROR_SUCCESS if successful
  654. Win32 error code otherwise
  655. --*/
  656. {
  657. PNM_INTERFACE NetInterface;
  658. PNM_NODE Node;
  659. API_CHECK_INIT();
  660. VALIDATE_NETINTERFACE_EXISTS(NetInterface, hNetInterface);
  661. VALIDATE_NODE(Node, hNode);
  662. //
  663. // Check if this is an internal, private control code.
  664. //
  665. if ( dwControlCode & CLCTL_INTERNAL_MASK )
  666. {
  667. return(ERROR_PRIVILEGE_NOT_HELD);
  668. }
  669. //
  670. // Since lpInBuffer is declared as [unique] in the IDL file, it can be NULL while dwBufferSize
  671. // is non-zero and vice-versa. To avoid confusion in the following code, we make them consistent
  672. // right here.
  673. //
  674. if ( lpInBuffer == NULL )
  675. {
  676. dwInBufferSize = 0;
  677. }
  678. else if ( dwInBufferSize == 0 )
  679. {
  680. lpInBuffer = NULL;
  681. }
  682. return(NmInterfaceControl(NetInterface,
  683. Node,
  684. dwControlCode,
  685. lpInBuffer,
  686. dwInBufferSize,
  687. lpOutBuffer,
  688. nOutBufferSize,
  689. lpBytesReturned,
  690. lpcbRequired ));
  691. }
  692. error_status_t
  693. s_ApiNetInterfaceControl(
  694. IN HNETINTERFACE_RPC hNetInterface,
  695. IN DWORD dwControlCode,
  696. IN UCHAR *lpInBuffer,
  697. IN DWORD dwInBufferSize,
  698. OUT UCHAR *lpOutBuffer,
  699. IN DWORD nOutBufferSize,
  700. OUT DWORD *lpBytesReturned,
  701. OUT DWORD *lpcbRequired
  702. )
  703. /*++
  704. Routine Description:
  705. Provides for arbitrary communication and control between an application
  706. and a specific instance of a network interface.
  707. Arguments:
  708. hNetInterface - Supplies a handle to the network interface to be controlled.
  709. dwControlCode- Supplies the control code that defines the
  710. structure and action of the network control.
  711. Values of dwControlCode between 0 and 0x10000000 are reserved
  712. for future definition and use by Microsoft. All other values
  713. are available for use by ISVs.
  714. lpInBuffer- Supplies a pointer to the input buffer to be passed
  715. to the network.
  716. nInBufferSize- Supplies the size, in bytes, of the data pointed
  717. to by lpInBuffer.
  718. lpOutBuffer- Supplies a pointer to the output buffer to be
  719. filled in by the network.
  720. nOutBufferSize- Supplies the size, in bytes, of the available
  721. space pointed to by lpOutBuffer.
  722. lpBytesReturned - Returns the number of bytes of lpOutBuffer
  723. actually filled in by the network.
  724. lpcbRequired - Returns the number of bytes required if OutBuffer
  725. is not large enough.
  726. Return Value:
  727. ERROR_SUCCESS if successful
  728. Win32 error code otherwise
  729. --*/
  730. {
  731. PNM_INTERFACE NetInterface;
  732. API_CHECK_INIT();
  733. VALIDATE_NETINTERFACE_EXISTS(NetInterface, hNetInterface);
  734. //
  735. // Check if this is an internal, private control code.
  736. //
  737. if ( dwControlCode & CLCTL_INTERNAL_MASK )
  738. {
  739. return(ERROR_PRIVILEGE_NOT_HELD);
  740. }
  741. //
  742. // Since lpInBuffer is declared as [unique] in the IDL file, it can be NULL while dwBufferSize
  743. // is non-zero and vice-versa. To avoid confusion in the following code, we make them consistent
  744. // right here.
  745. //
  746. if ( lpInBuffer == NULL )
  747. {
  748. dwInBufferSize = 0;
  749. }
  750. else if ( dwInBufferSize == 0 )
  751. {
  752. lpInBuffer = NULL;
  753. }
  754. return(NmInterfaceControl(NetInterface,
  755. NULL,
  756. dwControlCode,
  757. lpInBuffer,
  758. dwInBufferSize,
  759. lpOutBuffer,
  760. nOutBufferSize,
  761. lpBytesReturned,
  762. lpcbRequired ));
  763. }
  764. error_status_t
  765. s_ApiNodeNodeControl(
  766. IN HNODE_RPC hNode,
  767. IN HNODE_RPC hHostNode,
  768. IN DWORD dwControlCode,
  769. IN UCHAR *lpInBuffer,
  770. IN DWORD dwInBufferSize,
  771. OUT UCHAR *lpOutBuffer,
  772. IN DWORD nOutBufferSize,
  773. OUT DWORD *lpBytesReturned,
  774. OUT DWORD *lpcbRequired
  775. )
  776. /*++
  777. Routine Description:
  778. Provides for arbitrary communication and control between an application
  779. and a specific instance of a node.
  780. Arguments:
  781. hNode - Supplies a handle to the node to be controlled.
  782. hHostNode - Supplies a handle to the node on which the node
  783. control should be delivered. If this is NULL, the node where
  784. the application is bound performs the request.
  785. dwControlCode- Supplies the control code that defines the
  786. structure and action of the node control.
  787. Values of dwControlCode between 0 and 0x10000000 are reserved
  788. for future definition and use by Microsoft. All other values
  789. are available for use by ISVs.
  790. lpInBuffer- Supplies a pointer to the input buffer to be passed
  791. to the node.
  792. nInBufferSize- Supplies the size, in bytes, of the data pointed
  793. to by lpInBuffer.
  794. lpOutBuffer- Supplies a pointer to the output buffer to be
  795. filled in by the node.
  796. nOutBufferSize- Supplies the size, in bytes, of the available
  797. space pointed to by lpOutBuffer.
  798. lpBytesReturned - Returns the number of bytes of lpOutBuffer
  799. actually filled in by the node.
  800. lpcbRequired - Returns the number of bytes required if OutBuffer
  801. is not large enough.
  802. Return Value:
  803. ERROR_SUCCESS if successful
  804. Win32 error code otherwise
  805. --*/
  806. {
  807. PNM_NODE Node;
  808. PNM_NODE HostNode;
  809. API_CHECK_INIT();
  810. VALIDATE_NODE(Node, hNode);
  811. VALIDATE_NODE(HostNode, hHostNode);
  812. //
  813. // Check if this is an internal, private control code.
  814. //
  815. if ( dwControlCode & CLCTL_INTERNAL_MASK )
  816. {
  817. return(ERROR_PRIVILEGE_NOT_HELD);
  818. }
  819. //
  820. // Since lpInBuffer is declared as [unique] in the IDL file, it can be NULL while dwBufferSize
  821. // is non-zero and vice-versa. To avoid confusion in the following code, we make them consistent
  822. // right here.
  823. //
  824. if ( lpInBuffer == NULL )
  825. {
  826. dwInBufferSize = 0;
  827. }
  828. else if ( dwInBufferSize == 0 )
  829. {
  830. lpInBuffer = NULL;
  831. }
  832. return(NmNodeControl( Node,
  833. HostNode,
  834. dwControlCode,
  835. lpInBuffer,
  836. dwInBufferSize,
  837. lpOutBuffer,
  838. nOutBufferSize,
  839. lpBytesReturned,
  840. lpcbRequired ));
  841. }
  842. error_status_t
  843. s_ApiNodeControl(
  844. IN HNODE_RPC hNode,
  845. IN DWORD dwControlCode,
  846. IN UCHAR *lpInBuffer,
  847. IN DWORD dwInBufferSize,
  848. OUT UCHAR *lpOutBuffer,
  849. IN DWORD nOutBufferSize,
  850. OUT DWORD *lpBytesReturned,
  851. OUT DWORD *lpcbRequired
  852. )
  853. /*++
  854. Routine Description:
  855. Provides for arbitrary communication and control between an application
  856. and a specific instance of a node.
  857. Arguments:
  858. hNode - Supplies a handle to the node to be controlled.
  859. dwControlCode- Supplies the control code that defines the
  860. structure and action of the node control.
  861. Values of dwControlCode between 0 and 0x10000000 are reserved
  862. for future definition and use by Microsoft. All other values
  863. are available for use by ISVs.
  864. lpInBuffer- Supplies a pointer to the input buffer to be passed
  865. to the node.
  866. nInBufferSize- Supplies the size, in bytes, of the data pointed
  867. to by lpInBuffer.
  868. lpOutBuffer- Supplies a pointer to the output buffer to be
  869. filled in by the node.
  870. nOutBufferSize- Supplies the size, in bytes, of the available
  871. space pointed to by lpOutBuffer.
  872. lpBytesReturned - Returns the number of bytes of lpOutBuffer
  873. actually filled in by the node.
  874. lpcbRequired - Returns the number of bytes required if OutBuffer
  875. is not large enough.
  876. Return Value:
  877. ERROR_SUCCESS if successful
  878. Win32 error code otherwise
  879. --*/
  880. {
  881. PNM_NODE Node;
  882. API_CHECK_INIT();
  883. VALIDATE_NODE(Node, hNode);
  884. //
  885. // Check if this is an internal, private control code.
  886. //
  887. if ( dwControlCode & CLCTL_INTERNAL_MASK )
  888. {
  889. return(ERROR_PRIVILEGE_NOT_HELD);
  890. }
  891. //
  892. // Since lpInBuffer is declared as [unique] in the IDL file, it can be NULL while dwBufferSize
  893. // is non-zero and vice-versa. To avoid confusion in the following code, we make them consistent
  894. // right here.
  895. //
  896. if ( lpInBuffer == NULL )
  897. {
  898. dwInBufferSize = 0;
  899. }
  900. else if ( dwInBufferSize == 0 )
  901. {
  902. lpInBuffer = NULL;
  903. }
  904. return(NmNodeControl( Node,
  905. NULL,
  906. dwControlCode,
  907. lpInBuffer,
  908. dwInBufferSize,
  909. lpOutBuffer,
  910. nOutBufferSize,
  911. lpBytesReturned,
  912. lpcbRequired ));
  913. }
  914. error_status_t
  915. s_ApiNodeClusterControl(
  916. IN HCLUSTER hCluster,
  917. IN HNODE_RPC hHostNode,
  918. IN DWORD dwControlCode,
  919. IN UCHAR *lpInBuffer,
  920. IN DWORD dwInBufferSize,
  921. OUT UCHAR *lpOutBuffer,
  922. IN DWORD nOutBufferSize,
  923. OUT DWORD *lpBytesReturned,
  924. OUT DWORD *lpcbRequired
  925. )
  926. /*++
  927. Routine Description:
  928. Provides for arbitrary communication and control between an application
  929. and the cluster.
  930. Arguments:
  931. dwControlCode- Supplies the control code that defines the
  932. structure and action of the cluster control.
  933. Values of dwControlCode between 0 and 0x10000000 are reserved
  934. for future definition and use by Microsoft. All other values
  935. are available for use by ISVs.
  936. lpInBuffer- Supplies a pointer to the input buffer to be passed
  937. to the cluster.
  938. nInBufferSize- Supplies the size, in bytes, of the data pointed
  939. to by lpInBuffer.
  940. lpOutBuffer- Supplies a pointer to the output buffer to be
  941. filled in by the cluster.
  942. nOutBufferSize- Supplies the size, in bytes, of the available
  943. space pointed to by lpOutBuffer.
  944. lpBytesReturned - Returns the number of bytes of lpOutBuffer
  945. actually filled in by the cluster.
  946. lpcbRequired - Returns the number of bytes required if OutBuffer
  947. is not large enough.
  948. Return Value:
  949. ERROR_SUCCESS if successful
  950. Win32 error code otherwise
  951. --*/
  952. {
  953. PNM_NODE HostNode;
  954. API_CHECK_INIT();
  955. VALIDATE_NODE(HostNode, hHostNode);
  956. //
  957. // Check if this is an internal, private control code.
  958. //
  959. if ( dwControlCode & CLCTL_INTERNAL_MASK )
  960. {
  961. return(ERROR_PRIVILEGE_NOT_HELD);
  962. }
  963. //
  964. // Since lpInBuffer is declared as [unique] in the IDL file, it can be NULL while dwBufferSize
  965. // is non-zero and vice-versa. To avoid confusion in the following code, we make them consistent
  966. // right here.
  967. //
  968. if ( lpInBuffer == NULL )
  969. {
  970. dwInBufferSize = 0;
  971. }
  972. else if ( dwInBufferSize == 0 )
  973. {
  974. lpInBuffer = NULL;
  975. }
  976. return(CsClusterControl(
  977. HostNode,
  978. dwControlCode,
  979. lpInBuffer,
  980. dwInBufferSize,
  981. lpOutBuffer,
  982. nOutBufferSize,
  983. lpBytesReturned,
  984. lpcbRequired ));
  985. }
  986. error_status_t
  987. s_ApiClusterControl(
  988. IN HCLUSTER hCluster,
  989. IN DWORD dwControlCode,
  990. IN UCHAR *lpInBuffer,
  991. IN DWORD dwInBufferSize,
  992. OUT UCHAR *lpOutBuffer,
  993. IN DWORD nOutBufferSize,
  994. OUT DWORD *lpBytesReturned,
  995. OUT DWORD *lpcbRequired
  996. )
  997. /*++
  998. Routine Description:
  999. Provides for arbitrary communication and control between an application
  1000. and the cluster.
  1001. Arguments:
  1002. dwControlCode- Supplies the control code that defines the
  1003. structure and action of the cluster control.
  1004. Values of dwControlCode between 0 and 0x10000000 are reserved
  1005. for future definition and use by Microsoft. All other values
  1006. are available for use by ISVs.
  1007. lpInBuffer- Supplies a pointer to the input buffer to be passed
  1008. to the cluster.
  1009. nInBufferSize- Supplies the size, in bytes, of the data pointed
  1010. to by lpInBuffer.
  1011. lpOutBuffer- Supplies a pointer to the output buffer to be
  1012. filled in by the cluster.
  1013. nOutBufferSize- Supplies the size, in bytes, of the available
  1014. space pointed to by lpOutBuffer.
  1015. lpBytesReturned - Returns the number of bytes of lpOutBuffer
  1016. actually filled in by the cluster.
  1017. lpcbRequired - Returns the number of bytes required if OutBuffer
  1018. is not large enough.
  1019. Return Value:
  1020. ERROR_SUCCESS if successful
  1021. Win32 error code otherwise
  1022. --*/
  1023. {
  1024. API_CHECK_INIT();
  1025. //
  1026. // Check if this is an internal, private control code.
  1027. //
  1028. if ( dwControlCode & CLCTL_INTERNAL_MASK )
  1029. {
  1030. return(ERROR_PRIVILEGE_NOT_HELD);
  1031. }
  1032. //
  1033. // Since lpInBuffer is declared as [unique] in the IDL file, it can be NULL while dwBufferSize
  1034. // is non-zero and vice-versa. To avoid confusion in the following code, we make them consistent
  1035. // right here.
  1036. //
  1037. if ( lpInBuffer == NULL )
  1038. {
  1039. dwInBufferSize = 0;
  1040. }
  1041. else if ( dwInBufferSize == 0 )
  1042. {
  1043. lpInBuffer = NULL;
  1044. }
  1045. return(CsClusterControl(
  1046. NULL,
  1047. dwControlCode,
  1048. lpInBuffer,
  1049. dwInBufferSize,
  1050. lpOutBuffer,
  1051. nOutBufferSize,
  1052. lpBytesReturned,
  1053. lpcbRequired ));
  1054. }