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.

231 lines
7.9 KiB

  1. #include "precomp.h"
  2. // {2D0A4070-FB48-11d1-8722-00A0C9B0EB4F}
  3. DEFINE_GUID(NODEID_IEAKSnapinExtNameSpace, 0x2d0a4070, 0xfb48, 0x11d1, 0x87, 0x22, 0x0, 0xa0, 0xc9, 0xb0, 0xeb, 0x4f);
  4. //
  5. // Result pane items for the nodes with no result pane items
  6. //
  7. RESULTITEM g_ResultUndefined[] =
  8. {
  9. { 1, 0, 0, 0, NULL, NULL, 0, NULL }
  10. };
  11. //
  12. // Result pane items for the Browser UI Settings node
  13. //
  14. RESULTITEM g_ResultBrowser[] =
  15. {
  16. { 1, IDS_BTITLE, -1, IDS_BTITLE_DESC, IDD_BTITLE, 1, NULL, NULL,
  17. NULL, TitleDlgProc, TEXT("wiz4_0.htm") },
  18. { 1, IDS_CUSTICON2, -1, IDS_CUSTICON_DESC, IDD_CUSTICON, 1, NULL, NULL,
  19. NULL, LogoDlgProc, TEXT("wiz4_1.htm") },
  20. { 1, IDS_BTOOLBAR, IDS_BTOOLBAR_PREF, IDS_BTOOLBAR_DESC, IDD_BTOOLBARS, 1, NULL, NULL,
  21. NULL, BToolbarsDlgProc, TEXT("wiz4_0a.htm") }
  22. };
  23. //
  24. // Result pane items for the Connection Settings node
  25. //
  26. RESULTITEM g_ResultConnection[] =
  27. {
  28. { 2, IDS_CONNECTSET, IDS_CONNECTSET_PREF, IDS_CONNECTSET_DESC, IDD_CONNECTSET,
  29. 2, NULL, NULL, NULL, ConnectSetDlgProc, TEXT("wiz4_11.htm") },
  30. { 2, IDS_QUERYAUTOCONFIG, IDS_QUERYAUTOCONFIG_PREF, IDS_QUERYAUTOCONFIG_DESC, IDD_QUERYAUTOCONFIG,
  31. 2, NULL, NULL, NULL, AutoconfigDlgProc, TEXT("wiz4_10.htm") },
  32. { 2, IDS_PROXY2, IDS_PROXY_PREF, IDS_PROXY_DESC, IDD_PROXY,
  33. 2, NULL, NULL, NULL, ProxyDlgProc, TEXT("wiz4_12.htm") },
  34. { 2, IDS_UASTRDLG2, -1, IDS_UASTRDLG_DESC, IDD_UASTRDLG,
  35. 2, NULL, NULL, NULL, UserAgentDlgProc, TEXT("wiz4_9.htm") }
  36. };
  37. //
  38. // Result pane items for the URLs node
  39. //
  40. RESULTITEM g_ResultUrls[] =
  41. {
  42. { 3, IDS_FAVORITES2, IDS_FAVORITES_PREF, IDS_FAVORITES_DESC, IDD_FAVORITES, 3,
  43. NULL, NULL, NULL, FavoritesDlgProc, TEXT("wiz4_3.htm") },
  44. { 3, IDS_STARTSEARCH2, IDS_STARTSEARCH_PREF,IDS_STARTSEARCH_DESC, IDD_STARTSEARCH, 3,
  45. NULL, NULL, NULL, UrlsDlgProc, TEXT("wiz4_2.htm") }
  46. };
  47. //
  48. // Result pane items for the Security node
  49. //
  50. RESULTITEM g_ResultSecurity[] =
  51. {
  52. { 4, IDS_SECURITY, IDS_SECURITY_PREF, IDS_SECURITY_DESC, IDD_SECURITY1, 4,
  53. NULL, NULL, NULL, SecurityZonesDlgProc, TEXT("wiz4_17.htm") },
  54. { 4, IDS_SECURITYAUTH, IDS_SECURITYAUTH_PREF, IDS_AUTHCODE_DESC, IDD_SECURITYAUTH, 4,
  55. NULL, NULL, NULL, SecurityAuthDlgProc, TEXT("wiz4_16.htm") }
  56. };
  57. //
  58. // Result pane items for the Programs node
  59. //
  60. RESULTITEM g_ResultPrograms[] =
  61. {
  62. { 5, IDS_PROGRAMS, IDS_PROGRAMS_PREF, IDS_PROGRAMS_DESC, IDD_PROGRAMS, 5, NULL, NULL, NULL,
  63. ProgramsDlgProc, TEXT("wiz5_0a.htm ") }
  64. };
  65. //
  66. // Namespace (scope) items
  67. /* structure prototype for easy reference
  68. typedef struct _NAMESPACEITEM
  69. {
  70. DWORD dwParent;
  71. INT iNameID;
  72. INT iDescID;
  73. LPTSTR pszName;
  74. LPTSTR pszDesc;
  75. INT cChildren;
  76. INT cResultItems;
  77. LPRESULTITEM pResultItems;
  78. const GUID *pNodeID;
  79. } NAMESPACEITEM, *LPNAMESPACEITEM;
  80. //
  81. // Be sure to update NUM_NAMESPACE_ITEMS define in layout.h if you add / remove from this
  82. // array and leave IDS_ADMGRP_NAME as the last name space item
  83. */
  84. NAMESPACEITEM g_NameSpace[] =
  85. {
  86. { (DWORD)-1, IDS_SIE_NAME, IDS_SIE_DESC, NULL, NULL, 1,
  87. 0, g_ResultUndefined, &NODEID_IEAKSnapinExtNameSpace }, // Root
  88. { 0, IDS_BROWSERGRP_NAME, IDS_BROWSERGRP_DESC, NULL, NULL, 0,
  89. countof(g_ResultBrowser), g_ResultBrowser, &NODEID_IEAKSnapinExtNameSpace }, // Browser UI
  90. { 0, IDS_CONNGRP_NAME, IDS_CONNGRP_DESC, NULL, NULL, 0,
  91. countof(g_ResultConnection), g_ResultConnection, &NODEID_IEAKSnapinExtNameSpace }, // Connection Settings
  92. { 0, IDS_URLSGRP_NAME, IDS_URLSGRP_DESC, NULL, NULL, 0,
  93. countof(g_ResultUrls), g_ResultUrls, &NODEID_IEAKSnapinExtNameSpace }, // Urls
  94. { 0, IDS_SECURITYGRP_NAME, IDS_SECURITYGRP_DESC, NULL, NULL, 0,
  95. countof(g_ResultSecurity), g_ResultSecurity, &NODEID_IEAKSnapinExtNameSpace }, // Security
  96. { 0, IDS_PROGGRP_NAME, IDS_PROGGRP_DESC, NULL, NULL, 0,
  97. countof(g_ResultPrograms), g_ResultPrograms, &NODEID_IEAKSnapinExtNameSpace }, // Programs
  98. { 0, IDS_ADMGRP_NAME, IDS_ADMGRP_DESC, NULL, NULL, 0,
  99. 0, NULL, &NODEID_IEAKSnapinExtNameSpace } // Adms
  100. };
  101. // private forward declarations
  102. static void cleanUpResultItemsArray(LPRESULTITEM lpResultItemArray, INT cResultItems);
  103. // exported functions
  104. BOOL CreateBufandLoadString(HINSTANCE hInst, INT iResId, LPTSTR * ppGlobalStr,
  105. LPTSTR * ppMMCStrPtr, DWORD cchMax)
  106. {
  107. TCHAR szBuffer[MAX_PATH];
  108. BOOL fRet = FALSE;
  109. UNREFERENCED_PARAMETER(cchMax);
  110. ASSERT(cchMax <= countof(szBuffer));
  111. EnterCriticalSection(&g_LayoutCriticalSection);
  112. if (*ppGlobalStr == NULL)
  113. {
  114. if (LoadString(hInst, iResId, szBuffer, cchMax) != 0)
  115. {
  116. if ((*ppGlobalStr = (LPTSTR)CoTaskMemAlloc(StrCbFromSz(szBuffer))) != NULL)
  117. {
  118. StrCpy(*ppGlobalStr, szBuffer);
  119. fRet = TRUE;
  120. }
  121. }
  122. }
  123. *ppMMCStrPtr = *ppGlobalStr;
  124. LeaveCriticalSection(&g_LayoutCriticalSection);
  125. return fRet;
  126. }
  127. void CleanUpGlobalArrays()
  128. {
  129. EnterCriticalSection(&g_LayoutCriticalSection);
  130. for (int i = 0; i < NUM_NAMESPACE_ITEMS; i++)
  131. {
  132. if (g_NameSpace[i].pResultItems != NULL)
  133. cleanUpResultItemsArray(g_NameSpace[i].pResultItems, g_NameSpace[i].cResultItems);
  134. if (g_NameSpace[i].pszName != NULL)
  135. {
  136. CoTaskMemFree(g_NameSpace[i].pszName);
  137. g_NameSpace[i].pszName = NULL;
  138. }
  139. if (g_NameSpace[i].pszDesc != NULL)
  140. {
  141. CoTaskMemFree(g_NameSpace[i].pszDesc);
  142. g_NameSpace[i].pszDesc = NULL;
  143. }
  144. }
  145. if (g_NameSpace[ADM_NAMESPACE_ITEM].pResultItems != NULL)
  146. {
  147. CoTaskMemFree(g_NameSpace[ADM_NAMESPACE_ITEM].pResultItems);
  148. g_NameSpace[ADM_NAMESPACE_ITEM].pResultItems = NULL;
  149. }
  150. LeaveCriticalSection(&g_LayoutCriticalSection);
  151. }
  152. void DeleteCookieList(LPIEAKMMCCOOKIE lpCookieList)
  153. {
  154. if (lpCookieList != NULL)
  155. {
  156. LPIEAKMMCCOOKIE lpCookiePtr1, lpCookiePtr2;
  157. for (lpCookiePtr1 = lpCookieList, lpCookiePtr2 = lpCookiePtr1->pNext;
  158. (lpCookiePtr2 != NULL);
  159. lpCookiePtr1 = lpCookiePtr2, lpCookiePtr2 = lpCookiePtr1->pNext)
  160. CoTaskMemFree(lpCookiePtr1);
  161. CoTaskMemFree(lpCookiePtr1);
  162. }
  163. }
  164. void AddItemToCookieList(LPIEAKMMCCOOKIE *ppCookieList, LPIEAKMMCCOOKIE lpCookieItem)
  165. {
  166. if (*ppCookieList == NULL)
  167. *ppCookieList = lpCookieItem;
  168. else
  169. {
  170. LPIEAKMMCCOOKIE lpCookieList = *ppCookieList;
  171. while (lpCookieList->pNext != NULL)
  172. lpCookieList = lpCookieList->pNext;
  173. lpCookieList->pNext = lpCookieItem;
  174. }
  175. }
  176. // private helper functions
  177. static void cleanUpResultItemsArray(LPRESULTITEM lpResultItemArray, INT cResultItems)
  178. {
  179. for (int i = 0; i < cResultItems; i++)
  180. {
  181. if (lpResultItemArray[i].pszName != NULL)
  182. {
  183. CoTaskMemFree(lpResultItemArray[i].pszName);
  184. lpResultItemArray[i].pszName = NULL;
  185. }
  186. if (lpResultItemArray[i].pszNamePref != NULL)
  187. {
  188. CoTaskMemFree(lpResultItemArray[i].pszNamePref);
  189. lpResultItemArray[i].pszNamePref = NULL;
  190. }
  191. if (lpResultItemArray[i].pszDesc != NULL)
  192. {
  193. CoTaskMemFree(lpResultItemArray[i].pszDesc);
  194. lpResultItemArray[i].pszDesc = NULL;
  195. }
  196. }
  197. }