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.

1820 lines
53 KiB

  1. #include "stdafx.h"
  2. #include "regkeys.h"
  3. #include "filefind.h"
  4. #include "resdefs.h"
  5. #include <afxtempl.h>
  6. #include <shlobj.h>
  7. #include <comdef.h>
  8. #include <setupapi.h>
  9. #include <wininet.h>
  10. #include <winineti.h>
  11. #include <cleanoc.h>
  12. #include <ras.h>
  13. #include <raserror.h>
  14. #include <wincrypt.h>
  15. #define SECURITY_WIN32
  16. #include <schnlsp.h> //for UNISP_NAME_A
  17. #include <sspi.h> //for SCHANNEL.dll api -- to obtain encryption key size
  18. #include "msie.h"
  19. #include "msiedata.h"
  20. #ifdef _DEBUG
  21. #define new DEBUG_NEW
  22. #undef THIS_FILE
  23. static char THIS_FILE[] = __FILE__;
  24. #endif
  25. //*** DEFINES ***
  26. #define CONSTANT_MEGABYTE (1024*1024)
  27. #define CONTROLNAME_MAXSIZE 200
  28. #define CONTENT_IE5 "Content.IE5"
  29. #define INF_FILE "iefiles5.inf"
  30. #define INF_FILES_SECTION _T("Files")
  31. #define SETUP_LOG "Active Setup Log.txt"
  32. #define IEXPLORE_EXE "iexplore.exe"
  33. #define MY_STORE "MY"
  34. #define ADDRESS_BOOK_STORE "AddressBook"
  35. #define CA_STORE "CA"
  36. //*** ENUMS ***
  37. enum BoolStringType
  38. {
  39. YES_NO,
  40. TRUE_FALSE,
  41. ENABLED_DISABLED
  42. };
  43. enum ExportLibType
  44. {
  45. WININET,
  46. MSRATING,
  47. OCCACHE,
  48. RASAPI32,
  49. CRYPT32
  50. };
  51. //*** STRUCTS ***
  52. struct TRANSLATION // for retrieving Language
  53. {
  54. WORD langID; // language ID
  55. WORD charset; // code page
  56. } translation;
  57. // WININET Function Pointers
  58. BOOL (WINAPI* pfnInternetQueryOption)(HINTERNET hInternet, DWORD dwOption, LPVOID lpBuffer, LPDWORD lpdwBufferLength);
  59. BOOL (WINAPI* pfnGetDiskInfo)(LPTSTR pszPath, PDWORD pdwClusterSize, PDWORDLONG pdlAvail, PDWORDLONG pdlTotal);
  60. // MSRATING Function Pointers
  61. HRESULT (WINAPI* pfnRatingEnabledQuery)();
  62. // OCCACHE Function Pointers
  63. LONG (WINAPI *pfnFindFirstControl)(HANDLE& hFindHandle, HANDLE& hControlHandle, LPCTSTR lpszCachePath /*= NULL*/);
  64. LONG (WINAPI *pfnFindNextControl)(HANDLE& hFindHandle, HANDLE& hControlHandle);
  65. BOOL (WINAPI *pfnGetControlInfo)(HANDLE hControlHandle, UINT nFlag, LPDWORD lpdwData, LPSTR lpszBuf, int nBufLen);
  66. void (WINAPI *pfnFindControlClose)(HANDLE hFindHandle);
  67. void (WINAPI *pfnReleaseControlHandle)(HANDLE hControlHandle);
  68. // RASAPI32 Function Pointers
  69. DWORD (WINAPI* pfnRasGetEntryProperties)(LPCTSTR, LPCTSTR, LPRASENTRYW, LPDWORD, LPBYTE, LPDWORD);
  70. DWORD (WINAPI* pfnRasEnumEntries)(LPCTSTR, LPCTSTR, LPRASENTRYNAMEW, LPDWORD, LPDWORD);
  71. // CRYPT32 Function Pointers
  72. HCERTSTORE (WINAPI* pfnCertOpenSystemStore)(HCRYPTPROV, LPCSTR);
  73. BOOL (WINAPI* pfnCertCloseStore)(HCERTSTORE, DWORD);
  74. PCCERT_CONTEXT (WINAPI* pfnCertEnumCertificatesInStore)(HCERTSTORE, PCCERT_CONTEXT);
  75. DWORD (WINAPI* pfnCertGetNameString)(PCCERT_CONTEXT, DWORD, DWORD, void *, LPTSTR, DWORD);
  76. PCCRYPT_OID_INFO (WINAPI* pfnCryptFindOIDInfo)(DWORD, void *, DWORD);
  77. BOOL (WINAPI* pfnCertGetCertificateContextProperty)(PCCERT_CONTEXT, DWORD, void *, DWORD *);
  78. BOOL (WINAPI* pfnCryptDecodeObject)(DWORD, LPCSTR, const BYTE *, DWORD, DWORD, void *, DWORD *);
  79. HINSTANCE GetExports(int enExportLib)
  80. {
  81. TCHAR szwindir[MAX_PATH + 1];
  82. GetSystemDirectory(szwindir,MAX_PATH);
  83. CString strPath;
  84. HINSTANCE hInst;
  85. switch (enExportLib)
  86. {
  87. case WININET:
  88. strPath = szwindir;
  89. strPath += _T("\\WININET.DLL");
  90. //hInst = LoadLibraryW(_T("WININET.DLL"));
  91. hInst = LoadLibraryW(strPath);
  92. if (hInst == NULL)
  93. goto error;
  94. pfnInternetQueryOption = (BOOL(WINAPI *)(HINTERNET, DWORD, LPVOID, LPDWORD))GetProcAddress(hInst, "InternetQueryOptionW");
  95. pfnGetDiskInfo = (BOOL(WINAPI *)(LPTSTR, PDWORD, PDWORDLONG, PDWORDLONG))GetProcAddress(hInst, (LPSTR)102);
  96. if ((pfnInternetQueryOption == NULL) || (pfnGetDiskInfo == NULL))
  97. goto error;
  98. break;
  99. case MSRATING:
  100. strPath = szwindir;
  101. strPath += _T("\\MSRATING.DLL");
  102. hInst = LoadLibraryW(strPath);
  103. //hInst = LoadLibraryW(_T("MSRATING.DLL"));
  104. if (hInst == NULL)
  105. goto error;
  106. pfnRatingEnabledQuery = (HRESULT(WINAPI *)(VOID))GetProcAddress(hInst, "RatingEnabledQuery");
  107. if (pfnRatingEnabledQuery == NULL)
  108. goto error;
  109. break;
  110. case OCCACHE:
  111. strPath = szwindir;
  112. strPath += _T("\\OCCACHE.DLL");
  113. hInst = LoadLibraryW(strPath);
  114. if (hInst == NULL)
  115. goto error;
  116. pfnFindFirstControl = (LONG(WINAPI *)(HANDLE&, HANDLE&, LPCTSTR))GetProcAddress(hInst, "FindFirstControl");
  117. pfnFindNextControl = (LONG(WINAPI *)(HANDLE&, HANDLE&))GetProcAddress(hInst, "FindNextControl");
  118. pfnGetControlInfo = (BOOL(WINAPI *)(HANDLE, UINT, LPDWORD, LPSTR, int))GetProcAddress(hInst, "GetControlInfo");
  119. pfnFindControlClose = (void(WINAPI *)(HANDLE))GetProcAddress(hInst, "FindControlClose");
  120. pfnReleaseControlHandle = (void(WINAPI *)(HANDLE))GetProcAddress(hInst, "ReleaseControlHandle");
  121. if ((pfnFindFirstControl == NULL) || (pfnFindNextControl == NULL) || (pfnGetControlInfo == NULL)
  122. || (pfnFindControlClose == NULL) || (pfnReleaseControlHandle == NULL))
  123. goto error;
  124. break;
  125. case RASAPI32:
  126. hInst = LoadLibraryA("%windir%\\system32\\RASAPI32.DLL");
  127. if (hInst == NULL)
  128. goto error;
  129. pfnRasGetEntryProperties = (DWORD(WINAPI *)(LPCTSTR, LPCTSTR, LPRASENTRYW, LPDWORD, LPBYTE, LPDWORD))GetProcAddress(hInst, "RasGetEntryPropertiesW");
  130. pfnRasEnumEntries = (DWORD(WINAPI *)(LPCTSTR, LPCTSTR, LPRASENTRYNAMEW, LPDWORD, LPDWORD))GetProcAddress(hInst, "RasEnumEntriesW");
  131. if ((pfnRasGetEntryProperties == NULL) || (pfnRasEnumEntries == NULL))
  132. goto error;
  133. break;
  134. case CRYPT32:
  135. strPath = szwindir;
  136. strPath += _T("%windir%\\system32\\CRYPT32.DLL");
  137. hInst = LoadLibraryW(strPath);
  138. if (hInst == NULL)
  139. goto error;
  140. pfnCertOpenSystemStore = (HCERTSTORE(WINAPI *)(HCRYPTPROV, LPCSTR))GetProcAddress(hInst, "CertOpenSystemStoreW");
  141. pfnCertCloseStore = (BOOL(WINAPI *)(HCERTSTORE, DWORD))GetProcAddress(hInst, "CertCloseStore");
  142. pfnCertEnumCertificatesInStore = (PCCERT_CONTEXT(WINAPI *)(HCERTSTORE, PCCERT_CONTEXT))GetProcAddress(hInst, "CertEnumCertificatesInStore");
  143. pfnCertGetNameString = (DWORD(WINAPI *)(PCCERT_CONTEXT, DWORD, DWORD, void *, LPTSTR, DWORD))GetProcAddress(hInst, "CertGetNameStringW");
  144. pfnCryptFindOIDInfo = (PCCRYPT_OID_INFO(WINAPI *)(DWORD, void *, DWORD))GetProcAddress(hInst, "CryptFindOIDInfo");
  145. pfnCertGetCertificateContextProperty = (BOOL(WINAPI *)(PCCERT_CONTEXT, DWORD, void *, DWORD *))GetProcAddress(hInst, "CertGetCertificateContextProperty");
  146. pfnCryptDecodeObject = (BOOL(WINAPI *)(DWORD, LPCSTR, const BYTE *, DWORD, DWORD, void *, DWORD *))GetProcAddress(hInst, "CryptDecodeObject");
  147. if ((pfnCertOpenSystemStore == NULL) ||
  148. (pfnCertCloseStore == NULL) ||
  149. (pfnCertEnumCertificatesInStore == NULL) ||
  150. (pfnCertGetNameString == NULL) ||
  151. (pfnCryptFindOIDInfo == NULL) ||
  152. (pfnCertGetCertificateContextProperty == NULL) ||
  153. (pfnCryptDecodeObject == NULL))
  154. goto error;
  155. }
  156. return hInst;
  157. error:
  158. if (hInst)
  159. FreeLibrary(hInst);
  160. return NULL;
  161. }
  162. //-----------------------------------------------------------------------------
  163. // GetBooleanString - Converts a boolean to a string, returns as a CString.
  164. //-----------------------------------------------------------------------------
  165. CString CMsieApp::GetBooleanString(BOOL bValue, int nType)
  166. {
  167. CString strTemp;
  168. int idsTemp;
  169. switch (nType)
  170. {
  171. case TRUE_FALSE:
  172. idsTemp = bValue ? IDS_TRUE : IDS_FALSE;
  173. break;
  174. case ENABLED_DISABLED:
  175. idsTemp = bValue ? IDS_ENABLED : IDS_DISABLED;
  176. break;
  177. case YES_NO:
  178. default:
  179. idsTemp = bValue ? IDS_YES : IDS_NO;
  180. break;
  181. }
  182. strTemp.LoadString(idsTemp);
  183. return strTemp;
  184. }
  185. //-----------------------------------------------------------------------------
  186. // ConvertIPAddressToString - Converts an IP address, returns as a CString.
  187. //-----------------------------------------------------------------------------
  188. CString CMsieApp::ConvertIPAddressToString(RASIPADDR ipaddr)
  189. {
  190. CString strTemp;
  191. strTemp.Format(_T("%d.%d.%d.%d"), ipaddr.a, ipaddr.b, ipaddr.c, ipaddr.d);
  192. return strTemp;
  193. }
  194. //-----------------------------------------------------------------------------
  195. // GetRegValue - Gets a Registry value, returns as variant.
  196. //-----------------------------------------------------------------------------
  197. void CMsieApp::GetRegValue(HKEY hKey, LPCTSTR pszSubKey, LPCTSTR pszName, COleVariant &vtData)
  198. {
  199. CoImpersonateClient();
  200. HKEY hOpenKey;
  201. BYTE byData[MAX_PATH];
  202. DWORD dwType, cbData;
  203. long lResult;
  204. if (ERROR_SUCCESS == RegOpenKeyEx(hKey, pszSubKey, 0, KEY_QUERY_VALUE, &hOpenKey))
  205. {
  206. cbData = sizeof(byData);
  207. dwType = REG_DWORD;
  208. lResult = RegQueryValueEx(hOpenKey, pszName, NULL, &dwType, byData, &cbData);
  209. if (lResult == ERROR_SUCCESS)
  210. {
  211. if ((dwType == REG_BINARY) || (dwType == REG_DWORD))
  212. vtData = (long)*byData;
  213. else
  214. vtData = (TCHAR*) byData;
  215. }
  216. RegCloseKey(hOpenKey);
  217. }
  218. }
  219. //-----------------------------------------------------------------------------
  220. // GetRegValue - Gets a Registry value, returns as long.
  221. //-----------------------------------------------------------------------------
  222. long CMsieApp::GetRegValue(HKEY hKey, LPCTSTR pszSubKey, LPCTSTR pszName, DWORD &dwData)
  223. {
  224. HKEY hOpenKey;
  225. DWORD cbData;
  226. long lResult;
  227. lResult = RegOpenKeyEx(hKey, pszSubKey, 0, KEY_QUERY_VALUE, &hOpenKey);
  228. if (lResult == ERROR_SUCCESS)
  229. {
  230. cbData = sizeof(dwData);
  231. lResult = RegQueryValueEx(hOpenKey, pszName, NULL, NULL, (LPBYTE)&dwData, &cbData);
  232. RegCloseKey(hOpenKey);
  233. }
  234. return lResult;
  235. }
  236. //-----------------------------------------------------------------------------
  237. // GetRegValue - Gets a Registry value, returns as string.
  238. //-----------------------------------------------------------------------------
  239. long CMsieApp::GetRegValue(HKEY hKey, LPCTSTR pszSubKey, LPCTSTR pszName, CString &strData)
  240. {
  241. HKEY hOpenKey;
  242. DWORD cbData;
  243. long lResult;
  244. lResult = RegOpenKeyEx(hKey, pszSubKey, 0, KEY_QUERY_VALUE, &hOpenKey);
  245. if (lResult == ERROR_SUCCESS)
  246. {
  247. cbData = MAX_PATH;
  248. lResult = RegQueryValueEx(hOpenKey, pszName, NULL, NULL, (LPBYTE)strData.GetBuffer(MAX_PATH), &cbData);
  249. strData.ReleaseBuffer();
  250. RegCloseKey(hOpenKey);
  251. }
  252. return lResult;
  253. }
  254. //-----------------------------------------------------------------------------
  255. // GetLongPathName - Returns long path name of passed in short path name.
  256. //-----------------------------------------------------------------------------
  257. CString CMsieApp::GetLongPathName(LPCTSTR pszShortPath)
  258. {
  259. LPSHELLFOLDER psfDesktop = NULL;
  260. ULONG chEaten = 0;
  261. LPITEMIDLIST pidlShellItem = NULL;
  262. CString strLongPath = pszShortPath; // initializing return str in case of failure
  263. WCHAR wstrShortPath[MAX_PATH + 1];
  264. // Get the Desktop's shell folder interface
  265. HRESULT hr = SHGetDesktopFolder(&psfDesktop);
  266. #ifdef _UNICODE
  267. wcsncpy(wstrShortPath, pszShortPath,MAX_PATH);
  268. #else
  269. MultiByteToWideChar(CP_ACP, 0, pszShortPath, -1, wstrShortPath, MAX_PATH);
  270. #endif
  271. // Request an ID list (relative to the desktop) for the short pathname
  272. hr = psfDesktop->ParseDisplayName(NULL, NULL, wstrShortPath, &chEaten, &pidlShellItem, NULL);
  273. psfDesktop->Release(); // Release the desktop's IShellFolder
  274. if (SUCCEEDED(hr))
  275. {
  276. // We did get an ID list, convert it to a long pathname
  277. SHGetPathFromIDList(pidlShellItem, strLongPath.GetBuffer(MAX_PATH));
  278. strLongPath.ReleaseBuffer();
  279. // Free the ID list allocated by ParseDisplayName
  280. LPMALLOC pMalloc = NULL;
  281. SHGetMalloc(&pMalloc);
  282. pMalloc->Free(pidlShellItem);
  283. pMalloc->Release();
  284. }
  285. return strLongPath;
  286. }
  287. //-----------------------------------------------------------------------------
  288. // GetDirSize - Returns size of a directory, including all files in subdirs.
  289. //-----------------------------------------------------------------------------
  290. DWORD CMsieApp::GetDirSize(LPCTSTR pszDir)
  291. {
  292. CFindFile finder;
  293. CString strDir(pszDir);
  294. DWORD dwSize = 0;
  295. BOOL bWorking;
  296. if (strDir[strDir.GetLength() - 1] != _T('\\'))
  297. strDir += '\\';
  298. strDir += "*.*";
  299. bWorking = finder.FindFile(strDir);
  300. while (bWorking)
  301. {
  302. bWorking = finder.FindNextFile();
  303. if (!finder.IsDots())
  304. {
  305. if (finder.IsDirectory())
  306. {
  307. // recursively add subdir size
  308. dwSize += GetDirSize(finder.GetFilePath());
  309. }
  310. else
  311. {
  312. //TRACE(finder.GetFileName() + "\n");
  313. dwSize += finder.GetLength();
  314. }
  315. }
  316. }
  317. return dwSize;
  318. }
  319. //-----------------------------------------------------------------------------
  320. // GetFileVersion - Retrieves FileVersion of passed in filename.
  321. //-----------------------------------------------------------------------------
  322. CString CMsieApp::GetFileVersion(LPCTSTR pszFileName)
  323. {
  324. CString strVersion;
  325. HANDLE hMem;
  326. LPVOID lpvMem;
  327. VS_FIXEDFILEINFO *pVerInfo;
  328. UINT cchVerInfo;
  329. DWORD dwVerInfoSize, dwTemp;
  330. dwVerInfoSize = GetFileVersionInfoSize((LPTSTR)pszFileName, &dwTemp);
  331. if (dwVerInfoSize)
  332. {
  333. hMem = GlobalAlloc(GMEM_MOVEABLE, dwVerInfoSize);
  334. lpvMem = GlobalLock(hMem);
  335. if (GetFileVersionInfo((LPTSTR)pszFileName, dwTemp, dwVerInfoSize, lpvMem))
  336. {
  337. if (VerQueryValue(lpvMem, _T("\\"), (LPVOID*)&pVerInfo, &cchVerInfo))
  338. {
  339. strVersion.Format(_T("%u.%u.%u.%u"), HIWORD(pVerInfo->dwFileVersionMS), LOWORD(pVerInfo->dwFileVersionMS),
  340. HIWORD(pVerInfo->dwFileVersionLS), LOWORD(pVerInfo->dwFileVersionLS));
  341. }
  342. }
  343. GlobalUnlock(hMem);
  344. GlobalFree(hMem);
  345. }
  346. if (strVersion.IsEmpty())
  347. strVersion.LoadString(IDS_NOT_AVAILABLE);
  348. return strVersion;
  349. }
  350. //-----------------------------------------------------------------------------
  351. // GetFileCompany - Retrieves CompanyName declared in passed in file.
  352. //-----------------------------------------------------------------------------
  353. CString CMsieApp::GetFileCompany(LPCTSTR pszFileName)
  354. {
  355. CString strCompany, strSubBlock, strLangID, strCharset;
  356. HANDLE hMem;
  357. LPVOID lpvMem, pBuffer;
  358. VS_FIXEDFILEINFO *pVerInfo;
  359. UINT cchVerInfo, cchBuffer;
  360. DWORD dwVerInfoSize, dwTemp;
  361. dwVerInfoSize = GetFileVersionInfoSize((LPTSTR)pszFileName, &dwTemp);
  362. if (dwVerInfoSize)
  363. {
  364. hMem = GlobalAlloc(GMEM_MOVEABLE, dwVerInfoSize);
  365. lpvMem = GlobalLock(hMem);
  366. if (GetFileVersionInfo((LPTSTR)pszFileName, dwTemp, dwVerInfoSize, lpvMem))
  367. {
  368. if (VerQueryValue(lpvMem, _T("\\VarFileInfo\\Translation"), (LPVOID*)&pVerInfo, &cchVerInfo))
  369. {
  370. translation = *(TRANSLATION*)pVerInfo;
  371. strSubBlock.Format(_T("\\StringFileInfo\\%04X%04X\\CompanyName"), translation.langID, translation.charset);
  372. VerQueryValue(lpvMem, (LPTSTR)(LPCTSTR)strSubBlock, &pBuffer, &cchBuffer);
  373. strCompany = (LPCTSTR)pBuffer;
  374. }
  375. }
  376. GlobalUnlock(hMem);
  377. GlobalFree(hMem);
  378. }
  379. if (strCompany.IsEmpty())
  380. strCompany.LoadString(IDS_NOT_AVAILABLE);
  381. return strCompany;
  382. }
  383. //-----------------------------------------------------------------------------
  384. // GetCipherStrength - Returns the maximum cipher strength (snagged from IE
  385. // About Box code (aboutinf.cpp).
  386. //-----------------------------------------------------------------------------
  387. DWORD CMsieApp::GetCipherStrength()
  388. {
  389. PSecurityFunctionTable (WINAPI *pfnInitSecurityInterface)();
  390. PSecurityFunctionTable pSecFuncTable;
  391. HINSTANCE hSecurity;
  392. DWORD dwKeySize = 0;
  393. // Can't go directly to schannel on NT5. (Note that g_bRunningOnNT5OrHigher
  394. // may not be initialized when fUseSChannel is initialized!)
  395. //
  396. TCHAR szwindir[MAX_PATH + 1];
  397. GetSystemDirectory(szwindir,MAX_PATH);
  398. static BOOL fUseSChannel = TRUE;
  399. if (fUseSChannel && !m_bRunningOnNT5OrHigher)
  400. {
  401. //
  402. // This is better for performance. Rather than call through
  403. // SSPI, we go right to the DLL doing the work.
  404. //
  405. CString strPath = szwindir;
  406. strPath +=_T("\\SCHANNEL.DLL");
  407. hSecurity = LoadLibrary(strPath);
  408. }
  409. else
  410. {
  411. //
  412. // Use SSPI
  413. //
  414. if (m_bRunningOnNT)
  415. {
  416. CString strPath = szwindir;
  417. strPath +=_T("\\SECURITY.DLL");
  418. hSecurity = LoadLibrary(strPath);
  419. }
  420. else
  421. {
  422. CString strPath = szwindir;
  423. strPath +=_T("\\SECUR32.DLL");
  424. hSecurity = LoadLibrary(strPath );
  425. }
  426. }
  427. if (hSecurity == NULL)
  428. {
  429. return 0;
  430. }
  431. //
  432. // Get the SSPI dispatch table
  433. //
  434. pfnInitSecurityInterface =
  435. (PSecurityFunctionTable(WINAPI *)())GetProcAddress(hSecurity, "InitSecurityInterfaceW");
  436. if (pfnInitSecurityInterface == NULL)
  437. {
  438. goto exit;
  439. }
  440. pSecFuncTable = (PSecurityFunctionTable)((*pfnInitSecurityInterface)());
  441. if (pSecFuncTable == NULL)
  442. {
  443. goto exit;
  444. }
  445. if (pSecFuncTable->AcquireCredentialsHandleW && pSecFuncTable->QueryCredentialsAttributesW)
  446. {
  447. TimeStamp tsExpiry;
  448. CredHandle chCred;
  449. SecPkgCred_CipherStrengths cs;
  450. if (S_OK == (*pSecFuncTable->AcquireCredentialsHandleW)(NULL,
  451. UNISP_NAME_W, // Package
  452. SECPKG_CRED_OUTBOUND,
  453. NULL,
  454. NULL,
  455. NULL,
  456. NULL,
  457. &chCred, // Handle
  458. &tsExpiry ))
  459. {
  460. if (S_OK == (*pSecFuncTable->QueryCredentialsAttributesW)(&chCred, SECPKG_ATTR_CIPHER_STRENGTHS, &cs))
  461. {
  462. dwKeySize = cs.dwMaximumCipherStrength;
  463. }
  464. // Free the handle if we can
  465. if (pSecFuncTable->FreeCredentialsHandle)
  466. {
  467. (*pSecFuncTable->FreeCredentialsHandle)(&chCred);
  468. }
  469. }
  470. }
  471. exit:
  472. FreeLibrary(hSecurity);
  473. if (dwKeySize == 0 && fUseSChannel)
  474. {
  475. // Failed, so retry using SSPI
  476. fUseSChannel = FALSE;
  477. dwKeySize = GetCipherStrength();
  478. }
  479. return dwKeySize;
  480. }
  481. //---------------------------------------------------------------------------------
  482. // GetCertificateInfo - Retrieves specific certificate info from passed in context.
  483. //---------------------------------------------------------------------------------
  484. void CMsieApp::GetCertificateInfo(PCCERT_CONTEXT pContext, int idsType, CPtrArray& ptrs)
  485. {
  486. IE_CERTIFICATE *pData;
  487. PCCRYPT_OID_INFO pOidInfo;
  488. CString strType, strIssuedTo, strIssuedBy, strValidity;
  489. COleDateTime dateNotBefore, dateNotAfter;
  490. DWORD dwResult;
  491. pData = new IE_CERTIFICATE;
  492. ptrs.Add(pData);
  493. strType.LoadString(idsType);
  494. pData->Type = strType;
  495. // get Issued To (Subject)
  496. dwResult = pfnCertGetNameString(pContext, CERT_NAME_SIMPLE_DISPLAY_TYPE, 0, NULL, strIssuedTo.GetBuffer(256), 256);
  497. strIssuedTo.ReleaseBuffer();
  498. if (dwResult)
  499. pData->IssuedTo = strIssuedTo;
  500. // get Issued From (Issuer)
  501. dwResult = pfnCertGetNameString(pContext, CERT_NAME_SIMPLE_DISPLAY_TYPE, CERT_NAME_ISSUER_FLAG, NULL, strIssuedBy.GetBuffer(256), 256);
  502. strIssuedBy.ReleaseBuffer();
  503. if (dwResult)
  504. pData->IssuedBy = strIssuedBy;
  505. // get Validity dates
  506. dateNotBefore = pContext->pCertInfo->NotBefore;
  507. dateNotAfter = pContext->pCertInfo->NotAfter;
  508. strValidity.Format(IDS_VALIDITY_FORMAT, dateNotBefore.Format(VAR_DATEVALUEONLY), dateNotAfter.Format(VAR_DATEVALUEONLY));
  509. pData->Validity = strValidity;
  510. // get Signature Algorithm
  511. if (pOidInfo = pfnCryptFindOIDInfo(CRYPT_OID_INFO_OID_KEY, pContext->pCertInfo->SignatureAlgorithm.pszObjId, 0))
  512. pData->SignatureAlgorithm = pOidInfo->pwszName;
  513. }
  514. //-----------------------------------------------------------------------------
  515. // GetPersonalCertificates - Retrieves certificates from MY certificate store.
  516. //-----------------------------------------------------------------------------
  517. void CMsieApp::GetPersonalCertificates(CPtrArray& ptrs)
  518. {
  519. HCERTSTORE hStore;
  520. PCCERT_CONTEXT pPrevContext, pContext;
  521. DWORD dwPrivateKey, dwSize;
  522. hStore = pfnCertOpenSystemStore(NULL, MY_STORE);
  523. if (hStore)
  524. {
  525. pPrevContext = NULL;
  526. while (pContext = pfnCertEnumCertificatesInStore(hStore, pPrevContext))
  527. {
  528. // make sure private key property exists
  529. dwSize = sizeof(DWORD);
  530. if (pfnCertGetCertificateContextProperty(pContext, CERT_KEY_SPEC_PROP_ID, &dwPrivateKey, &dwSize))
  531. {
  532. GetCertificateInfo(pContext, IDS_PERSONAL_TYPE, ptrs);
  533. }
  534. pPrevContext = pContext;
  535. }
  536. pfnCertCloseStore(hStore, 0);
  537. }
  538. }
  539. //-----------------------------------------------------------------------------
  540. // GetOtherPeopleCertificates - Retrieves from AddressBook certificate store.
  541. //-----------------------------------------------------------------------------
  542. void CMsieApp::GetOtherPeopleCertificates(CPtrArray& ptrs)
  543. {
  544. HCERTSTORE hStore;
  545. PCCERT_CONTEXT pPrevContext, pContext;
  546. CERT_BASIC_CONSTRAINTS2_INFO constraintInfo;
  547. DWORD dwSize, dwIndex;
  548. bool bIsEndEntity;
  549. hStore = pfnCertOpenSystemStore(NULL, ADDRESS_BOOK_STORE);
  550. if (hStore)
  551. {
  552. pPrevContext = NULL;
  553. while (pContext = pfnCertEnumCertificatesInStore(hStore, pPrevContext))
  554. {
  555. GetCertificateInfo(pContext, IDS_OTHER_PEOPLE_TYPE, ptrs);
  556. pPrevContext = pContext;
  557. }
  558. pfnCertCloseStore(hStore, 0);
  559. }
  560. // also obtain end-entity certificate from CA store
  561. hStore = pfnCertOpenSystemStore(NULL, CA_STORE);
  562. if (hStore)
  563. {
  564. pPrevContext = NULL;
  565. while (pContext = pfnCertEnumCertificatesInStore(hStore, pPrevContext))
  566. {
  567. bIsEndEntity = false;
  568. for (dwIndex = 0; dwIndex < pContext->pCertInfo->cExtension; dwIndex++)
  569. {
  570. if (!strcmp(pContext->pCertInfo->rgExtension[dwIndex].pszObjId, szOID_BASIC_CONSTRAINTS2))
  571. {
  572. dwSize = sizeof(constraintInfo);
  573. if (pfnCryptDecodeObject(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, szOID_BASIC_CONSTRAINTS2,
  574. pContext->pCertInfo->rgExtension[dwIndex].Value.pbData,
  575. pContext->pCertInfo->rgExtension[dwIndex].Value.cbData, 0, &constraintInfo, &dwSize))
  576. {
  577. bIsEndEntity = !constraintInfo.fCA;
  578. break;
  579. }
  580. }
  581. }
  582. if (bIsEndEntity)
  583. {
  584. GetCertificateInfo(pContext, IDS_OTHER_PEOPLE_TYPE, ptrs);
  585. }
  586. pPrevContext = pContext;
  587. }
  588. pfnCertCloseStore(hStore, 0);
  589. }
  590. }
  591. ///////////////////////////////////////////////////////////////////////////////
  592. // AppGetIEData - Retrieves IE data.
  593. ///////////////////////////////////////////////////////////////////////////////
  594. void CMsieApp::AppGetIEData(IEDataType enType, long *plCount, void ***pppIEData, long *pCancel)
  595. {
  596. *plCount = 0;
  597. *pppIEData = NULL;
  598. if (enType == SummaryType)
  599. {
  600. IE_SUMMARY *pData;
  601. HINSTANCE hInstRatingDll;
  602. OSVERSIONINFO osver;
  603. HANDLE hMem;
  604. LPVOID lpvMem;
  605. VS_FIXEDFILEINFO *pVerInfo;
  606. CStdioFile fileSetupLog;
  607. COleDateTime dateTime;
  608. CString strAppName, strKey, strPath, strActivePrinter, strVersion, strCustomizedVersion, strSetupLog, strLine, strFullPath, strLanguage;
  609. DWORD dwVerInfoSize, dwTemp;
  610. long lStrength;
  611. UINT cchVerInfo;
  612. int nIndex, nEndIndex;
  613. BOOL (WINAPI *pfnRatingEnabledQuery)();
  614. if (pCancel)
  615. if (*pCancel != 0L) return;
  616. // Allocate one struct pointer
  617. *pppIEData = (void**)new LPVOID;
  618. // Allocate one struct
  619. pData = new IE_SUMMARY;
  620. *pppIEData[0] = pData;
  621. *plCount = 1;
  622. // get name
  623. strAppName.LoadString(IDS_INTERNET_EXPLORER_6);
  624. pData->Name = strAppName;
  625. // get version and build
  626. GetRegValue(HKEY_LOCAL_MACHINE, REG_IE_KEY, REG_VERSION, pData->Version);
  627. GetRegValue(HKEY_LOCAL_MACHINE, REG_IE_KEY, REG_BUILD, pData->Build);
  628. // get product id
  629. strKey = REG_IE_KEY;
  630. strKey += "\\";
  631. strKey += REG_REGISTRATION;
  632. GetRegValue(HKEY_LOCAL_MACHINE, strKey, REG_PRODUCT_ID, pData->ProductID);
  633. // get app path
  634. GetRegValue(HKEY_LOCAL_MACHINE, REG_IEXPLORE_EXE_KEY, _T(""), pData->Path);
  635. strPath = pData->Path.bstrVal;
  636. if (!strPath.IsEmpty())
  637. {
  638. nIndex = strPath.ReverseFind(_T('\\'));
  639. if (nIndex != -1)
  640. strPath = strPath.Left(nIndex);
  641. // change to long file name
  642. pData->Path = GetLongPathName(strPath);
  643. }
  644. // get last install date from "active setup log.txt"
  645. // Ex: "Date:4/7/1999 (M/D/Y) Time:10:23:20"
  646. if (GetWindowsDirectory(strSetupLog.GetBuffer(MAX_PATH), MAX_PATH))
  647. {
  648. strSetupLog.ReleaseBuffer();
  649. strSetupLog += '\\';
  650. strSetupLog += SETUP_LOG;
  651. if (fileSetupLog.Open(strSetupLog, CFile::modeRead))
  652. {
  653. try
  654. {
  655. while (fileSetupLog.ReadString(strLine))
  656. {
  657. // find date line
  658. if (strLine.Left(5) == "Date:")
  659. {
  660. strLine = strLine.Right(strLine.GetLength() - 5);
  661. // remove "(M/D/Y)"
  662. if ((nIndex = strLine.Find('(')) != -1)
  663. {
  664. if ((nEndIndex = strLine.Find(')')) != -1)
  665. strLine = strLine.Left(nIndex) + strLine.Right(strLine.GetLength() - nEndIndex - 1);
  666. }
  667. // remove "Time:"
  668. if ((nIndex = strLine.Find(_T("Time:"))) != -1)
  669. strLine = strLine.Left(nIndex) + strLine.Right(strLine.GetLength() - nIndex - 5);
  670. dateTime.ParseDateTime(strLine);
  671. pData->LastInstallDate = dateTime;
  672. break;
  673. }
  674. }
  675. }
  676. catch (CFileException *e)
  677. {
  678. e->Delete();
  679. }
  680. fileSetupLog.Close();
  681. }
  682. }
  683. // get language (from iexplore.exe)
  684. GetRegValue(HKEY_LOCAL_MACHINE, REG_IEXPLORE_EXE_KEY, _T(""), strFullPath);
  685. dwVerInfoSize = GetFileVersionInfoSize((LPTSTR)(LPCTSTR)strFullPath, &dwTemp);
  686. if (dwVerInfoSize)
  687. {
  688. hMem = GlobalAlloc(GMEM_MOVEABLE, dwVerInfoSize);
  689. lpvMem = GlobalLock(hMem);
  690. if (GetFileVersionInfo((LPTSTR)(LPCTSTR)strFullPath, dwTemp, dwVerInfoSize, lpvMem))
  691. {
  692. if (VerQueryValue(lpvMem, _T("\\VarFileInfo\\Translation"), (LPVOID*)&pVerInfo, &cchVerInfo))
  693. {
  694. translation = *(TRANSLATION*)pVerInfo;
  695. VerLanguageName(translation.langID, strLanguage.GetBuffer(MAX_PATH), MAX_PATH);
  696. strLanguage.ReleaseBuffer();
  697. pData->Language = strLanguage;
  698. }
  699. }
  700. GlobalUnlock(hMem);
  701. GlobalFree(hMem);
  702. }
  703. // get active printer
  704. ::GetProfileString(_T("windows"), _T("device"), _T(",,,"), strActivePrinter.GetBuffer(MAX_PATH), MAX_PATH);
  705. strActivePrinter.ReleaseBuffer();
  706. if ((!strActivePrinter.IsEmpty()) && (strActivePrinter != ",,,"))
  707. pData->ActivePrinter = strActivePrinter;
  708. // get cipher strength
  709. // first check OS
  710. osver.dwOSVersionInfoSize = sizeof(osver);
  711. VERIFY(GetVersionEx(&osver));
  712. m_bRunningOnNT = (osver.dwPlatformId == VER_PLATFORM_WIN32_NT);
  713. m_bRunningOnNT5OrHigher = (m_bRunningOnNT && (osver.dwMajorVersion >= 5));
  714. lStrength = (long)GetCipherStrength();
  715. // handle weirdness of cipher strength
  716. /*
  717. if (m_bRunningOnNT5OrHigher)
  718. pData->CipherStrength = lStrength;
  719. else
  720. pData->CipherStrength = (lStrength >= 168) ? (long)128 : (long)40;
  721. a-sanka 02/15/2001
  722. QueryCredentialsAttributes returns 128 for 40-bit & 168 for 128-bit encryption.
  723. All other values are authentic, and can be reported unchanged.
  724. */
  725. if(lStrength == 128)
  726. lStrength = 40;
  727. else if(lStrength == 168)
  728. lStrength = 128;
  729. pData->CipherStrength = lStrength;
  730. // get content advisor (via msrating.dll call)
  731. TCHAR szwindir[MAX_PATH + 1];
  732. GetSystemDirectory(szwindir,MAX_PATH);
  733. strPath = szwindir;
  734. strPath += _T("\\msrating.dll");
  735. if (hInstRatingDll = LoadLibrary(strPath))
  736. {
  737. if (pfnRatingEnabledQuery = (BOOL(WINAPI *)())GetProcAddress(hInstRatingDll, "RatingEnabledQuery"))
  738. {
  739. pData->ContentAdvisor = GetBooleanString(S_OK == pfnRatingEnabledQuery(), ENABLED_DISABLED);
  740. }
  741. FreeLibrary(hInstRatingDll);
  742. }
  743. // get ieak install
  744. GetRegValue(HKEY_LOCAL_MACHINE, REG_IE_KEY, REG_CUSTOMIZED_VERSION, strCustomizedVersion);
  745. pData->IEAKInstall = GetBooleanString(!strCustomizedVersion.IsEmpty());
  746. if (!strCustomizedVersion.IsEmpty())
  747. {
  748. // add IS, CO or IC to version string
  749. strVersion = pData->Version.bstrVal;
  750. strVersion += strCustomizedVersion;
  751. pData->Version = strVersion;
  752. }
  753. }
  754. else if (enType == FileVersionType)
  755. {
  756. IE_FILE_VERSION *pData;
  757. CTypedPtrArray<CPtrArray, IE_FILE_VERSION*> ptrs;
  758. CStringArray strSearchPaths;
  759. CString strInfPath, strFileName, strFileMissing, strPathEnvVar, strFullPath, strIExplorePath;
  760. CFileStatus status;
  761. COleDateTime dateTime;
  762. HINF hInf;
  763. INFCONTEXT context;
  764. DWORD dwFileIndex;
  765. long cFiles;
  766. int nIndex, nPathIndex;
  767. bool bFoundFile;
  768. // open msiefiles.inf file for list of files display info about
  769. GetRegValue(HKEY_LOCAL_MACHINE, REG_MSINFO_KEY, REG_PATH, strInfPath);
  770. ASSERT(!strInfPath.IsEmpty());
  771. // replace msinfo32.exe with inf filename
  772. nIndex = strInfPath.ReverseFind(_T('\\'));
  773. strInfPath = strInfPath.Left(nIndex + 1);
  774. strInfPath += INF_FILE;
  775. if (strInfPath[0] == _T('"'))
  776. strInfPath = strInfPath.Right(strInfPath.GetLength() - 1);
  777. hInf = SetupOpenInfFile(strInfPath, NULL, INF_STYLE_WIN4, NULL);
  778. ASSERT(hInf != INVALID_HANDLE_VALUE);
  779. if (hInf != INVALID_HANDLE_VALUE)
  780. {
  781. cFiles = SetupGetLineCount(hInf, INF_FILES_SECTION);
  782. if (cFiles > 0)
  783. {
  784. // get all dirs to look in from PATH environment variable
  785. GetEnvironmentVariable(_T("PATH"), strPathEnvVar.GetBuffer(1024), 1024);
  786. strPathEnvVar.ReleaseBuffer();
  787. while (-1 != (nIndex = strPathEnvVar.Find(_T(';'))))
  788. {
  789. strSearchPaths.Add(strPathEnvVar.Left(nIndex));
  790. strPathEnvVar = strPathEnvVar.Right(strPathEnvVar.GetLength() - (nIndex + 1));
  791. }
  792. if (!strPathEnvVar.IsEmpty())
  793. strSearchPaths.Add(strPathEnvVar);
  794. // also add iexplore dir to search paths
  795. GetRegValue(HKEY_LOCAL_MACHINE, REG_IEXPLORE_EXE_KEY, REG_PATH, strIExplorePath);
  796. if (!strIExplorePath.IsEmpty())
  797. {
  798. if (strIExplorePath[strIExplorePath.GetLength() - 1] == _T(';'))
  799. strIExplorePath = strIExplorePath.Left(strIExplorePath.GetLength() -1);
  800. strSearchPaths.Add(strIExplorePath);
  801. }
  802. // Look for files...
  803. strFileMissing.LoadString(IDS_FILE_MISSING);
  804. for (dwFileIndex = 0; dwFileIndex < (DWORD)cFiles; dwFileIndex++)
  805. {
  806. SetupGetLineByIndex(hInf, INF_FILES_SECTION, dwFileIndex, &context);
  807. SetupGetLineText(&context, hInf, NULL, NULL, strFileName.GetBuffer(_MAX_FNAME), _MAX_FNAME, NULL);
  808. strFileName.ReleaseBuffer();
  809. //...in each path (in environment)
  810. bFoundFile = false;
  811. for (nPathIndex = 0; nPathIndex < strSearchPaths.GetSize(); nPathIndex++)
  812. {
  813. strFullPath = strSearchPaths[nPathIndex];
  814. if (strFullPath[strFullPath.GetLength() - 1] != _T('\\'))
  815. strFullPath += '\\';
  816. strFullPath += strFileName;
  817. if (CFile::GetStatus(strFullPath, status))
  818. {
  819. if (!bFoundFile)
  820. bFoundFile = true;
  821. pData = new IE_FILE_VERSION;
  822. ptrs.Add(pData);
  823. // set name
  824. pData->File = strFileName;
  825. // get version
  826. pData->Version = GetFileVersion(strFullPath);
  827. // get size and modified date
  828. if (CFile::GetStatus(strFullPath, status))
  829. {
  830. pData->Size = (float)status.m_size / 1024;
  831. dateTime = status.m_mtime.GetTime();
  832. pData->Date = dateTime;
  833. }
  834. // get company
  835. pData->Company = GetFileCompany(strFullPath);
  836. // get path (chop off filename and make sure long filename)
  837. strFullPath = strFullPath.Left(strFullPath.GetLength() - (strFileName.GetLength() + 1));
  838. pData->Path = GetLongPathName(strFullPath);
  839. }
  840. }
  841. if (!bFoundFile)
  842. {
  843. pData = new IE_FILE_VERSION;
  844. ptrs.Add(pData);
  845. pData->File = strFileName;
  846. pData->Version = strFileMissing;
  847. pData->Size = _T("");
  848. pData->Date = _T("");
  849. pData->Path = _T("");
  850. pData->Company = _T("");
  851. }
  852. }
  853. SetupCloseInfFile(hInf);
  854. *plCount = (long) ptrs.GetSize();
  855. *pppIEData = (void**)new LPVOID[*plCount];
  856. for (int i = 0; i < *plCount; i++)
  857. (*pppIEData)[i] = ptrs[i];
  858. }
  859. else
  860. {
  861. *pppIEData = (void**)new LPVOID;
  862. pData = new IE_FILE_VERSION;
  863. *pppIEData[0] = pData;
  864. *plCount = 1;
  865. strFileName.LoadString(IDS_INF_FILE_MISSING);
  866. pData->File = strFileName;
  867. pData->Version = _T("");
  868. pData->Size = _T("");
  869. pData->Date = _T("");
  870. pData->Path = _T("");
  871. pData->Company = _T("");
  872. }
  873. }
  874. }
  875. else if (enType == ConnSummaryType)
  876. {
  877. IE_CONN_SUMMARY *pData;
  878. HKEY hOpenKey;
  879. BOOL bAutodial, bNoNetAutodial;
  880. DWORD cbData;
  881. long lResult;
  882. int ids;
  883. CString strTemp;
  884. if (pCancel)
  885. if (*pCancel != 0L) return;
  886. // Allocate one struct pointer
  887. *pppIEData = (void**)new LPVOID;
  888. // Allocate one struct
  889. pData = new IE_CONN_SUMMARY;
  890. *pppIEData[0] = pData;
  891. *plCount = 1;
  892. if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_CURRENT_USER, REG_IE_SETTINGS_KEY, 0, KEY_QUERY_VALUE, &hOpenKey))
  893. {
  894. cbData = sizeof(bAutodial);
  895. lResult = RegQueryValueEx(hOpenKey, REG_ENABLE_AUTODIAL, NULL, NULL, (BYTE*)&bAutodial, &cbData);
  896. if (lResult == ERROR_SUCCESS)
  897. {
  898. if (bAutodial)
  899. {
  900. cbData = sizeof(bNoNetAutodial);
  901. lResult = RegQueryValueEx(hOpenKey, REG_NO_NET_AUTODIAL, NULL, NULL, (BYTE*)&bNoNetAutodial, &cbData);
  902. if (lResult == ERROR_SUCCESS)
  903. ids = bNoNetAutodial ? IDS_DIAL_NO_NET : IDS_ALWAYS_DIAL;
  904. else
  905. ids = IDS_NOT_AVAILABLE;
  906. }
  907. else
  908. ids = IDS_NEVER_DIAL;
  909. }
  910. else
  911. ids = IDS_NEVER_DIAL; // if reg entry not found, set to default
  912. strTemp.LoadString(ids);
  913. pData->ConnectionPreference = strTemp;
  914. RegCloseKey(hOpenKey);
  915. }
  916. GetRegValue(HKEY_CURRENT_USER, REG_IE_SETTINGS_KEY, REG_ENABLE_HTTP_1_1, pData->EnableHttp11);
  917. if (VT_EMPTY == pData->EnableHttp11.vt)
  918. pData->EnableHttp11 = (long)1; // if reg entry not found, set to default
  919. GetRegValue(HKEY_CURRENT_USER, REG_IE_SETTINGS_KEY, REG_PROXY_HTTP_1_1, pData->ProxyHttp11);
  920. if (VT_EMPTY == pData->ProxyHttp11.vt)
  921. pData->ProxyHttp11 = (long)0; // if reg entry not found, set to default
  922. }
  923. else if (enType == LanSettingsType)
  924. {
  925. IE_LAN_SETTINGS *pData;
  926. INTERNET_PER_CONN_OPTION_LIST list;
  927. HINSTANCE hInst;
  928. DWORD dwListSize;
  929. CString strTemp;
  930. if (pCancel)
  931. if (*pCancel != 0L) return;
  932. // Allocate one struct pointer
  933. *pppIEData = (void**)new LPVOID;
  934. // Allocate one struct
  935. pData = new IE_LAN_SETTINGS;
  936. *pppIEData[0] = pData;
  937. *plCount = 1;
  938. // get AutoConfigProxy
  939. GetRegValue(HKEY_CURRENT_USER, REG_IE_SETTINGS_KEY, REG_AUTO_CONFIG_PROXY, pData->AutoConfigProxy);
  940. // get all InternetQueryOption info
  941. if (hInst = GetExports(WININET))
  942. {
  943. dwListSize = sizeof(list);
  944. list.pszConnection = NULL;
  945. list.dwSize = sizeof(list);
  946. list.dwOptionCount = 4;
  947. list.pOptions = new INTERNET_PER_CONN_OPTION[4];
  948. list.pOptions[0].dwOption = INTERNET_PER_CONN_FLAGS;
  949. list.pOptions[1].dwOption = INTERNET_PER_CONN_PROXY_SERVER;
  950. list.pOptions[2].dwOption = INTERNET_PER_CONN_PROXY_BYPASS;
  951. list.pOptions[3].dwOption = INTERNET_PER_CONN_AUTOCONFIG_URL;
  952. BOOL bResult = pfnInternetQueryOption(NULL, INTERNET_OPTION_PER_CONNECTION_OPTION, &list, &dwListSize);
  953. if (bResult)
  954. {
  955. pData->AutoProxyDetectMode = GetBooleanString(list.pOptions[0].Value.dwValue & PROXY_TYPE_AUTO_DETECT, ENABLED_DISABLED);
  956. strTemp = list.pOptions[3].Value.pszValue;
  957. pData->AutoConfigURL = strTemp;
  958. pData->Proxy = GetBooleanString(list.pOptions[0].Value.dwValue & PROXY_TYPE_PROXY, ENABLED_DISABLED);
  959. strTemp = list.pOptions[1].Value.pszValue;
  960. pData->ProxyServer = strTemp;
  961. strTemp = list.pOptions[2].Value.pszValue;
  962. pData->ProxyOverride = strTemp;
  963. }
  964. delete []list.pOptions;
  965. FreeLibrary(hInst);
  966. }
  967. }
  968. else if (enType == ConnSettingsType)
  969. {
  970. IE_CONN_SETTINGS *pData;
  971. CString strName, strDefaultName, strDefault, strKey, strProxyOverride, strTemp;
  972. INTERNET_PER_CONN_OPTION_LIST list;
  973. LPRASENTRYNAME pRasEntryName;
  974. LPRASENTRYNAME pRasEntryNamePreFail = NULL;
  975. LPRASENTRY pRasEntry;
  976. LPRASENTRY pRasEntryPreFail = NULL;
  977. HINSTANCE hInstRAS, hInst;
  978. DWORD dwTemp, dwIndex, dwListSize, dwEntrySize, dwResult, cEntries = 0;
  979. int ids, nIndex, nDefaultIndex = -1;
  980. BOOL bResult;
  981. bool bFoundDefault = false;
  982. strDefault.LoadString(IDS_DEFAULT);
  983. // get number of Connections
  984. if (hInstRAS = GetExports(RASAPI32))
  985. {
  986. dwEntrySize = sizeof(RASENTRYNAME);
  987. if ((pRasEntryName = (LPRASENTRYNAME)malloc((UINT)dwEntrySize)) != NULL)
  988. {
  989. pRasEntryName->dwSize = sizeof(RASENTRYNAME);
  990. dwResult = pfnRasEnumEntries(NULL, NULL, pRasEntryName, &dwEntrySize, &cEntries);
  991. if (dwResult == ERROR_BUFFER_TOO_SMALL)
  992. {
  993. pRasEntryNamePreFail = pRasEntryName;
  994. #pragma prefast(suppress:308,"Pointer was saved")
  995. if ((pRasEntryName = (LPRASENTRYNAME)realloc(pRasEntryName, dwEntrySize)) != NULL)
  996. dwResult = pfnRasEnumEntries(NULL, NULL, pRasEntryName, &dwEntrySize, &cEntries);
  997. else
  998. {
  999. free(pRasEntryNamePreFail);
  1000. }
  1001. }
  1002. if ((!dwResult) && (cEntries > 0) && pRasEntryName)
  1003. {
  1004. *plCount = cEntries;
  1005. *pppIEData = (void**)new LPVOID[cEntries];
  1006. // get default connection name (if one exists)
  1007. GetRegValue(HKEY_CURRENT_USER, REG_REMOTE_ACCESS, REG_INTERNET_PROFILE, strDefaultName);
  1008. for (dwIndex = 0; dwIndex < cEntries; dwIndex++)
  1009. {
  1010. pData = new IE_CONN_SETTINGS;
  1011. (*pppIEData)[dwIndex] = pData;
  1012. // set connection name
  1013. strName = pRasEntryName[dwIndex].szEntryName;
  1014. if (strName == strDefaultName)
  1015. {
  1016. // add " (Default)" to name
  1017. strDefaultName += strDefault;
  1018. pData->Name = strDefaultName;
  1019. pData->Default = VARIANT_TRUE;
  1020. nDefaultIndex = dwIndex;
  1021. }
  1022. else
  1023. {
  1024. pData->Name = strName;
  1025. pData->Default = VARIANT_FALSE;
  1026. }
  1027. // get all InternetQueryOption info
  1028. if (hInst = GetExports(WININET))
  1029. {
  1030. dwListSize = sizeof(list);
  1031. list.pszConnection = strName.GetBuffer(strName.GetLength());
  1032. list.dwSize = sizeof(list);
  1033. list.dwOptionCount = 4;
  1034. list.pOptions = new INTERNET_PER_CONN_OPTION[4];
  1035. list.pOptions[0].dwOption = INTERNET_PER_CONN_FLAGS;
  1036. list.pOptions[1].dwOption = INTERNET_PER_CONN_PROXY_SERVER;
  1037. list.pOptions[2].dwOption = INTERNET_PER_CONN_PROXY_BYPASS;
  1038. list.pOptions[3].dwOption = INTERNET_PER_CONN_AUTOCONFIG_URL;
  1039. bResult = pfnInternetQueryOption(NULL, INTERNET_OPTION_PER_CONNECTION_OPTION, &list, &dwListSize);
  1040. if (bResult)
  1041. {
  1042. pData->AutoProxyDetectMode = GetBooleanString(list.pOptions[0].Value.dwValue & PROXY_TYPE_AUTO_DETECT, ENABLED_DISABLED);
  1043. strTemp = list.pOptions[3].Value.pszValue;
  1044. pData->AutoConfigURL = strTemp;
  1045. pData->Proxy = GetBooleanString(list.pOptions[0].Value.dwValue & PROXY_TYPE_PROXY, ENABLED_DISABLED);
  1046. strTemp = list.pOptions[1].Value.pszValue;
  1047. pData->ProxyServer = strTemp;
  1048. strProxyOverride = list.pOptions[2].Value.pszValue;
  1049. // removing all <enter>s from string
  1050. while (-1 != (nIndex = strProxyOverride.Find(_T("\r\n"))))
  1051. strProxyOverride = strProxyOverride.Left(nIndex) + strProxyOverride.Right(strProxyOverride.GetLength() - (nIndex + 2));
  1052. pData->ProxyOverride = strProxyOverride;
  1053. }
  1054. delete []list.pOptions;
  1055. strName.ReleaseBuffer();
  1056. FreeLibrary(hInst);
  1057. }
  1058. // allow Internet programs to use connection
  1059. strKey = REG_REMOTE_ACCESS_PROFILE;
  1060. strKey += _T('\\');
  1061. strKey += strName;
  1062. if (ERROR_SUCCESS == GetRegValue(HKEY_CURRENT_USER, strKey, REG_COVER_EXCLUDE, dwTemp))
  1063. pData->AllowInternetPrograms = GetBooleanString(!dwTemp);
  1064. // get other reg data
  1065. GetRegValue(HKEY_CURRENT_USER, strKey, REG_REDIAL_ATTEMPTS, pData->RedialAttempts);
  1066. if (VT_EMPTY == pData->RedialAttempts.vt)
  1067. pData->RedialAttempts = (long)10; // if reg entry not found, set to default
  1068. GetRegValue(HKEY_CURRENT_USER, strKey, REG_REDIAL_WAIT, pData->RedialWait);
  1069. if (VT_EMPTY == pData->RedialWait.vt)
  1070. pData->RedialWait = (long)5; // if reg entry not found, set to default
  1071. GetRegValue(HKEY_CURRENT_USER, strKey, REG_DISCONNECT_IDLE_TIME, pData->DisconnectIdleTime);
  1072. if (VT_EMPTY == pData->DisconnectIdleTime.vt)
  1073. pData->DisconnectIdleTime = (long)20; // if reg entry not found, set to default
  1074. dwTemp = 0; // if reg entry not found, set to default
  1075. GetRegValue(HKEY_CURRENT_USER, strKey, REG_ENABLE_AUTO_DISCONNECT, dwTemp);
  1076. pData->AutoDisconnect = GetBooleanString(dwTemp, ENABLED_DISABLED);
  1077. if (ERROR_SUCCESS == GetRegValue(HKEY_LOCAL_MACHINE, REG_PPP_KEY, REG_LOGGING, dwTemp))
  1078. pData->RecordLogFile = GetBooleanString(dwTemp);
  1079. // get all RasGetEntryProperties info
  1080. dwEntrySize = sizeof(RASENTRY);
  1081. if ((pRasEntry = (LPRASENTRY)malloc((UINT)dwEntrySize)) != NULL)
  1082. {
  1083. pRasEntry->dwSize = sizeof(RASENTRY);
  1084. dwResult = pfnRasGetEntryProperties(NULL,(LPCTSTR)strName, pRasEntry, &dwEntrySize, NULL, NULL);
  1085. if (dwResult == ERROR_BUFFER_TOO_SMALL)
  1086. {
  1087. pRasEntryPreFail = pRasEntry;
  1088. #pragma prefast(suppress:308,"Pointer was saved")
  1089. if ((pRasEntry = (LPRASENTRY)realloc(pRasEntry, dwEntrySize)) != NULL)
  1090. dwResult = pfnRasGetEntryProperties(NULL, (LPCTSTR)strName, pRasEntry, &dwEntrySize, NULL, NULL);
  1091. else
  1092. {
  1093. free(pRasEntryPreFail);
  1094. }
  1095. }
  1096. if (!dwResult && pRasEntry)
  1097. {
  1098. // modem name
  1099. pData->Modem = pRasEntry->szDeviceName;
  1100. // dial-up server (framing protocol)
  1101. switch (pRasEntry->dwFramingProtocol)
  1102. {
  1103. case RASFP_Ppp:
  1104. ids = IDS_PROTOCOL_PPP;
  1105. break;
  1106. case RASFP_Slip:
  1107. ids = IDS_PROTOCOL_SLIP;
  1108. break;
  1109. case RASFP_Ras:
  1110. ids = IDS_PROTOCOL_RAS;
  1111. break;
  1112. default:
  1113. ids = IDS_NOT_AVAILABLE;
  1114. }
  1115. strTemp.LoadString(ids);
  1116. pData->DialUpServer = strTemp;
  1117. // bools
  1118. pData->NetworkLogon = GetBooleanString(pRasEntry->dwfOptions & RASEO_NetworkLogon);
  1119. pData->SoftwareCompression = GetBooleanString(pRasEntry->dwfOptions & RASEO_SwCompression);
  1120. pData->EncryptedPassword = GetBooleanString(pRasEntry->dwfOptions & RASEO_RequireEncryptedPw);
  1121. pData->DataEncryption = GetBooleanString(pRasEntry->dwfOptions & RASEO_RequireDataEncryption);
  1122. pData->IPHeaderCompression = GetBooleanString(pRasEntry->dwfOptions & RASEO_IpHeaderCompression);
  1123. pData->DefaultGateway = GetBooleanString(pRasEntry->dwfOptions & RASEO_RemoteDefaultGateway);
  1124. // network protocols
  1125. strName.Empty();
  1126. if (pRasEntry->dwfNetProtocols & RASNP_Ip)
  1127. {
  1128. strTemp.LoadString(IDS_TCP_IP);
  1129. strName += strTemp;
  1130. }
  1131. if (pRasEntry->dwfNetProtocols & RASNP_Ipx)
  1132. {
  1133. strTemp.LoadString(IDS_IPX_SPX);
  1134. if (!strName.IsEmpty())
  1135. strName += _T(", ");
  1136. strName += strTemp;
  1137. }
  1138. if (pRasEntry->dwfNetProtocols & RASNP_NetBEUI)
  1139. {
  1140. strTemp.LoadString(IDS_NET_BEUI);
  1141. if (!strName.IsEmpty())
  1142. strName += _T(", ");
  1143. strName += strTemp;
  1144. }
  1145. pData->NetworkProtocols = strName;
  1146. // IP addresses
  1147. pData->ServerAssignedIPAddress = GetBooleanString(!(pRasEntry->dwfOptions & RASEO_SpecificIpAddr));
  1148. pData->IPAddress = ConvertIPAddressToString(pRasEntry->ipaddr);
  1149. pData->ServerAssignedNameServer = GetBooleanString(!(pRasEntry->dwfOptions & RASEO_SpecificNameServers));
  1150. pData->PrimaryDNS = ConvertIPAddressToString(pRasEntry->ipaddrDns);
  1151. pData->SecondaryDNS = ConvertIPAddressToString(pRasEntry->ipaddrDnsAlt);
  1152. pData->PrimaryWINS = ConvertIPAddressToString(pRasEntry->ipaddrWins);
  1153. pData->SecondaryWINS = ConvertIPAddressToString(pRasEntry->ipaddrWinsAlt);
  1154. // script filename
  1155. pData->ScriptFileName = pRasEntry->szScript;
  1156. }
  1157. free(pRasEntry);
  1158. }
  1159. }
  1160. // Making sure the first item in the returned array is the default connection (if one exists)
  1161. if (nDefaultIndex > 0)
  1162. {
  1163. // swapping ptrs so first item is default
  1164. pData = (IE_CONN_SETTINGS*)(*pppIEData)[0];
  1165. (*pppIEData)[0] = (*pppIEData)[nDefaultIndex];
  1166. (*pppIEData)[nDefaultIndex] = pData;
  1167. }
  1168. }
  1169. free(pRasEntryName);
  1170. }
  1171. FreeLibrary(hInstRAS);
  1172. }
  1173. }
  1174. else if (enType == CacheType)
  1175. {
  1176. IE_CACHE *pData;
  1177. CString strTemp, strCachePath, strKey;
  1178. HINSTANCE hInst;
  1179. DWORDLONG cbAvail = 0, cbTotal = 0;
  1180. DWORD dwSyncMode, dwCacheLimit, dwCacheSize;
  1181. int ids;
  1182. if (pCancel)
  1183. if (*pCancel != 0L) return;
  1184. // Allocate one struct pointer
  1185. *pppIEData = (void**)new LPVOID;
  1186. // Allocate one struct
  1187. pData = new IE_CACHE;
  1188. *pppIEData[0] = pData;
  1189. *plCount = 1;
  1190. // page refresh type
  1191. if (ERROR_SUCCESS == GetRegValue(HKEY_CURRENT_USER, REG_IE_SETTINGS_KEY, REG_SYNC_MODE_5, dwSyncMode))
  1192. {
  1193. switch (dwSyncMode)
  1194. {
  1195. case WININET_SYNC_MODE_ALWAYS:
  1196. ids = IDS_ALWAYS;
  1197. break;
  1198. case WININET_SYNC_MODE_ONCE_PER_SESSION:
  1199. ids = IDS_ONCE_PER_SESSION;
  1200. break;
  1201. case WININET_SYNC_MODE_AUTOMATIC:
  1202. ids = IDS_AUTOMATIC;
  1203. break;
  1204. case WININET_SYNC_MODE_NEVER:
  1205. ids = IDS_NEVER;
  1206. break;
  1207. default:
  1208. ids = IDS_NOT_AVAILABLE;
  1209. }
  1210. }
  1211. else
  1212. ids = IDS_AUTOMATIC; // if reg entry not found, set to default
  1213. strTemp.LoadString(ids);
  1214. pData->PageRefreshType = strTemp;
  1215. // temp internet files folder
  1216. GetRegValue(HKEY_CURRENT_USER, REG_SHELL_FOLDERS_KEY, REG_CACHE, pData->TempInternetFilesFolder);
  1217. // adding hidden content.ie5 folder for size calculations
  1218. strCachePath = pData->TempInternetFilesFolder.bstrVal;
  1219. if (strCachePath.Right(strlen(CONTENT_IE5)) != CONTENT_IE5)
  1220. {
  1221. if (strCachePath[strCachePath.GetLength() - 1] != _T('\\'))
  1222. strCachePath += '\\';
  1223. strCachePath += CONTENT_IE5;
  1224. }
  1225. // disk space and cache size
  1226. strKey = REG_IE_SETTINGS_KEY;
  1227. strKey += _T('\\');
  1228. strKey += REG_CACHE;
  1229. strKey += _T('\\');
  1230. strKey += REG_CONTENT;
  1231. if (ERROR_SUCCESS == GetRegValue(HKEY_CURRENT_USER, strKey, REG_CACHE_LIMIT, dwCacheLimit))
  1232. {
  1233. if (hInst = GetExports(WININET))
  1234. {
  1235. if (pfnGetDiskInfo((LPTSTR)(LPCTSTR)strCachePath, NULL, &cbAvail, &cbTotal))
  1236. {
  1237. pData->TotalDiskSpace = (float)(signed __int64)(cbTotal / CONSTANT_MEGABYTE);
  1238. pData->AvailableDiskSpace = (float)(signed __int64)(cbAvail / CONSTANT_MEGABYTE);
  1239. pData->MaxCacheSize = (float)(dwCacheLimit / 1024);
  1240. // get size of all files under "Temporary Internet Files" folder
  1241. dwCacheSize = GetDirSize(strCachePath);
  1242. TRACE(_T("Temporary Internet Files Folder Size = %lu\n"), dwCacheSize);
  1243. pData->AvailableCacheSize = ((float)((dwCacheLimit * 1024) - dwCacheSize) / CONSTANT_MEGABYTE);
  1244. }
  1245. FreeLibrary(hInst);
  1246. }
  1247. }
  1248. }
  1249. else if (enType == ObjectType)
  1250. {
  1251. IE_OBJECT *pData;
  1252. CTypedPtrArray<CPtrArray, IE_OBJECT*> ptrs;
  1253. CString strTemp;
  1254. HINSTANCE hInst;
  1255. HANDLE hFindControl, hControl;
  1256. DWORD dwStatus;
  1257. int ids;
  1258. if (hInst = GetExports(OCCACHE))
  1259. {
  1260. if (ERROR_SUCCESS == pfnFindFirstControl(hFindControl, hControl, NULL))
  1261. {
  1262. do
  1263. {
  1264. pData = new IE_OBJECT;
  1265. ptrs.Add(pData);
  1266. char strName[CONTROLNAME_MAXSIZE];
  1267. pfnGetControlInfo(hControl, GCI_NAME, NULL, strName, CONTROLNAME_MAXSIZE);
  1268. //strTemp.ReleaseBuffer();
  1269. pData->ProgramFile = strName;
  1270. pfnGetControlInfo(hControl, GCI_STATUS, &dwStatus, NULL, 0);
  1271. switch (dwStatus)
  1272. {
  1273. case STATUS_CTRL_INSTALLED:
  1274. ids = IDS_INSTALLED;
  1275. break;
  1276. case STATUS_CTRL_SHARED:
  1277. ids = IDS_SHARED;
  1278. break;
  1279. case STATUS_CTRL_DAMAGED:
  1280. ids = IDS_DAMAGED;
  1281. break;
  1282. case STATUS_CTRL_UNPLUGGED:
  1283. ids = IDS_UNPLUGGED;
  1284. break;
  1285. case STATUS_CTRL_UNKNOWN:
  1286. default:
  1287. ids = IDS_NOT_AVAILABLE;
  1288. }
  1289. CString strTemp;
  1290. strTemp.LoadString(ids);
  1291. pData->Status = strTemp;
  1292. char strCodeBase[INTERNET_MAX_URL_LENGTH];
  1293. pfnGetControlInfo(hControl, GCI_CODEBASE, NULL, strCodeBase, INTERNET_MAX_URL_LENGTH);
  1294. //strTemp.ReleaseBuffer();
  1295. pData->CodeBase = strCodeBase;
  1296. pfnReleaseControlHandle(hControl);
  1297. } while (ERROR_SUCCESS == pfnFindNextControl(hFindControl, hControl));
  1298. }
  1299. pfnFindControlClose(hFindControl);
  1300. *plCount = (long) ptrs.GetSize();
  1301. *pppIEData = (void**)new LPVOID[*plCount];
  1302. for (int i = 0; i < *plCount; i++)
  1303. (*pppIEData)[i] = ptrs[i];
  1304. FreeLibrary(hInst);
  1305. }
  1306. }
  1307. else if (enType == ContentType)
  1308. {
  1309. IE_CONTENT *pData;
  1310. HINSTANCE hInst;
  1311. // Allocate one struct pointer
  1312. *pppIEData = (void**)new LPVOID;
  1313. // Allocate one struct
  1314. pData = new IE_CONTENT;
  1315. *pppIEData[0] = pData;
  1316. *plCount = 1;
  1317. if (hInst = GetExports(MSRATING))
  1318. {
  1319. pData->Advisor = GetBooleanString(pfnRatingEnabledQuery() == S_OK, ENABLED_DISABLED);
  1320. FreeLibrary(hInst);
  1321. }
  1322. }
  1323. else if ((enType == CertificateType))
  1324. {
  1325. CTypedPtrArray<CPtrArray, IE_CERTIFICATE*> ptrs;
  1326. HINSTANCE hInst;
  1327. if (hInst = GetExports(CRYPT32))
  1328. {
  1329. GetPersonalCertificates(ptrs);
  1330. GetOtherPeopleCertificates(ptrs);
  1331. *plCount = (long) ptrs.GetSize();
  1332. *pppIEData = (void**)new LPVOID[*plCount];
  1333. for (int i = 0; i < *plCount; i++)
  1334. (*pppIEData)[i] = ptrs[i];
  1335. FreeLibrary(hInst);
  1336. }
  1337. }
  1338. else if ((enType == PublisherType))
  1339. {
  1340. IE_PUBLISHER *pData;
  1341. HKEY hKey;
  1342. CString strRegName, strRegData;
  1343. DWORD cPublishers, dwIndex, dwNameSize, dwDataSize;
  1344. if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_CURRENT_USER, REG_PUBLISHERS_KEY, 0, KEY_READ, &hKey))
  1345. {
  1346. if (ERROR_SUCCESS == RegQueryInfoKey(hKey, NULL, NULL, NULL, NULL, NULL, NULL, &cPublishers, NULL, NULL, NULL, NULL))
  1347. {
  1348. *plCount = cPublishers;
  1349. *pppIEData = (void**)new LPVOID[cPublishers];
  1350. for (dwIndex = 0; dwIndex < cPublishers; dwIndex++)
  1351. {
  1352. pData = new IE_PUBLISHER;
  1353. (*pppIEData)[dwIndex] = pData;
  1354. dwNameSize = _MAX_FNAME;
  1355. dwDataSize = _MAX_FNAME;
  1356. RegEnumValue(hKey, dwIndex, strRegName.GetBuffer(_MAX_FNAME), &dwNameSize, NULL, NULL, (LPBYTE)strRegData.GetBuffer(_MAX_FNAME), &dwDataSize);
  1357. strRegName.ReleaseBuffer();
  1358. strRegData.ReleaseBuffer();
  1359. pData->Name = strRegData;
  1360. }
  1361. }
  1362. RegCloseKey(hKey);
  1363. }
  1364. }
  1365. else if (enType == SecurityType)
  1366. {
  1367. IE_SECURITY *pData;
  1368. IInternetZoneManager* pIZoneMgr = NULL;
  1369. DWORD dwEnum;
  1370. DWORD dwCount;
  1371. CTypedPtrArray<CPtrArray, IE_SECURITY*> ptrs;
  1372. try
  1373. {
  1374. HRESULT hr = CoCreateInstance(CLSID_InternetZoneManager,NULL,CLSCTX_INPROC_SERVER,IID_IInternetZoneManager,(void**) &pIZoneMgr);
  1375. if (SUCCEEDED(hr))
  1376. {
  1377. hr = pIZoneMgr->CreateZoneEnumerator(&dwEnum,&dwCount,0);
  1378. if (SUCCEEDED(hr))
  1379. {
  1380. DWORD dwZone;
  1381. ZONEATTRIBUTES zoneAttrib;
  1382. for(DWORD i = 0; i < dwCount; i++)
  1383. {
  1384. hr = pIZoneMgr->GetZoneAt(dwEnum,i,&dwZone);
  1385. if (FAILED(hr))
  1386. {
  1387. break;
  1388. }
  1389. hr = pIZoneMgr->GetZoneAttributes(dwZone,&zoneAttrib);
  1390. if (FAILED(hr))
  1391. {
  1392. break;
  1393. }
  1394. pData = new IE_SECURITY;
  1395. ptrs.Add(pData);
  1396. pData->Zone = zoneAttrib.szDisplayName;
  1397. CString strTemp;
  1398. int ids;
  1399. switch (zoneAttrib.dwTemplateCurrentLevel)
  1400. {
  1401. case URLTEMPLATE_LOW:
  1402. ids = IDS_LOW;
  1403. break;
  1404. case 0x10500:
  1405. ids = IDS_MEDIUM_LOW;
  1406. break;
  1407. case URLTEMPLATE_MEDIUM:
  1408. ids = IDS_MEDIUM;
  1409. break;
  1410. case URLTEMPLATE_HIGH:
  1411. ids = IDS_HIGH;
  1412. break;
  1413. case URLTEMPLATE_CUSTOM:
  1414. ids = IDS_CUSTOM;
  1415. break;
  1416. default:
  1417. ids = IDS_NOT_AVAILABLE;
  1418. }
  1419. strTemp.LoadString(ids);
  1420. pData->Level = strTemp;
  1421. }
  1422. }
  1423. *plCount = (long) ptrs.GetSize();
  1424. *pppIEData = (void**)new LPVOID[*plCount];
  1425. for (int i = 0; i < *plCount; i++)
  1426. (*pppIEData)[i] = ptrs[i];
  1427. }
  1428. }
  1429. catch(...)
  1430. {
  1431. }
  1432. if (pIZoneMgr)
  1433. {
  1434. pIZoneMgr->Release();
  1435. }
  1436. }
  1437. }
  1438. ///////////////////////////////////////////////////////////////////////////////
  1439. // AppDeleteIEData - Deletes previously retrieved IE data.
  1440. ///////////////////////////////////////////////////////////////////////////////
  1441. void CMsieApp::AppDeleteIEData(IEDataType enType, long lCount, void **ppIEData)
  1442. {
  1443. for (long i = 0; i < lCount; i++)
  1444. {
  1445. switch (enType)
  1446. {
  1447. case SummaryType:
  1448. delete (IE_SUMMARY*)ppIEData[i];
  1449. break;
  1450. case FileVersionType:
  1451. delete (IE_FILE_VERSION*)ppIEData[i];
  1452. break;
  1453. case ConnSummaryType:
  1454. delete (IE_CONN_SUMMARY*)ppIEData[i];
  1455. break;
  1456. case LanSettingsType:
  1457. delete (IE_LAN_SETTINGS*)ppIEData[i];
  1458. break;
  1459. case ConnSettingsType:
  1460. delete (IE_CONN_SETTINGS*)ppIEData[i];
  1461. break;
  1462. case CacheType:
  1463. delete (IE_CACHE*)ppIEData[i];
  1464. break;
  1465. case ObjectType:
  1466. delete (IE_OBJECT*)ppIEData[i];
  1467. break;
  1468. case ContentType:
  1469. delete (IE_CONTENT*)ppIEData[i];
  1470. break;
  1471. case CertificateType:
  1472. delete (IE_CERTIFICATE*)ppIEData[i];
  1473. break;
  1474. case PublisherType:
  1475. delete (IE_PUBLISHER*)ppIEData[i];
  1476. break;
  1477. case SecurityType:
  1478. delete (IE_SECURITY*)ppIEData[i];
  1479. break;
  1480. }
  1481. }
  1482. delete []ppIEData;
  1483. }