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.

1322 lines
26 KiB

  1. /********************************************************************/
  2. /** Copyright(c) 1989 Microsoft Corporation. **/
  3. /********************************************************************/
  4. //***
  5. //
  6. // Filename: apistub.c
  7. //
  8. // Description: This module contains the AFP server service API RPC
  9. // client stubs.
  10. //
  11. // History:
  12. // June 11,1992. NarenG Created original version.
  13. //
  14. #include "client.h"
  15. //**
  16. //
  17. // Call: AfpAdminConnect
  18. //
  19. // Returns: NO_ERROR - success
  20. // non-zero returns from the AfpRPCBind routine.
  21. //
  22. //
  23. // Description: This is the DLL entrypoint for AfpAdminConnect
  24. //
  25. DWORD
  26. AfpAdminConnect(
  27. IN LPWSTR lpwsServerName,
  28. OUT PAFP_SERVER_HANDLE phAfpServer
  29. )
  30. {
  31. // Bind with the server
  32. //
  33. return( AfpRPCBind( lpwsServerName, phAfpServer ) );
  34. }
  35. //**
  36. //
  37. // Call: AfpAdminDisconnect
  38. //
  39. // Returns: none.
  40. //
  41. // Description: This is the DLL entrypoint for AfpAdminDisconnect
  42. //
  43. VOID
  44. AfpAdminDisconnect(
  45. IN AFP_SERVER_HANDLE hAfpServer
  46. )
  47. {
  48. RpcBindingFree( (handle_t *)&hAfpServer );
  49. }
  50. //**
  51. //
  52. // Call: AfpAdminBufferFree
  53. //
  54. // Returns: none
  55. //
  56. // Description: This is the DLL entrypoint for AfpAdminBufferFree
  57. //
  58. VOID
  59. AfpAdminBufferFree(
  60. IN PVOID pBuffer
  61. )
  62. {
  63. MIDL_user_free( pBuffer );
  64. }
  65. //**
  66. //
  67. // Call: AfpAdminVolumeEnum
  68. //
  69. // Returns: NO_ERROR - success
  70. // ERROR_INVALID_PARAMETER
  71. // non-zero returns from AdpAdminrVolumeEnum
  72. //
  73. // Description: This is the DLL entry point for AfpAdminVolumeEnum.
  74. //
  75. DWORD
  76. AfpAdminVolumeEnum(
  77. IN AFP_SERVER_HANDLE hAfpServer,
  78. OUT LPBYTE *ppbBuffer,
  79. IN DWORD dwPrefMaxLen,
  80. OUT LPDWORD lpdwEntriesRead,
  81. OUT LPDWORD lpdwTotalEntries,
  82. IN LPDWORD lpdwResumeHandle
  83. )
  84. {
  85. DWORD dwRetCode;
  86. VOLUME_INFO_CONTAINER InfoStruct;
  87. // Touch all pointers
  88. //
  89. try {
  90. *ppbBuffer = NULL;
  91. *lpdwEntriesRead = 0;
  92. *lpdwTotalEntries = 0;
  93. if ( lpdwResumeHandle )
  94. *lpdwResumeHandle;
  95. }
  96. except( EXCEPTION_EXECUTE_HANDLER ) {
  97. return( ERROR_INVALID_PARAMETER );
  98. }
  99. InfoStruct.dwEntriesRead = 0;
  100. InfoStruct.pBuffer = NULL;
  101. RpcTryExcept{
  102. dwRetCode = AfpAdminrVolumeEnum( hAfpServer,
  103. &InfoStruct,
  104. dwPrefMaxLen,
  105. lpdwTotalEntries,
  106. lpdwResumeHandle );
  107. if ( InfoStruct.pBuffer != NULL ) {
  108. *ppbBuffer = (LPBYTE)(InfoStruct.pBuffer);
  109. *lpdwEntriesRead = InfoStruct.dwEntriesRead;
  110. }
  111. else
  112. *lpdwEntriesRead = 0;
  113. }
  114. RpcExcept(I_RpcExceptionFilter(RpcExceptionCode())) {
  115. dwRetCode = RpcExceptionCode();
  116. }
  117. RpcEndExcept
  118. return( dwRetCode );
  119. }
  120. //**
  121. //
  122. // Call: AfpAdminVolumeSetInfo
  123. //
  124. // Returns: NO_ERROR - success
  125. // ERROR_INVALID_PARAMETER
  126. // non-zero return codes from AfpAdminrVolumeSetInfo
  127. //
  128. // Description: This is the DLL entrypoint for AfpAdminSetInfo
  129. //
  130. DWORD
  131. AfpAdminVolumeSetInfo(
  132. IN AFP_SERVER_HANDLE hAfpServer,
  133. IN LPBYTE pbBuffer,
  134. IN DWORD dwParmNum
  135. )
  136. {
  137. DWORD dwRetCode;
  138. if ( dwParmNum == 0 )
  139. return( ERROR_INVALID_PARAMETER );
  140. if ( !IsAfpVolumeInfoValid( dwParmNum, (PAFP_VOLUME_INFO)pbBuffer ) )
  141. return( ERROR_INVALID_PARAMETER );
  142. RpcTryExcept{
  143. dwRetCode = AfpAdminrVolumeSetInfo( hAfpServer,
  144. (PAFP_VOLUME_INFO)pbBuffer,
  145. dwParmNum );
  146. }
  147. RpcExcept(I_RpcExceptionFilter(RpcExceptionCode())) {
  148. dwRetCode = RpcExceptionCode();
  149. }
  150. RpcEndExcept
  151. return( dwRetCode );
  152. }
  153. //**
  154. //
  155. // Call: AfpAdminVolumeGetInfo
  156. //
  157. // Returns: NO_ERROR - success
  158. // ERROR_INVALID_PARAMETER
  159. // non-zero return codes from AfpAdminrVolumeGetInfo
  160. //
  161. // Description: This is the DLL entrypoint for AfpAdminVolumeGetInfo
  162. //
  163. DWORD
  164. AfpAdminVolumeGetInfo(
  165. IN AFP_SERVER_HANDLE hAfpServer,
  166. IN LPWSTR lpwsVolumeName ,
  167. OUT LPBYTE *ppbBuffer
  168. )
  169. {
  170. DWORD dwRetCode;
  171. if ( !IsAfpVolumeNameValid( lpwsVolumeName ) )
  172. return( ERROR_INVALID_PARAMETER );
  173. // Make sure that all pointers passed in are valid
  174. //
  175. try {
  176. *ppbBuffer = NULL;
  177. }
  178. except( EXCEPTION_EXECUTE_HANDLER ) {
  179. return( ERROR_INVALID_PARAMETER );
  180. }
  181. RpcTryExcept{
  182. dwRetCode = AfpAdminrVolumeGetInfo( hAfpServer,
  183. lpwsVolumeName,
  184. (PAFP_VOLUME_INFO*)ppbBuffer );
  185. }
  186. RpcExcept(I_RpcExceptionFilter(RpcExceptionCode())) {
  187. dwRetCode = RpcExceptionCode();
  188. }
  189. RpcEndExcept
  190. return( dwRetCode );
  191. }
  192. //**
  193. //
  194. // Call: AfpAdminVolumeDelete
  195. //
  196. // Returns: NO_ERROR - success
  197. // ERROR_INVALID_PARAMETER
  198. // non-zero return codes from AfpAdminrVolumeDelete
  199. //
  200. // Description: This is the DLL entrypoint for AfpAdminVolumeDelete
  201. //
  202. DWORD
  203. AfpAdminVolumeDelete(
  204. IN AFP_SERVER_HANDLE hAfpServer,
  205. IN LPWSTR lpwsVolumeName
  206. )
  207. {
  208. DWORD dwRetCode;
  209. if ( !IsAfpVolumeNameValid( lpwsVolumeName ) )
  210. return( ERROR_INVALID_PARAMETER );
  211. RpcTryExcept{
  212. dwRetCode = AfpAdminrVolumeDelete( hAfpServer, lpwsVolumeName );
  213. }
  214. RpcExcept(I_RpcExceptionFilter(RpcExceptionCode())) {
  215. dwRetCode = RpcExceptionCode();
  216. }
  217. RpcEndExcept
  218. return( dwRetCode );
  219. }
  220. //**
  221. //
  222. // Call: AfpAdminVolumeAdd
  223. //
  224. // Returns: NO_ERROR - success
  225. // ERROR_INVALID_PARAMETER
  226. // non-zero return codes from AfpAdminrVolumeAdd
  227. //
  228. // Description: This is the DLL entrypoint for AfpAdminVolumeAdd
  229. //
  230. DWORD
  231. AfpAdminVolumeAdd(
  232. IN AFP_SERVER_HANDLE hAfpServer,
  233. IN LPBYTE pbBuffer
  234. )
  235. {
  236. DWORD dwRetCode;
  237. if ( !IsAfpVolumeInfoValid( AFP_VALIDATE_ALL_FIELDS,
  238. (PAFP_VOLUME_INFO)pbBuffer ) )
  239. return( ERROR_INVALID_PARAMETER );
  240. RpcTryExcept{
  241. dwRetCode = AfpAdminrVolumeAdd(hAfpServer, (PAFP_VOLUME_INFO)pbBuffer);
  242. }
  243. RpcExcept(I_RpcExceptionFilter(RpcExceptionCode())) {
  244. dwRetCode = RpcExceptionCode();
  245. }
  246. RpcEndExcept
  247. return( dwRetCode );
  248. }
  249. //**
  250. //
  251. // Call: AfpAdminInvalidVolumeEnum
  252. //
  253. // Returns: NO_ERROR - success
  254. // ERROR_INVALID_PARAMETER
  255. // non-zero returns from AdpAdminrInvalidVolumeEnum
  256. //
  257. // Description: This is the DLL entry point for AfpAdminInvalidVolumeEnum.
  258. //
  259. DWORD
  260. AfpAdminInvalidVolumeEnum(
  261. IN AFP_SERVER_HANDLE hAfpServer,
  262. OUT LPBYTE *ppbBuffer,
  263. OUT LPDWORD lpdwEntriesRead
  264. )
  265. {
  266. DWORD dwRetCode;
  267. VOLUME_INFO_CONTAINER InfoStruct;
  268. // Touch all pointers
  269. //
  270. try {
  271. *ppbBuffer = NULL;
  272. *lpdwEntriesRead = 0;
  273. }
  274. except( EXCEPTION_EXECUTE_HANDLER ) {
  275. return( ERROR_INVALID_PARAMETER );
  276. }
  277. InfoStruct.dwEntriesRead = 0;
  278. InfoStruct.pBuffer = NULL;
  279. RpcTryExcept{
  280. dwRetCode = AfpAdminrInvalidVolumeEnum( hAfpServer, &InfoStruct );
  281. if ( InfoStruct.pBuffer != NULL ) {
  282. *ppbBuffer = (LPBYTE)(InfoStruct.pBuffer);
  283. *lpdwEntriesRead = InfoStruct.dwEntriesRead;
  284. }
  285. else
  286. *lpdwEntriesRead = 0;
  287. }
  288. RpcExcept(I_RpcExceptionFilter(RpcExceptionCode())) {
  289. dwRetCode = RpcExceptionCode();
  290. }
  291. RpcEndExcept
  292. return( dwRetCode );
  293. }
  294. //**
  295. //
  296. // Call: AfpAdminInvalidVolumeDelete
  297. //
  298. // Returns: NO_ERROR - success
  299. // ERROR_INVALID_PARAMETER
  300. // non-zero return codes from AfpAdminrInvalidVolumeDelete
  301. //
  302. // Description: This is the DLL entrypoint for AfpAdminInvalidVolumeDelete
  303. //
  304. DWORD
  305. AfpAdminInvalidVolumeDelete(
  306. IN AFP_SERVER_HANDLE hAfpServer,
  307. IN LPWSTR lpwsVolumeName
  308. )
  309. {
  310. DWORD dwRetCode;
  311. if ( !IsAfpVolumeNameValid( lpwsVolumeName ) )
  312. return( ERROR_INVALID_PARAMETER );
  313. RpcTryExcept{
  314. dwRetCode = AfpAdminrInvalidVolumeDelete( hAfpServer, lpwsVolumeName );
  315. }
  316. RpcExcept(I_RpcExceptionFilter(RpcExceptionCode())) {
  317. dwRetCode = RpcExceptionCode();
  318. }
  319. RpcEndExcept
  320. return( dwRetCode );
  321. }
  322. //**
  323. //
  324. // Call: AfpAdminDirectoryGetInfo
  325. //
  326. // Returns: NO_ERROR - success
  327. // ERROR_INVALID_PARAMETER
  328. // non-zero return codes from AfpAdminrDirectoryGetInfo
  329. //
  330. // Description: This is the DLL entrypoint for AfpAdminDirectoryGetInfo
  331. //
  332. DWORD
  333. AfpAdminDirectoryGetInfo(
  334. IN AFP_SERVER_HANDLE hAfpServer,
  335. IN LPWSTR lpwsPath,
  336. OUT LPBYTE *ppbBuffer
  337. )
  338. {
  339. DWORD dwRetCode;
  340. // Make sure that all pointers passed in are valid
  341. //
  342. try {
  343. STRLEN( lpwsPath );
  344. *ppbBuffer = NULL;
  345. }
  346. except( EXCEPTION_EXECUTE_HANDLER ) {
  347. return( ERROR_INVALID_PARAMETER );
  348. }
  349. RpcTryExcept{
  350. dwRetCode = AfpAdminrDirectoryGetInfo(hAfpServer,
  351. lpwsPath,
  352. (PAFP_DIRECTORY_INFO*)ppbBuffer);
  353. }
  354. RpcExcept(I_RpcExceptionFilter(RpcExceptionCode())) {
  355. dwRetCode = RpcExceptionCode();
  356. }
  357. RpcEndExcept
  358. return( dwRetCode );
  359. }
  360. //**
  361. //
  362. // Call: AfpAdminDirectorySetInfo
  363. //
  364. // Returns: NO_ERROR - success
  365. // ERROR_INVALID_PARAMETER
  366. // non-zero return codes from AfpAdminrDirectorySetInfo
  367. //
  368. // Description: This is the DLL entrypoint for AfpAdminDirectorySetInfo
  369. //
  370. DWORD
  371. AfpAdminDirectorySetInfo(
  372. IN AFP_SERVER_HANDLE hAfpServer,
  373. IN LPBYTE pbBuffer,
  374. IN DWORD dwParmNum
  375. )
  376. {
  377. DWORD dwRetCode;
  378. if ( dwParmNum == 0 )
  379. return( ERROR_INVALID_PARAMETER );
  380. if ( !IsAfpDirInfoValid( dwParmNum, (PAFP_DIRECTORY_INFO)pbBuffer ) )
  381. return( ERROR_INVALID_PARAMETER );
  382. RpcTryExcept{
  383. dwRetCode = AfpAdminrDirectorySetInfo(hAfpServer,
  384. (PAFP_DIRECTORY_INFO)pbBuffer,
  385. dwParmNum );
  386. }
  387. RpcExcept(I_RpcExceptionFilter(RpcExceptionCode())) {
  388. dwRetCode = RpcExceptionCode();
  389. }
  390. RpcEndExcept
  391. return( dwRetCode );
  392. }
  393. //**
  394. //
  395. // Call: AfpAdminServerGetInfo
  396. //
  397. // Returns: NO_ERROR - success
  398. // ERROR_INVALID_PARAMETER
  399. // non-zero return codes from AfpAdminrServerGetInfo
  400. //
  401. // Description: This is the DLL entrypoint for AfpAdminServerGetInfo
  402. //
  403. DWORD
  404. AfpAdminServerGetInfo(
  405. IN AFP_SERVER_HANDLE hAfpServer,
  406. OUT LPBYTE *ppbBuffer
  407. )
  408. {
  409. DWORD dwRetCode;
  410. // Make sure that all pointers passed in are valid
  411. //
  412. try {
  413. *ppbBuffer = NULL;
  414. }
  415. except( EXCEPTION_EXECUTE_HANDLER ) {
  416. return( ERROR_INVALID_PARAMETER );
  417. }
  418. RpcTryExcept{
  419. dwRetCode = AfpAdminrServerGetInfo( hAfpServer,
  420. (PAFP_SERVER_INFO*)ppbBuffer);
  421. }
  422. RpcExcept(I_RpcExceptionFilter(RpcExceptionCode())) {
  423. dwRetCode = RpcExceptionCode();
  424. }
  425. RpcEndExcept
  426. return( dwRetCode );
  427. }
  428. //**
  429. //
  430. // Call: AfpAdminServerSetInfo
  431. //
  432. // Returns: NO_ERROR - success
  433. // ERROR_INVALID_PARAMETER
  434. // non-zero return codes from AfpAdminrServerSetInfo
  435. //
  436. // Description: This is the DLL entrypoint for AfpAdminServerSetInfo
  437. //
  438. DWORD
  439. AfpAdminServerSetInfo(
  440. IN AFP_SERVER_HANDLE hAfpServer,
  441. IN LPBYTE pbBuffer,
  442. IN DWORD dwParmNum
  443. )
  444. {
  445. DWORD dwRetCode;
  446. if ( dwParmNum == 0 )
  447. return( ERROR_INVALID_PARAMETER );
  448. if ( !IsAfpServerInfoValid( dwParmNum, (PAFP_SERVER_INFO)pbBuffer ) )
  449. return( ERROR_INVALID_PARAMETER );
  450. RpcTryExcept{
  451. dwRetCode = AfpAdminrServerSetInfo( hAfpServer,
  452. (PAFP_SERVER_INFO)pbBuffer,
  453. dwParmNum );
  454. }
  455. RpcExcept(I_RpcExceptionFilter(RpcExceptionCode())) {
  456. dwRetCode = RpcExceptionCode();
  457. }
  458. RpcEndExcept
  459. return( dwRetCode );
  460. }
  461. //**
  462. //
  463. // Call: AfpAdminSessionEnum
  464. //
  465. // Returns: NO_ERROR - success
  466. // ERROR_INVALID_PARAMETER
  467. // non-zero return codes from AfpAdminrSessionEnum
  468. //
  469. // Description: This is the DLL entry point for AfpAdminSessionEnum.
  470. //
  471. DWORD
  472. AfpAdminSessionEnum(
  473. IN AFP_SERVER_HANDLE hAfpServer,
  474. OUT LPBYTE *ppbBuffer,
  475. IN DWORD dwPrefMaxLen,
  476. OUT LPDWORD lpdwEntriesRead,
  477. OUT LPDWORD lpdwTotalEntries,
  478. IN LPDWORD lpdwResumeHandle
  479. )
  480. {
  481. DWORD dwRetCode;
  482. SESSION_INFO_CONTAINER InfoStruct;
  483. // Touch all pointers
  484. //
  485. try {
  486. *ppbBuffer = NULL;
  487. *lpdwEntriesRead = 0;
  488. *lpdwTotalEntries = 0;
  489. if ( lpdwResumeHandle )
  490. *lpdwResumeHandle;
  491. }
  492. except( EXCEPTION_EXECUTE_HANDLER ) {
  493. return( ERROR_INVALID_PARAMETER );
  494. }
  495. InfoStruct.dwEntriesRead = 0;
  496. InfoStruct.pBuffer = NULL;
  497. RpcTryExcept{
  498. dwRetCode = AfpAdminrSessionEnum( hAfpServer,
  499. &InfoStruct,
  500. dwPrefMaxLen,
  501. lpdwTotalEntries,
  502. lpdwResumeHandle );
  503. if ( InfoStruct.pBuffer != NULL ) {
  504. *ppbBuffer = (LPBYTE)(InfoStruct.pBuffer);
  505. *lpdwEntriesRead = InfoStruct.dwEntriesRead;
  506. }
  507. else
  508. *lpdwEntriesRead = 0;
  509. }
  510. RpcExcept(I_RpcExceptionFilter(RpcExceptionCode())) {
  511. dwRetCode = RpcExceptionCode();
  512. }
  513. RpcEndExcept
  514. return( dwRetCode );
  515. }
  516. //**
  517. //
  518. // Call: AfpAdminSessionClose
  519. //
  520. // Returns: NO_ERROR - success
  521. // non-zero return codes from AfpAdminrSessionClose
  522. //
  523. // Description: This is the DLL entrypoint for AfpAdminSessionClose
  524. //
  525. DWORD
  526. AfpAdminSessionClose(
  527. IN AFP_SERVER_HANDLE hAfpServer,
  528. IN DWORD dwSessionId
  529. )
  530. {
  531. DWORD dwRetCode;
  532. RpcTryExcept{
  533. dwRetCode = AfpAdminrSessionClose( hAfpServer, dwSessionId );
  534. }
  535. RpcExcept(I_RpcExceptionFilter(RpcExceptionCode())) {
  536. dwRetCode = RpcExceptionCode();
  537. }
  538. RpcEndExcept
  539. return( dwRetCode );
  540. }
  541. //**
  542. //
  543. // Call: AfpAdminConnectionEnum
  544. //
  545. // Returns: NO_ERROR - success
  546. // ERROR_INVALID_PARAMETER
  547. // non-zero return codes from AfpAdminrConnectionEnum
  548. //
  549. // Description: This is the DLL entry point for AfpAdminConnectionEnum.
  550. //
  551. DWORD
  552. AfpAdminConnectionEnum(
  553. IN AFP_SERVER_HANDLE hAfpServer,
  554. OUT LPBYTE *ppbBuffer,
  555. IN DWORD dwFilter,
  556. IN DWORD dwId,
  557. IN DWORD dwPrefMaxLen,
  558. OUT LPDWORD lpdwEntriesRead,
  559. OUT LPDWORD lpdwTotalEntries,
  560. IN LPDWORD lpdwResumeHandle
  561. )
  562. {
  563. DWORD dwRetCode;
  564. CONN_INFO_CONTAINER InfoStruct;
  565. switch( dwFilter ){
  566. case AFP_FILTER_ON_VOLUME_ID:
  567. case AFP_FILTER_ON_SESSION_ID:
  568. if ( dwId == 0 )
  569. return( ERROR_INVALID_PARAMETER );
  570. break;
  571. case AFP_NO_FILTER:
  572. break;
  573. default:
  574. return( ERROR_INVALID_PARAMETER );
  575. }
  576. // Touch all pointers
  577. //
  578. try {
  579. *ppbBuffer = NULL;
  580. *lpdwEntriesRead = 0;
  581. *lpdwTotalEntries = 0;
  582. if ( lpdwResumeHandle )
  583. *lpdwResumeHandle;
  584. }
  585. except( EXCEPTION_EXECUTE_HANDLER ) {
  586. return( ERROR_INVALID_PARAMETER );
  587. }
  588. InfoStruct.dwEntriesRead = 0;
  589. InfoStruct.pBuffer = NULL;
  590. RpcTryExcept{
  591. dwRetCode = AfpAdminrConnectionEnum( hAfpServer,
  592. &InfoStruct,
  593. dwFilter,
  594. dwId,
  595. dwPrefMaxLen,
  596. lpdwTotalEntries,
  597. lpdwResumeHandle );
  598. if ( InfoStruct.pBuffer != NULL ) {
  599. *ppbBuffer = (LPBYTE)(InfoStruct.pBuffer);
  600. *lpdwEntriesRead = InfoStruct.dwEntriesRead;
  601. }
  602. else
  603. *lpdwEntriesRead = 0;
  604. }
  605. RpcExcept(I_RpcExceptionFilter(RpcExceptionCode())) {
  606. dwRetCode = RpcExceptionCode();
  607. }
  608. RpcEndExcept
  609. return( dwRetCode );
  610. }
  611. //**
  612. //
  613. // Call: AfpAdminConnectionClose
  614. //
  615. // Returns: NO_ERROR - success
  616. // non-zero return codes from AfpAdminrConnectionClose
  617. //
  618. // Description: This is the DLL entrypoint for AfpAdminConnectionClose
  619. //
  620. DWORD
  621. AfpAdminConnectionClose(
  622. IN AFP_SERVER_HANDLE hAfpServer,
  623. IN DWORD dwConnectionId
  624. )
  625. {
  626. DWORD dwRetCode;
  627. RpcTryExcept{
  628. dwRetCode = AfpAdminrConnectionClose( hAfpServer, dwConnectionId );
  629. }
  630. RpcExcept(I_RpcExceptionFilter(RpcExceptionCode())) {
  631. dwRetCode = RpcExceptionCode();
  632. }
  633. RpcEndExcept
  634. return( dwRetCode );
  635. }
  636. //**
  637. //
  638. // Call: AfpAdminFileEnum
  639. //
  640. // Returns: NO_ERROR - success
  641. // ERROR_INVALID_PARAMETER
  642. // non-zero return codes from AfpAdminrFileEnum
  643. //
  644. // Description: This is the DLL entry point for AfpAdminFileEnum.
  645. //
  646. DWORD
  647. AfpAdminFileEnum(
  648. IN AFP_SERVER_HANDLE hAfpServer,
  649. OUT LPBYTE *ppbBuffer,
  650. IN DWORD dwPrefMaxLen,
  651. OUT LPDWORD lpdwEntriesRead,
  652. OUT LPDWORD lpdwTotalEntries,
  653. IN LPDWORD lpdwResumeHandle
  654. )
  655. {
  656. DWORD dwRetCode;
  657. FILE_INFO_CONTAINER InfoStruct;
  658. // Touch all pointers
  659. //
  660. try {
  661. *ppbBuffer = NULL;
  662. *lpdwEntriesRead = 0;
  663. *lpdwTotalEntries = 0;
  664. if ( lpdwResumeHandle )
  665. *lpdwResumeHandle;
  666. }
  667. except( EXCEPTION_EXECUTE_HANDLER ) {
  668. return( ERROR_INVALID_PARAMETER );
  669. }
  670. InfoStruct.dwEntriesRead = 0;
  671. InfoStruct.pBuffer = NULL;
  672. RpcTryExcept{
  673. dwRetCode = AfpAdminrFileEnum( hAfpServer,
  674. &InfoStruct,
  675. dwPrefMaxLen,
  676. lpdwTotalEntries,
  677. lpdwResumeHandle );
  678. if ( InfoStruct.pBuffer != NULL ) {
  679. *ppbBuffer = (LPBYTE)(InfoStruct.pBuffer);
  680. *lpdwEntriesRead = InfoStruct.dwEntriesRead;
  681. }
  682. else
  683. *lpdwEntriesRead = 0;
  684. }
  685. RpcExcept(I_RpcExceptionFilter(RpcExceptionCode())) {
  686. dwRetCode = RpcExceptionCode();
  687. }
  688. RpcEndExcept
  689. return( dwRetCode );
  690. }
  691. //**
  692. //
  693. // Call: AfpAdminFileClose
  694. //
  695. // Returns: NO_ERROR - success
  696. // non-zero return codes from AfpAdminrFileClose
  697. //
  698. // Description: This is the DLL entrypoint for AfpAdminFileClose
  699. //
  700. DWORD
  701. AfpAdminFileClose(
  702. IN AFP_SERVER_HANDLE hAfpServer,
  703. IN DWORD dwFileId
  704. )
  705. {
  706. DWORD dwRetCode;
  707. RpcTryExcept{
  708. dwRetCode = AfpAdminrFileClose( hAfpServer, dwFileId );
  709. }
  710. RpcExcept(I_RpcExceptionFilter(RpcExceptionCode())) {
  711. dwRetCode = RpcExceptionCode();
  712. }
  713. RpcEndExcept
  714. return( dwRetCode );
  715. }
  716. //**
  717. //
  718. // Call: AfpAdminETCMapGetInfo
  719. //
  720. // Returns: NO_ERROR - success
  721. // ERROR_INVALID_PARAMETER
  722. // non-zero return codes from AfpAdminrETCMapGetInfo
  723. //
  724. // Description: This is the DLL entry point for AfpAdminETCMapGetInfo.
  725. //
  726. DWORD
  727. AfpAdminETCMapGetInfo(
  728. IN AFP_SERVER_HANDLE hAfpServer,
  729. OUT LPBYTE *ppbBuffer
  730. )
  731. {
  732. DWORD dwRetCode;
  733. try {
  734. *ppbBuffer = NULL;
  735. }
  736. except( EXCEPTION_EXECUTE_HANDLER ) {
  737. return( ERROR_INVALID_PARAMETER );
  738. }
  739. RpcTryExcept{
  740. dwRetCode = AfpAdminrETCMapGetInfo( hAfpServer,
  741. (PAFP_ETCMAP_INFO*)ppbBuffer
  742. );
  743. }
  744. RpcExcept(I_RpcExceptionFilter(RpcExceptionCode())) {
  745. dwRetCode = RpcExceptionCode();
  746. }
  747. RpcEndExcept
  748. return( dwRetCode );
  749. }
  750. //**
  751. //
  752. // Call: AfpAdminETCMapAdd
  753. //
  754. // Returns: NO_ERROR - success
  755. // ERROR_INVALID_PARAMETER
  756. // non-zero return codes from AfpAdminrETCMapAdd
  757. //
  758. // Description: This is the DLL entrypoint for AfpAdminETCMapAdd
  759. //
  760. DWORD
  761. AfpAdminETCMapAdd(
  762. IN AFP_SERVER_HANDLE hAfpServer,
  763. IN PAFP_TYPE_CREATOR pAfpTypeCreator
  764. )
  765. {
  766. DWORD dwRetCode;
  767. if ( !IsAfpTypeCreatorValid( pAfpTypeCreator ) )
  768. return( ERROR_INVALID_PARAMETER );
  769. RpcTryExcept{
  770. dwRetCode = AfpAdminrETCMapAdd( hAfpServer, pAfpTypeCreator );
  771. }
  772. RpcExcept(I_RpcExceptionFilter(RpcExceptionCode())) {
  773. dwRetCode = RpcExceptionCode();
  774. }
  775. RpcEndExcept
  776. return( dwRetCode );
  777. }
  778. //**
  779. //
  780. // Call: AfpAdminETCMapDelete
  781. //
  782. // Returns: NO_ERROR - success
  783. // ERROR_INVALID_PARAMETER
  784. // non-zero return codes from AfpAdminrETCMapDelete
  785. //
  786. // Description: This is the DLL entrypoint for AfpAdminETCMapDelete
  787. //
  788. DWORD
  789. AfpAdminETCMapDelete(
  790. IN AFP_SERVER_HANDLE hAfpServer,
  791. IN PAFP_TYPE_CREATOR pAfpTypeCreator
  792. )
  793. {
  794. DWORD dwRetCode;
  795. if ( !IsAfpTypeCreatorValid( pAfpTypeCreator ) )
  796. return( ERROR_INVALID_PARAMETER );
  797. RpcTryExcept{
  798. dwRetCode = AfpAdminrETCMapDelete( hAfpServer, pAfpTypeCreator );
  799. }
  800. RpcExcept(I_RpcExceptionFilter(RpcExceptionCode())) {
  801. dwRetCode = RpcExceptionCode();
  802. }
  803. RpcEndExcept
  804. return( dwRetCode );
  805. }
  806. //**
  807. //
  808. // Call: AfpAdminrETCMapSetInfo
  809. //
  810. // Returns: NO_ERROR - success
  811. // ERROR_INVALID_PARAMETER
  812. // non-zero return codes from AfpAdminrETCMapSetInfo
  813. //
  814. // Description: This is the DLL entrypoint for AfpAdminETCMapSetInfo
  815. //
  816. DWORD
  817. AfpAdminETCMapSetInfo(
  818. IN AFP_SERVER_HANDLE hAfpServer,
  819. IN PAFP_TYPE_CREATOR pAfpTypeCreator
  820. )
  821. {
  822. DWORD dwRetCode;
  823. if ( !IsAfpTypeCreatorValid( pAfpTypeCreator ) )
  824. return( ERROR_INVALID_PARAMETER );
  825. RpcTryExcept{
  826. dwRetCode = AfpAdminrETCMapSetInfo( hAfpServer, pAfpTypeCreator );
  827. }
  828. RpcExcept(I_RpcExceptionFilter(RpcExceptionCode())) {
  829. dwRetCode = RpcExceptionCode();
  830. }
  831. RpcEndExcept
  832. return( dwRetCode );
  833. }
  834. //**
  835. //
  836. // Call: AfpAdminETCMapAssociate
  837. //
  838. // Returns: NO_ERROR - success
  839. // ERROR_INVALID_PARAMETER
  840. // non-zero return codes from AfpAdminrETCMapAssociate
  841. //
  842. // Description: This is the DLL entrypoint for AfpAdminETCMapAssociate
  843. //
  844. DWORD
  845. AfpAdminETCMapAssociate(
  846. IN AFP_SERVER_HANDLE hAfpServer,
  847. IN PAFP_TYPE_CREATOR pAfpTypeCreator,
  848. IN PAFP_EXTENSION pAfpExtension
  849. )
  850. {
  851. DWORD dwRetCode;
  852. if ( !IsAfpTypeCreatorValid( pAfpTypeCreator ) )
  853. return( ERROR_INVALID_PARAMETER );
  854. if ( !IsAfpExtensionValid( pAfpExtension ) )
  855. return( ERROR_INVALID_PARAMETER );
  856. RpcTryExcept{
  857. dwRetCode = AfpAdminrETCMapAssociate( hAfpServer,
  858. pAfpTypeCreator,
  859. pAfpExtension
  860. );
  861. }
  862. RpcExcept(I_RpcExceptionFilter(RpcExceptionCode())) {
  863. dwRetCode = RpcExceptionCode();
  864. }
  865. RpcEndExcept
  866. return( dwRetCode );
  867. }
  868. //**
  869. //
  870. // Call: AfpAdminStatisticsGet
  871. //
  872. // Returns: NO_ERROR - success
  873. // ERROR_INVALID_PARAMETER
  874. // non-zero return codes from AfpAdminrStatisticsGet
  875. //
  876. // Description: This is the DLL entrypoint for AfpAdminStatisticsGet
  877. //
  878. DWORD
  879. AfpAdminStatisticsGet(
  880. IN AFP_SERVER_HANDLE hAfpServer,
  881. OUT LPBYTE *ppbBuffer
  882. )
  883. {
  884. DWORD dwRetCode;
  885. try {
  886. *ppbBuffer = NULL;
  887. }
  888. except( EXCEPTION_EXECUTE_HANDLER ) {
  889. return( ERROR_INVALID_PARAMETER );
  890. }
  891. RpcTryExcept{
  892. dwRetCode = AfpAdminrStatisticsGet( hAfpServer,
  893. (PAFP_STATISTICS_INFO*)ppbBuffer );
  894. }
  895. RpcExcept(I_RpcExceptionFilter(RpcExceptionCode())) {
  896. dwRetCode = RpcExceptionCode();
  897. }
  898. RpcEndExcept
  899. return( dwRetCode );
  900. }
  901. //**
  902. //
  903. // Call: AfpAdminStatisticsGetEx
  904. //
  905. // Returns: NO_ERROR - success
  906. // ERROR_INVALID_PARAMETER
  907. // non-zero return codes from AfpAdminrStatisticsGetEx
  908. //
  909. // Description: This is the DLL entrypoint for AfpAdminStatisticsGetEx
  910. //
  911. DWORD
  912. AfpAdminStatisticsGetEx(
  913. IN AFP_SERVER_HANDLE hAfpServer,
  914. OUT LPBYTE *ppbBuffer
  915. )
  916. {
  917. DWORD dwRetCode;
  918. try {
  919. *ppbBuffer = NULL;
  920. }
  921. except( EXCEPTION_EXECUTE_HANDLER ) {
  922. return( ERROR_INVALID_PARAMETER );
  923. }
  924. RpcTryExcept{
  925. dwRetCode = AfpAdminrStatisticsGetEx( hAfpServer,
  926. (PAFP_STATISTICS_INFO_EX *)ppbBuffer );
  927. }
  928. RpcExcept(I_RpcExceptionFilter(RpcExceptionCode())) {
  929. dwRetCode = RpcExceptionCode();
  930. }
  931. RpcEndExcept
  932. return( dwRetCode );
  933. }
  934. //**
  935. //
  936. // Call: AfpAdminStatisticsClear
  937. //
  938. // Returns: NO_ERROR - success
  939. // ERROR_INVALID_PARAMETER
  940. // non-zero return codes from AfpAdminrStatisticsClear
  941. //
  942. // Description: This is the DLL entrypoint for AfpAdminStatisticsClear
  943. //
  944. DWORD
  945. AfpAdminStatisticsClear(
  946. IN AFP_SERVER_HANDLE hAfpServer
  947. )
  948. {
  949. DWORD dwRetCode;
  950. RpcTryExcept{
  951. dwRetCode = AfpAdminrStatisticsClear( hAfpServer );
  952. }
  953. RpcExcept(I_RpcExceptionFilter(RpcExceptionCode())) {
  954. dwRetCode = RpcExceptionCode();
  955. }
  956. RpcEndExcept
  957. return( dwRetCode );
  958. }
  959. //**
  960. //
  961. // Call: AfpAdminProfileGet
  962. //
  963. // Returns: NO_ERROR - success
  964. // ERROR_INVALID_PARAMETER
  965. // non-zero return codes from AfpAdminrProfileGet
  966. //
  967. // Description: This is the DLL entrypoint for AfpAdminProfileGet
  968. //
  969. DWORD
  970. AfpAdminProfileGet(
  971. IN AFP_SERVER_HANDLE hAfpServer,
  972. OUT LPBYTE *ppbBuffer
  973. )
  974. {
  975. DWORD dwRetCode;
  976. try {
  977. *ppbBuffer = NULL;
  978. }
  979. except( EXCEPTION_EXECUTE_HANDLER ) {
  980. return( ERROR_INVALID_PARAMETER );
  981. }
  982. RpcTryExcept{
  983. dwRetCode = AfpAdminrProfileGet( hAfpServer,
  984. (PAFP_PROFILE_INFO*)ppbBuffer );
  985. }
  986. RpcExcept(I_RpcExceptionFilter(RpcExceptionCode())) {
  987. dwRetCode = RpcExceptionCode();
  988. }
  989. RpcEndExcept
  990. return( dwRetCode );
  991. }
  992. //**
  993. //
  994. // Call: AfpAdminProfileClear
  995. //
  996. // Returns: NO_ERROR - success
  997. // ERROR_INVALID_PARAMETER
  998. // non-zero return codes from AfpAdminrProfileClear
  999. //
  1000. // Description: This is the DLL entrypoint for AfpAdminProfileClear
  1001. //
  1002. DWORD
  1003. AfpAdminProfileClear(
  1004. IN AFP_SERVER_HANDLE hAfpServer
  1005. )
  1006. {
  1007. DWORD dwRetCode;
  1008. RpcTryExcept{
  1009. dwRetCode = AfpAdminrProfileClear( hAfpServer );
  1010. }
  1011. RpcExcept(I_RpcExceptionFilter(RpcExceptionCode())) {
  1012. dwRetCode = RpcExceptionCode();
  1013. }
  1014. RpcEndExcept
  1015. return( dwRetCode );
  1016. }
  1017. //**
  1018. //
  1019. // Call: AfpAdminMessageSend
  1020. //
  1021. // Returns: NO_ERROR - success
  1022. // ERROR_INVALID_PARAMETER
  1023. // non-zero return codes from AfpAdminrMessageSend
  1024. //
  1025. // Description: This is the DLL entrypoint for AfpAdminMessageSend
  1026. //
  1027. DWORD
  1028. AfpAdminMessageSend(
  1029. IN AFP_SERVER_HANDLE hAfpServer,
  1030. IN PAFP_MESSAGE_INFO pAfpMessageInfo
  1031. )
  1032. {
  1033. DWORD dwRetCode;
  1034. try {
  1035. *pAfpMessageInfo;
  1036. }
  1037. except( EXCEPTION_EXECUTE_HANDLER ) {
  1038. return( ERROR_INVALID_PARAMETER );
  1039. }
  1040. if ( !IsAfpMsgValid( pAfpMessageInfo->afpmsg_text ) )
  1041. return( ERROR_INVALID_PARAMETER );
  1042. RpcTryExcept{
  1043. dwRetCode = AfpAdminrMessageSend( hAfpServer,
  1044. pAfpMessageInfo );
  1045. }
  1046. RpcExcept(I_RpcExceptionFilter(RpcExceptionCode())) {
  1047. dwRetCode = RpcExceptionCode();
  1048. }
  1049. RpcEndExcept
  1050. return( dwRetCode );
  1051. }
  1052. //**
  1053. //
  1054. // Call: AfpAdminFinderSetInfo
  1055. //
  1056. // Returns: NO_ERROR - success
  1057. // ERROR_INVALID_PARAMETER
  1058. // non-zero return codes from AfpAdminrFinderSetInfo
  1059. //
  1060. // Description: This is the DLL entrypoint for AfpAdminFinderSetInfo
  1061. //
  1062. DWORD
  1063. AfpAdminFinderSetInfo(
  1064. IN AFP_SERVER_HANDLE hAfpServer,
  1065. IN LPWSTR pType,
  1066. IN LPWSTR pCreator,
  1067. IN LPWSTR pData,
  1068. IN LPWSTR pResource,
  1069. IN LPWSTR pTarget,
  1070. IN DWORD dwParmNum
  1071. )
  1072. {
  1073. DWORD dwRetCode;
  1074. if ( !IsAfpFinderInfoValid( pType,
  1075. pCreator,
  1076. pData,
  1077. pResource,
  1078. pTarget,
  1079. dwParmNum ) )
  1080. return( ERROR_INVALID_PARAMETER );
  1081. if ( pType == NULL )
  1082. pType = (LPWSTR)TEXT("");
  1083. if ( pCreator == NULL )
  1084. pCreator = (LPWSTR)TEXT("");
  1085. if ( pData == NULL )
  1086. pData = (LPWSTR)TEXT("");
  1087. if ( pResource == NULL )
  1088. pResource = (LPWSTR)TEXT("");
  1089. RpcTryExcept{
  1090. dwRetCode = AfpAdminrFinderSetInfo( hAfpServer,
  1091. pType,
  1092. pCreator,
  1093. pData,
  1094. pResource,
  1095. pTarget,
  1096. dwParmNum );
  1097. }
  1098. RpcExcept(I_RpcExceptionFilter(RpcExceptionCode())) {
  1099. dwRetCode = RpcExceptionCode();
  1100. }
  1101. RpcEndExcept
  1102. return( dwRetCode );
  1103. }