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.

783 lines
22 KiB

  1. // wamreg.cpp : Implementation of DLL Exports.
  2. // Note: Proxy/Stub Information
  3. // To merge the proxy/stub code into the object DLL, add the file
  4. // dlldatax.c to the project. Make sure precompiled headers
  5. // are turned off for this file, and add _MERGE_PROXYSTUB to the
  6. // defines for the project.
  7. //
  8. // If you are not running WinNT4.0 or Win95 with DCOM, then you
  9. // need to remove the following define from dlldatax.c
  10. // #define _WIN32_WINNT 0x0400
  11. //
  12. // Further, if you are running MIDL without /Oicf switch, you also
  13. // need to remove the following define from dlldatax.c.
  14. // #define USE_STUBLESS_PROXY
  15. //
  16. // Modify the custom build rule for wamreg.idl by adding the following
  17. // files to the Outputs.
  18. // wamreg_p.c
  19. // dlldata.c
  20. // To build a separate proxy/stub DLL,
  21. // run nmake -f wamregps.mk in the project directory.
  22. #include "common.h"
  23. #include "objbase.h"
  24. #include "initguid.h"
  25. #include "iwamreg.h"
  26. #include "iadmext.h"
  27. #include "dlldatax.h"
  28. #include "auxfunc.h"
  29. #include "wmrgsv.h"
  30. #include "WamAdm.h"
  31. #include "comobj.h"
  32. #include "dbgutil.h"
  33. #ifdef _MERGE_PROXYSTUB
  34. extern "C" HINSTANCE hProxyDll;
  35. #endif
  36. #define IIS_DEFAULT_PACKAGE 0
  37. #ifdef _IIS_6_0
  38. #include "w3ctrlps.h"
  39. #endif // _IIS_6_0
  40. DECLARE_DEBUG_VARIABLE();
  41. DECLARE_DEBUG_PRINTS_OBJECT();
  42. DECLARE_PLATFORM_TYPE();
  43. const CHAR g_pszModuleName[] = "WAMREG";
  44. HINSTANCE g_hModule = NULL;
  45. /////////////////////////////////////////////////////////////////////////////
  46. // DLL Entry Point
  47. extern "C"
  48. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
  49. {
  50. lpReserved;
  51. #ifdef _MERGE_PROXYSTUB
  52. if (!PrxDllMain(hInstance, dwReason, lpReserved))
  53. return FALSE;
  54. #endif
  55. BOOL fReturn = FALSE;
  56. if (dwReason == DLL_PROCESS_ATTACH)
  57. {
  58. DisableThreadLibraryCalls(hInstance);
  59. g_hModule = hInstance;
  60. INITIALIZE_PLATFORM_TYPE();
  61. #ifdef _NO_TRACING_
  62. SET_DEBUG_FLAGS(DEBUG_ERROR);
  63. CREATE_DEBUG_PRINT_OBJECT( g_pszModuleName);
  64. #else
  65. // CREATE_DEBUG_PRINT_OBJECT( g_pszModuleName);
  66. #endif
  67. /*
  68. if ( !VALID_DEBUG_PRINT_OBJECT())
  69. {
  70. fReturn = FALSE;
  71. }
  72. else
  73. {
  74. */
  75. g_pWmRgSrvFactory = new CWmRgSrvFactory();
  76. fReturn = g_WamRegGlobal.Init();
  77. //}
  78. }
  79. else if (dwReason == DLL_PROCESS_DETACH)
  80. {
  81. g_WamRegGlobal.UnInit();
  82. delete g_pWmRgSrvFactory;
  83. DELETE_DEBUG_PRINT_OBJECT();
  84. }
  85. fReturn = TRUE; // ok
  86. return fReturn;
  87. }
  88. /////////////////////////////////////////////////////////////////////////////
  89. // Used to determine whether the DLL can be unloaded by OLE
  90. STDAPI DllCanUnloadNow(void)
  91. {
  92. #ifdef _MERGE_PROXYSTUB
  93. if (PrxDllCanUnloadNow() != S_OK)
  94. return S_FALSE;
  95. #endif
  96. if (g_dwRefCount == 0)
  97. {
  98. return S_OK;
  99. }
  100. else
  101. {
  102. return S_FALSE;
  103. }
  104. }
  105. /////////////////////////////////////////////////////////////////////////////
  106. // Returns a class factory to create an object of the requested type
  107. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  108. {
  109. HRESULT hrReturn = E_FAIL;
  110. #ifdef _MERGE_PROXYSTUB
  111. if (PrxDllGetClassObject(rclsid, riid, ppv) == S_OK)
  112. return S_OK;
  113. #endif
  114. if (rclsid == CLSID_WmRgSrv)
  115. {
  116. if (FAILED(g_pWmRgSrvFactory->QueryInterface(riid, ppv)))
  117. {
  118. *ppv = NULL;
  119. hrReturn = E_INVALIDARG;
  120. }
  121. else
  122. {
  123. hrReturn = NOERROR;
  124. }
  125. }
  126. else
  127. {
  128. hrReturn = S_OK;
  129. }
  130. return hrReturn;
  131. }
  132. HRESULT WamReg_RegisterServer()
  133. {
  134. HKEY hKeyCLSID, hKeyInproc32;
  135. HKEY hKeyIF, hKeyStub32;
  136. HKEY hKeyAppID, hKeyTemp;
  137. DWORD dwDisposition;
  138. char pszName[MAX_PATH+1 + sizeof("inetinfo.exe -e iisadmin")];
  139. HRESULT hr;
  140. //
  141. //register AppID
  142. //CLSID_WamAdmin, 0x61738644, 0xF196, 0x11D0, 0x99, 0x53, 0x00, 0xC0, 0x4F, 0xD9, 0x19, 0xC1)
  143. //
  144. if (ERROR_SUCCESS != RegCreateKeyEx(HKEY_CLASSES_ROOT,
  145. TEXT("AppID\\{61738644-F196-11D0-9953-00C04FD919C1}"),
  146. NULL,
  147. TEXT(""),
  148. REG_OPTION_NON_VOLATILE,
  149. KEY_ALL_ACCESS,
  150. NULL,
  151. &hKeyAppID,
  152. &dwDisposition))
  153. {
  154. return E_UNEXPECTED;
  155. }
  156. else
  157. {
  158. if (ERROR_SUCCESS != RegSetValueEx(hKeyAppID,
  159. TEXT(""),
  160. NULL,
  161. REG_SZ,
  162. (BYTE*) TEXT("IIS WAMREG admin Service"),
  163. sizeof(TEXT("IIS WAMREG Admin Service"))))
  164. {
  165. RegCloseKey(hKeyAppID);
  166. return E_UNEXPECTED;
  167. }
  168. if (ERROR_SUCCESS != RegSetValueEx(hKeyAppID,
  169. TEXT("LocalService"),
  170. NULL,
  171. REG_SZ,
  172. (BYTE *) TEXT("IISADMIN"),
  173. sizeof(TEXT("IISADMIN"))))
  174. {
  175. RegCloseKey(hKeyAppID);
  176. return E_UNEXPECTED;
  177. }
  178. RegCloseKey(hKeyAppID);
  179. }
  180. //
  181. // register CLSID
  182. //WamAdmin_CLSID
  183. if (ERROR_SUCCESS != RegCreateKeyEx(HKEY_CLASSES_ROOT,
  184. TEXT("CLSID\\{61738644-F196-11D0-9953-00C04FD919C1}"),
  185. NULL,
  186. TEXT(""),
  187. REG_OPTION_NON_VOLATILE,
  188. KEY_ALL_ACCESS,
  189. NULL,
  190. &hKeyCLSID,
  191. &dwDisposition))
  192. {
  193. return E_UNEXPECTED;
  194. }
  195. else
  196. {
  197. if (ERROR_SUCCESS != RegSetValueEx(hKeyCLSID,
  198. TEXT(""),
  199. NULL,
  200. REG_SZ,
  201. (BYTE*) TEXT("IIS WAMREG Admin"),
  202. sizeof(TEXT("IIS WAMREG Admin"))))
  203. {
  204. RegCloseKey(hKeyCLSID);
  205. return E_UNEXPECTED;
  206. }
  207. if (ERROR_SUCCESS != RegSetValueEx(hKeyCLSID,
  208. TEXT("AppID"),
  209. NULL,
  210. REG_SZ,
  211. (BYTE*) TEXT("{61738644-F196-11D0-9953-00C04FD919C1}"),
  212. sizeof(TEXT("{61738644-F196-11D0-9953-00C04FD919C1}"))))
  213. {
  214. RegCloseKey(hKeyCLSID);
  215. return E_UNEXPECTED;
  216. }
  217. if (ERROR_SUCCESS != RegSetValueEx(hKeyCLSID,
  218. TEXT("LocalService"),
  219. NULL,
  220. REG_SZ,
  221. (BYTE*) TEXT("IISADMIN"),
  222. sizeof(TEXT("IISADMIN"))))
  223. {
  224. RegCloseKey(hKeyCLSID);
  225. return E_UNEXPECTED;
  226. }
  227. RegCloseKey(hKeyCLSID);
  228. }
  229. //
  230. // Main Interfaces
  231. //
  232. //
  233. // WAMREG Admin Interface
  234. //IID_IWamAdmin, 0x29822AB7, 0xF302, 0x11D0, 0x99, 0x53, 0x00, 0xC0, 0x4F, 0xD9, 0x19, 0xC1
  235. if (ERROR_SUCCESS != RegCreateKeyEx(HKEY_CLASSES_ROOT,
  236. TEXT("CLSID\\{29822AB7-F302-11D0-9953-00C04FD919C1}"),
  237. NULL,
  238. TEXT(""),
  239. REG_OPTION_NON_VOLATILE,
  240. KEY_ALL_ACCESS,
  241. NULL,
  242. &hKeyCLSID,
  243. &dwDisposition))
  244. {
  245. return E_UNEXPECTED;
  246. }
  247. else
  248. {
  249. if (ERROR_SUCCESS != RegSetValueEx(hKeyCLSID,
  250. TEXT(""),
  251. NULL,
  252. REG_SZ,
  253. (BYTE*) TEXT("PSFactoryBuffer"),
  254. sizeof(TEXT("PSFactoryBuffer"))))
  255. {
  256. RegCloseKey(hKeyCLSID);
  257. return E_UNEXPECTED;
  258. }
  259. if (ERROR_SUCCESS != RegCreateKeyEx(hKeyCLSID,
  260. "InprocServer32",
  261. NULL,
  262. TEXT(""),
  263. REG_OPTION_NON_VOLATILE,
  264. KEY_ALL_ACCESS,
  265. NULL,
  266. &hKeyInproc32,
  267. &dwDisposition))
  268. {
  269. RegCloseKey(hKeyCLSID);
  270. return E_UNEXPECTED;
  271. }
  272. else
  273. {
  274. if (ERROR_SUCCESS != RegSetValueEx(hKeyInproc32,
  275. TEXT(""),
  276. NULL,
  277. REG_SZ,
  278. (BYTE*) "WAMREGPS.DLL",
  279. sizeof(TEXT("WAMREGPS.DLL"))))
  280. {
  281. RegCloseKey(hKeyInproc32);
  282. RegCloseKey(hKeyCLSID);
  283. return E_UNEXPECTED;
  284. }
  285. if (ERROR_SUCCESS != RegSetValueEx(hKeyInproc32,
  286. TEXT("ThreadingModel"),
  287. NULL,
  288. REG_SZ,
  289. (BYTE*) "Both",
  290. sizeof("Both")-1 ))
  291. {
  292. RegCloseKey(hKeyInproc32);
  293. RegCloseKey(hKeyCLSID);
  294. return E_UNEXPECTED;
  295. }
  296. RegCloseKey(hKeyInproc32);
  297. }
  298. RegCloseKey(hKeyCLSID);
  299. }
  300. //
  301. // WAMREG Admin Interface
  302. //IID_IWamAdmin2, 0x29822AB8, 0xF302, 0x11D0, 0x99, 0x53, 0x00, 0xC0, 0x4F, 0xD9, 0x19, 0xC1
  303. if (ERROR_SUCCESS != RegCreateKeyEx(HKEY_CLASSES_ROOT,
  304. TEXT("CLSID\\{29822AB8-F302-11D0-9953-00C04FD919C1}"),
  305. NULL,
  306. TEXT(""),
  307. REG_OPTION_NON_VOLATILE,
  308. KEY_ALL_ACCESS,
  309. NULL,
  310. &hKeyCLSID,
  311. &dwDisposition))
  312. {
  313. return E_UNEXPECTED;
  314. }
  315. else
  316. {
  317. if (ERROR_SUCCESS != RegSetValueEx(hKeyCLSID,
  318. TEXT(""),
  319. NULL,
  320. REG_SZ,
  321. (BYTE*) TEXT("PSFactoryBuffer"),
  322. sizeof(TEXT("PSFactoryBuffer"))))
  323. {
  324. RegCloseKey(hKeyCLSID);
  325. return E_UNEXPECTED;
  326. }
  327. if (ERROR_SUCCESS != RegCreateKeyEx(hKeyCLSID,
  328. "InprocServer32",
  329. NULL,
  330. TEXT(""),
  331. REG_OPTION_NON_VOLATILE,
  332. KEY_ALL_ACCESS,
  333. NULL,
  334. &hKeyInproc32,
  335. &dwDisposition))
  336. {
  337. RegCloseKey(hKeyCLSID);
  338. return E_UNEXPECTED;
  339. }
  340. else
  341. {
  342. if (ERROR_SUCCESS != RegSetValueEx(hKeyInproc32,
  343. TEXT(""),
  344. NULL,
  345. REG_SZ,
  346. (BYTE*) "WAMREGPS.DLL",
  347. sizeof(TEXT("WAMREGPS.DLL"))))
  348. {
  349. RegCloseKey(hKeyInproc32);
  350. RegCloseKey(hKeyCLSID);
  351. return E_UNEXPECTED;
  352. }
  353. if (ERROR_SUCCESS != RegSetValueEx(hKeyInproc32,
  354. TEXT("ThreadingModel"),
  355. NULL,
  356. REG_SZ,
  357. (BYTE*) "Both",
  358. sizeof("Both")-1 ))
  359. {
  360. RegCloseKey(hKeyInproc32);
  361. RegCloseKey(hKeyCLSID);
  362. return E_UNEXPECTED;
  363. }
  364. RegCloseKey(hKeyInproc32);
  365. }
  366. RegCloseKey(hKeyCLSID);
  367. }
  368. //
  369. //
  370. // register Interfaces
  371. //
  372. //
  373. // ANSI Main Interface
  374. // WamReg Admin Interface
  375. if (ERROR_SUCCESS != RegCreateKeyEx(HKEY_CLASSES_ROOT,
  376. TEXT("Interface\\{29822AB7-F302-11D0-9953-00C04FD919C1}"),
  377. NULL,
  378. TEXT(""),
  379. REG_OPTION_NON_VOLATILE,
  380. KEY_ALL_ACCESS,
  381. NULL,
  382. &hKeyIF,
  383. &dwDisposition))
  384. {
  385. return E_UNEXPECTED;
  386. }
  387. else
  388. {
  389. if (ERROR_SUCCESS != RegSetValueEx(hKeyIF,
  390. TEXT(""),
  391. NULL,
  392. REG_SZ,
  393. (BYTE*) TEXT("IWamAdmin"),
  394. sizeof(TEXT("IWamAdmin"))))
  395. {
  396. RegCloseKey(hKeyIF);
  397. return E_UNEXPECTED;
  398. }
  399. if (ERROR_SUCCESS != RegCreateKeyEx(hKeyIF,
  400. "ProxyStubClsid32",
  401. NULL,
  402. TEXT(""),
  403. REG_OPTION_NON_VOLATILE,
  404. KEY_ALL_ACCESS,
  405. NULL,
  406. &hKeyStub32,
  407. &dwDisposition))
  408. {
  409. RegCloseKey(hKeyIF);
  410. return E_UNEXPECTED;
  411. }
  412. else
  413. {
  414. if (ERROR_SUCCESS != RegSetValueEx(hKeyStub32,
  415. TEXT(""),
  416. NULL,
  417. REG_SZ,
  418. (BYTE*)"{29822AB7-F302-11D0-9953-00C04FD919C1}",
  419. sizeof("{29822AB7-F302-11D0-9953-00C04FD919C1}")))
  420. {
  421. RegCloseKey(hKeyStub32);
  422. RegCloseKey(hKeyIF);
  423. return E_UNEXPECTED;
  424. }
  425. RegCloseKey(hKeyStub32);
  426. }
  427. RegCloseKey(hKeyIF);
  428. }
  429. // WamReg Admin Interface
  430. // IID_IWamAdmin2
  431. if (ERROR_SUCCESS != RegCreateKeyEx(HKEY_CLASSES_ROOT,
  432. TEXT("Interface\\{29822AB8-F302-11D0-9953-00C04FD919C1}"),
  433. NULL,
  434. TEXT(""),
  435. REG_OPTION_NON_VOLATILE,
  436. KEY_ALL_ACCESS,
  437. NULL,
  438. &hKeyIF,
  439. &dwDisposition))
  440. {
  441. return E_UNEXPECTED;
  442. }
  443. else
  444. {
  445. if (ERROR_SUCCESS != RegSetValueEx(hKeyIF,
  446. TEXT(""),
  447. NULL,
  448. REG_SZ,
  449. (BYTE*) TEXT("IWamAdmin2"),
  450. sizeof(TEXT("IWamAdmin2"))))
  451. {
  452. RegCloseKey(hKeyIF);
  453. return E_UNEXPECTED;
  454. }
  455. if (ERROR_SUCCESS != RegCreateKeyEx(hKeyIF,
  456. "ProxyStubClsid32",
  457. NULL,
  458. TEXT(""),
  459. REG_OPTION_NON_VOLATILE,
  460. KEY_ALL_ACCESS,
  461. NULL,
  462. &hKeyStub32,
  463. &dwDisposition))
  464. {
  465. RegCloseKey(hKeyIF);
  466. return E_UNEXPECTED;
  467. }
  468. else
  469. {
  470. if (ERROR_SUCCESS != RegSetValueEx(hKeyStub32,
  471. TEXT(""),
  472. NULL,
  473. REG_SZ,
  474. (BYTE*)"{29822AB8-F302-11D0-9953-00C04FD919C1}",
  475. sizeof("{29822AB8-F302-11D0-9953-00C04FD919C1}")))
  476. {
  477. RegCloseKey(hKeyStub32);
  478. RegCloseKey(hKeyIF);
  479. return E_UNEXPECTED;
  480. }
  481. RegCloseKey(hKeyStub32);
  482. }
  483. RegCloseKey(hKeyIF);
  484. }
  485. return NOERROR;
  486. }
  487. STDAPI WamReg_UnRegisterServer(void) {
  488. //
  489. // register AppID
  490. //
  491. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("AppID\\{61738644-F196-11D0-9953-00C04FD919C1}"));
  492. //RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("AppID\\{61738646-F196-11D0-9953-00C04FD919C1}"));
  493. //
  494. // register CLSID
  495. //
  496. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{61738644-F196-11D0-9953-00C04FD919C1}"));
  497. /*
  498. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{61738646-F196-11D0-9953-00C04FD919C1}"));
  499. */
  500. //
  501. // WAMREG Interfaces
  502. //
  503. //
  504. // Admin Interface
  505. //
  506. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{29822AB7-F302-11D0-9953-00C04FD919C1}\\InprocServer32"));
  507. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{29822AB7-F302-11D0-9953-00C04FD919C1}"));
  508. //
  509. // Replication Interface
  510. //
  511. /*
  512. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{29822AB8-F302-11D0-9953-00C04FD919C1}\\InprocServer32"));
  513. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{29822AB8-F302-11D0-9953-00C04FD919C1}"));
  514. */
  515. //
  516. // deregister Interfaces
  517. //
  518. //
  519. // Admin Interface
  520. //
  521. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("Interface\\{29822AB7-F302-11D0-9953-00C04FD919C1}\\ProxyStubClsid32"));
  522. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("Interface\\{29822AB7-F302-11D0-9953-00C04FD919C1}"));
  523. /*
  524. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("Interface\\{29822AB8-F302-11D0-9953-00C04FD919C1}\\ProxyStubClsid32"));
  525. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("Interface\\{29822AB8-F302-11D0-9953-00C04FD919C1}"));
  526. */
  527. return NOERROR;
  528. }
  529. /////////////////////////////////////////////////////////////////////////////
  530. // DllRegisterServer - Adds entries to the system registry
  531. STDAPI DllRegisterServer(void)
  532. {
  533. HKEY hKeyCLSID, hKeyInproc32;
  534. DWORD dwDisposition;
  535. HMODULE hModule;
  536. DWORD dwReturn = ERROR_SUCCESS;
  537. #ifdef _MERGE_PROXYSTUB
  538. HRESULT hRes = PrxDllRegisterServer();
  539. if (FAILED(hRes))
  540. return hRes;
  541. #endif
  542. dwReturn = RegCreateKeyEx(HKEY_CLASSES_ROOT,
  543. TEXT("CLSID\\{763A6C86-F30F-11D0-9953-00C04FD919C1}"),
  544. NULL,
  545. TEXT(""),
  546. REG_OPTION_NON_VOLATILE,
  547. KEY_ALL_ACCESS,
  548. NULL,
  549. &hKeyCLSID,
  550. &dwDisposition);
  551. if (dwReturn == ERROR_SUCCESS)
  552. {
  553. dwReturn = RegSetValueEx(hKeyCLSID,
  554. TEXT(""),
  555. NULL,
  556. REG_SZ,
  557. (BYTE*) TEXT("WAM REG COM LAYER"),
  558. sizeof(TEXT("WAM REG COM LAYER")));
  559. if (dwReturn == ERROR_SUCCESS)
  560. {
  561. dwReturn = RegCreateKeyEx(hKeyCLSID,
  562. "InprocServer32",
  563. NULL,
  564. TEXT(""),
  565. REG_OPTION_NON_VOLATILE,
  566. KEY_ALL_ACCESS,
  567. NULL,
  568. &hKeyInproc32,
  569. &dwDisposition);
  570. if (dwReturn == ERROR_SUCCESS)
  571. {
  572. hModule=GetModuleHandle(TEXT("WAMREG.DLL"));
  573. if (!hModule)
  574. {
  575. dwReturn = GetLastError();
  576. }
  577. else
  578. {
  579. TCHAR szName[MAX_PATH+1];
  580. if (GetModuleFileName(hModule,
  581. szName,
  582. sizeof(szName)) == NULL)
  583. {
  584. dwReturn = GetLastError();
  585. }
  586. else
  587. {
  588. dwReturn = RegSetValueEx(hKeyInproc32,
  589. TEXT(""),
  590. NULL,
  591. REG_SZ,
  592. (BYTE*) szName,
  593. sizeof(TCHAR)*(lstrlen(szName)+1));
  594. if (dwReturn == ERROR_SUCCESS)
  595. {
  596. dwReturn = RegSetValueEx(hKeyInproc32,
  597. TEXT("ThreadingModel"),
  598. NULL,
  599. REG_SZ,
  600. (BYTE*) TEXT("Both"),
  601. sizeof(TEXT("Both")));
  602. }
  603. }
  604. }
  605. RegCloseKey(hKeyInproc32);
  606. }
  607. }
  608. RegCloseKey(hKeyCLSID);
  609. }
  610. //
  611. // Register the COM object's CLSID under IISADMIN_EXTENSIONS_REG_KEY
  612. //
  613. if (dwReturn == ERROR_SUCCESS)
  614. {
  615. dwReturn = RegCreateKeyEx(HKEY_LOCAL_MACHINE,
  616. IISADMIN_EXTENSIONS_REG_KEY
  617. TEXT("\\{763A6C86-F30F-11D0-9953-00C04FD919C1}"),
  618. NULL,
  619. TEXT(""),
  620. REG_OPTION_NON_VOLATILE,
  621. KEY_ALL_ACCESS,
  622. NULL,
  623. &hKeyCLSID,
  624. &dwDisposition);
  625. if (dwReturn == ERROR_SUCCESS)
  626. {
  627. RegCloseKey(hKeyCLSID);
  628. }
  629. }
  630. if (dwReturn == ERROR_SUCCESS)
  631. {
  632. HRESULT hr;
  633. // registers object, typelib and all interfaces in typelib
  634. hr = WamReg_RegisterServer();
  635. return hr;
  636. }
  637. else
  638. {
  639. return RETURNCODETOHRESULT(dwReturn);
  640. }
  641. }
  642. /////////////////////////////////////////////////////////////////////////////
  643. // DllUnregisterServer - Removes entries from the system registry
  644. STDAPI DllUnregisterServer(void)
  645. {
  646. DWORD dwReturn = ERROR_SUCCESS;
  647. DWORD dwTemp;
  648. #ifdef _MERGE_PROXYSTUB
  649. PrxDllUnregisterServer();
  650. #endif
  651. dwTemp = RegDeleteKey(HKEY_CLASSES_ROOT,
  652. TEXT("CLSID\\{763A6C86-F30F-11D0-9953-00C04FD919C1}\\InprocServer32"));
  653. if (dwTemp != ERROR_SUCCESS)
  654. {
  655. dwReturn = dwTemp;
  656. }
  657. dwTemp = RegDeleteKey(HKEY_CLASSES_ROOT,
  658. TEXT("CLSID\\{763A6C86-F30F-11D0-9953-00C04FD919C1}"));
  659. if (dwTemp != ERROR_SUCCESS)
  660. {
  661. dwReturn = dwTemp;
  662. }
  663. dwTemp = RegDeleteKey(HKEY_LOCAL_MACHINE,
  664. IISADMIN_EXTENSIONS_REG_KEY
  665. TEXT("\\{763A6C86-F30F-11D0-9953-00C04FD919C1}"));
  666. if (dwTemp != ERROR_SUCCESS)
  667. {
  668. dwReturn = dwTemp;
  669. }
  670. if (SUCCEEDED(HRESULT_FROM_WIN32(dwReturn)))
  671. {
  672. HRESULT hr;
  673. hr = WamReg_UnRegisterServer();
  674. return hr;
  675. }
  676. else
  677. {
  678. return HRESULT_FROM_WIN32(dwReturn);
  679. }
  680. }