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.

929 lines
24 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. ApiShare.c
  5. Abstract:
  6. This module contains individual API handlers for the NetShare APIs.
  7. SUPPORTED : NetShareAdd, NetShareCheck, NetShareDel, NetShareEnum,
  8. NetShareGetInfo, NetShareSetInfo.
  9. Author:
  10. David Treadwell (davidtr) 07-Jan-1991
  11. Shanku Niyogi (w-shanku)
  12. Revision History:
  13. --*/
  14. #include "XactSrvP.h"
  15. //
  16. // Declaration of descriptor strings.
  17. //
  18. STATIC const LPDESC Desc16_share_info_0 = REM16_share_info_0;
  19. STATIC const LPDESC Desc32_share_info_0 = REM32_share_info_0;
  20. STATIC const LPDESC Desc16_share_info_1 = REM16_share_info_1;
  21. STATIC const LPDESC Desc32_share_info_1 = REM32_share_info_1;
  22. STATIC const LPDESC Desc16_share_info_1_setinfo = REM16_share_info_1_setinfo;
  23. STATIC const LPDESC Desc32_share_info_1_setinfo = REM32_share_info_1_setinfo;
  24. STATIC const LPDESC Desc16_share_info_2 = REM16_share_info_2;
  25. STATIC const LPDESC Desc32_share_info_2 = REM32_share_info_2;
  26. STATIC const LPDESC Desc16_share_info_2_setinfo = REM16_share_info_2_setinfo;
  27. STATIC const LPDESC Desc32_share_info_2_setinfo = REM32_share_info_2_setinfo;
  28. NTSTATUS
  29. XsNetShareAdd (
  30. API_HANDLER_PARAMETERS
  31. )
  32. /*++
  33. Routine Description:
  34. This routine handles a call to NetShareAdd.
  35. Arguments:
  36. API_HANDLER_PARAMETERS - information about the API call. See
  37. XsTypes.h for details.
  38. Return Value:
  39. NTSTATUS - STATUS_SUCCESS or reason for failure.
  40. --*/
  41. {
  42. NET_API_STATUS status;
  43. PXS_NET_SHARE_ADD parameters = Parameters;
  44. LPVOID buffer = NULL; // Native parameters
  45. LPBYTE stringLocation = NULL; // Conversion variables
  46. DWORD bytesRequired = 0;
  47. DWORD bufferSize;
  48. API_HANDLER_PARAMETERS_REFERENCE; // Avoid warnings
  49. IF_DEBUG(SHARE) {
  50. NetpKdPrint(( "XsNetShareAdd: header at %lx, params at %lx, "
  51. "level %ld\n",
  52. Header,
  53. parameters,
  54. SmbGetUshort( &parameters->Level ) ));
  55. }
  56. try {
  57. //
  58. // Check for errors.
  59. //
  60. if ( SmbGetUshort( &parameters->Level ) != 2 ) {
  61. Header->Status = ERROR_INVALID_LEVEL;
  62. goto cleanup;
  63. }
  64. StructureDesc = Desc16_share_info_2;
  65. //
  66. // Figure out if there is enough room in the buffer for all the
  67. // data required. If not, return NERR_BufTooSmall.
  68. //
  69. if ( !XsCheckBufferSize(
  70. SmbGetUshort( &parameters->BufLen ),
  71. StructureDesc,
  72. FALSE // not in native format
  73. )) {
  74. IF_DEBUG(ERRORS) {
  75. NetpKdPrint(( "XsNetShareAdd: Buffer too small.\n" ));
  76. }
  77. Header->Status = NERR_BufTooSmall;
  78. goto cleanup;
  79. }
  80. //
  81. // Find out how big a buffer we need to allocate to hold the native
  82. // 32-bit version of the input data structure.
  83. //
  84. bufferSize = XsBytesForConvertedStructure(
  85. (LPBYTE)XsSmbGetPointer( &parameters->Buffer ),
  86. StructureDesc,
  87. Desc32_share_info_2,
  88. RapToNative,
  89. TRUE
  90. );
  91. //
  92. // Allocate enough memory to hold the converted native buffer.
  93. //
  94. buffer = NetpMemoryAllocate( bufferSize );
  95. if ( buffer == NULL ) {
  96. IF_DEBUG(ERRORS) {
  97. NetpKdPrint(( "XsNetShareAdd: failed to create buffer" ));
  98. }
  99. Header->Status = NERR_NoRoom;
  100. goto cleanup;
  101. }
  102. IF_DEBUG(SHARE) {
  103. NetpKdPrint(( "XsNetShareAdd: buffer of %ld bytes at %lx\n",
  104. bufferSize, buffer ));
  105. }
  106. //
  107. // Convert the buffer from 16-bit to 32-bit.
  108. //
  109. stringLocation = (LPBYTE)buffer + bufferSize;
  110. bytesRequired = 0;
  111. status = RapConvertSingleEntry(
  112. (LPBYTE)XsSmbGetPointer( &parameters->Buffer ),
  113. StructureDesc,
  114. TRUE,
  115. buffer,
  116. buffer,
  117. Desc32_share_info_2,
  118. FALSE,
  119. &stringLocation,
  120. &bytesRequired,
  121. Response,
  122. RapToNative
  123. );
  124. if ( status != NERR_Success ) {
  125. IF_DEBUG(ERRORS) {
  126. NetpKdPrint(( "XsNetShareAdd: RapConvertSingleEntry failed: "
  127. "%X\n", status ));
  128. }
  129. Header->Status = NERR_InternalError;
  130. goto cleanup;
  131. }
  132. //
  133. // Make the local call.
  134. //
  135. status = NetShareAdd(
  136. NULL,
  137. (DWORD)SmbGetUshort( &parameters->Level ),
  138. buffer,
  139. NULL
  140. );
  141. if ( !XsApiSuccess( status )) {
  142. IF_DEBUG(ERRORS) {
  143. NetpKdPrint(( "XsNetShareAdd: NetShareAdd failed: %X\n", status ));
  144. }
  145. if ( status == ERROR_DIRECTORY ) {
  146. Header->Status = NERR_UnknownDevDir;
  147. } else {
  148. Header->Status = (WORD)status;
  149. }
  150. goto cleanup;
  151. }
  152. //
  153. // There is no real return information for this API.
  154. //
  155. cleanup:
  156. ;
  157. } except( EXCEPTION_EXECUTE_HANDLER ) {
  158. Header->Status = (WORD)RtlNtStatusToDosError( GetExceptionCode() );
  159. }
  160. NetpMemoryFree( buffer );
  161. return STATUS_SUCCESS;
  162. } // XsNetShareAdd
  163. NTSTATUS
  164. XsNetShareCheck (
  165. API_HANDLER_PARAMETERS
  166. )
  167. /*++
  168. Routine Description:
  169. This routine handles a call to NetShareCheck.
  170. Arguments:
  171. API_HANDLER_PARAMETERS - information about the API call. See
  172. XsTypes.h for details.
  173. Return Value:
  174. NTSTATUS - STATUS_SUCCESS or reason for failure.
  175. --*/
  176. {
  177. NET_API_STATUS status;
  178. PXS_NET_SHARE_CHECK parameters = Parameters;
  179. LPTSTR nativeDeviceName = NULL; // Native parameters
  180. DWORD shareType;
  181. API_HANDLER_PARAMETERS_REFERENCE; // Avoid warnings
  182. try {
  183. //
  184. // Translate parameters, check for errors.
  185. //
  186. XsConvertTextParameter(
  187. nativeDeviceName,
  188. (LPSTR)XsSmbGetPointer( &parameters->DeviceName )
  189. );
  190. //
  191. // Do the local call.
  192. //
  193. status = NetShareCheck(
  194. NULL,
  195. nativeDeviceName,
  196. &shareType
  197. );
  198. if ( !XsApiSuccess( status )) {
  199. IF_DEBUG(ERRORS) {
  200. NetpKdPrint(( "XsNetShareCheck: NetShareCheck failed: "
  201. "%X\n", status ));
  202. }
  203. }
  204. //
  205. // Put type into return field.
  206. //
  207. SmbPutUshort( &parameters->Type, (WORD)shareType );
  208. Header->Status = (WORD)status;
  209. cleanup:
  210. ;
  211. } except( EXCEPTION_EXECUTE_HANDLER ) {
  212. Header->Status = (WORD)RtlNtStatusToDosError( GetExceptionCode() );
  213. }
  214. NetpMemoryFree( nativeDeviceName );
  215. return STATUS_SUCCESS;
  216. } // XsNetShareCheck
  217. NTSTATUS
  218. XsNetShareDel (
  219. API_HANDLER_PARAMETERS
  220. )
  221. /*++
  222. Routine Description:
  223. This routine handles a call to NetShareDel.
  224. Arguments:
  225. API_HANDLER_PARAMETERS - information about the API call. See
  226. XsTypes.h for details.
  227. Return Value:
  228. NTSTATUS - STATUS_SUCCESS or reason for failure.
  229. --*/
  230. {
  231. NET_API_STATUS status;
  232. PXS_NET_SHARE_DEL parameters = Parameters;
  233. LPTSTR nativeNetName = NULL; // Native parameters
  234. API_HANDLER_PARAMETERS_REFERENCE; // Avoid warnings
  235. IF_DEBUG(SHARE) {
  236. NetpKdPrint(( "XsNetShareDel: header at %lx, params at %lx, name %s\n",
  237. Header, parameters, SmbGetUlong( &parameters->NetName )));
  238. }
  239. try {
  240. //
  241. // Translate parameters, check for errors.
  242. //
  243. XsConvertTextParameter(
  244. nativeNetName,
  245. (LPSTR)XsSmbGetPointer( &parameters->NetName )
  246. );
  247. //
  248. // Make the local call.
  249. //
  250. status = NetShareDel(
  251. NULL,
  252. nativeNetName,
  253. (DWORD)SmbGetUshort( &parameters->Reserved )
  254. );
  255. if ( !XsApiSuccess( status )) {
  256. IF_DEBUG(ERRORS) {
  257. NetpKdPrint(( "XsNetShareDel: NetShareDel failed: %X\n", status ));
  258. }
  259. }
  260. //
  261. // Nothing to return.
  262. //
  263. Header->Status = (WORD)status;
  264. cleanup:
  265. ;
  266. } except( EXCEPTION_EXECUTE_HANDLER ) {
  267. Header->Status = (WORD)RtlNtStatusToDosError( GetExceptionCode() );
  268. }
  269. NetpMemoryFree( nativeNetName );
  270. return STATUS_SUCCESS;
  271. } // XsNetShareDel
  272. NTSTATUS
  273. XsNetShareEnum (
  274. API_HANDLER_PARAMETERS
  275. )
  276. /*++
  277. Routine Description:
  278. This routine handles a call to NetShareEnum.
  279. Arguments:
  280. API_HANDLER_PARAMETERS - information about the API call. See
  281. XsTypes.h for details.
  282. Return Value:
  283. NTSTATUS - STATUS_SUCCESS or reason for failure.
  284. --*/
  285. {
  286. NET_API_STATUS status;
  287. PXS_NET_SHARE_ENUM parameters = Parameters;
  288. LPVOID outBuffer= NULL; // Native parameters
  289. DWORD entriesRead = 0;
  290. DWORD totalEntries;
  291. DWORD entriesFilled = 0; // Conversion variables
  292. DWORD bytesRequired = 0;
  293. DWORD invalidEntries = 0;
  294. LPDESC nativeStructureDesc;
  295. API_HANDLER_PARAMETERS_REFERENCE; // Avoid warnings
  296. IF_DEBUG(SHARE) {
  297. NetpKdPrint(( "XsNetShareEnum: header at %lx, params at %lx, "
  298. "level %ld, buf size %ld\n",
  299. Header, parameters, SmbGetUshort( &parameters->Level ),
  300. SmbGetUshort( &parameters->BufLen )));
  301. }
  302. try {
  303. //
  304. // Check for errors.
  305. //
  306. if ( XsWordParamOutOfRange( parameters->Level, 0, 2 )) {
  307. Header->Status = ERROR_INVALID_LEVEL;
  308. goto cleanup;
  309. }
  310. //
  311. // Make the local call.
  312. //
  313. status = NetShareEnum(
  314. NULL,
  315. (DWORD)SmbGetUshort( &parameters->Level ),
  316. (LPBYTE *)&outBuffer,
  317. XsNativeBufferSize( SmbGetUshort( &parameters->BufLen )),
  318. &entriesRead,
  319. &totalEntries,
  320. NULL
  321. );
  322. if ( !XsApiSuccess( status )) {
  323. IF_DEBUG(API_ERRORS) {
  324. NetpKdPrint(( "XsNetShareEnum: NetShareEnum failed: "
  325. "%X\n", status ));
  326. }
  327. Header->Status = (WORD)status;
  328. goto cleanup;
  329. }
  330. IF_DEBUG(SHARE) {
  331. NetpKdPrint(( "XsNetShareEnum: received %ld entries at %lx\n",
  332. entriesRead, outBuffer ));
  333. }
  334. //
  335. // Use the requested level to determine the format of the
  336. // data structure.
  337. //
  338. switch ( SmbGetUshort( &parameters->Level ) ) {
  339. case 0:
  340. nativeStructureDesc = Desc32_share_info_0;
  341. StructureDesc = Desc16_share_info_0;
  342. break;
  343. case 1:
  344. nativeStructureDesc = Desc32_share_info_1;
  345. StructureDesc = Desc16_share_info_1;
  346. break;
  347. case 2:
  348. nativeStructureDesc = Desc32_share_info_2;
  349. StructureDesc = Desc16_share_info_2;
  350. break;
  351. }
  352. //
  353. // Do the actual conversion from the 32-bit structures to 16-bit
  354. // structures.
  355. //
  356. XsFillEnumBuffer(
  357. outBuffer,
  358. entriesRead,
  359. nativeStructureDesc,
  360. (LPVOID)XsSmbGetPointer( &parameters->Buffer ),
  361. (LPVOID)XsSmbGetPointer( &parameters->Buffer ),
  362. SmbGetUshort( &parameters->BufLen ),
  363. StructureDesc,
  364. NULL, // verify function
  365. &bytesRequired,
  366. &entriesFilled,
  367. &invalidEntries
  368. );
  369. IF_DEBUG(SHARE) {
  370. NetpKdPrint(( "32-bit data at %lx, 16-bit data at %lx, %ld BR,"
  371. " Entries %ld of %ld\n",
  372. outBuffer, SmbGetUlong( &parameters->Buffer ),
  373. bytesRequired, entriesFilled, totalEntries ));
  374. }
  375. //
  376. // If all the entries could not be filled, return ERROR_MORE_DATA,
  377. // and return the buffer as is. Otherwise, the data needs to be
  378. // packed so that we don't send too much useless data.
  379. //
  380. if ( entriesFilled + invalidEntries < totalEntries ) {
  381. Header->Status = ERROR_MORE_DATA;
  382. } else {
  383. Header->Converter = XsPackReturnData(
  384. (LPVOID)XsSmbGetPointer( &parameters->Buffer ),
  385. SmbGetUshort( &parameters->BufLen ),
  386. StructureDesc,
  387. entriesFilled
  388. );
  389. }
  390. //
  391. // Set up the response parameters.
  392. //
  393. SmbPutUshort( &parameters->EntriesRead, (WORD)entriesFilled );
  394. SmbPutUshort( &parameters->TotalAvail, (WORD)totalEntries );
  395. cleanup:
  396. ;
  397. } except( EXCEPTION_EXECUTE_HANDLER ) {
  398. Header->Status = (WORD)RtlNtStatusToDosError( GetExceptionCode() );
  399. }
  400. NetApiBufferFree( outBuffer );
  401. //
  402. // Determine return buffer size.
  403. //
  404. XsSetDataCount(
  405. &parameters->BufLen,
  406. StructureDesc,
  407. Header->Converter,
  408. entriesFilled,
  409. Header->Status
  410. );
  411. return STATUS_SUCCESS;
  412. } // XsNetShareEnum
  413. NTSTATUS
  414. XsNetShareGetInfo (
  415. API_HANDLER_PARAMETERS
  416. )
  417. /*++
  418. Routine Description:
  419. This routine handles a call to NetShareGetInfo.
  420. Arguments:
  421. API_HANDLER_PARAMETERS - information about the API call. See
  422. XsTypes.h for details.
  423. Return Value:
  424. NTSTATUS - STATUS_SUCCESS or reason for failure.
  425. --*/
  426. {
  427. NET_API_STATUS status;
  428. PXS_NET_SHARE_GET_INFO parameters = Parameters;
  429. LPTSTR nativeNetName = NULL; // Native parameters
  430. LPVOID outBuffer = NULL;
  431. LPBYTE stringLocation = NULL; // Conversion variables
  432. DWORD bytesRequired = 0;
  433. LPDESC nativeStructureDesc;
  434. API_HANDLER_PARAMETERS_REFERENCE; // Avoid warnings
  435. IF_DEBUG(SHARE) {
  436. NetpKdPrint(( "XsNetShareGetInfo: header at %lx, "
  437. "params at %lx, level %ld\n",
  438. Header, parameters, SmbGetUshort( &parameters->Level ) ));
  439. }
  440. try {
  441. //
  442. // Translate parameters, check for errors.
  443. //
  444. if ( XsWordParamOutOfRange( parameters->Level, 0, 2 )) {
  445. Header->Status = ERROR_INVALID_LEVEL;
  446. goto cleanup;
  447. }
  448. XsConvertTextParameter(
  449. nativeNetName,
  450. (LPSTR)XsSmbGetPointer( &parameters->NetName )
  451. );
  452. //
  453. // Make the local call.
  454. //
  455. status = NetShareGetInfo(
  456. NULL,
  457. nativeNetName,
  458. (DWORD)SmbGetUshort( &parameters->Level ),
  459. (LPBYTE *)&outBuffer
  460. );
  461. if ( !XsApiSuccess( status )) {
  462. IF_DEBUG(API_ERRORS) {
  463. NetpKdPrint(( "XsNetShareGetInfo: NetShareGetInfo failed: "
  464. "%X\n", status ));
  465. }
  466. Header->Status = (WORD)status;
  467. goto cleanup;
  468. }
  469. //
  470. // Use the requested level to determine the format of the
  471. // data structure.
  472. //
  473. switch ( SmbGetUshort( &parameters->Level ) ) {
  474. case 0:
  475. nativeStructureDesc = Desc32_share_info_0;
  476. StructureDesc = Desc16_share_info_0;
  477. break;
  478. case 1:
  479. nativeStructureDesc = Desc32_share_info_1;
  480. StructureDesc = Desc16_share_info_1;
  481. break;
  482. case 2:
  483. nativeStructureDesc = Desc32_share_info_2;
  484. StructureDesc = Desc16_share_info_2;
  485. break;
  486. }
  487. //
  488. // Convert the structure returned by the 32-bit call to a 16-bit
  489. // structure. The last possible location for variable data is
  490. // calculated from buffer location and length.
  491. //
  492. stringLocation = (LPBYTE)( XsSmbGetPointer( &parameters->Buffer )
  493. + SmbGetUshort( &parameters->BufLen ) );
  494. status = RapConvertSingleEntry(
  495. outBuffer,
  496. nativeStructureDesc,
  497. FALSE,
  498. (LPBYTE)XsSmbGetPointer( &parameters->Buffer ),
  499. (LPBYTE)XsSmbGetPointer( &parameters->Buffer ),
  500. StructureDesc,
  501. TRUE,
  502. &stringLocation,
  503. &bytesRequired,
  504. Response,
  505. NativeToRap
  506. );
  507. if ( status != NERR_Success ) {
  508. IF_DEBUG(ERRORS) {
  509. NetpKdPrint(( "XsNetShareGetInfo: RapConvertSingleEntry failed: "
  510. "%X\n", status ));
  511. }
  512. Header->Status = NERR_InternalError;
  513. goto cleanup;
  514. }
  515. IF_DEBUG(SHARE) {
  516. NetpKdPrint(( "32-bit data at %lx, 16-bit data at %lx, %ld BR\n",
  517. outBuffer, SmbGetUlong( &parameters->Buffer ),
  518. bytesRequired ));
  519. }
  520. //
  521. // Determine return code based on the size of the buffer.
  522. //
  523. if ( !XsCheckBufferSize(
  524. SmbGetUshort( &parameters->BufLen ),
  525. StructureDesc,
  526. FALSE // not in native format
  527. )) {
  528. IF_DEBUG(ERRORS) {
  529. NetpKdPrint(( "XsNetShareGetInfo: Buffer too small.\n" ));
  530. }
  531. Header->Status = NERR_BufTooSmall;
  532. } else if ( bytesRequired > (DWORD)SmbGetUshort( &parameters-> BufLen )) {
  533. IF_DEBUG(ERRORS) {
  534. NetpKdPrint(( "XsNetShareGetInfo: More data available.\n" ));
  535. }
  536. Header->Status = ERROR_MORE_DATA;
  537. } else {
  538. //
  539. // Pack the response data.
  540. //
  541. Header->Converter = XsPackReturnData(
  542. (LPVOID)XsSmbGetPointer( &parameters->Buffer ),
  543. SmbGetUshort( &parameters->BufLen ),
  544. StructureDesc,
  545. 1
  546. );
  547. }
  548. //
  549. // Set up the response parameters.
  550. //
  551. SmbPutUshort( &parameters->TotalAvail, (WORD)bytesRequired );
  552. cleanup:
  553. ;
  554. } except( EXCEPTION_EXECUTE_HANDLER ) {
  555. Header->Status = (WORD)RtlNtStatusToDosError( GetExceptionCode() );
  556. }
  557. NetApiBufferFree( outBuffer );
  558. NetpMemoryFree( nativeNetName );
  559. //
  560. // Determine return buffer size.
  561. //
  562. XsSetDataCount(
  563. &parameters->BufLen,
  564. StructureDesc,
  565. Header->Converter,
  566. 1,
  567. Header->Status
  568. );
  569. return STATUS_SUCCESS;
  570. } // XsNetShareGetInfo
  571. NTSTATUS
  572. XsNetShareSetInfo (
  573. API_HANDLER_PARAMETERS
  574. )
  575. /*++
  576. Routine Description:
  577. This routine handles a call to NetShareSetInfo.
  578. Arguments:
  579. API_HANDLER_PARAMETERS - information about the API call. See
  580. XsTypes.h for details.
  581. Return Value:
  582. NTSTATUS - STATUS_SUCCESS or reason for failure.
  583. --*/
  584. {
  585. NET_API_STATUS status;
  586. PXS_NET_SHARE_SET_INFO parameters = Parameters;
  587. LPTSTR nativeNetName = NULL; // Native parameters
  588. LPVOID buffer = NULL;
  589. DWORD level;
  590. LPDESC setInfoDesc; // Conversion variables
  591. LPDESC nativeSetInfoDesc;
  592. LPDESC nativeStructureDesc;
  593. API_HANDLER_PARAMETERS_REFERENCE; // Avoid warnings
  594. try {
  595. //
  596. // Translate parameters, check for errors.
  597. //
  598. XsConvertTextParameter(
  599. nativeNetName,
  600. (LPSTR)XsSmbGetPointer( &parameters->NetName )
  601. );
  602. //
  603. // Determine descriptor strings based on level.
  604. //
  605. switch ( SmbGetUshort( &parameters->Level )) {
  606. case 1:
  607. StructureDesc = Desc16_share_info_1;
  608. nativeStructureDesc = Desc32_share_info_1;
  609. setInfoDesc = Desc16_share_info_1_setinfo;
  610. nativeSetInfoDesc = Desc32_share_info_1_setinfo;
  611. break;
  612. case 2:
  613. StructureDesc = Desc16_share_info_2;
  614. nativeStructureDesc = Desc32_share_info_2;
  615. setInfoDesc = Desc16_share_info_2_setinfo;
  616. nativeSetInfoDesc = Desc32_share_info_2_setinfo;
  617. break;
  618. default:
  619. Header->Status = ERROR_INVALID_LEVEL;
  620. goto cleanup;
  621. }
  622. status = XsConvertSetInfoBuffer(
  623. (LPBYTE)XsSmbGetPointer( &parameters->Buffer ),
  624. SmbGetUshort( &parameters->BufLen ),
  625. SmbGetUshort( &parameters->ParmNum ),
  626. FALSE,
  627. TRUE,
  628. StructureDesc,
  629. nativeStructureDesc,
  630. setInfoDesc,
  631. nativeSetInfoDesc,
  632. (LPBYTE *)&buffer,
  633. NULL
  634. );
  635. if ( status != NERR_Success ) {
  636. IF_DEBUG(ERRORS) {
  637. NetpKdPrint(( "XsNetShareSetInfo: Problem with conversion: %X\n",
  638. status ));
  639. }
  640. Header->Status = (WORD)status;
  641. goto cleanup;
  642. }
  643. //
  644. // Do the actual local call.
  645. //
  646. level = SmbGetUshort( &parameters->ParmNum );
  647. if ( level != 0 ) {
  648. level = level + PARMNUM_BASE_INFOLEVEL;
  649. } else {
  650. level = SmbGetUshort( &parameters->Level );
  651. }
  652. status = NetShareSetInfo(
  653. NULL,
  654. nativeNetName,
  655. level,
  656. (LPBYTE)buffer,
  657. NULL
  658. );
  659. if ( !XsApiSuccess( status )) {
  660. IF_DEBUG(ERRORS) {
  661. NetpKdPrint(( "XsNetShareSetInfo: NetShareSetInfo failed: %X\n",
  662. status ));
  663. }
  664. Header->Status = (WORD)status;
  665. goto cleanup;
  666. }
  667. //
  668. // No return information for this API.
  669. //
  670. cleanup:
  671. ;
  672. } except( EXCEPTION_EXECUTE_HANDLER ) {
  673. Header->Status = (WORD)RtlNtStatusToDosError( GetExceptionCode() );
  674. }
  675. //
  676. // If there is a native 32-bit buffer, free it.
  677. //
  678. NetpMemoryFree( buffer );
  679. NetpMemoryFree( nativeNetName );
  680. return STATUS_SUCCESS;
  681. } // XsNetShareSetInfo