Source code of Windows XP (NT5)
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.

1650 lines
38 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. remote.c
  5. Abstract:
  6. Domain Name System (DNS) Server -- Admin Client API
  7. Remote API that are not direct calls to RPC stubs.
  8. Author:
  9. Jim Gilroy (jamesg) April 1997
  10. Environment:
  11. User Mode - Win32
  12. Revision History:
  13. --*/
  14. #include "dnsclip.h"
  15. //
  16. // Error indicating talking to old server
  17. //
  18. #define DNS_ERROR_NT4 RPC_S_UNKNOWN_IF
  19. //
  20. // Macro to set up RPC structure header fields.
  21. //
  22. // Sample:
  23. // DNS_RPC_FORWARDERS forwarders;
  24. // INITIALIZE_RPC_STRUCT( FORWARDERS, forwarders );
  25. //
  26. #define INITIALIZE_RPC_STRUCT( rpcStructType, rpcStruct ) \
  27. * ( DWORD * ) &( rpcStruct ) = \
  28. DNS_RPC_## rpcStructType ##_VER; \
  29. * ( ( ( DWORD * ) &( rpcStruct ) ) + 1 ) = 0;
  30. //
  31. // General Server\Zone, Query\Operation for DWORD properties
  32. //
  33. DNS_STATUS
  34. DNS_API_FUNCTION
  35. DnssrvQueryDwordPropertyEx(
  36. IN DWORD dwClientVersion,
  37. IN DWORD dwSettingFlags,
  38. IN LPCWSTR Server,
  39. IN LPCSTR pszZone,
  40. IN LPCSTR pszProperty,
  41. OUT PDWORD pdwResult
  42. )
  43. {
  44. DNS_STATUS status;
  45. DWORD typeId;
  46. DNSDBG( STUB, (
  47. "Enter DnssrvQueryDwordProperty()\n"
  48. "\tClient ver = 0x%X\n"
  49. "\tServer = %s\n"
  50. "\tZoneName = %s\n"
  51. "\tProperty = %s\n"
  52. "\tpResult = %p\n",
  53. dwClientVersion,
  54. Server,
  55. pszZone,
  56. pszProperty,
  57. pdwResult ));
  58. status = DnssrvComplexOperationEx(
  59. dwClientVersion,
  60. dwSettingFlags,
  61. Server,
  62. pszZone,
  63. DNSSRV_QUERY_DWORD_PROPERTY,
  64. DNSSRV_TYPEID_LPSTR, // property name as string
  65. (LPSTR) pszProperty,
  66. & typeId, // DWORD property value back out
  67. (PVOID *) pdwResult );
  68. DNSDBG( STUB, (
  69. "Leave DnssrvQueryDwordProperty(): status %d (%p)\n"
  70. "\tServer = %s\n"
  71. "\tZoneName = %s\n"
  72. "\tProperty = %s\n"
  73. "\tTypeId = %d\n"
  74. "\tResult = %d (%p)\n",
  75. status, status,
  76. Server,
  77. pszZone,
  78. pszProperty,
  79. typeId,
  80. *pdwResult, *pdwResult ));
  81. ASSERT(
  82. (status == ERROR_SUCCESS && typeId == DNSSRV_TYPEID_DWORD) ||
  83. (status != ERROR_SUCCESS && *pdwResult == 0 ) );
  84. return( status );
  85. }
  86. DNS_STATUS
  87. DNS_API_FUNCTION
  88. DnssrvResetDwordPropertyEx(
  89. IN DWORD dwClientVersion,
  90. IN DWORD dwSettingFlags,
  91. IN LPCWSTR Server,
  92. IN LPCSTR pszZone,
  93. IN DWORD dwContext,
  94. IN LPCSTR pszProperty,
  95. IN DWORD dwPropertyValue
  96. )
  97. {
  98. DNS_STATUS status;
  99. DNS_RPC_NAME_AND_PARAM param;
  100. param.dwParam = dwPropertyValue;
  101. param.pszNodeName = (LPSTR) pszProperty;
  102. DNSDBG( STUB, (
  103. "Enter DnssrvResetDwordPropertyEx()\n"
  104. "\tClient ver = 0x%X\n"
  105. "\tServer = %S\n"
  106. "\tZoneName = %s\n"
  107. "\tContext = %p\n"
  108. "\tPropertyName = %s\n"
  109. "\tPropertyValue = %d (%p)\n",
  110. dwClientVersion,
  111. Server,
  112. pszZone,
  113. dwContext,
  114. pszProperty,
  115. dwPropertyValue,
  116. dwPropertyValue ));
  117. status = DnssrvOperationEx(
  118. dwClientVersion,
  119. dwSettingFlags,
  120. Server,
  121. pszZone,
  122. dwContext,
  123. DNSSRV_OP_RESET_DWORD_PROPERTY,
  124. DNSSRV_TYPEID_NAME_AND_PARAM,
  125. &param );
  126. DNSDBG( STUB, (
  127. "Leaving DnssrvResetDwordPropertyEx(): status = %d (%p)\n",
  128. status, status ));
  129. return( status );
  130. }
  131. DNS_STATUS
  132. DNS_API_FUNCTION
  133. DnssrvResetStringPropertyEx(
  134. IN DWORD dwClientVersion,
  135. IN DWORD dwSettingFlags,
  136. IN LPCWSTR pwszServerName,
  137. IN LPCSTR pszZone,
  138. IN DWORD dwContext,
  139. IN LPCSTR pszProperty,
  140. IN LPCWSTR pswzPropertyValue,
  141. IN DWORD dwFlags
  142. )
  143. /*++
  144. Routine Description:
  145. Set a string property on the server. The property value is
  146. unicode.
  147. Arguments:
  148. Server - server name
  149. pszZone - pointer to zone
  150. dwContext - context
  151. pszProperty - name of property to set
  152. pswzPropertyValue - unicode property value
  153. dwFlags - flags, may be combination of:
  154. DNSSRV_OP_PARAM_APPLY_ALL_ZONES
  155. Return Value:
  156. None
  157. --*/
  158. {
  159. DNS_STATUS status;
  160. DNSDBG( STUB, (
  161. "Enter DnssrvResetStringPropertyEx()\n"
  162. "\tClient ver = 0x%X\n"
  163. "\tServer = %S\n"
  164. "\tZoneName = %s\n"
  165. "\tContext = %p\n"
  166. "\tPropertyName = %s\n"
  167. "\tPropertyValue = %S\n",
  168. dwClientVersion,
  169. pwszServerName,
  170. pszZone,
  171. dwContext,
  172. pszProperty,
  173. pswzPropertyValue ));
  174. status = DnssrvOperationEx(
  175. dwClientVersion,
  176. dwSettingFlags,
  177. pwszServerName,
  178. pszZone,
  179. dwContext,
  180. pszProperty,
  181. DNSSRV_TYPEID_LPWSTR,
  182. ( PVOID ) pswzPropertyValue );
  183. DNSDBG( STUB, (
  184. "Leaving DnssrvResetDwordPropertyEx(): status = %d (%p)\n",
  185. status, status ));
  186. return status;
  187. }
  188. DNS_STATUS
  189. DNS_API_FUNCTION
  190. DnssrvResetIPListPropertyEx(
  191. IN DWORD dwClientVersion,
  192. IN DWORD dwSettingFlags,
  193. IN LPCWSTR pwszServerName,
  194. IN LPCSTR pszZone,
  195. IN DWORD dwContext,
  196. IN LPCSTR pszProperty,
  197. IN PIP_ARRAY pipArray,
  198. IN DWORD dwFlags
  199. )
  200. /*++
  201. Routine Description:
  202. Set an IP list property on the server.
  203. Arguments:
  204. Server - server name
  205. pszZone - pointer to zone
  206. dwContext - context
  207. pszProperty - name of property to set
  208. pipArray - new IP array property value
  209. dwFlags - flags, may be combination of:
  210. DNSSRV_OP_PARAM_APPLY_ALL_ZONES
  211. Return Value:
  212. None
  213. --*/
  214. {
  215. DNS_STATUS status;
  216. DNSDBG( STUB, (
  217. "Enter DnssrvResetIPListPropertyEx()\n"
  218. "\tClient ver = 0x%X\n"
  219. "\tServer = %S\n"
  220. "\tZoneName = %s\n"
  221. "\tContext = %p\n"
  222. "\tPropertyName = %s\n"
  223. "\tpipArray = %p\n",
  224. dwClientVersion,
  225. pwszServerName,
  226. pszZone,
  227. dwContext,
  228. pszProperty,
  229. pipArray ));
  230. DnsDbg_IpArray(
  231. "DnssrvResetIPListPropertyEx\n",
  232. NULL,
  233. pipArray );
  234. status = DnssrvOperationEx(
  235. dwClientVersion,
  236. dwSettingFlags,
  237. pwszServerName,
  238. pszZone,
  239. dwContext,
  240. pszProperty,
  241. DNSSRV_TYPEID_IPARRAY,
  242. ( pipArray && pipArray->AddrCount ) ?
  243. pipArray :
  244. NULL );
  245. DNSDBG( STUB, (
  246. "Leaving DnssrvResetIPListPropertyEx(): status = %d (%p)\n",
  247. status, status ));
  248. return status;
  249. } // DnssrvResetIPListPropertyEx
  250. //
  251. // Server Queries
  252. //
  253. DNS_STATUS
  254. DNS_API_FUNCTION
  255. DnssrvGetServerInfo(
  256. IN LPCWSTR Server,
  257. OUT PDNS_RPC_SERVER_INFO * ppServerInfo
  258. )
  259. {
  260. DNS_STATUS status;
  261. DWORD typeId;
  262. status = DnssrvQuery(
  263. Server,
  264. NULL,
  265. DNSSRV_QUERY_SERVER_INFO,
  266. &typeId,
  267. ppServerInfo );
  268. ASSERT(
  269. (status == ERROR_SUCCESS && typeId == DNSSRV_TYPEID_SERVER_INFO) ||
  270. (status != ERROR_SUCCESS && *ppServerInfo == NULL ) );
  271. return( status );
  272. }
  273. DNS_STATUS
  274. DNS_API_FUNCTION
  275. DnssrvQueryZoneDwordProperty(
  276. IN LPCWSTR Server,
  277. IN LPCSTR pszZoneName,
  278. IN LPCSTR pszProperty,
  279. OUT PDWORD pdwResult
  280. )
  281. {
  282. DNS_STATUS status;
  283. DWORD typeId;
  284. IF_DNSDBG( STUB )
  285. {
  286. DNS_PRINT((
  287. "Enter DnssrvQueryDwordProperty()\n"
  288. "\tServer = %s\n"
  289. "\tpszProperty = %s\n"
  290. "\tpResult = %p\n",
  291. Server,
  292. pszZoneName,
  293. pszProperty,
  294. pdwResult ));
  295. }
  296. status = DnssrvQuery(
  297. Server,
  298. pszZoneName,
  299. pszProperty,
  300. & typeId,
  301. (PVOID *) pdwResult );
  302. IF_DNSDBG( STUB )
  303. {
  304. DNS_PRINT((
  305. "Leave DnssrvQueryZoneDwordProperty(): status %d (%p)\n"
  306. "\tServer = %s\n"
  307. "\tpszProperty = %s\n"
  308. "\tTypeId = %d\n"
  309. "\tResult = %d (%p)\n",
  310. status, status,
  311. Server,
  312. pszProperty,
  313. typeId,
  314. *pdwResult, *pdwResult ));
  315. ASSERT(
  316. (status == ERROR_SUCCESS && typeId == DNSSRV_TYPEID_DWORD) ||
  317. (status != ERROR_SUCCESS && *pdwResult == 0 ) );
  318. }
  319. return( status );
  320. }
  321. //
  322. // Server Operations
  323. //
  324. DNS_STATUS
  325. DNS_API_FUNCTION
  326. DnssrvResetServerDwordProperty(
  327. IN LPCWSTR Server,
  328. IN LPCSTR pszProperty,
  329. IN DWORD dwPropertyValue
  330. )
  331. {
  332. DNS_STATUS status;
  333. DNSDBG( STUB, (
  334. "Enter DnssrvResetServerDwordProperty()\n"
  335. "\tServer = %s\n"
  336. "\tpszPropertyName = %s\n"
  337. "\tdwPropertyValue = %p\n",
  338. Server,
  339. pszProperty,
  340. dwPropertyValue ));
  341. status = DnssrvOperation(
  342. Server,
  343. NULL,
  344. pszProperty,
  345. DNSSRV_TYPEID_DWORD,
  346. (PVOID) (DWORD_PTR) dwPropertyValue );
  347. DNSDBG( STUB, (
  348. "Leaving DnssrvResetServerDwordProperty: status = %d (%p)\n",
  349. status, status ));
  350. return( status );
  351. }
  352. DNS_STATUS
  353. DNS_API_FUNCTION
  354. DnssrvCreateZoneEx(
  355. IN LPCWSTR Server,
  356. IN LPCSTR pszZoneName,
  357. IN DWORD dwZoneType,
  358. IN DWORD fAllowUpdate,
  359. IN DWORD dwCreateFlags,
  360. IN LPCSTR pszAdminEmailName,
  361. IN DWORD cMasters,
  362. IN PIP_ADDRESS aipMasters,
  363. IN BOOL bDsIntegrated,
  364. IN LPCSTR pszDataFile,
  365. IN DWORD dwTimeout, // for forwarder zones
  366. IN DWORD fSlave, // for forwarder zones
  367. IN DWORD dwDpFlags, // for directory partition
  368. IN LPCSTR pszDpFqdn // for directory partition
  369. )
  370. {
  371. DNS_STATUS status;
  372. DNS_RPC_ZONE_CREATE_INFO zoneInfo;
  373. PIP_ARRAY arrayIp = NULL;
  374. RtlZeroMemory(
  375. &zoneInfo,
  376. sizeof( DNS_RPC_ZONE_CREATE_INFO ) );
  377. INITIALIZE_RPC_STRUCT( ZONE_CREATE_INFO, zoneInfo );
  378. if ( cMasters && aipMasters )
  379. {
  380. arrayIp = Dns_BuildIpArray(
  381. cMasters,
  382. aipMasters );
  383. if ( !arrayIp && cMasters )
  384. {
  385. return( DNS_ERROR_NO_MEMORY );
  386. }
  387. }
  388. zoneInfo.pszZoneName = (LPSTR) pszZoneName;
  389. zoneInfo.dwZoneType = dwZoneType;
  390. zoneInfo.fAllowUpdate = fAllowUpdate;
  391. zoneInfo.fAging = 0;
  392. zoneInfo.dwFlags = dwCreateFlags;
  393. zoneInfo.fDsIntegrated = (DWORD) bDsIntegrated;
  394. // temp backward compat
  395. zoneInfo.fLoadExisting = !!(dwCreateFlags & DNS_ZONE_LOAD_EXISTING); // JJW WTF???
  396. zoneInfo.pszDataFile = (LPSTR) pszDataFile;
  397. zoneInfo.pszAdmin = (LPSTR) pszAdminEmailName;
  398. zoneInfo.aipMasters = arrayIp;
  399. zoneInfo.dwTimeout = dwTimeout;
  400. zoneInfo.fSlave = fSlave;
  401. zoneInfo.dwDpFlags = dwDpFlags;
  402. zoneInfo.pszDpFqdn = ( LPSTR ) pszDpFqdn;
  403. status = DnssrvOperation(
  404. Server,
  405. NULL, // server operation
  406. DNSSRV_OP_ZONE_CREATE,
  407. DNSSRV_TYPEID_ZONE_CREATE,
  408. (PVOID) &zoneInfo
  409. );
  410. FREE_HEAP( arrayIp );
  411. return( status );
  412. }
  413. DNS_STATUS
  414. DNS_API_FUNCTION
  415. DnssrvCreateZone(
  416. IN LPCWSTR Server,
  417. IN LPCSTR pszZoneName,
  418. IN DWORD dwZoneType,
  419. IN LPCSTR pszAdminEmailName,
  420. IN DWORD cMasters,
  421. IN PIP_ADDRESS aipMasters,
  422. IN DWORD fLoadExisting,
  423. IN DWORD fDsIntegrated,
  424. IN LPCSTR pszDataFile,
  425. IN DWORD dwTimeout,
  426. IN DWORD fSlave
  427. )
  428. {
  429. DWORD flags = 0;
  430. DWORD dpFlags = 0;
  431. if ( fLoadExisting )
  432. {
  433. flags = DNS_ZONE_LOAD_EXISTING;
  434. }
  435. return DnssrvCreateZoneEx(
  436. Server,
  437. pszZoneName,
  438. dwZoneType,
  439. 0, // update unknown, send off
  440. flags, // load flags
  441. pszAdminEmailName,
  442. cMasters,
  443. aipMasters,
  444. fDsIntegrated,
  445. pszDataFile,
  446. dwTimeout,
  447. fSlave,
  448. dpFlags, // dwDirPartFlag
  449. NULL // pszDirPartFqdn
  450. );
  451. }
  452. DNS_STATUS
  453. DNS_API_FUNCTION
  454. DnssrvCreateZoneForDcPromo(
  455. IN LPCWSTR Server,
  456. IN LPCSTR pszZoneName,
  457. IN LPCSTR pszDataFile
  458. )
  459. {
  460. return DnssrvCreateZoneEx(
  461. Server,
  462. pszZoneName,
  463. 1, // primary
  464. 0, // update unknown, send off
  465. DNS_ZONE_CREATE_FOR_DCPROMO,
  466. NULL, // no admin name
  467. 0, // no masters
  468. NULL,
  469. FALSE, // not DS integrated
  470. pszDataFile,
  471. 0, // timeout - for forwarder zones
  472. 0, // slave - for forwarder zones
  473. 0, // dwDirPartFlag
  474. NULL // pszDirPartFqdn
  475. );
  476. }
  477. DNS_STATUS
  478. DNS_API_FUNCTION
  479. DnssrvCreateZoneInDirectoryPartition(
  480. IN LPCWSTR pwszServer,
  481. IN LPCSTR pszZoneName,
  482. IN DWORD dwZoneType,
  483. IN LPCSTR pszAdminEmailName,
  484. IN DWORD cMasters,
  485. IN PIP_ADDRESS aipMasters,
  486. IN DWORD fLoadExisting,
  487. IN DWORD dwTimeout,
  488. IN DWORD fSlave,
  489. IN DWORD dwDirPartFlags,
  490. IN LPCSTR pszDirPartFqdn
  491. )
  492. {
  493. DWORD dwFlags = 0;
  494. if ( fLoadExisting )
  495. {
  496. dwFlags = DNS_ZONE_LOAD_EXISTING;
  497. }
  498. return DnssrvCreateZoneEx(
  499. pwszServer,
  500. pszZoneName,
  501. dwZoneType,
  502. 0, // allow update
  503. dwFlags,
  504. pszAdminEmailName,
  505. 0, // masters count
  506. NULL, // masters array
  507. TRUE, // DS integrated
  508. NULL, // data file
  509. dwTimeout, // for forwarder zones
  510. fSlave, // for forwarder zones
  511. dwDirPartFlags,
  512. pszDirPartFqdn );
  513. }
  514. DNS_STATUS
  515. DNS_API_FUNCTION
  516. DnssrvClearStatistics(
  517. IN LPCWSTR Server
  518. )
  519. {
  520. DNS_STATUS status;
  521. status = DnssrvOperation(
  522. Server,
  523. NULL,
  524. DNSSRV_OP_CLEAR_STATISTICS,
  525. DNSSRV_TYPEID_NULL,
  526. (PVOID) NULL
  527. );
  528. return( status );
  529. }
  530. DNS_STATUS
  531. DNS_API_FUNCTION
  532. DnssrvResetServerListenAddresses(
  533. IN LPCWSTR Server,
  534. IN DWORD cListenAddrs,
  535. IN PIP_ADDRESS aipListenAddrs
  536. )
  537. {
  538. DNS_STATUS status;
  539. PIP_ARRAY arrayIp;
  540. arrayIp = Dns_BuildIpArray(
  541. cListenAddrs,
  542. aipListenAddrs );
  543. if ( !arrayIp && cListenAddrs )
  544. {
  545. return( DNS_ERROR_NO_MEMORY );
  546. }
  547. status = DnssrvOperation(
  548. Server,
  549. NULL,
  550. DNS_REGKEY_LISTEN_ADDRESSES,
  551. DNSSRV_TYPEID_IPARRAY,
  552. (PVOID) arrayIp
  553. );
  554. FREE_HEAP( arrayIp );
  555. return( status );
  556. }
  557. DNS_STATUS
  558. DNS_API_FUNCTION
  559. DnssrvResetForwarders(
  560. IN LPCWSTR Server,
  561. IN DWORD cForwarders,
  562. IN PIP_ADDRESS aipForwarders,
  563. IN DWORD dwForwardTimeout,
  564. IN DWORD fSlave
  565. )
  566. {
  567. DNS_STATUS status;
  568. DNS_RPC_FORWARDERS forwarders;
  569. PIP_ARRAY arrayIp;
  570. INITIALIZE_RPC_STRUCT( FORWARDERS, forwarders );
  571. arrayIp = Dns_BuildIpArray(
  572. cForwarders,
  573. aipForwarders );
  574. if ( !arrayIp && cForwarders )
  575. {
  576. return( DNS_ERROR_NO_MEMORY );
  577. }
  578. forwarders.fSlave = fSlave;
  579. forwarders.dwForwardTimeout = dwForwardTimeout;
  580. forwarders.aipForwarders = arrayIp;
  581. status = DnssrvOperation(
  582. Server,
  583. NULL,
  584. DNS_REGKEY_FORWARDERS,
  585. DNSSRV_TYPEID_FORWARDERS,
  586. (PVOID) &forwarders
  587. );
  588. FREE_HEAP( arrayIp );
  589. return( status );
  590. }
  591. //
  592. // Zone Queries
  593. //
  594. DNS_STATUS
  595. DNS_API_FUNCTION
  596. DnssrvGetZoneInfo(
  597. IN LPCWSTR Server,
  598. IN LPCSTR pszZone,
  599. OUT PDNS_RPC_ZONE_INFO * ppZoneInfo
  600. )
  601. {
  602. DNS_STATUS status;
  603. DWORD typeId;
  604. status = DnssrvQuery(
  605. Server,
  606. pszZone,
  607. DNSSRV_QUERY_ZONE_INFO,
  608. & typeId,
  609. ppZoneInfo
  610. );
  611. ASSERT(
  612. (status == ERROR_SUCCESS && typeId == DNSSRV_TYPEID_ZONE_INFO) ||
  613. (status != ERROR_SUCCESS && *ppZoneInfo == NULL ) );
  614. return( status );
  615. }
  616. //
  617. // Zone Operations
  618. //
  619. DNS_STATUS
  620. DNS_API_FUNCTION
  621. DnssrvResetZoneTypeEx(
  622. IN LPCWSTR Server,
  623. IN LPCSTR pszZoneName,
  624. IN DWORD dwZoneType,
  625. IN DWORD cMasters,
  626. IN PIP_ADDRESS aipMasters,
  627. IN DWORD dwLoadOptions,
  628. IN DWORD fDsIntegrated,
  629. IN LPCSTR pszDataFile
  630. )
  631. {
  632. DNS_STATUS status;
  633. DNS_RPC_ZONE_CREATE_INFO zoneInfo;
  634. PIP_ARRAY arrayIp = NULL;
  635. RtlZeroMemory(
  636. &zoneInfo,
  637. sizeof(DNS_RPC_ZONE_CREATE_INFO) );
  638. INITIALIZE_RPC_STRUCT( ZONE_CREATE_INFO, zoneInfo );
  639. if ( cMasters )
  640. {
  641. arrayIp = Dns_BuildIpArray(
  642. cMasters,
  643. aipMasters );
  644. if ( !arrayIp )
  645. {
  646. return( DNS_ERROR_NO_MEMORY );
  647. }
  648. }
  649. zoneInfo.pszZoneName = (LPSTR) pszZoneName;
  650. zoneInfo.dwZoneType = dwZoneType;
  651. zoneInfo.fDsIntegrated = fDsIntegrated;
  652. zoneInfo.fLoadExisting = dwLoadOptions;
  653. zoneInfo.pszDataFile = (LPSTR) pszDataFile;
  654. zoneInfo.pszAdmin = NULL;
  655. zoneInfo.aipMasters = arrayIp;
  656. status = DnssrvOperation(
  657. Server,
  658. pszZoneName,
  659. DNSSRV_OP_ZONE_TYPE_RESET,
  660. DNSSRV_TYPEID_ZONE_CREATE,
  661. (PVOID) &zoneInfo
  662. );
  663. FREE_HEAP( arrayIp );
  664. return( status );
  665. }
  666. DNS_STATUS
  667. DNS_API_FUNCTION
  668. DnssrvRenameZone(
  669. IN LPCWSTR Server,
  670. IN LPCSTR pszCurrentZoneName,
  671. IN LPCSTR pszNewZoneName,
  672. IN LPCSTR pszNewFileName
  673. )
  674. {
  675. DNS_STATUS status;
  676. DNS_RPC_ZONE_RENAME_INFO renameInfo;
  677. RtlZeroMemory(
  678. &renameInfo,
  679. sizeof( DNS_RPC_ZONE_RENAME_INFO ) );
  680. INITIALIZE_RPC_STRUCT( ZONE_RENAME_INFO, renameInfo );
  681. renameInfo.pszNewZoneName = ( LPSTR ) pszNewZoneName;
  682. renameInfo.pszNewFileName = ( LPSTR ) pszNewFileName;
  683. status = DnssrvOperation(
  684. Server,
  685. pszCurrentZoneName,
  686. DNSSRV_OP_ZONE_RENAME,
  687. DNSSRV_TYPEID_ZONE_RENAME,
  688. ( PVOID ) &renameInfo );
  689. return status;
  690. }
  691. DNS_STATUS
  692. DNS_API_FUNCTION
  693. DnssrvChangeZoneDirectoryPartition(
  694. IN LPCWSTR Server,
  695. IN LPCSTR pszZoneName,
  696. IN LPCSTR pszNewPartitionName
  697. )
  698. {
  699. DNS_STATUS status;
  700. DNS_RPC_ZONE_CHANGE_DP rpcInfo;
  701. RtlZeroMemory(
  702. &rpcInfo,
  703. sizeof( DNS_RPC_ZONE_CHANGE_DP ) );
  704. INITIALIZE_RPC_STRUCT( ZONE_RENAME_INFO, rpcInfo );
  705. rpcInfo.pszDestPartition = ( LPSTR ) pszNewPartitionName;
  706. status = DnssrvOperation(
  707. Server,
  708. pszZoneName,
  709. DNSSRV_OP_ZONE_CHANGE_DP,
  710. DNSSRV_TYPEID_ZONE_CHANGE_DP,
  711. ( PVOID ) &rpcInfo );
  712. return status;
  713. }
  714. DNS_STATUS
  715. DNS_API_FUNCTION
  716. DnssrvExportZone(
  717. IN LPCWSTR Server,
  718. IN LPCSTR pszZoneName,
  719. IN LPCSTR pszZoneExportFile
  720. )
  721. {
  722. DNS_STATUS status;
  723. DNS_RPC_ZONE_EXPORT_INFO info;
  724. RtlZeroMemory(
  725. &info,
  726. sizeof( DNS_RPC_ZONE_EXPORT_INFO ) );
  727. INITIALIZE_RPC_STRUCT( ZONE_EXPORT_INFO, info );
  728. info.pszZoneExportFile = ( LPSTR ) pszZoneExportFile;
  729. status = DnssrvOperation(
  730. Server,
  731. pszZoneName,
  732. DNSSRV_OP_ZONE_EXPORT,
  733. DNSSRV_TYPEID_ZONE_EXPORT,
  734. ( PVOID ) &info );
  735. return status;
  736. }
  737. DNS_STATUS
  738. DNS_API_FUNCTION
  739. DnssrvResetZoneMastersEx(
  740. IN LPCWSTR Server,
  741. IN LPCSTR pszZone,
  742. IN DWORD cMasters,
  743. IN PIP_ADDRESS aipMasters,
  744. IN DWORD fSetLocalMasters
  745. )
  746. {
  747. DNS_STATUS status;
  748. PIP_ARRAY arrayIp;
  749. arrayIp = Dns_BuildIpArray(
  750. cMasters,
  751. aipMasters );
  752. if ( !arrayIp && cMasters )
  753. {
  754. return( DNS_ERROR_NO_MEMORY );
  755. }
  756. status = DnssrvOperation(
  757. Server,
  758. pszZone,
  759. fSetLocalMasters ?
  760. DNS_REGKEY_ZONE_LOCAL_MASTERS :
  761. DNS_REGKEY_ZONE_MASTERS,
  762. DNSSRV_TYPEID_IPARRAY,
  763. (PVOID) arrayIp );
  764. FREE_HEAP( arrayIp );
  765. return( status );
  766. }
  767. DNS_STATUS
  768. DNS_API_FUNCTION
  769. DnssrvResetZoneMasters(
  770. IN LPCWSTR Server,
  771. IN LPCSTR pszZone,
  772. IN DWORD cMasters,
  773. IN PIP_ADDRESS aipMasters
  774. )
  775. {
  776. DNS_STATUS status;
  777. PIP_ARRAY arrayIp;
  778. arrayIp = Dns_BuildIpArray(
  779. cMasters,
  780. aipMasters );
  781. if ( !arrayIp && cMasters )
  782. {
  783. return( DNS_ERROR_NO_MEMORY );
  784. }
  785. status = DnssrvOperation(
  786. Server,
  787. pszZone,
  788. DNS_REGKEY_ZONE_MASTERS,
  789. DNSSRV_TYPEID_IPARRAY,
  790. (PVOID) arrayIp
  791. );
  792. FREE_HEAP( arrayIp );
  793. return( status );
  794. }
  795. DNS_STATUS
  796. DNS_API_FUNCTION
  797. DnssrvResetZoneSecondaries(
  798. IN LPCWSTR Server,
  799. IN LPCSTR pszZone,
  800. IN DWORD fSecureSecondaries,
  801. IN DWORD cSecondaries,
  802. IN PIP_ADDRESS aipSecondaries,
  803. IN DWORD fNotifyLevel,
  804. IN DWORD cNotify,
  805. IN PIP_ADDRESS aipNotify
  806. )
  807. {
  808. DNS_STATUS status;
  809. DNS_RPC_ZONE_SECONDARIES secondaryInfo;
  810. PIP_ARRAY arrayIp;
  811. INITIALIZE_RPC_STRUCT( ZONE_SECONDARIES, secondaryInfo );
  812. arrayIp = Dns_BuildIpArray(
  813. cSecondaries,
  814. aipSecondaries );
  815. if ( !arrayIp && cSecondaries )
  816. {
  817. return( DNS_ERROR_NO_MEMORY );
  818. }
  819. secondaryInfo.fSecureSecondaries = fSecureSecondaries;
  820. secondaryInfo.aipSecondaries = arrayIp;
  821. arrayIp = Dns_BuildIpArray(
  822. cNotify,
  823. aipNotify );
  824. if ( !arrayIp && cNotify )
  825. {
  826. return( DNS_ERROR_NO_MEMORY );
  827. }
  828. secondaryInfo.aipNotify = arrayIp;
  829. secondaryInfo.fNotifyLevel = fNotifyLevel;
  830. status = DnssrvOperation(
  831. Server,
  832. pszZone,
  833. DNS_REGKEY_ZONE_SECONDARIES,
  834. DNSSRV_TYPEID_ZONE_SECONDARIES,
  835. (PVOID) &secondaryInfo
  836. );
  837. FREE_HEAP( secondaryInfo.aipNotify );
  838. FREE_HEAP( secondaryInfo.aipSecondaries );
  839. return( status );
  840. }
  841. #if 0
  842. DNS_STATUS
  843. DNS_API_FUNCTION
  844. DnssrvResetZoneScavengeServers(
  845. IN LPCWSTR Server,
  846. IN LPCSTR pszZone,
  847. IN DWORD cServers,
  848. IN PIP_ADDRESS aipServers
  849. )
  850. {
  851. DNS_STATUS status;
  852. PIP_ARRAY arrayIp;
  853. arrayIp = Dns_BuildIpArray(
  854. cServers,
  855. aipServers );
  856. if ( !arrayIp && cSecondaries )
  857. {
  858. return( DNS_ERROR_NO_MEMORY );
  859. }
  860. status = DnssrvOperation(
  861. Server,
  862. pszZone,
  863. DNS_REGKEY_ZONE_SCAVENGE_SERVERS,
  864. DNSSRV_TYPEID_IPARRAY,
  865. arrayIp
  866. );
  867. FREE_HEAP( arrayIp );
  868. return( status );
  869. }
  870. #endif
  871. //
  872. // Zone management API
  873. //
  874. DNS_STATUS
  875. DNS_API_FUNCTION
  876. DnssrvIncrementZoneVersion(
  877. IN LPCWSTR Server,
  878. IN LPCSTR pszZone
  879. )
  880. {
  881. return DnssrvOperation(
  882. Server,
  883. pszZone,
  884. DNSSRV_OP_ZONE_INCREMENT_VERSION,
  885. DNSSRV_TYPEID_NULL,
  886. (PVOID) NULL
  887. );
  888. }
  889. DNS_STATUS
  890. DNS_API_FUNCTION
  891. DnssrvDeleteZone(
  892. IN LPCWSTR Server,
  893. IN LPCSTR pszZone
  894. )
  895. {
  896. return DnssrvOperation(
  897. Server,
  898. pszZone,
  899. DNSSRV_OP_ZONE_DELETE,
  900. DNSSRV_TYPEID_NULL,
  901. (PVOID) NULL
  902. );
  903. }
  904. DNS_STATUS
  905. DNS_API_FUNCTION
  906. DnssrvPauseZone(
  907. IN LPCWSTR Server,
  908. IN LPCSTR pszZone
  909. )
  910. {
  911. return DnssrvOperation(
  912. Server,
  913. pszZone,
  914. DNSSRV_OP_ZONE_PAUSE,
  915. DNSSRV_TYPEID_NULL,
  916. (PVOID) NULL
  917. );
  918. }
  919. DNS_STATUS
  920. DNS_API_FUNCTION
  921. DnssrvResumeZone(
  922. IN LPCWSTR Server,
  923. IN LPCSTR pszZone
  924. )
  925. {
  926. return DnssrvOperation(
  927. Server,
  928. pszZone,
  929. DNSSRV_OP_ZONE_RESUME,
  930. DNSSRV_TYPEID_NULL,
  931. (PVOID) NULL
  932. );
  933. }
  934. //
  935. // Record viewing API
  936. //
  937. DNS_STATUS
  938. DNS_API_FUNCTION
  939. DnssrvEnumRecordsAndConvertNodes(
  940. IN LPCWSTR pszServer,
  941. IN LPCSTR pszZoneName,
  942. IN LPCSTR pszNodeName,
  943. IN LPCSTR pszStartChild,
  944. IN WORD wRecordType,
  945. IN DWORD dwSelectFlag,
  946. IN LPCSTR pszFilterStart,
  947. IN LPCSTR pszFilterStop,
  948. OUT PDNS_NODE * ppNodeFirst,
  949. OUT PDNS_NODE * ppNodeLast
  950. )
  951. {
  952. DNS_STATUS status;
  953. PDNS_NODE pnode;
  954. PDNS_NODE pnodeLast;
  955. PBYTE pbuffer;
  956. DWORD bufferLength;
  957. //
  958. // get records from server
  959. //
  960. status = DnssrvEnumRecords(
  961. pszServer,
  962. pszZoneName,
  963. pszNodeName,
  964. pszStartChild,
  965. wRecordType,
  966. dwSelectFlag,
  967. pszFilterStart,
  968. pszFilterStop,
  969. & bufferLength,
  970. & pbuffer );
  971. if ( status != ERROR_SUCCESS && status != ERROR_MORE_DATA )
  972. {
  973. return( status );
  974. }
  975. //
  976. // pull nodes and records out of RPC buffer
  977. //
  978. pnode = DnsConvertRpcBuffer(
  979. & pnodeLast,
  980. bufferLength,
  981. pbuffer,
  982. TRUE // convert unicode
  983. );
  984. if ( !pnode )
  985. {
  986. DNS_PRINT((
  987. "ERROR: failure converting RPC buffer to DNS records\n"
  988. "\tstatus = %p\n",
  989. GetLastError() ));
  990. ASSERT( FALSE );
  991. return( ERROR_INVALID_DATA );
  992. }
  993. *ppNodeFirst = pnode;
  994. *ppNodeLast = pnodeLast;
  995. return( status );
  996. }
  997. //
  998. // Record management API
  999. //
  1000. DNS_STATUS
  1001. DNS_API_FUNCTION
  1002. DnssrvDeleteNode(
  1003. IN LPCWSTR Server,
  1004. IN LPCSTR pszZoneName,
  1005. IN LPCSTR pszNodeName,
  1006. IN BOOL bDeleteSubtree
  1007. )
  1008. {
  1009. DNS_RPC_NAME_AND_PARAM param;
  1010. param.dwParam = (DWORD) bDeleteSubtree;
  1011. param.pszNodeName = (LPSTR) pszNodeName;
  1012. return DnssrvOperation(
  1013. Server,
  1014. pszZoneName,
  1015. DNSSRV_OP_DELETE_NODE,
  1016. DNSSRV_TYPEID_NAME_AND_PARAM,
  1017. (PVOID) &param
  1018. );
  1019. }
  1020. DNS_STATUS
  1021. DNS_API_FUNCTION
  1022. DnssrvDeleteRecordSet(
  1023. IN LPCWSTR Server,
  1024. IN LPCSTR pszZoneName,
  1025. IN LPCSTR pszNodeName,
  1026. IN WORD wType
  1027. )
  1028. {
  1029. DNS_RPC_NAME_AND_PARAM param;
  1030. param.dwParam = (DWORD) wType;
  1031. param.pszNodeName = (LPSTR) pszNodeName;
  1032. return DnssrvOperation(
  1033. Server,
  1034. pszZoneName,
  1035. DNSSRV_OP_DELETE_RECORD_SET,
  1036. DNSSRV_TYPEID_NAME_AND_PARAM,
  1037. (PVOID) &param
  1038. );
  1039. }
  1040. DNS_STATUS
  1041. DNS_API_FUNCTION
  1042. DnssrvForceAging(
  1043. IN LPCWSTR Server,
  1044. IN LPCSTR pszZoneName,
  1045. IN LPCSTR pszNodeName,
  1046. IN BOOL bAgeSubtree
  1047. )
  1048. {
  1049. DNS_RPC_NAME_AND_PARAM param;
  1050. param.dwParam = (DWORD) bAgeSubtree;
  1051. param.pszNodeName = (LPSTR) pszNodeName;
  1052. return DnssrvOperation(
  1053. Server,
  1054. pszZoneName,
  1055. DNSSRV_OP_FORCE_AGING_ON_NODE,
  1056. DNSSRV_TYPEID_NAME_AND_PARAM,
  1057. (PVOID) &param
  1058. );
  1059. }
  1060. //
  1061. // Server API
  1062. //
  1063. DNS_STATUS
  1064. DNS_API_FUNCTION
  1065. DnssrvEnumZones(
  1066. IN LPCWSTR Server,
  1067. IN DWORD dwFilter,
  1068. IN LPCSTR pszLastZone,
  1069. OUT PDNS_RPC_ZONE_LIST * ppZoneList
  1070. )
  1071. {
  1072. DNS_STATUS status;
  1073. DWORD typeId;
  1074. PDNS_RPC_ZONE_LIST pzoneEnum = NULL;
  1075. IF_DNSDBG( STUB )
  1076. {
  1077. DNS_PRINT((
  1078. "Enter DnssrvEnumZones()\n"
  1079. "\tServer = %s\n"
  1080. "\tFilter = %p\n"
  1081. "\tLastZone = %s\n"
  1082. //"\tpdwZoneCount = %p\n"
  1083. "\tppZoneList = %p\n",
  1084. Server,
  1085. dwFilter,
  1086. pszLastZone,
  1087. // pdwZoneCount,
  1088. ppZoneList
  1089. ));
  1090. }
  1091. status = DnssrvComplexOperation(
  1092. Server,
  1093. NULL,
  1094. DNSSRV_OP_ENUM_ZONES,
  1095. DNSSRV_TYPEID_DWORD, // DWORD filter in
  1096. (PVOID) (DWORD_PTR) dwFilter,
  1097. & typeId, // enumeration out
  1098. (PVOID*) &pzoneEnum );
  1099. if ( status != DNS_ERROR_NT4 )
  1100. {
  1101. ASSERT(
  1102. ( status == ERROR_SUCCESS && typeId == DNSSRV_TYPEID_ZONE_LIST ) ||
  1103. ( status != ERROR_SUCCESS && pzoneEnum == NULL ) );
  1104. if ( pzoneEnum )
  1105. {
  1106. *ppZoneList = pzoneEnum;
  1107. }
  1108. else
  1109. {
  1110. *ppZoneList = NULL;
  1111. }
  1112. }
  1113. return( status );
  1114. }
  1115. DNS_STATUS
  1116. DNS_API_FUNCTION
  1117. DnssrvEnumDirectoryPartitions(
  1118. IN LPCWSTR Server,
  1119. IN DWORD dwFilter,
  1120. OUT PDNS_RPC_DP_LIST * ppDpList
  1121. )
  1122. {
  1123. DNS_STATUS status;
  1124. DWORD dwTypeId;
  1125. PDNS_RPC_DP_LIST pDpList = NULL;
  1126. IF_DNSDBG( STUB )
  1127. {
  1128. DNS_PRINT((
  1129. "Enter DnssrvEnumDirectoryPartitions()\n"
  1130. "\tServer = %S\n"
  1131. "\tppDpList = %p\n",
  1132. Server,
  1133. ppDpList ));
  1134. }
  1135. status = DnssrvComplexOperation(
  1136. Server,
  1137. NULL,
  1138. DNSSRV_OP_ENUM_DPS,
  1139. DNSSRV_TYPEID_DWORD,
  1140. ( PVOID ) ( DWORD_PTR ) dwFilter,
  1141. &dwTypeId,
  1142. ( PVOID * ) &pDpList );
  1143. ASSERT( ( status == ERROR_SUCCESS &&
  1144. dwTypeId == DNSSRV_TYPEID_DP_LIST ) ||
  1145. ( status != ERROR_SUCCESS && pDpList == NULL ) );
  1146. *ppDpList = pDpList;
  1147. return status;
  1148. } // DnssrvEnumDirectoryPartitions
  1149. DNS_STATUS
  1150. DNS_API_FUNCTION
  1151. DnssrvDirectoryPartitionInfo(
  1152. IN LPCWSTR Server,
  1153. IN LPSTR pszDpFqdn,
  1154. OUT PDNS_RPC_DP_INFO * ppDpInfo
  1155. )
  1156. {
  1157. DNS_STATUS status;
  1158. DWORD dwTypeId;
  1159. PDNS_RPC_DP_INFO pDpInfo = NULL;
  1160. IF_DNSDBG( STUB )
  1161. {
  1162. DNS_PRINT((
  1163. "Enter DnssrvDirectoryPartitionInfo()\n"
  1164. "\tServer = %S\n"
  1165. "\tpszDpFqdn = %s\n"
  1166. "\tppDpInfo = %p\n",
  1167. Server,
  1168. pszDpFqdn,
  1169. ppDpInfo ));
  1170. }
  1171. status = DnssrvComplexOperation(
  1172. Server,
  1173. NULL,
  1174. DNSSRV_OP_DP_INFO,
  1175. DNSSRV_TYPEID_LPSTR,
  1176. ( PVOID ) ( DWORD_PTR ) pszDpFqdn,
  1177. &dwTypeId,
  1178. ( PVOID * ) &pDpInfo );
  1179. ASSERT( ( status == ERROR_SUCCESS &&
  1180. dwTypeId == DNSSRV_TYPEID_DP_INFO ) ||
  1181. status != ERROR_SUCCESS );
  1182. *ppDpInfo = pDpInfo;
  1183. return status;
  1184. } // DnssrvDirectoryPartitionInfo
  1185. DNS_STATUS
  1186. DNS_API_FUNCTION
  1187. DnssrvEnlistDirectoryPartition(
  1188. IN LPCWSTR pszServer,
  1189. IN DWORD dwOperation,
  1190. IN LPCSTR pszDirPartFqdn
  1191. )
  1192. {
  1193. DNS_STATUS status;
  1194. DWORD dwTypeId;
  1195. DNS_RPC_ENLIST_DP param = { 0 };
  1196. INITIALIZE_RPC_STRUCT( ENLIST_DP, param );
  1197. IF_DNSDBG( STUB )
  1198. {
  1199. DNS_PRINT((
  1200. "Enter DnssrvEnlistDirectoryPartition()\n"
  1201. "\tpszServer = %S\n"
  1202. "\tdwOperation = %d\n"
  1203. "\tpszDirPartFqdn = %s\n",
  1204. pszServer,
  1205. dwOperation,
  1206. pszDirPartFqdn ));
  1207. }
  1208. param.pszDpFqdn = ( LPSTR ) pszDirPartFqdn;
  1209. param.dwOperation = dwOperation;
  1210. status = DnssrvOperation(
  1211. pszServer,
  1212. NULL,
  1213. DNSSRV_OP_ENLIST_DP,
  1214. DNSSRV_TYPEID_ENLIST_DP,
  1215. &param );
  1216. return status;
  1217. } // DnssrvEnlistDirectoryPartition
  1218. DNS_STATUS
  1219. DNS_API_FUNCTION
  1220. DnssrvSetupDefaultDirectoryPartitions(
  1221. IN LPCWSTR pszServer,
  1222. IN DWORD dwParam
  1223. )
  1224. {
  1225. DNS_STATUS status;
  1226. DWORD dwTypeId;
  1227. IF_DNSDBG( STUB )
  1228. {
  1229. DNS_PRINT((
  1230. "Enter DnssrvSetupDefaultDirectoryPartitions()\n"
  1231. "\tpszServer = %S\n"
  1232. "\tdwParam = %d\n",
  1233. pszServer,
  1234. dwParam ));
  1235. }
  1236. status = DnssrvOperation(
  1237. pszServer,
  1238. NULL,
  1239. DNSSRV_OP_ENLIST_DP,
  1240. DNSSRV_TYPEID_DWORD,
  1241. ( PVOID ) ( DWORD_PTR) dwParam );
  1242. return status;
  1243. } // DnssrvSetupDefaultDirectoryPartitions
  1244. DNS_STATUS
  1245. DNS_API_FUNCTION
  1246. DnssrvGetStatistics(
  1247. IN LPCWSTR Server,
  1248. IN DWORD dwFilter,
  1249. OUT PDNS_RPC_BUFFER * ppStatsBuffer
  1250. )
  1251. {
  1252. DNS_STATUS status;
  1253. DWORD typeId;
  1254. PDNS_RPC_BUFFER pstatsBuf = NULL;
  1255. IF_DNSDBG( STUB )
  1256. {
  1257. DNS_PRINT((
  1258. "Enter DnssrvGetStatistics()\n"
  1259. "\tServer = %s\n"
  1260. "\tFilter = %p\n"
  1261. "\tppStatsBuf = %p\n",
  1262. Server,
  1263. dwFilter,
  1264. ppStatsBuffer
  1265. ));
  1266. }
  1267. status = DnssrvComplexOperation(
  1268. Server,
  1269. NULL,
  1270. DNSSRV_QUERY_STATISTICS,
  1271. DNSSRV_TYPEID_DWORD, // DWORD filter in
  1272. (PVOID) (DWORD_PTR) dwFilter,
  1273. & typeId, // enumeration out
  1274. (PVOID*) &pstatsBuf
  1275. );
  1276. ASSERT( (status == ERROR_SUCCESS && typeId == DNSSRV_TYPEID_BUFFER )
  1277. || (status != ERROR_SUCCESS && pstatsBuf == NULL ) );
  1278. *ppStatsBuffer = pstatsBuf;
  1279. return( status );
  1280. }
  1281. DNS_STATUS
  1282. DNS_API_FUNCTION
  1283. DnssrvWriteDirtyZones(
  1284. IN LPCWSTR Server
  1285. )
  1286. {
  1287. DNS_STATUS status;
  1288. status = DnssrvOperation(
  1289. Server,
  1290. NULL,
  1291. DNSSRV_OP_WRITE_DIRTY_ZONES,
  1292. DNSSRV_TYPEID_NULL,
  1293. NULL
  1294. );
  1295. return( status );
  1296. }
  1297. //
  1298. // Old zone API -- discontinued
  1299. //
  1300. DNS_STATUS
  1301. DNS_API_FUNCTION
  1302. DnssrvResetZoneType(
  1303. IN LPCWSTR Server,
  1304. IN LPCSTR pszZone,
  1305. IN DWORD dwZoneType,
  1306. IN DWORD cMasters,
  1307. IN PIP_ADDRESS aipMasters
  1308. )
  1309. {
  1310. DNS_STATUS status;
  1311. DNS_RPC_ZONE_TYPE_RESET typeReset;
  1312. PIP_ARRAY arrayIp;
  1313. INITIALIZE_RPC_STRUCT( ZONE_TYPE_RESET, typeReset );
  1314. arrayIp = Dns_BuildIpArray(
  1315. cMasters,
  1316. aipMasters );
  1317. if ( !arrayIp && cMasters )
  1318. {
  1319. return( DNS_ERROR_NO_MEMORY );
  1320. }
  1321. typeReset.dwZoneType = dwZoneType;
  1322. typeReset.aipMasters = arrayIp;
  1323. status = DnssrvOperation(
  1324. Server,
  1325. pszZone,
  1326. DNS_REGKEY_ZONE_TYPE,
  1327. DNSSRV_TYPEID_ZONE_TYPE_RESET,
  1328. (PVOID) &typeReset
  1329. );
  1330. FREE_HEAP( arrayIp );
  1331. return( status );
  1332. }
  1333. DNS_STATUS
  1334. DNS_API_FUNCTION
  1335. DnssrvResetZoneDatabase(
  1336. IN LPCWSTR Server,
  1337. IN LPCSTR pszZone,
  1338. IN DWORD fDsIntegrated,
  1339. IN LPCSTR pszDataFile
  1340. )
  1341. {
  1342. DNS_STATUS status;
  1343. DNS_RPC_ZONE_DATABASE dbase;
  1344. INITIALIZE_RPC_STRUCT( ZONE_DATABASE, dbase );
  1345. dbase.fDsIntegrated = fDsIntegrated;
  1346. dbase.pszFileName = (LPSTR) pszDataFile;
  1347. return DnssrvOperation(
  1348. Server,
  1349. pszZone,
  1350. DNS_REGKEY_ZONE_FILE,
  1351. DNSSRV_TYPEID_ZONE_DATABASE,
  1352. (PVOID) &dbase
  1353. );
  1354. }
  1355. //
  1356. // End remote.c
  1357. //