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.

1380 lines
46 KiB

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