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.

1392 lines
50 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1997.
  5. //
  6. // File: libmain.cxx
  7. //
  8. // Contents: LibMain for iisext.dll
  9. //
  10. // Functions: LibMain, DllGetClassObject
  11. //
  12. // History: 25-1-98 sophiac Created.
  13. //
  14. //----------------------------------------------------------------------------
  15. #include "iisext.hxx"
  16. #pragma hdrstop
  17. HINSTANCE g_hInst = NULL;
  18. //
  19. // Global Data
  20. //
  21. WIN32_CRITSEC * g_pGlobalLock = NULL;
  22. SERVER_CACHE * g_pServerCache = NULL;
  23. DECLARE_DEBUG_PRINTS_OBJECT()
  24. #ifdef _NO_TRACING_
  25. DECLARE_DEBUG_VARIABLE();
  26. #endif
  27. //---------------------------------------------------------------------------
  28. // ADs debug print, mem leak and object tracking-related stuff
  29. //---------------------------------------------------------------------------
  30. DECLARE_INFOLEVEL(ADs)
  31. //+---------------------------------------------------------------------------
  32. //
  33. // Function: ShutDown
  34. //
  35. // Synopsis: Function to handle printing out heap debugging display
  36. //
  37. //----------------------------------------------------------------------------
  38. inline VOID ShutDown()
  39. {
  40. #if DBG==1
  41. #ifndef MSVC
  42. DUMP_TRACKING_INFO_DELETE();
  43. DeleteCriticalSection(&g_csOT);
  44. #endif // ifndef MSVC
  45. DeleteCriticalSection(&g_csDP);
  46. #endif
  47. }
  48. extern "C" DWORD heapInfoLevel;
  49. extern "C" DWORD OtInfoLevel;
  50. extern "C" DWORD ADsInfoLevel;
  51. //+---------------------------------------------------------------------------
  52. //
  53. // Function: GetINIHeapInfoLevel
  54. //
  55. // Synopsis: Gets various infolevel values from win.ini
  56. //
  57. //----------------------------------------------------------------------------
  58. inline VOID GetINIHeapInfoLevel()
  59. {
  60. #if DBG==1
  61. const INT MAXINFOLEN=11;
  62. WCHAR awcs[MAXINFOLEN];
  63. #ifndef MSVC
  64. if (GetProfileString(L"IISEXT",L"heapInfoLevel", L"00000003", awcs,MAXINFOLEN))
  65. heapInfoLevel = wcstoul(awcs, NULL, 16);
  66. if (GetProfileString(L"IISEXT",L"Ot", L"00000003", awcs, MAXINFOLEN))
  67. OtInfoLevel = wcstoul(awcs, NULL, 16);
  68. #endif // MSVC
  69. if (GetProfileString(L"IISEXT",L"ADsInfoLevel", L"00000003", awcs,MAXINFOLEN))
  70. ADsInfoLevel = wcstoul(awcs, NULL, 16);
  71. #endif
  72. }
  73. // Globals
  74. ULONG g_ulObjCount = 0; // Number of objects alive in oleds.dll
  75. //+------------------------------------------------------------------------
  76. //
  77. // Macro that calculates the number of elements in a statically-defined
  78. // array.
  79. //
  80. // Note - I swiped this from ADsary.cxx - A type-safe array class. Remember
  81. // to swipe the whole thing as required.
  82. //-------------------------------------------------------------------------
  83. #define ARRAY_SIZE(_a) (sizeof(_a) / sizeof(_a[0]))
  84. CIISComputerCF g_cfComputer;
  85. CIISServerCF g_cfServer;
  86. CIISAppCF g_cfApp;
  87. CIISDsCrMapCF g_cfDsCrMap;
  88. CIISApplicationPoolCF g_cfApplicationPool;
  89. CIISApplicationPoolsCF g_cfApplicationPools;
  90. CIISWebServiceCF g_cfWebService;
  91. //+------------------------------------------------------------------------
  92. //
  93. // oleds class factories
  94. //
  95. //-------------------------------------------------------------------------
  96. struct CLSCACHE
  97. {
  98. const CLSID * pclsid;
  99. IClassFactory * pCF;
  100. };
  101. CLSCACHE g_aclscache[] =
  102. {
  103. &CLSID_IISExtComputer, &g_cfComputer,
  104. &CLSID_IISExtServer, &g_cfServer,
  105. &CLSID_IISExtApp, &g_cfApp,
  106. &CLSID_IISExtDsCrMap, &g_cfDsCrMap,
  107. &CLSID_IISExtApplicationPool, &g_cfApplicationPool,
  108. &CLSID_IISExtApplicationPools, &g_cfApplicationPools,
  109. &CLSID_IISExtWebService, &g_cfWebService
  110. };
  111. //+---------------------------------------------------------------
  112. //
  113. // Function: DllGetClassObject
  114. //
  115. // Synopsis: Standard DLL entrypoint for locating class factories
  116. //
  117. //----------------------------------------------------------------
  118. STDAPI
  119. DllGetClassObject(REFCLSID clsid, REFIID iid, LPVOID FAR* ppv)
  120. {
  121. HRESULT hr;
  122. size_t i;
  123. for (i = 0; i < ARRAY_SIZE(g_aclscache); i++)
  124. {
  125. if (IsEqualCLSID(clsid, *g_aclscache[i].pclsid))
  126. {
  127. hr = g_aclscache[i].pCF->QueryInterface(iid, ppv);
  128. RRETURN(hr);
  129. }
  130. }
  131. *ppv = NULL;
  132. //
  133. // Add Debugging Code to indicate that the oleds.DllGetClassObject has been called with an unknown CLSID.
  134. //
  135. return E_NOINTERFACE;
  136. }
  137. //+---------------------------------------------------------------
  138. //
  139. // Function: DllCanUnloadNow
  140. //
  141. // Synopsis: Standard DLL entrypoint to determine if DLL can be unloaded
  142. //
  143. //---------------------------------------------------------------
  144. STDAPI
  145. DllCanUnloadNow(void)
  146. {
  147. HRESULT hr;
  148. hr = S_FALSE;
  149. return hr;
  150. }
  151. //+---------------------------------------------------------------
  152. //
  153. // Function: LibMain
  154. //
  155. // Synopsis: Standard DLL initialization entrypoint
  156. //
  157. //---------------------------------------------------------------
  158. EXTERN_C BOOL __cdecl
  159. LibMain(HINSTANCE hInst, ULONG ulReason, LPVOID pvReserved)
  160. {
  161. HRESULT hr;
  162. switch (ulReason)
  163. {
  164. case DLL_PROCESS_ATTACH:
  165. DisableThreadLibraryCalls(hInst);
  166. g_pGlobalLock = new WIN32_CRITSEC();
  167. g_pServerCache = new SERVER_CACHE();
  168. g_hInst = hInst;
  169. #if DBG==1
  170. #ifndef MSVC
  171. InitializeCriticalSection(&g_csOT);
  172. InitializeCriticalSection(&g_csMem);
  173. #endif
  174. InitializeCriticalSection(&g_csDP);
  175. #endif
  176. #ifdef _NO_TRACING_
  177. CREATE_DEBUG_PRINT_OBJECT("iisext");
  178. SET_DEBUG_FLAGS(DEBUG_ERROR);
  179. #endif
  180. break;
  181. case DLL_PROCESS_DETACH:
  182. break;
  183. default:
  184. break;
  185. }
  186. return TRUE;
  187. }
  188. //+---------------------------------------------------------------------------
  189. //
  190. // Function: DllMain
  191. //
  192. // Synopsis: entry point for NT - post .546
  193. //
  194. //----------------------------------------------------------------------------
  195. BOOL
  196. DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
  197. {
  198. return LibMain((HINSTANCE)hDll, dwReason, lpReserved);
  199. }
  200. //+------------------------------------------------------------------------
  201. //
  202. // Function: GetCachedClsidIndex
  203. //
  204. // Synopsis: Returns the index of the given CLSID in the cache, or
  205. // -1 if the CLSID is not present in the cache
  206. //
  207. // Arguments: [clsid]
  208. //
  209. // Returns: int
  210. //
  211. //-------------------------------------------------------------------------
  212. int
  213. GetCachedClsidIndex(REFCLSID clsid)
  214. {
  215. int i;
  216. CLSCACHE * pclscache;
  217. for (i = 0, pclscache = g_aclscache;
  218. i < ARRAY_SIZE(g_aclscache);
  219. i ++, pclscache++)
  220. {
  221. if (IsEqualCLSID(*pclscache->pclsid, clsid))
  222. return i;
  223. }
  224. return -1;
  225. }
  226. //+------------------------------------------------------------------------
  227. //
  228. // Function: GetCachedClassFactory
  229. //
  230. // Synopsis: Returns the cached class factory with the given index.
  231. // The pointer returned has been AddRef'd.
  232. //
  233. // Arguments: [iclsid]
  234. //
  235. // Returns: IClassFactory *
  236. //
  237. //-------------------------------------------------------------------------
  238. IClassFactory *
  239. GetCachedClassFactory(int iclsid)
  240. {
  241. IClassFactory * pCF;
  242. // Assert(iclsid >= 0);
  243. // Assert(iclsid < ARRAY_SIZE(g_aclscache));
  244. pCF = g_aclscache[iclsid].pCF;
  245. pCF->AddRef();
  246. return pCF;
  247. }
  248. //+------------------------------------------------------------------------
  249. //
  250. // Function: GetCachedClsid
  251. //
  252. // Synopsis: Returns the CLSID corresponding to the given index.
  253. // Normally, code should call GetCachedClassFactory to get
  254. // the class factory directly.
  255. //
  256. // Arguments: [iclsid] -- Clsid index
  257. // [pclsid] -- Matching clsid returned in *pclsid
  258. //
  259. //-------------------------------------------------------------------------
  260. void
  261. GetCachedClsid(int iclsid, CLSID * pclsid)
  262. {
  263. // Assert(iclsid >= 0);
  264. // Assert(iclsid < ARRAY_SIZE(g_aclscache));
  265. *pclsid = *g_aclscache[iclsid].pclsid;
  266. }
  267. //+------------------------------------------------------------------------
  268. //
  269. // Function: DllRegisterServer
  270. //
  271. // Synopsis: Register registry keys for adsiis
  272. //
  273. // Arguments: None
  274. //
  275. //-------------------------------------------------------------------------
  276. STDAPI DllRegisterServer(
  277. )
  278. {
  279. HKEY hKeyCLSID, hKeyTemp;
  280. DWORD dwDisposition;
  281. HMODULE hModule;
  282. HRESULT hr;
  283. ITypeLib *pITypeLib;
  284. WCHAR pszName[MAX_PATH +1];
  285. int i;
  286. hModule=GetModuleHandle(TEXT("IISEXT.DLL"));
  287. if (!hModule) {
  288. return E_UNEXPECTED;
  289. }
  290. if (GetModuleFileName(hModule, pszName, MAX_PATH+1)==0) {
  291. return E_UNEXPECTED;
  292. }
  293. hr=LoadTypeLibEx(pszName, REGKIND_REGISTER, &pITypeLib);
  294. if (FAILED(hr)) {
  295. return E_UNEXPECTED;
  296. }
  297. pITypeLib->Release();
  298. if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,
  299. TEXT("Software\\Microsoft\\ADs\\Providers\\IIS\\Extensions\\IIsCertMapper\\{bc36cde8-afeb-11d1-9868-00a0c922e703}"),
  300. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  301. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  302. return E_UNEXPECTED;
  303. }
  304. if (RegSetValueEx(hKeyTemp, TEXT("Interfaces"), NULL, REG_MULTI_SZ,
  305. (BYTE*) TEXT("{edcd6a60-b053-11d0-a62f-00a0c922e752}"),
  306. sizeof(TEXT("{edcd6a60-b053-11d0-a62f-00a0c922e752}")))!=ERROR_SUCCESS) {
  307. RegCloseKey(hKeyTemp);
  308. return E_UNEXPECTED;
  309. }
  310. RegCloseKey(hKeyTemp);
  311. if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,
  312. TEXT("Software\\Microsoft\\ADs\\Providers\\IIS\\Extensions\\IIsComputer\\{91ef9258-afec-11d1-9868-00a0c922e703}"),
  313. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  314. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  315. return E_UNEXPECTED;
  316. }
  317. if (RegSetValueEx(hKeyTemp, TEXT("Interfaces"), NULL, REG_MULTI_SZ,
  318. (BYTE*) TEXT("{CF87A2E0-078B-11d1-9C3D-00A0C922E703}"),
  319. sizeof(TEXT("{CF87A2E0-078B-11d1-9C3D-00A0C922E703}")))!=ERROR_SUCCESS) {
  320. RegCloseKey(hKeyTemp);
  321. return E_UNEXPECTED;
  322. }
  323. RegCloseKey(hKeyTemp);
  324. if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,
  325. TEXT("Software\\Microsoft\\ADs\\Providers\\IIS\\Extensions\\IIsApplicationPool\\{E99F9D0C-FB39-402b-9EEB-AA185237BD34}"),
  326. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  327. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  328. return E_UNEXPECTED;
  329. }
  330. if (RegSetValueEx(hKeyTemp, TEXT("Interfaces"), NULL, REG_MULTI_SZ,
  331. (BYTE*) TEXT("{0B3CB1E1-829A-4c06-8B09-F56DA1894C88}"),
  332. sizeof(TEXT("{0B3CB1E1-829A-4c06-8B09-F56DA1894C88}")))!=ERROR_SUCCESS) {
  333. RegCloseKey(hKeyTemp);
  334. return E_UNEXPECTED;
  335. }
  336. RegCloseKey(hKeyTemp);
  337. if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,
  338. TEXT("Software\\Microsoft\\ADs\\Providers\\IIS\\Extensions\\IIsApplicationPools\\{95863074-A389-406a-A2D7-D98BFC95B905}"),
  339. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  340. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  341. return E_UNEXPECTED;
  342. }
  343. if (RegSetValueEx(hKeyTemp, TEXT("Interfaces"), NULL, REG_MULTI_SZ,
  344. (BYTE*) TEXT("{587F123F-49B4-49dd-939E-F4547AA3FA75}"),
  345. sizeof(TEXT("{587F123F-49B4-49dd-939E-F4547AA3FA75}")))!=ERROR_SUCCESS) {
  346. RegCloseKey(hKeyTemp);
  347. return E_UNEXPECTED;
  348. }
  349. RegCloseKey(hKeyTemp);
  350. if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,
  351. TEXT("Software\\Microsoft\\ADs\\Providers\\IIS\\Extensions\\IIsWebService\\{40B8F873-B30E-475d-BEC5-4D0EBB0DBAF3}"),
  352. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  353. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  354. return E_UNEXPECTED;
  355. }
  356. if (RegSetValueEx(hKeyTemp, TEXT("Interfaces"), NULL, REG_MULTI_SZ,
  357. (BYTE*) TEXT("{EE46D40C-1B38-4a02-898D-358E74DFC9D2}"),
  358. sizeof(TEXT("{EE46D40C-1B38-4a02-898D-358E74DFC9D2}")))!=ERROR_SUCCESS) {
  359. RegCloseKey(hKeyTemp);
  360. return E_UNEXPECTED;
  361. }
  362. RegCloseKey(hKeyTemp);
  363. if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,
  364. TEXT("Software\\Microsoft\\ADs\\Providers\\IIS\\Extensions\\IIsApp\\{b4f34438-afec-11d1-9868-00a0c922e703}"),
  365. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  366. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  367. return E_UNEXPECTED;
  368. }
  369. if (RegSetValueEx(hKeyTemp, TEXT("Interfaces"), NULL, REG_MULTI_SZ,
  370. (BYTE*) TEXT("{46FBBB80-0192-11d1-9C39-00A0C922E703}"),
  371. sizeof(TEXT("{46FBBB80-0192-11d1-9C39-00A0C922E703}")))!=ERROR_SUCCESS) {
  372. RegCloseKey(hKeyTemp);
  373. return E_UNEXPECTED;
  374. }
  375. RegCloseKey(hKeyTemp);
  376. if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,
  377. TEXT("Software\\Microsoft\\ADs\\Providers\\IIS\\Extensions\\IIsServer\\{c3b32488-afec-11d1-9868-00a0c922e703}"),
  378. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  379. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  380. return E_UNEXPECTED;
  381. }
  382. if (RegSetValueEx(hKeyTemp, TEXT("Interfaces"), NULL, REG_MULTI_SZ,
  383. (BYTE*) TEXT("{5d7b33f0-31ca-11cf-a98a-00aa006bc149}"),
  384. sizeof(TEXT("{5d7b33f0-31ca-11cf-a98a-00aa006bc149}")))!=ERROR_SUCCESS) {
  385. RegCloseKey(hKeyTemp);
  386. return E_UNEXPECTED;
  387. }
  388. RegCloseKey(hKeyTemp);
  389. if (RegCreateKeyEx(HKEY_CLASSES_ROOT,
  390. TEXT("IISExtDsCrMap\\CLSID"),
  391. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  392. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  393. return E_UNEXPECTED;
  394. }
  395. if (RegSetValueEx(hKeyTemp, TEXT(""), NULL, REG_SZ,
  396. (BYTE*) TEXT("{bc36cde8-afeb-11d1-9868-00a0c922e703}"),
  397. sizeof(TEXT("{bc36cde8-afeb-11d1-9868-00a0c922e703}")))!=ERROR_SUCCESS) {
  398. RegCloseKey(hKeyTemp);
  399. return E_UNEXPECTED;
  400. }
  401. RegCloseKey(hKeyTemp);
  402. //
  403. // register CLSID
  404. //
  405. if (RegCreateKeyEx(HKEY_CLASSES_ROOT,
  406. TEXT("CLSID\\{bc36cde8-afeb-11d1-9868-00a0c922e703}"),
  407. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  408. &hKeyCLSID, &dwDisposition)!=ERROR_SUCCESS) {
  409. return E_UNEXPECTED;
  410. }
  411. if (RegSetValueEx(hKeyCLSID, TEXT(""), NULL, REG_SZ,
  412. (BYTE*) TEXT("IIS Cert Map Extension"),
  413. sizeof(TEXT("IIS Cert Map Extension")))!=ERROR_SUCCESS) {
  414. RegCloseKey(hKeyCLSID);
  415. return E_UNEXPECTED;
  416. }
  417. if (RegCreateKeyEx(hKeyCLSID,
  418. TEXT("InprocServer32"),
  419. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  420. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  421. RegCloseKey(hKeyCLSID);
  422. return E_UNEXPECTED;
  423. }
  424. if (RegSetValueEx(hKeyTemp, TEXT(""), NULL, REG_SZ,
  425. (BYTE*) TEXT("iisext.dll"),
  426. sizeof(TEXT("iisext.dll")))!=ERROR_SUCCESS) {
  427. RegCloseKey(hKeyTemp);
  428. RegCloseKey(hKeyCLSID);
  429. return E_UNEXPECTED;
  430. }
  431. if (RegSetValueEx(hKeyTemp, TEXT("ThreadingModel"), NULL, REG_SZ,
  432. (BYTE*) TEXT("Both"),
  433. sizeof(TEXT("Both")))!=ERROR_SUCCESS) {
  434. RegCloseKey(hKeyTemp);
  435. RegCloseKey(hKeyCLSID);
  436. return E_UNEXPECTED;
  437. }
  438. RegCloseKey(hKeyTemp);
  439. if (RegCreateKeyEx(hKeyCLSID,
  440. TEXT("ProgID"),
  441. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  442. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  443. RegCloseKey(hKeyCLSID);
  444. return E_UNEXPECTED;
  445. }
  446. if (RegSetValueEx(hKeyTemp, TEXT(""), NULL, REG_SZ,
  447. (BYTE*) TEXT("IISExtDsCrMap"),
  448. sizeof(TEXT("IISExtDsCrMap")))!=ERROR_SUCCESS) {
  449. RegCloseKey(hKeyTemp);
  450. RegCloseKey(hKeyCLSID);
  451. return E_UNEXPECTED;
  452. }
  453. RegCloseKey(hKeyTemp);
  454. if (RegCreateKeyEx(hKeyCLSID,
  455. TEXT("TypeLib"),
  456. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  457. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  458. RegCloseKey(hKeyCLSID);
  459. return E_UNEXPECTED;
  460. }
  461. if (RegSetValueEx(hKeyTemp, TEXT(""), NULL, REG_SZ,
  462. (BYTE*) TEXT("{2a56ea30-afeb-11d1-9868-00a0c922e703}"),
  463. sizeof(TEXT("{2a56ea30-afeb-11d1-9868-00a0c922e703}")))!=ERROR_SUCCESS) {
  464. RegCloseKey(hKeyTemp);
  465. RegCloseKey(hKeyCLSID);
  466. return E_UNEXPECTED;
  467. }
  468. RegCloseKey(hKeyTemp);
  469. if (RegCreateKeyEx(hKeyCLSID,
  470. TEXT("Version"),
  471. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  472. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  473. RegCloseKey(hKeyCLSID);
  474. return E_UNEXPECTED;
  475. }
  476. if (RegSetValueEx(hKeyTemp, TEXT(""), NULL, REG_SZ,
  477. (BYTE*) TEXT("0.0"),
  478. sizeof(TEXT("0.0")))!=ERROR_SUCCESS) {
  479. RegCloseKey(hKeyTemp);
  480. RegCloseKey(hKeyCLSID);
  481. return E_UNEXPECTED;
  482. }
  483. RegCloseKey(hKeyTemp);
  484. RegCloseKey(hKeyCLSID);
  485. if (RegCreateKeyEx(HKEY_CLASSES_ROOT,
  486. TEXT("IISExtComputer\\CLSID"),
  487. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  488. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  489. return E_UNEXPECTED;
  490. }
  491. if (RegSetValueEx(hKeyTemp, TEXT(""), NULL, REG_SZ,
  492. (BYTE*) TEXT("{91ef9258-afec-11d1-9868-00a0c922e703}"),
  493. sizeof(TEXT("{91ef9258-afec-11d1-9868-00a0c922e703}")))!=ERROR_SUCCESS) {
  494. RegCloseKey(hKeyTemp);
  495. return E_UNEXPECTED;
  496. }
  497. RegCloseKey(hKeyTemp);
  498. //
  499. // register CLSID
  500. //
  501. if (RegCreateKeyEx(HKEY_CLASSES_ROOT,
  502. TEXT("CLSID\\{91ef9258-afec-11d1-9868-00a0c922e703}"),
  503. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  504. &hKeyCLSID, &dwDisposition)!=ERROR_SUCCESS) {
  505. return E_UNEXPECTED;
  506. }
  507. if (RegSetValueEx(hKeyCLSID, TEXT(""), NULL, REG_SZ,
  508. (BYTE*) TEXT("IIS Computer Extension"),
  509. sizeof(TEXT("IIS Computer Extension")))!=ERROR_SUCCESS) {
  510. RegCloseKey(hKeyCLSID);
  511. return E_UNEXPECTED;
  512. }
  513. if (RegCreateKeyEx(hKeyCLSID,
  514. TEXT("InprocServer32"),
  515. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  516. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  517. RegCloseKey(hKeyCLSID);
  518. return E_UNEXPECTED;
  519. }
  520. if (RegSetValueEx(hKeyTemp, TEXT(""), NULL, REG_SZ,
  521. (BYTE*) TEXT("iisext.dll"),
  522. sizeof(TEXT("iisext.dll")))!=ERROR_SUCCESS) {
  523. RegCloseKey(hKeyTemp);
  524. RegCloseKey(hKeyCLSID);
  525. return E_UNEXPECTED;
  526. }
  527. if (RegSetValueEx(hKeyTemp, TEXT("ThreadingModel"), NULL, REG_SZ,
  528. (BYTE*) TEXT("Both"),
  529. sizeof(TEXT("Both")))!=ERROR_SUCCESS) {
  530. RegCloseKey(hKeyTemp);
  531. RegCloseKey(hKeyCLSID);
  532. return E_UNEXPECTED;
  533. }
  534. RegCloseKey(hKeyTemp);
  535. if (RegCreateKeyEx(hKeyCLSID,
  536. TEXT("ProgID"),
  537. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  538. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  539. RegCloseKey(hKeyCLSID);
  540. return E_UNEXPECTED;
  541. }
  542. if (RegSetValueEx(hKeyTemp, TEXT(""), NULL, REG_SZ,
  543. (BYTE*) TEXT("IISExtComputer"),
  544. sizeof(TEXT("IISExtComputer")))!=ERROR_SUCCESS) {
  545. RegCloseKey(hKeyTemp);
  546. RegCloseKey(hKeyCLSID);
  547. return E_UNEXPECTED;
  548. }
  549. RegCloseKey(hKeyTemp);
  550. if (RegCreateKeyEx(hKeyCLSID,
  551. TEXT("TypeLib"),
  552. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  553. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  554. RegCloseKey(hKeyCLSID);
  555. return E_UNEXPECTED;
  556. }
  557. if (RegSetValueEx(hKeyTemp, TEXT(""), NULL, REG_SZ,
  558. (BYTE*) TEXT("{2a56ea30-afeb-11d1-9868-00a0c922e703}"),
  559. sizeof(TEXT("{2a56ea30-afeb-11d1-9868-00a0c922e703}")))!=ERROR_SUCCESS) {
  560. RegCloseKey(hKeyTemp);
  561. RegCloseKey(hKeyCLSID);
  562. return E_UNEXPECTED;
  563. }
  564. RegCloseKey(hKeyTemp);
  565. if (RegCreateKeyEx(hKeyCLSID,
  566. TEXT("Version"),
  567. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  568. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  569. RegCloseKey(hKeyCLSID);
  570. return E_UNEXPECTED;
  571. }
  572. if (RegSetValueEx(hKeyTemp, TEXT(""), NULL, REG_SZ,
  573. (BYTE*) TEXT("0.0"),
  574. sizeof(TEXT("0.0")))!=ERROR_SUCCESS) {
  575. RegCloseKey(hKeyTemp);
  576. RegCloseKey(hKeyCLSID);
  577. return E_UNEXPECTED;
  578. }
  579. RegCloseKey(hKeyTemp);
  580. RegCloseKey(hKeyCLSID);
  581. if (RegCreateKeyEx(HKEY_CLASSES_ROOT,
  582. TEXT("IISExtApplicationPool\\CLSID"),
  583. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  584. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  585. return E_UNEXPECTED;
  586. }
  587. if (RegSetValueEx(hKeyTemp, TEXT(""), NULL, REG_SZ,
  588. (BYTE*) TEXT("{E99F9D0C-FB39-402b-9EEB-AA185237BD34}"),
  589. sizeof(TEXT("{E99F9D0C-FB39-402b-9EEB-AA185237BD34}")))!=ERROR_SUCCESS) {
  590. RegCloseKey(hKeyTemp);
  591. return E_UNEXPECTED;
  592. }
  593. RegCloseKey(hKeyTemp);
  594. //
  595. // register CLSID
  596. //
  597. if (RegCreateKeyEx(HKEY_CLASSES_ROOT,
  598. TEXT("CLSID\\{E99F9D0C-FB39-402b-9EEB-AA185237BD34}"),
  599. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  600. &hKeyCLSID, &dwDisposition)!=ERROR_SUCCESS) {
  601. return E_UNEXPECTED;
  602. }
  603. if (RegSetValueEx(hKeyCLSID, TEXT(""), NULL, REG_SZ,
  604. (BYTE*) TEXT("IIS ApplicationPool Extension"),
  605. sizeof(TEXT("IIS ApplicationPool Extension")))!=ERROR_SUCCESS) {
  606. RegCloseKey(hKeyCLSID);
  607. return E_UNEXPECTED;
  608. }
  609. if (RegCreateKeyEx(hKeyCLSID,
  610. TEXT("InprocServer32"),
  611. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  612. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  613. RegCloseKey(hKeyCLSID);
  614. return E_UNEXPECTED;
  615. }
  616. if (RegSetValueEx(hKeyTemp, TEXT(""), NULL, REG_SZ,
  617. (BYTE*) TEXT("iisext.dll"),
  618. sizeof(TEXT("iisext.dll")))!=ERROR_SUCCESS) {
  619. RegCloseKey(hKeyTemp);
  620. RegCloseKey(hKeyCLSID);
  621. return E_UNEXPECTED;
  622. }
  623. if (RegSetValueEx(hKeyTemp, TEXT("ThreadingModel"), NULL, REG_SZ,
  624. (BYTE*) TEXT("Both"),
  625. sizeof(TEXT("Both")))!=ERROR_SUCCESS) {
  626. RegCloseKey(hKeyTemp);
  627. RegCloseKey(hKeyCLSID);
  628. return E_UNEXPECTED;
  629. }
  630. RegCloseKey(hKeyTemp);
  631. if (RegCreateKeyEx(hKeyCLSID,
  632. TEXT("ProgID"),
  633. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  634. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  635. RegCloseKey(hKeyCLSID);
  636. return E_UNEXPECTED;
  637. }
  638. if (RegSetValueEx(hKeyTemp, TEXT(""), NULL, REG_SZ,
  639. (BYTE*) TEXT("IISExtApplicationPool"),
  640. sizeof(TEXT("IISExtApplicationPool")))!=ERROR_SUCCESS) {
  641. RegCloseKey(hKeyTemp);
  642. RegCloseKey(hKeyCLSID);
  643. return E_UNEXPECTED;
  644. }
  645. RegCloseKey(hKeyTemp);
  646. if (RegCreateKeyEx(hKeyCLSID,
  647. TEXT("TypeLib"),
  648. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  649. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  650. RegCloseKey(hKeyCLSID);
  651. return E_UNEXPECTED;
  652. }
  653. if (RegSetValueEx(hKeyTemp, TEXT(""), NULL, REG_SZ,
  654. (BYTE*) TEXT("{2a56ea30-afeb-11d1-9868-00a0c922e703}"),
  655. sizeof(TEXT("{2a56ea30-afeb-11d1-9868-00a0c922e703}")))!=ERROR_SUCCESS) {
  656. RegCloseKey(hKeyTemp);
  657. RegCloseKey(hKeyCLSID);
  658. return E_UNEXPECTED;
  659. }
  660. RegCloseKey(hKeyTemp);
  661. if (RegCreateKeyEx(hKeyCLSID,
  662. TEXT("Version"),
  663. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  664. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  665. RegCloseKey(hKeyCLSID);
  666. return E_UNEXPECTED;
  667. }
  668. if (RegSetValueEx(hKeyTemp, TEXT(""), NULL, REG_SZ,
  669. (BYTE*) TEXT("0.0"),
  670. sizeof(TEXT("0.0")))!=ERROR_SUCCESS) {
  671. RegCloseKey(hKeyTemp);
  672. RegCloseKey(hKeyCLSID);
  673. return E_UNEXPECTED;
  674. }
  675. RegCloseKey(hKeyTemp);
  676. RegCloseKey(hKeyCLSID);
  677. if (RegCreateKeyEx(HKEY_CLASSES_ROOT,
  678. TEXT("IISExtApplicationPools\\CLSID"),
  679. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  680. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  681. return E_UNEXPECTED;
  682. }
  683. if (RegSetValueEx(hKeyTemp, TEXT(""), NULL, REG_SZ,
  684. (BYTE*) TEXT("{95863074-A389-406a-A2D7-D98BFC95B905}"),
  685. sizeof(TEXT("{95863074-A389-406a-A2D7-D98BFC95B905}")))!=ERROR_SUCCESS) {
  686. RegCloseKey(hKeyTemp);
  687. return E_UNEXPECTED;
  688. }
  689. RegCloseKey(hKeyTemp);
  690. if (RegCreateKeyEx(HKEY_CLASSES_ROOT,
  691. TEXT("CLSID\\{95863074-A389-406a-A2D7-D98BFC95B905}"),
  692. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  693. &hKeyCLSID, &dwDisposition)!=ERROR_SUCCESS) {
  694. return E_UNEXPECTED;
  695. }
  696. if (RegSetValueEx(hKeyCLSID, TEXT(""), NULL, REG_SZ,
  697. (BYTE*) TEXT("IIS ApplicationPools Extension"),
  698. sizeof(TEXT("IIS ApplicationPools Extension")))!=ERROR_SUCCESS) {
  699. RegCloseKey(hKeyCLSID);
  700. return E_UNEXPECTED;
  701. }
  702. if (RegCreateKeyEx(hKeyCLSID,
  703. TEXT("InprocServer32"),
  704. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  705. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  706. RegCloseKey(hKeyCLSID);
  707. return E_UNEXPECTED;
  708. }
  709. if (RegSetValueEx(hKeyTemp, TEXT(""), NULL, REG_SZ,
  710. (BYTE*) TEXT("iisext.dll"),
  711. sizeof(TEXT("iisext.dll")))!=ERROR_SUCCESS) {
  712. RegCloseKey(hKeyTemp);
  713. RegCloseKey(hKeyCLSID);
  714. return E_UNEXPECTED;
  715. }
  716. if (RegSetValueEx(hKeyTemp, TEXT("ThreadingModel"), NULL, REG_SZ,
  717. (BYTE*) TEXT("Both"),
  718. sizeof(TEXT("Both")))!=ERROR_SUCCESS) {
  719. RegCloseKey(hKeyTemp);
  720. RegCloseKey(hKeyCLSID);
  721. return E_UNEXPECTED;
  722. }
  723. RegCloseKey(hKeyTemp);
  724. if (RegCreateKeyEx(hKeyCLSID,
  725. TEXT("ProgID"),
  726. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  727. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  728. RegCloseKey(hKeyCLSID);
  729. return E_UNEXPECTED;
  730. }
  731. if (RegSetValueEx(hKeyTemp, TEXT(""), NULL, REG_SZ,
  732. (BYTE*) TEXT("IISExtApplicationPools"),
  733. sizeof(TEXT("IISExtApplicationPools")))!=ERROR_SUCCESS) {
  734. RegCloseKey(hKeyTemp);
  735. RegCloseKey(hKeyCLSID);
  736. return E_UNEXPECTED;
  737. }
  738. RegCloseKey(hKeyTemp);
  739. if (RegCreateKeyEx(hKeyCLSID,
  740. TEXT("TypeLib"),
  741. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  742. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  743. RegCloseKey(hKeyCLSID);
  744. return E_UNEXPECTED;
  745. }
  746. if (RegSetValueEx(hKeyTemp, TEXT(""), NULL, REG_SZ,
  747. (BYTE*) TEXT("{2a56ea30-afeb-11d1-9868-00a0c922e703}"),
  748. sizeof(TEXT("{2a56ea30-afeb-11d1-9868-00a0c922e703}")))!=ERROR_SUCCESS) {
  749. RegCloseKey(hKeyTemp);
  750. RegCloseKey(hKeyCLSID);
  751. return E_UNEXPECTED;
  752. }
  753. RegCloseKey(hKeyTemp);
  754. if (RegCreateKeyEx(hKeyCLSID,
  755. TEXT("Version"),
  756. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  757. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  758. RegCloseKey(hKeyCLSID);
  759. return E_UNEXPECTED;
  760. }
  761. if (RegSetValueEx(hKeyTemp, TEXT(""), NULL, REG_SZ,
  762. (BYTE*) TEXT("0.0"),
  763. sizeof(TEXT("0.0")))!=ERROR_SUCCESS) {
  764. RegCloseKey(hKeyTemp);
  765. RegCloseKey(hKeyCLSID);
  766. return E_UNEXPECTED;
  767. }
  768. RegCloseKey(hKeyTemp);
  769. RegCloseKey(hKeyCLSID);
  770. if (RegCreateKeyEx(HKEY_CLASSES_ROOT,
  771. TEXT("IISWebService\\CLSID"),
  772. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  773. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  774. return E_UNEXPECTED;
  775. }
  776. if (RegSetValueEx(hKeyTemp, TEXT(""), NULL, REG_SZ,
  777. (BYTE*) TEXT("{40B8F873-B30E-475d-BEC5-4D0EBB0DBAF3}"),
  778. sizeof(TEXT("{40B8F873-B30E-475d-BEC5-4D0EBB0DBAF3}")))!=ERROR_SUCCESS) {
  779. RegCloseKey(hKeyTemp);
  780. return E_UNEXPECTED;
  781. }
  782. RegCloseKey(hKeyTemp);
  783. if (RegCreateKeyEx(HKEY_CLASSES_ROOT,
  784. TEXT("CLSID\\{40B8F873-B30E-475d-BEC5-4D0EBB0DBAF3}"),
  785. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  786. &hKeyCLSID, &dwDisposition)!=ERROR_SUCCESS) {
  787. return E_UNEXPECTED;
  788. }
  789. if (RegSetValueEx(hKeyCLSID, TEXT(""), NULL, REG_SZ,
  790. (BYTE*) TEXT("IIS Web Service Extension"),
  791. sizeof(TEXT("IIS Web Service Extension")))!=ERROR_SUCCESS) {
  792. RegCloseKey(hKeyCLSID);
  793. return E_UNEXPECTED;
  794. }
  795. if (RegCreateKeyEx(hKeyCLSID,
  796. TEXT("InprocServer32"),
  797. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  798. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  799. RegCloseKey(hKeyCLSID);
  800. return E_UNEXPECTED;
  801. }
  802. if (RegSetValueEx(hKeyTemp, TEXT(""), NULL, REG_SZ,
  803. (BYTE*) TEXT("iisext.dll"),
  804. sizeof(TEXT("iisext.dll")))!=ERROR_SUCCESS) {
  805. RegCloseKey(hKeyTemp);
  806. RegCloseKey(hKeyCLSID);
  807. return E_UNEXPECTED;
  808. }
  809. if (RegSetValueEx(hKeyTemp, TEXT("ThreadingModel"), NULL, REG_SZ,
  810. (BYTE*) TEXT("Both"),
  811. sizeof(TEXT("Both")))!=ERROR_SUCCESS) {
  812. RegCloseKey(hKeyTemp);
  813. RegCloseKey(hKeyCLSID);
  814. return E_UNEXPECTED;
  815. }
  816. RegCloseKey(hKeyTemp);
  817. if (RegCreateKeyEx(hKeyCLSID,
  818. TEXT("ProgID"),
  819. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  820. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  821. RegCloseKey(hKeyCLSID);
  822. return E_UNEXPECTED;
  823. }
  824. if (RegSetValueEx(hKeyTemp, TEXT(""), NULL, REG_SZ,
  825. (BYTE*) TEXT("IISExtWebService"),
  826. sizeof(TEXT("IISExtWebService")))!=ERROR_SUCCESS) {
  827. RegCloseKey(hKeyTemp);
  828. RegCloseKey(hKeyCLSID);
  829. return E_UNEXPECTED;
  830. }
  831. RegCloseKey(hKeyTemp);
  832. if (RegCreateKeyEx(hKeyCLSID,
  833. TEXT("TypeLib"),
  834. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  835. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  836. RegCloseKey(hKeyCLSID);
  837. return E_UNEXPECTED;
  838. }
  839. if (RegSetValueEx(hKeyTemp, TEXT(""), NULL, REG_SZ,
  840. (BYTE*) TEXT("{2a56ea30-afeb-11d1-9868-00a0c922e703}"),
  841. sizeof(TEXT("{2a56ea30-afeb-11d1-9868-00a0c922e703}")))!=ERROR_SUCCESS) {
  842. RegCloseKey(hKeyTemp);
  843. RegCloseKey(hKeyCLSID);
  844. return E_UNEXPECTED;
  845. }
  846. RegCloseKey(hKeyTemp);
  847. if (RegCreateKeyEx(hKeyCLSID,
  848. TEXT("Version"),
  849. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  850. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  851. RegCloseKey(hKeyCLSID);
  852. return E_UNEXPECTED;
  853. }
  854. if (RegSetValueEx(hKeyTemp, TEXT(""), NULL, REG_SZ,
  855. (BYTE*) TEXT("0.0"),
  856. sizeof(TEXT("0.0")))!=ERROR_SUCCESS) {
  857. RegCloseKey(hKeyTemp);
  858. RegCloseKey(hKeyCLSID);
  859. return E_UNEXPECTED;
  860. }
  861. RegCloseKey(hKeyTemp);
  862. RegCloseKey(hKeyCLSID);
  863. if (RegCreateKeyEx(HKEY_CLASSES_ROOT,
  864. TEXT("IISExtApp\\CLSID"),
  865. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  866. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  867. return E_UNEXPECTED;
  868. }
  869. if (RegSetValueEx(hKeyTemp, TEXT(""), NULL, REG_SZ,
  870. (BYTE*) TEXT("{b4f34438-afec-11d1-9868-00a0c922e703}"),
  871. sizeof(TEXT("{b4f34438-afec-11d1-9868-00a0c922e703}")))!=ERROR_SUCCESS) {
  872. RegCloseKey(hKeyTemp);
  873. return E_UNEXPECTED;
  874. }
  875. RegCloseKey(hKeyTemp);
  876. //
  877. // register CLSID
  878. //
  879. if (RegCreateKeyEx(HKEY_CLASSES_ROOT,
  880. TEXT("CLSID\\{b4f34438-afec-11d1-9868-00a0c922e703}"),
  881. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  882. &hKeyCLSID, &dwDisposition)!=ERROR_SUCCESS) {
  883. return E_UNEXPECTED;
  884. }
  885. if (RegSetValueEx(hKeyCLSID, TEXT(""), NULL, REG_SZ,
  886. (BYTE*) TEXT("IIS App Extension"),
  887. sizeof(TEXT("IIS App Extension")))!=ERROR_SUCCESS) {
  888. RegCloseKey(hKeyCLSID);
  889. return E_UNEXPECTED;
  890. }
  891. if (RegCreateKeyEx(hKeyCLSID,
  892. TEXT("InprocServer32"),
  893. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  894. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  895. RegCloseKey(hKeyCLSID);
  896. return E_UNEXPECTED;
  897. }
  898. if (RegSetValueEx(hKeyTemp, TEXT(""), NULL, REG_SZ,
  899. (BYTE*) TEXT("iisext.dll"),
  900. sizeof(TEXT("iisext.dll")))!=ERROR_SUCCESS) {
  901. RegCloseKey(hKeyTemp);
  902. RegCloseKey(hKeyCLSID);
  903. return E_UNEXPECTED;
  904. }
  905. if (RegSetValueEx(hKeyTemp, TEXT("ThreadingModel"), NULL, REG_SZ,
  906. (BYTE*) TEXT("Both"),
  907. sizeof(TEXT("Both")))!=ERROR_SUCCESS) {
  908. RegCloseKey(hKeyTemp);
  909. RegCloseKey(hKeyCLSID);
  910. return E_UNEXPECTED;
  911. }
  912. RegCloseKey(hKeyTemp);
  913. if (RegCreateKeyEx(hKeyCLSID,
  914. TEXT("ProgID"),
  915. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  916. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  917. RegCloseKey(hKeyCLSID);
  918. return E_UNEXPECTED;
  919. }
  920. if (RegSetValueEx(hKeyTemp, TEXT(""), NULL, REG_SZ,
  921. (BYTE*) TEXT("IISExtApp"),
  922. sizeof(TEXT("IISExtApp")))!=ERROR_SUCCESS) {
  923. RegCloseKey(hKeyTemp);
  924. RegCloseKey(hKeyCLSID);
  925. return E_UNEXPECTED;
  926. }
  927. RegCloseKey(hKeyTemp);
  928. if (RegCreateKeyEx(hKeyCLSID,
  929. TEXT("TypeLib"),
  930. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  931. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  932. RegCloseKey(hKeyCLSID);
  933. return E_UNEXPECTED;
  934. }
  935. if (RegSetValueEx(hKeyTemp, TEXT(""), NULL, REG_SZ,
  936. (BYTE*) TEXT("{2a56ea30-afeb-11d1-9868-00a0c922e703}"),
  937. sizeof(TEXT("{2a56ea30-afeb-11d1-9868-00a0c922e703}")))!=ERROR_SUCCESS) {
  938. RegCloseKey(hKeyTemp);
  939. RegCloseKey(hKeyCLSID);
  940. return E_UNEXPECTED;
  941. }
  942. RegCloseKey(hKeyTemp);
  943. if (RegCreateKeyEx(hKeyCLSID,
  944. TEXT("Version"),
  945. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  946. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  947. RegCloseKey(hKeyCLSID);
  948. return E_UNEXPECTED;
  949. }
  950. if (RegSetValueEx(hKeyTemp, TEXT(""), NULL, REG_SZ,
  951. (BYTE*) TEXT("0.0"),
  952. sizeof(TEXT("0.0")))!=ERROR_SUCCESS) {
  953. RegCloseKey(hKeyTemp);
  954. RegCloseKey(hKeyCLSID);
  955. return E_UNEXPECTED;
  956. }
  957. RegCloseKey(hKeyTemp);
  958. RegCloseKey(hKeyCLSID);
  959. if (RegCreateKeyEx(HKEY_CLASSES_ROOT,
  960. TEXT("IISExtServer\\CLSID"),
  961. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  962. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  963. return E_UNEXPECTED;
  964. }
  965. if (RegSetValueEx(hKeyTemp, TEXT(""), NULL, REG_SZ,
  966. (BYTE*) TEXT("{c3b32488-afec-11d1-9868-00a0c922e703}"),
  967. sizeof(TEXT("{c3b32488-afec-11d1-9868-00a0c922e703}")))!=ERROR_SUCCESS) {
  968. RegCloseKey(hKeyTemp);
  969. return E_UNEXPECTED;
  970. }
  971. RegCloseKey(hKeyTemp);
  972. //
  973. // register CLSID
  974. //
  975. if (RegCreateKeyEx(HKEY_CLASSES_ROOT,
  976. TEXT("CLSID\\{c3b32488-afec-11d1-9868-00a0c922e703}"),
  977. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  978. &hKeyCLSID, &dwDisposition)!=ERROR_SUCCESS) {
  979. return E_UNEXPECTED;
  980. }
  981. if (RegSetValueEx(hKeyCLSID, TEXT(""), NULL, REG_SZ,
  982. (BYTE*) TEXT("IIS Server Extension"),
  983. sizeof(TEXT("IIS Server Extension")))!=ERROR_SUCCESS) {
  984. RegCloseKey(hKeyCLSID);
  985. return E_UNEXPECTED;
  986. }
  987. if (RegCreateKeyEx(hKeyCLSID,
  988. TEXT("InprocServer32"),
  989. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  990. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  991. RegCloseKey(hKeyCLSID);
  992. return E_UNEXPECTED;
  993. }
  994. if (RegSetValueEx(hKeyTemp, TEXT(""), NULL, REG_SZ,
  995. (BYTE*) TEXT("iisext.dll"),
  996. sizeof(TEXT("iisext.dll")))!=ERROR_SUCCESS) {
  997. RegCloseKey(hKeyTemp);
  998. RegCloseKey(hKeyCLSID);
  999. return E_UNEXPECTED;
  1000. }
  1001. if (RegSetValueEx(hKeyTemp, TEXT("ThreadingModel"), NULL, REG_SZ,
  1002. (BYTE*) TEXT("Both"),
  1003. sizeof(TEXT("Both")))!=ERROR_SUCCESS) {
  1004. RegCloseKey(hKeyTemp);
  1005. RegCloseKey(hKeyCLSID);
  1006. return E_UNEXPECTED;
  1007. }
  1008. RegCloseKey(hKeyTemp);
  1009. if (RegCreateKeyEx(hKeyCLSID,
  1010. TEXT("ProgID"),
  1011. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  1012. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  1013. RegCloseKey(hKeyCLSID);
  1014. return E_UNEXPECTED;
  1015. }
  1016. if (RegSetValueEx(hKeyTemp, TEXT(""), NULL, REG_SZ,
  1017. (BYTE*) TEXT("IISExtServer"),
  1018. sizeof(TEXT("IISExtServer")))!=ERROR_SUCCESS) {
  1019. RegCloseKey(hKeyTemp);
  1020. RegCloseKey(hKeyCLSID);
  1021. return E_UNEXPECTED;
  1022. }
  1023. RegCloseKey(hKeyTemp);
  1024. if (RegCreateKeyEx(hKeyCLSID,
  1025. TEXT("TypeLib"),
  1026. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  1027. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  1028. RegCloseKey(hKeyCLSID);
  1029. return E_UNEXPECTED;
  1030. }
  1031. if (RegSetValueEx(hKeyTemp, TEXT(""), NULL, REG_SZ,
  1032. (BYTE*) TEXT("{2a56ea30-afeb-11d1-9868-00a0c922e703}"),
  1033. sizeof(TEXT("{2a56ea30-afeb-11d1-9868-00a0c922e703}")))!=ERROR_SUCCESS) {
  1034. RegCloseKey(hKeyTemp);
  1035. RegCloseKey(hKeyCLSID);
  1036. return E_UNEXPECTED;
  1037. }
  1038. RegCloseKey(hKeyTemp);
  1039. if (RegCreateKeyEx(hKeyCLSID,
  1040. TEXT("Version"),
  1041. NULL, TEXT(""), REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL,
  1042. &hKeyTemp, &dwDisposition)!=ERROR_SUCCESS) {
  1043. RegCloseKey(hKeyCLSID);
  1044. return E_UNEXPECTED;
  1045. }
  1046. if (RegSetValueEx(hKeyTemp, TEXT(""), NULL, REG_SZ,
  1047. (BYTE*) TEXT("0.0"),
  1048. sizeof(TEXT("0.0")))!=ERROR_SUCCESS) {
  1049. RegCloseKey(hKeyTemp);
  1050. RegCloseKey(hKeyCLSID);
  1051. return E_UNEXPECTED;
  1052. }
  1053. RegCloseKey(hKeyTemp);
  1054. RegCloseKey(hKeyCLSID);
  1055. return NOERROR;
  1056. }
  1057. //+------------------------------------------------------------------------
  1058. //
  1059. // Function: DllUnregisterServer
  1060. //
  1061. // Synopsis: Register registry keys for adsiis
  1062. //
  1063. // Arguments: None
  1064. //
  1065. //+------------------------------------------------------------------------
  1066. /* #pragma INTRINSA suppress=all */
  1067. STDAPI DllUnregisterServer(void) {
  1068. UnRegisterTypeLib(LIBID_IISExt,
  1069. 1,
  1070. 0,
  1071. 0,
  1072. SYS_WIN32);
  1073. RegDeleteKey(HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\ADs\\Providers\\IIS\\Extensions\\IIsCertMapper\\{bc36cde8-afeb-11d1-9868-00a0c922e703}"));
  1074. RegDeleteKey(HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\ADs\\Providers\\IIS\\Extensions\\IIsCertMapper"));
  1075. RegDeleteKey(HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\ADs\\Providers\\IIS\\Extensions\\IIsComputer\\{91ef9258-afec-11d1-9868-00a0c922e703}"));
  1076. RegDeleteKey(HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\ADs\\Providers\\IIS\\Extensions\\IIsComputer"));
  1077. RegDeleteKey(HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\ADs\\Providers\\IIS\\Extensions\\IIsApplicationPool\\{E99F9D0C-FB39-402b-9EEB-AA185237BD34}"));
  1078. RegDeleteKey(HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\ADs\\Providers\\IIS\\Extensions\\IIsApplicationPool"));
  1079. RegDeleteKey(HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\ADs\\Providers\\IIS\\Extensions\\IIsWebService\\{40B8F873-B30E-475d-BEC5-4D0EBB0DBAF3}"));
  1080. RegDeleteKey(HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\ADs\\Providers\\IIS\\Extensions\\IIsWebService"));
  1081. RegDeleteKey(HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\ADs\\Providers\\IIS\\Extensions\\IIsApplicationPools\\{95863074-A389-406a-A2D7-D98BFC95B905}"));
  1082. RegDeleteKey(HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\ADs\\Providers\\IIS\\Extensions\\IIsApplicationPools"));
  1083. RegDeleteKey(HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\ADs\\Providers\\IIS\\Extensions\\IIsApp\\{b4f34438-afec-11d1-9868-00a0c922e703}"));
  1084. RegDeleteKey(HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\ADs\\Providers\\IIS\\Extensions\\IIsApp"));
  1085. RegDeleteKey(HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\ADs\\Providers\\IIS\\Extensions\\IIsServer\\{c3b32488-afec-11d1-9868-00a0c922e703}"));
  1086. RegDeleteKey(HKEY_LOCAL_MACHINE, TEXT("Software\\Microsoft\\ADs\\Providers\\IIS\\Extensions\\IIsServer"));
  1087. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("IISExtDsCrMap\\CLSID"));
  1088. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("IISExtDsCrMap"));
  1089. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{bc36cde8-afeb-11d1-9868-00a0c922e703}\\InprocServer32"));
  1090. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{bc36cde8-afeb-11d1-9868-00a0c922e703}\\ProgID"));
  1091. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{bc36cde8-afeb-11d1-9868-00a0c922e703}\\TypeLib"));
  1092. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{bc36cde8-afeb-11d1-9868-00a0c922e703}\\Version"));
  1093. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{bc36cde8-afeb-11d1-9868-00a0c922e703}"));
  1094. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("IISExtComputer\\CLSID"));
  1095. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("IISExtComputer"));
  1096. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{91ef9258-afec-11d1-9868-00a0c922e703}\\InprocServer32"));
  1097. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{91ef9258-afec-11d1-9868-00a0c922e703}\\ProgID"));
  1098. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{91ef9258-afec-11d1-9868-00a0c922e703}\\TypeLib"));
  1099. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{91ef9258-afec-11d1-9868-00a0c922e703}\\Version"));
  1100. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{91ef9258-afec-11d1-9868-00a0c922e703}"));
  1101. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("IISExtApplicationPool\\CLSID"));
  1102. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("IISExtApplicationPool"));
  1103. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{E99F9D0C-FB39-402b-9EEB-AA185237BD34}\\InprocServer32"));
  1104. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{E99F9D0C-FB39-402b-9EEB-AA185237BD34}\\ProgID"));
  1105. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{E99F9D0C-FB39-402b-9EEB-AA185237BD34}\\TypeLib"));
  1106. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{E99F9D0C-FB39-402b-9EEB-AA185237BD34}\\Version"));
  1107. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{E99F9D0C-FB39-402b-9EEB-AA185237BD34}"));
  1108. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("IISExtApplicationPools\\CLSID"));
  1109. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("IISExtApplicationPools"));
  1110. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{95863074-A389-406a-A2D7-D98BFC95B905}\\InprocServer32"));
  1111. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{95863074-A389-406a-A2D7-D98BFC95B905}\\ProgID"));
  1112. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{95863074-A389-406a-A2D7-D98BFC95B905}\\TypeLib"));
  1113. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{95863074-A389-406a-A2D7-D98BFC95B905}\\Version"));
  1114. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{95863074-A389-406a-A2D7-D98BFC95B905}"));
  1115. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("IISExtWebService\\CLSID"));
  1116. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("IISExtWebService"));
  1117. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{40B8F873-B30E-475d-BEC5-4D0EBB0DBAF3}\\InprocServer32"));
  1118. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{40B8F873-B30E-475d-BEC5-4D0EBB0DBAF3}\\ProgID"));
  1119. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{40B8F873-B30E-475d-BEC5-4D0EBB0DBAF3}\\TypeLib"));
  1120. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{40B8F873-B30E-475d-BEC5-4D0EBB0DBAF3}\\Version"));
  1121. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{40B8F873-B30E-475d-BEC5-4D0EBB0DBAF3}"));
  1122. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("IISExtApp\\CLSID"));
  1123. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("IISExtApp"));
  1124. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{91ef9258-afec-11d1-9868-00a0c922e703}\\InprocServer32"));
  1125. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{91ef9258-afec-11d1-9868-00a0c922e703}\\ProgID"));
  1126. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{91ef9258-afec-11d1-9868-00a0c922e703}\\TypeLib"));
  1127. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{91ef9258-afec-11d1-9868-00a0c922e703}\\Version"));
  1128. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{91ef9258-afec-11d1-9868-00a0c922e703}"));
  1129. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("IISExtServer\\CLSID"));
  1130. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("IISExtServer"));
  1131. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{c3b32488-afec-11d1-9868-00a0c922e703}\\InprocServer32"));
  1132. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{c3b32488-afec-11d1-9868-00a0c922e703}\\ProgID"));
  1133. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{c3b32488-afec-11d1-9868-00a0c922e703}\\TypeLib"));
  1134. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{c3b32488-afec-11d1-9868-00a0c922e703}\\Version"));
  1135. RegDeleteKey(HKEY_CLASSES_ROOT, TEXT("CLSID\\{c3b32488-afec-11d1-9868-00a0c922e703}"));
  1136. return NOERROR;
  1137. }