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.

964 lines
21 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. winsstub.c
  5. Abstract:
  6. Client stubs of the WINS server service APIs.
  7. Author:
  8. Pradeep Bahl (pradeepb) Apr-1993
  9. Environment:
  10. User Mode - Win32
  11. Revision History:
  12. --*/
  13. #include "windows.h"
  14. #include "rpc.h"
  15. #include "winsif.h"
  16. #include "esent.h"
  17. #include "winscnst.h"
  18. //#include "winsintf.h"
  19. //
  20. // prototypes
  21. //
  22. DWORD
  23. WinsRestoreC(
  24. LPBYTE pBackupPath,
  25. DbVersion Version
  26. );
  27. DWORD
  28. WinsRecordAction(
  29. WINSIF2_HANDLE ServerHdl,
  30. PWINSINTF_RECORD_ACTION_T *ppRecAction
  31. )
  32. {
  33. DWORD status;
  34. RpcTryExcept {
  35. status = R_WinsRecordAction(
  36. ServerHdl,
  37. ppRecAction
  38. );
  39. } RpcExcept( I_RpcExceptionFilter(RpcExceptionCode()) ) {
  40. status = RpcExceptionCode();
  41. } RpcEndExcept
  42. return status;
  43. }
  44. DWORD
  45. WinsStatus(
  46. WINSIF2_HANDLE ServerHdl,
  47. WINSINTF_CMD_E Cmd_e,
  48. PWINSINTF_RESULTS_T pResults
  49. )
  50. {
  51. DWORD status;
  52. RpcTryExcept {
  53. status = R_WinsStatus(
  54. //pWinsAddStr,
  55. ServerHdl,
  56. Cmd_e,
  57. pResults
  58. );
  59. } RpcExcept( I_RpcExceptionFilter(RpcExceptionCode()) ) {
  60. status = RpcExceptionCode();
  61. } RpcEndExcept
  62. return status;
  63. }
  64. DWORD
  65. WinsStatusNew(
  66. WINSIF2_HANDLE ServerHdl,
  67. WINSINTF_CMD_E Cmd_e,
  68. PWINSINTF_RESULTS_NEW_T pResults
  69. )
  70. {
  71. DWORD status;
  72. RpcTryExcept {
  73. status = R_WinsStatusNew(
  74. ServerHdl,
  75. Cmd_e,
  76. pResults
  77. );
  78. } RpcExcept( I_RpcExceptionFilter(RpcExceptionCode()) ) {
  79. status = RpcExceptionCode();
  80. } RpcEndExcept
  81. return status;
  82. }
  83. DWORD
  84. WinsStatusWHdl(
  85. WINSIF_HANDLE ServerHdl,
  86. WINSINTF_CMD_E Cmd_e,
  87. PWINSINTF_RESULTS_NEW_T pResults
  88. )
  89. {
  90. DWORD status;
  91. RpcTryExcept {
  92. status = R_WinsStatusWHdl(
  93. ServerHdl,
  94. Cmd_e,
  95. pResults
  96. );
  97. } RpcExcept( I_RpcExceptionFilter(RpcExceptionCode()) ) {
  98. status = RpcExceptionCode();
  99. } RpcEndExcept
  100. return status;
  101. }
  102. DWORD
  103. WinsTrigger(
  104. WINSIF2_HANDLE ServerHdl,
  105. PWINSINTF_ADD_T pWinsAdd,
  106. WINSINTF_TRIG_TYPE_E TrigType_e
  107. )
  108. {
  109. DWORD status;
  110. RpcTryExcept {
  111. status = R_WinsTrigger(
  112. ServerHdl,
  113. pWinsAdd,
  114. TrigType_e
  115. );
  116. } RpcExcept( I_RpcExceptionFilter(RpcExceptionCode()) ) {
  117. status = RpcExceptionCode();
  118. } RpcEndExcept
  119. return status;
  120. }
  121. DWORD
  122. WinsDoStaticInit(
  123. WINSIF2_HANDLE ServerHdl,
  124. LPWSTR pDataFilePath,
  125. DWORD fDel
  126. )
  127. {
  128. DWORD status;
  129. RpcTryExcept {
  130. status = R_WinsDoStaticInit(
  131. ServerHdl,
  132. pDataFilePath, fDel);
  133. } RpcExcept( I_RpcExceptionFilter(RpcExceptionCode()) ) {
  134. status = RpcExceptionCode();
  135. } RpcEndExcept
  136. return status;
  137. }
  138. DWORD
  139. WinsDoScavenging(
  140. WINSIF2_HANDLE ServerHdl
  141. )
  142. {
  143. DWORD status;
  144. RpcTryExcept {
  145. status = R_WinsDoScavenging(
  146. ServerHdl
  147. );
  148. } RpcExcept( I_RpcExceptionFilter(RpcExceptionCode()) ) {
  149. status = RpcExceptionCode();
  150. } RpcEndExcept
  151. return status;
  152. }
  153. DWORD
  154. WinsDoScavengingNew(
  155. WINSIF2_HANDLE ServerHdl,
  156. PWINSINTF_SCV_REQ_T pScvReq
  157. )
  158. {
  159. DWORD status;
  160. RpcTryExcept {
  161. status = R_WinsDoScavengingNew(
  162. ServerHdl,
  163. pScvReq);
  164. } RpcExcept( I_RpcExceptionFilter(RpcExceptionCode()) ) {
  165. status = RpcExceptionCode();
  166. } RpcEndExcept
  167. return status;
  168. }
  169. DWORD
  170. WinsGetDbRecs(
  171. WINSIF2_HANDLE ServerHdl,
  172. PWINSINTF_ADD_T pWinsAdd,
  173. WINSINTF_VERS_NO_T MinVersNo,
  174. WINSINTF_VERS_NO_T MaxVersNo,
  175. PWINSINTF_RECS_T pRecs
  176. )
  177. {
  178. DWORD status;
  179. RpcTryExcept {
  180. status = R_WinsGetDbRecs(
  181. ServerHdl,
  182. pWinsAdd, MinVersNo, MaxVersNo, pRecs);
  183. } RpcExcept( I_RpcExceptionFilter(RpcExceptionCode()) ) {
  184. status = RpcExceptionCode();
  185. } RpcEndExcept
  186. return status;
  187. }
  188. DWORD
  189. WinsTerm(
  190. handle_t ServerHdl,
  191. short fAbruptTerm
  192. )
  193. {
  194. DWORD status;
  195. RpcTryExcept {
  196. status = R_WinsTerm(
  197. ServerHdl,
  198. fAbruptTerm);
  199. } RpcExcept( I_RpcExceptionFilter(RpcExceptionCode()) ) {
  200. status = RpcExceptionCode();
  201. } RpcEndExcept
  202. return status;
  203. }
  204. DWORD
  205. WinsBackup(
  206. WINSIF2_HANDLE ServerHdl,
  207. LPBYTE pBackupPath,
  208. short fIncremental
  209. )
  210. {
  211. DWORD status;
  212. RpcTryExcept {
  213. status = R_WinsBackup(
  214. ServerHdl,
  215. pBackupPath, fIncremental);
  216. } RpcExcept( I_RpcExceptionFilter(RpcExceptionCode()) ) {
  217. status = RpcExceptionCode();
  218. } RpcEndExcept
  219. return status;
  220. }
  221. DWORD
  222. WinsDelDbRecs(
  223. WINSIF2_HANDLE ServerHdl,
  224. PWINSINTF_ADD_T pWinsAdd,
  225. WINSINTF_VERS_NO_T MinVersNo,
  226. WINSINTF_VERS_NO_T MaxVersNo
  227. )
  228. {
  229. DWORD status;
  230. RpcTryExcept {
  231. status = R_WinsDelDbRecs(
  232. ServerHdl,
  233. pWinsAdd, MinVersNo, MaxVersNo);
  234. } RpcExcept( I_RpcExceptionFilter(RpcExceptionCode()) ) {
  235. status = RpcExceptionCode();
  236. } RpcEndExcept
  237. return status;
  238. }
  239. DWORD
  240. WinsPullRange(
  241. WINSIF2_HANDLE ServerHdl,
  242. PWINSINTF_ADD_T pWinsAdd,
  243. PWINSINTF_ADD_T pOwnAdd,
  244. WINSINTF_VERS_NO_T MinVersNo,
  245. WINSINTF_VERS_NO_T MaxVersNo
  246. )
  247. {
  248. DWORD status;
  249. RpcTryExcept {
  250. status = R_WinsPullRange(
  251. ServerHdl,
  252. pWinsAdd, pOwnAdd, MinVersNo, MaxVersNo);
  253. } RpcExcept( I_RpcExceptionFilter(RpcExceptionCode()) ) {
  254. status = RpcExceptionCode();
  255. } RpcEndExcept
  256. return status;
  257. }
  258. DWORD
  259. WinsSetPriorityClass(
  260. WINSIF2_HANDLE ServerHdl,
  261. WINSINTF_PRIORITY_CLASS_E PrCls_e
  262. )
  263. {
  264. DWORD status;
  265. RpcTryExcept {
  266. status = R_WinsSetPriorityClass(
  267. ServerHdl,
  268. PrCls_e);
  269. } RpcExcept( I_RpcExceptionFilter(RpcExceptionCode()) ) {
  270. status = RpcExceptionCode();
  271. } RpcEndExcept
  272. return status;
  273. }
  274. DWORD
  275. WinsResetCounters(
  276. WINSIF2_HANDLE ServerHdl
  277. )
  278. {
  279. DWORD status;
  280. RpcTryExcept {
  281. status = R_WinsResetCounters(
  282. ServerHdl
  283. );
  284. } RpcExcept( I_RpcExceptionFilter(RpcExceptionCode()) ) {
  285. status = RpcExceptionCode();
  286. } RpcEndExcept
  287. return status;
  288. }
  289. DWORD
  290. WinsRestoreEx(
  291. LPBYTE pBackupPath,
  292. DbVersion Version
  293. )
  294. {
  295. return(WinsRestoreC(pBackupPath, Version));
  296. }
  297. DWORD
  298. WinsRestore(
  299. LPBYTE pBackupPath
  300. )
  301. {
  302. return(WinsRestoreC(pBackupPath, DbVersion5 ));
  303. }
  304. DWORD
  305. ConvertUnicodeStringToAscii(
  306. LPWSTR pUnicodeString,
  307. LPBYTE pAsciiString,
  308. DWORD MaxSz
  309. )
  310. {
  311. DWORD RetVal;
  312. RetVal = WideCharToMultiByte(
  313. CP_ACP,
  314. 0,
  315. pUnicodeString,
  316. -1,
  317. pAsciiString,
  318. MaxSz,
  319. NULL,
  320. NULL
  321. );
  322. if (0 == RetVal ) {
  323. return GetLastError();
  324. } else {
  325. return ERROR_SUCCESS;
  326. }
  327. }
  328. DWORD
  329. WinsReadLogPath(
  330. PCHAR *pLogPath
  331. )
  332. {
  333. DWORD Error;
  334. static TCHAR Buf[WINSINTF_MAX_NAME_SIZE];
  335. static TCHAR ExpandBuf[WINSINTF_MAX_NAME_SIZE];
  336. static char AsciiBuf[WINSINTF_MAX_NAME_SIZE];
  337. WCHAR *pTempPath,*pExpandTempPath;
  338. HKEY sParamKey;
  339. DWORD ValTyp;
  340. DWORD Sz;
  341. #define WINS_PARAM_KEY TEXT("System\\CurrentControlSet\\Services\\Wins\\Parameters")
  342. #define DEFAULT_LOG_FILE_PATH TEXT("%SystemRoot%\\System32\\wins")
  343. Error = RegOpenKeyEx(
  344. HKEY_LOCAL_MACHINE,
  345. WINS_PARAM_KEY,
  346. 0 ,
  347. KEY_READ,
  348. &sParamKey
  349. );
  350. if (ERROR_SUCCESS != Error) {
  351. return Error;
  352. }
  353. pTempPath = Buf;
  354. Error = RegQueryValueEx(
  355. sParamKey,
  356. WINSCNF_LOG_FILE_PATH_NM,
  357. NULL, //reserved; must be NULL
  358. &ValTyp,
  359. (LPBYTE)pTempPath,
  360. &Sz
  361. );
  362. if (ERROR_SUCCESS != Error || pTempPath[0] == L'\0') {
  363. pTempPath = DEFAULT_LOG_FILE_PATH;
  364. }
  365. pExpandTempPath = ExpandBuf;
  366. Error = ExpandEnvironmentStrings(
  367. pTempPath,
  368. pExpandTempPath,
  369. WINSINTF_MAX_NAME_SIZE);
  370. if (0 == Error || Error > WINSINTF_MAX_NAME_SIZE) {
  371. RegCloseKey(sParamKey);
  372. return GetLastError();
  373. }
  374. *pLogPath = AsciiBuf;
  375. Error = ConvertUnicodeStringToAscii(
  376. pExpandTempPath,
  377. *pLogPath,
  378. WINSINTF_MAX_NAME_SIZE
  379. );
  380. RegCloseKey(sParamKey);
  381. return Error;
  382. }
  383. DWORD
  384. WinsDelLogFiles(LPCSTR pFilePattern, LPSTR pFilePath)
  385. {
  386. DWORD dwErr = ERROR_SUCCESS;
  387. WIN32_FIND_DATAA FileInfo;
  388. HANDLE SearchHandle;
  389. CHAR FullFilePath[MAX_PATH + WINSINTF_MAX_NAME_SIZE + 2];
  390. // Construct the full file pattern
  391. strcpy(FullFilePath, pFilePath);
  392. strcat(FullFilePath, "\\");
  393. strcat(FullFilePath, pFilePattern);
  394. SearchHandle = FindFirstFileA(FullFilePath, &FileInfo);
  395. if (SearchHandle == INVALID_HANDLE_VALUE)
  396. dwErr = GetLastError();
  397. while(dwErr == ERROR_SUCCESS)
  398. {
  399. // construct the full file path
  400. strcpy(FullFilePath, pFilePath);
  401. strcat(FullFilePath, "\\");
  402. strcat(FullFilePath, FileInfo.cFileName);
  403. if (!DeleteFileA(FullFilePath) ||
  404. !FindNextFileA(SearchHandle, &FileInfo))
  405. {
  406. dwErr = GetLastError();
  407. }
  408. }
  409. if (dwErr == ERROR_NO_MORE_FILES)
  410. dwErr = ERROR_SUCCESS;
  411. if (SearchHandle != INVALID_HANDLE_VALUE)
  412. FindClose(SearchHandle);
  413. return dwErr;
  414. }
  415. DWORD
  416. WinsRestoreC(
  417. LPBYTE pBackupPath,
  418. DbVersion Version
  419. )
  420. /*++
  421. Routine Description:
  422. This is not an RPC function. It is provided to do a restore of
  423. the database.
  424. Arguments:
  425. pBackupPath - Path to the backup directory
  426. Externals Used:
  427. None
  428. Return Value:
  429. Success status codes --
  430. Error status codes --
  431. Error Handling:
  432. Called by:
  433. Side Effects:
  434. Comments:
  435. None
  436. --*/
  437. {
  438. JET_ERR JetRetStat;
  439. HMODULE hExtension;
  440. FARPROC fRestoreFn;
  441. FARPROC fSetSystemParamFn;
  442. DWORD RetStat = WINSINTF_SUCCESS;
  443. DWORD ProcId = 0x9C; //ordinal value of JetRestore
  444. LPCSTR RestoreProcName;
  445. LPCSTR SetSystemParamProcName;
  446. BYTE BackupPath[WINSINTF_MAX_NAME_SIZE + sizeof(WINS_BACKUP_DIR_ASCII)];
  447. CHAR *pLogFilePath;
  448. DWORD Error;
  449. BOOL fDirCr;
  450. LPTSTR pDllName;
  451. // static BOOL sLoaded = FALSE;
  452. try {
  453. // if (!sLoaded)
  454. {
  455. switch ( Version ) {
  456. case DbVersion351:
  457. pDllName = TEXT("jet.dll");
  458. RestoreProcName = (LPCSTR)0x9C;
  459. SetSystemParamProcName=(LPCSTR)165;
  460. break;
  461. case DbVersion4:
  462. pDllName = TEXT("jet500.dll");
  463. RestoreProcName = "JetRestore";
  464. SetSystemParamProcName="JetSetSystemParameter";
  465. break;
  466. case DbVersion5:
  467. pDllName = TEXT("esent.dll");
  468. RestoreProcName = "JetRestore";
  469. SetSystemParamProcName="JetSetSystemParameter";
  470. break;
  471. default:
  472. return WINSINTF_FAILURE;
  473. }
  474. // load the extension agent dll and resolve the entry points...
  475. if ((hExtension = GetModuleHandle(pDllName)) == NULL)
  476. {
  477. if ((hExtension = LoadLibrary(pDllName)) == NULL)
  478. {
  479. return(GetLastError());
  480. }
  481. else
  482. {
  483. if ((fRestoreFn = GetProcAddress(hExtension,RestoreProcName)) == (FARPROC)NULL)
  484. {
  485. RetStat = GetLastError();
  486. }
  487. if ((RetStat == ERROR_SUCCESS) && (Version != DbVersion351) )
  488. {
  489. if ((fSetSystemParamFn = GetProcAddress(hExtension,
  490. SetSystemParamProcName)) == (FARPROC)NULL)
  491. {
  492. RetStat = GetLastError();
  493. }
  494. }
  495. }
  496. }
  497. }
  498. // sLoaded = TRUE;
  499. //FUTURES("Change to lstrcpy and lstrcat when Jet starts supporting unicode")
  500. if (RetStat == WINSINTF_SUCCESS)
  501. {
  502. strcpy(BackupPath, pBackupPath);
  503. strcat(BackupPath, WINS_BACKUP_DIR_ASCII);
  504. fDirCr = CreateDirectoryA(BackupPath, NULL);
  505. if (!fDirCr && ((Error = GetLastError()) == ERROR_ALREADY_EXISTS))
  506. {
  507. if (Version != DbVersion351)
  508. {
  509. JET_INSTANCE JetInstance=0;
  510. #define BASENAME "j50"
  511. #define LOG_FILE_SUFFIX "*.log"
  512. //
  513. // first set the system parameter for basename
  514. //
  515. //
  516. // Basename to use for jet*.log and jet.chk
  517. //
  518. // We should also specify the logfile path by checking WINS registry
  519. // but it is not essential.
  520. //
  521. // When WINS comes up, if it gets an error indicating that there
  522. // was a bad log signature or log version, it will delete all log
  523. // files and restart again.
  524. //
  525. do {
  526. JetRetStat = (JET_ERR)(*fSetSystemParamFn)(
  527. &JetInstance,
  528. (JET_SESID)0, //SesId - ignored
  529. JET_paramBaseName,
  530. 0,
  531. BASENAME
  532. );
  533. if (JetRetStat != JET_errSuccess) break;
  534. JetRetStat = (JET_ERR)(*fSetSystemParamFn)(
  535. &JetInstance,
  536. (JET_SESID)0, //SesId - ignored
  537. JET_paramLogFileSize,
  538. 1024,
  539. NULL
  540. );
  541. JetRetStat = WinsReadLogPath( &pLogFilePath );
  542. if (JetRetStat != JET_errSuccess) break;
  543. JetRetStat = (JET_ERR)(*fSetSystemParamFn)(
  544. &JetInstance,
  545. (JET_SESID)0, //SesId - ignored
  546. JET_paramLogFilePath,
  547. 0,
  548. pLogFilePath
  549. );
  550. if (JetRetStat != JET_errSuccess) break;
  551. if (Version == DbVersion5)
  552. {
  553. // only for esent, request to delete old logs to avoid
  554. // having them played back upon restore (bug #277816)
  555. JetRetStat = (JET_ERR)(*fSetSystemParamFn)(
  556. &JetInstance,
  557. (JET_SESID)0,
  558. JET_paramDeleteOutOfRangeLogs,
  559. 1,
  560. NULL);
  561. if (JetRetStat != JET_errSuccess) break;
  562. // make sure Circular logging is enabled
  563. JetRetStat = (JET_ERR)(*fSetSystemParamFn)(
  564. &JetInstance,
  565. (JET_SESID)0,
  566. JET_paramCircularLog,
  567. 1,
  568. NULL);
  569. }
  570. } while (FALSE);
  571. if (JetRetStat == JET_errSuccess) {
  572. JetRetStat = (JET_ERR)(*fRestoreFn)((const char *)BackupPath, NULL);
  573. if (JetRetStat == JET_errBadLogVersion ||
  574. JetRetStat == JET_errBadLogSignature ||
  575. JetRetStat == JET_errInvalidLogSequence ||
  576. JetRetStat == JET_errExistingLogFileHasBadSignature)
  577. {
  578. WinsDelLogFiles(LOG_FILE_SUFFIX, pLogFilePath);
  579. JetRetStat = (JET_ERR)(*fRestoreFn)((const char *)BackupPath, NULL);
  580. }
  581. }
  582. }
  583. else
  584. {
  585. JetRetStat = (JET_ERR)(*fRestoreFn)((const char *)BackupPath, 0, NULL, (JET_PFNSTATUS)NULL);
  586. }
  587. if (JetRetStat != JET_errSuccess)
  588. {
  589. RetStat = WINSINTF_FAILURE;
  590. }
  591. }
  592. else
  593. {
  594. //
  595. // If CreateDirectoryA was successful, renove the directory
  596. //
  597. if (fDirCr)
  598. {
  599. RemoveDirectoryA(BackupPath);
  600. RetStat = WINSINTF_FAILURE;
  601. }
  602. else
  603. {
  604. RetStat = Error;
  605. }
  606. }
  607. }
  608. }
  609. except(EXCEPTION_EXECUTE_HANDLER) {
  610. RetStat = WINSINTF_FAILURE;
  611. }
  612. if (!FreeLibrary(hExtension))
  613. {
  614. RetStat = GetLastError();
  615. }
  616. return(RetStat);
  617. }
  618. DWORD
  619. WinsWorkerThdUpd(
  620. WINSIF2_HANDLE ServerHdl,
  621. DWORD NewNoOfNbtThds
  622. )
  623. {
  624. DWORD status;
  625. RpcTryExcept {
  626. status = R_WinsWorkerThdUpd(
  627. ServerHdl,
  628. NewNoOfNbtThds);
  629. } RpcExcept( I_RpcExceptionFilter(RpcExceptionCode()) ) {
  630. status = RpcExceptionCode();
  631. } RpcEndExcept
  632. return status;
  633. }
  634. DWORD
  635. WinsSyncUp(
  636. WINSIF2_HANDLE ServerHdl,
  637. PWINSINTF_ADD_T pWinsAdd,
  638. PWINSINTF_ADD_T pOwnerAdd
  639. )
  640. {
  641. DWORD status;
  642. WINSINTF_VERS_NO_T MinVersNo, MaxVersNo;
  643. //
  644. // Set both version numbers to zero
  645. //
  646. MinVersNo.LowPart = 0;
  647. MinVersNo.HighPart = 0;
  648. MaxVersNo = MinVersNo;
  649. RpcTryExcept {
  650. status = R_WinsPullRange(
  651. ServerHdl,
  652. pWinsAdd, pOwnerAdd, MinVersNo, MaxVersNo);
  653. } RpcExcept( I_RpcExceptionFilter(RpcExceptionCode()) ) {
  654. status = RpcExceptionCode();
  655. } RpcEndExcept
  656. return status;
  657. }
  658. DWORD
  659. WinsGetNameAndAdd(
  660. WINSIF2_HANDLE ServerHdl,
  661. PWINSINTF_ADD_T pWinsAdd,
  662. LPBYTE pUncName
  663. )
  664. {
  665. DWORD status;
  666. RpcTryExcept {
  667. status = R_WinsGetNameAndAdd(
  668. ServerHdl,
  669. pWinsAdd, pUncName);
  670. } RpcExcept( I_RpcExceptionFilter(RpcExceptionCode()) ) {
  671. status = RpcExceptionCode();
  672. } RpcEndExcept
  673. return status;
  674. }
  675. DWORD
  676. WinsDeleteWins(
  677. WINSIF2_HANDLE ServerHdl,
  678. PWINSINTF_ADD_T pWinsAdd)
  679. {
  680. DWORD status;
  681. RpcTryExcept {
  682. status = R_WinsDeleteWins(
  683. ServerHdl,
  684. pWinsAdd);
  685. } RpcExcept( I_RpcExceptionFilter(RpcExceptionCode()) ) {
  686. status = RpcExceptionCode();
  687. } RpcEndExcept
  688. return status;
  689. }
  690. DWORD
  691. WinsSetFlags(
  692. WINSIF2_HANDLE ServerHdl,
  693. DWORD fFlags)
  694. {
  695. DWORD status;
  696. RpcTryExcept {
  697. status = R_WinsSetFlags(
  698. ServerHdl,
  699. fFlags);
  700. } RpcExcept( I_RpcExceptionFilter(RpcExceptionCode()) ) {
  701. status = RpcExceptionCode();
  702. } RpcEndExcept
  703. return status;
  704. }
  705. DWORD
  706. WinsGetDbRecsByName(
  707. WINSIF2_HANDLE ServerHdl,
  708. PWINSINTF_ADD_T pWinsAdd,
  709. DWORD Location,
  710. LPBYTE pName,
  711. DWORD NameLen,
  712. DWORD NoOfRecsDesired,
  713. DWORD fOnlyStatic,
  714. PWINSINTF_RECS_T pRecs
  715. )
  716. {
  717. DWORD status;
  718. RpcTryExcept {
  719. status = R_WinsGetDbRecsByName(
  720. ServerHdl,
  721. pWinsAdd,
  722. Location,
  723. pName,
  724. NameLen,
  725. NoOfRecsDesired,
  726. fOnlyStatic,
  727. pRecs);
  728. } RpcExcept( I_RpcExceptionFilter(RpcExceptionCode()) ) {
  729. status = RpcExceptionCode();
  730. } RpcEndExcept
  731. return status;
  732. }
  733. DWORD
  734. WinsTombstoneDbRecs(
  735. WINSIF2_HANDLE ServerHdl,
  736. PWINSINTF_ADD_T pWinsAdd,
  737. WINSINTF_VERS_NO_T MinVersNo,
  738. WINSINTF_VERS_NO_T MaxVersNo
  739. )
  740. {
  741. DWORD status;
  742. RpcTryExcept {
  743. status = R_WinsTombstoneDbRecs(ServerHdl, pWinsAdd, MinVersNo, MaxVersNo);
  744. } RpcExcept( I_RpcExceptionFilter(RpcExceptionCode()) ) {
  745. status = RpcExceptionCode();
  746. } RpcEndExcept
  747. return status;
  748. }
  749. DWORD
  750. WinsCheckAccess(
  751. WINSIF2_HANDLE ServerHdl,
  752. DWORD *Access
  753. )
  754. {
  755. DWORD status;
  756. RpcTryExcept {
  757. status = R_WinsCheckAccess(ServerHdl, Access);
  758. } RpcExcept( I_RpcExceptionFilter(RpcExceptionCode()) ) {
  759. status = RpcExceptionCode();
  760. } RpcEndExcept
  761. return status;
  762. }