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.

2033 lines
52 KiB

  1. /****************************************************************************
  2. *
  3. * FILE: DbgMenu.cpp
  4. *
  5. * CREATED: Robert Donner (RobD) 2-04-96
  6. *
  7. * CONTENTS: CDebugMenu object
  8. *
  9. ****************************************************************************/
  10. /*
  11. To add a debug menu option:
  12. 1) Add the text to _rgDbgSz
  13. 2) Add a function call to OnDebugCommand
  14. To add a checkbox in the debug options dialog:
  15. 2) Use either AddOptionReg or AddOptionPdw with appropriate parameters
  16. To add a file to the version list
  17. 1) Edit dbgfiles.txt
  18. */
  19. #include "precomp.h"
  20. #include "particip.h"
  21. #include "DbgMenu.h"
  22. #include "confroom.h"
  23. #include "conf.h"
  24. #include "version.h"
  25. #include "pfnver.h"
  26. #include "dlgacd.h"
  27. #include <ConfCpl.h>
  28. #ifdef DEBUG /*** THIS WHOLE FILE ***/
  29. #include "DbgFiles.h" // List of files for version info
  30. #include "..\..\core\imember.h" // for CNmMember
  31. #include "..\..\as\h\gdc.h" // for GCT compression stuff
  32. CDebugMenu * g_pDbgMenu = NULL;
  33. HWND ghwndVerList;
  34. ////////////////////////////
  35. // Local Function Prototypes
  36. VOID DbgSplash(HWND hwnd);
  37. VOID DbgTest2(void);
  38. VOID DbgTest3(void);
  39. VOID DbgWizard(BOOL fVisible);
  40. VOID DbgBreak(void);
  41. VOID UpdateCrtDbgSettings(void);
  42. VOID InitNmDebugOptions(void);
  43. VOID SaveNmDebugOptions(void);
  44. /*** Globals ***/
  45. extern DWORD g_fDisplayFPS; // vidview.cpp
  46. extern DWORD g_fDisplayViewStatus; // statbar.cpp
  47. extern DWORD g_dwPlaceCall; // controom.cpp
  48. #define iDbgChecked 1
  49. #define iDbgUnchecked 2
  50. DWORD _dwDebugModuleFlags;
  51. /*** Debug Menu Data ***/
  52. enum {
  53. IDM_DBG_OPTIONS = IDM_DEBUG_FIRST,
  54. IDM_DBG_ZONES,
  55. IDM_DBG_POLICY,
  56. IDM_DBG_UI,
  57. IDM_DBG_VERSION,
  58. IDM_DBG_MEMBERS,
  59. IDM_DBG_WIZARD,
  60. IDM_DBG_BREAK,
  61. IDM_DBG_SPLASH,
  62. IDM_DBG_TEST2,
  63. IDM_DBG_TEST3
  64. };
  65. static DWSTR _rgDbgMenu[] = {
  66. IDM_DBG_OPTIONS, TEXT("Debug Options..."),
  67. IDM_DBG_ZONES, TEXT("Zones..."),
  68. IDM_DBG_POLICY, TEXT("System Policies..."),
  69. IDM_DBG_UI, TEXT("User Interface..."),
  70. 0, NULL,
  71. IDM_DBG_VERSION, TEXT("Version Info..."),
  72. IDM_DBG_MEMBERS, TEXT("Member Info..."),
  73. 0, NULL,
  74. IDM_DBG_WIZARD, TEXT("Run Wizard"),
  75. IDM_DBG_BREAK, TEXT("Break"),
  76. 0, NULL,
  77. IDM_DBG_SPLASH, TEXT("Show/Hide Splash Screen"),
  78. IDM_DBG_TEST2, TEXT("Test 2"),
  79. IDM_DBG_TEST3, TEXT("Test 3"),
  80. };
  81. BOOL CDebugMenu::OnDebugCommand(WPARAM wCmd)
  82. {
  83. switch (wCmd)
  84. {
  85. case IDM_DBG_OPTIONS: DbgOptions(); break;
  86. case IDM_DBG_ZONES: DbgChangeZones(); break;
  87. case IDM_DBG_POLICY: DbgSysPolicy(); break;
  88. case IDM_DBG_UI: DbgUI(); break;
  89. case IDM_DBG_VERSION: DbgVersion(); break;
  90. case IDM_DBG_MEMBERS: DbgMemberInfo(); break;
  91. case IDM_DBG_WIZARD: DbgWizard(TRUE); break;
  92. case IDM_DBG_BREAK: DbgBreak(); break;
  93. case IDM_DBG_SPLASH: DbgSplash(m_hwnd);break;
  94. case IDM_DBG_TEST2: DbgTest2(); break;
  95. case IDM_DBG_TEST3: DbgTest3(); break;
  96. default: break;
  97. }
  98. return TRUE;
  99. }
  100. /*** Version Info Data ***/
  101. // FUTURE: Merge these into a single structure
  102. #define cVerInfo 11
  103. #define VERSION_INDEX 3
  104. static PTSTR _rgszVerInfo[cVerInfo] = {
  105. TEXT("InternalName"),
  106. TEXT("Size"),
  107. TEXT("Date"),
  108. TEXT("FileVersion"),
  109. TEXT("FileDescription"),
  110. TEXT("CompanyName"),
  111. TEXT("LegalCopyright"),
  112. TEXT("ProductName"),
  113. TEXT("ProductVersion"),
  114. TEXT("InternalName"),
  115. TEXT("OriginalFilename")
  116. };
  117. static PTSTR _rgVerTitle[cVerInfo] = {
  118. TEXT("Filename"),
  119. TEXT("Size"),
  120. TEXT("Date"),
  121. TEXT("Version"),
  122. TEXT("Description"),
  123. TEXT("Company"),
  124. TEXT("Trademark"),
  125. TEXT("Product"),
  126. TEXT("Version"),
  127. TEXT("Name"),
  128. TEXT("File")
  129. };
  130. static int _rgVerWidth[cVerInfo] = {
  131. 70,
  132. 70,
  133. 70,
  134. 70,
  135. 200,
  136. 70,
  137. 70,
  138. 70,
  139. 70,
  140. 70,
  141. 70
  142. };
  143. static TCHAR _szStringFileInfo[] = TEXT("StringFileInfo");
  144. static TCHAR _szVerIntlUSA[] = TEXT("040904E4");
  145. static TCHAR _szVerIntlAlt[] = TEXT("040904B0");
  146. static TCHAR _szVerFormat[] = TEXT("\\%s\\%s\\%s");
  147. /*** Debug Option Checkboxes ***/
  148. #define DEBUG_DFL_ENABLE_TRACE_MESSAGES 0x0001
  149. #define DEBUG_DFL_LOG_TRACE_MESSAGES 0x0002
  150. #define DEBUG_DFL_DUMP_THREAD_ID 0x0004
  151. #define DEBUG_DFL_ENABLE_CALL_TRACING 0x0008
  152. #define DEBUG_DFL_DUMP_TIME 0x0010
  153. #define DEBUG_DFL_INDENT 0x2000
  154. /* Static members of DBGOPTCOMPRESS class */
  155. int DBGOPTCOMPRESS::m_total = 0; // total number of instances of this subclass
  156. int DBGOPTCOMPRESS::m_count = 0; // internally used counter
  157. DWORD DBGOPTCOMPRESS::m_dwCompression; // actual compression value
  158. DWORD DBGOPTCOMPRESS::m_dwDefault = GCT_DEFAULT; // default value
  159. HKEY DBGOPTCOMPRESS::m_hkey = HKEY_LOCAL_MACHINE; // key
  160. PTSTR DBGOPTCOMPRESS::m_pszSubKey = AS_DEBUG_KEY; // subkey
  161. PTSTR DBGOPTCOMPRESS::m_pszEntry = REGVAL_AS_COMPRESSION; // entry
  162. VOID ShowDbgView(void)
  163. {
  164. if (ShellExecute(NULL, NULL, "dbgview.exe", NULL, NULL, SW_SHOW) <= (HINSTANCE) 32)
  165. {
  166. ConfMsgBox(NULL, TEXT("Unable to start 'DbgView.exe'"));
  167. }
  168. }
  169. /****************************************************************************
  170. *
  171. * CLASS: CDebugMenu
  172. *
  173. * MEMBER: CDebugMenu()
  174. *
  175. * PURPOSE: Constructor - initializes variables
  176. *
  177. ****************************************************************************/
  178. CDebugMenu::CDebugMenu(VOID):
  179. m_hwnd(NULL),
  180. m_hMenu(NULL),
  181. m_hMenuDebug(NULL)
  182. {
  183. DebugEntry(CDebugMenu::CDebugMenu);
  184. DebugExitVOID(CDebugMenu::CDebugMenu);
  185. }
  186. /****************************************************************************
  187. *
  188. * CLASS: CDebugMenu
  189. *
  190. * MEMBER: InitDebugMenu()
  191. *
  192. * PURPOSE: Puts debug menu options on the menu bar
  193. *
  194. ****************************************************************************/
  195. VOID CDebugMenu::InitDebugMenu(HWND hwnd)
  196. {
  197. m_hwnd = hwnd;
  198. if (NULL == hwnd)
  199. return;
  200. m_hMenu = GetMenu(hwnd);
  201. if (NULL == m_hMenu)
  202. return;
  203. m_hMenuDebug = CreateMenu();
  204. if (NULL == m_hMenuDebug)
  205. return;
  206. for (int i = 0; i < ARRAY_ELEMENTS(_rgDbgMenu); i++)
  207. {
  208. if (0 == _rgDbgMenu[i].dw)
  209. {
  210. AppendMenu(m_hMenuDebug, MF_SEPARATOR, 0, 0);
  211. }
  212. else if (!AppendMenu(m_hMenuDebug, MF_STRING | MF_ENABLED,
  213. _rgDbgMenu[i].dw, _rgDbgMenu[i].psz))
  214. {
  215. return;
  216. }
  217. }
  218. AppendMenu(m_hMenu, MF_POPUP, (UINT_PTR) m_hMenuDebug, TEXT(" "));
  219. }
  220. /////////////////////////////////////////////////////////////////////////////
  221. // D I A L O G: O P T I O N S
  222. /////////////////////////////////////////////////////////////////////////////
  223. /****************************************************************************
  224. *
  225. * CLASS: CDebugMenu
  226. *
  227. * MEMBER: DbgOptions()
  228. *
  229. * PURPOSE: Brings up the debug options dialog box
  230. *
  231. ****************************************************************************/
  232. VOID CDebugMenu::DbgOptions(VOID)
  233. {
  234. DebugEntry(CDebugMenu::DbgOptions);
  235. DialogBoxParam(GetInstanceHandle(), MAKEINTRESOURCE(IDD_DBG_OPTIONS),
  236. m_hwnd, CDebugMenu::DbgOptionsDlgProc, (LPARAM) this);
  237. DebugExitVOID(CDebugMenu::DbgOptions);
  238. }
  239. /****************************************************************************
  240. *
  241. * CLASS: CDebugMenu
  242. *
  243. * MEMBER: DbgOptionsDlgProc()
  244. *
  245. * PURPOSE: Dialog Proc for debug options
  246. *
  247. ****************************************************************************/
  248. INT_PTR CALLBACK CDebugMenu::DbgOptionsDlgProc(HWND hDlg, UINT uMsg,
  249. WPARAM wParam, LPARAM lParam)
  250. {
  251. if (WM_INITDIALOG == uMsg)
  252. {
  253. if (NULL == lParam)
  254. return FALSE;
  255. SetWindowLongPtr(hDlg, DWLP_USER, lParam);
  256. ((CDebugMenu *) lParam)->InitOptionsDlg(hDlg);
  257. ((CDebugMenu *) lParam)->InitOptionsData(hDlg);
  258. return TRUE;
  259. }
  260. CDebugMenu * ppd = (CDebugMenu*) GetWindowLongPtr(hDlg, DWLP_USER);
  261. if (NULL == ppd)
  262. return FALSE;
  263. return ppd->DlgOptionsMsg(hDlg, uMsg, wParam, lParam);
  264. }
  265. /* I N I T O P T I O N S D L G */
  266. /*----------------------------------------------------------------------------
  267. %%Function: InitOptionsDlg
  268. ----------------------------------------------------------------------------*/
  269. BOOL CDebugMenu::InitOptionsDlg(HWND hDlg)
  270. {
  271. m_hwndDbgopt = GetDlgItem(hDlg, IDL_DEBUG);
  272. if (NULL == m_hwndDbgopt)
  273. return FALSE;
  274. /* Initialize the list view images */
  275. {
  276. HICON hCheckedIcon = LoadIcon(GetInstanceHandle(), MAKEINTRESOURCE(IDI_CHECKON));
  277. HICON hUncheckedIcon = LoadIcon(GetInstanceHandle(), MAKEINTRESOURCE(IDI_CHECKOFF));
  278. HIMAGELIST hStates = ImageList_Create(16, 16, ILC_MASK, 2, 2);
  279. if ((NULL == hStates) || (NULL == hCheckedIcon) || (NULL == hUncheckedIcon))
  280. {
  281. return FALSE;
  282. }
  283. ImageList_AddIcon(hStates, hCheckedIcon);
  284. ImageList_AddIcon(hStates, hUncheckedIcon);
  285. // Associate the image list with the list view
  286. ListView_SetImageList(m_hwndDbgopt, hStates, LVSIL_STATE);
  287. }
  288. /* Initialize the column structure */
  289. {
  290. LV_COLUMN lvC;
  291. RECT rc;
  292. GetClientRect(m_hwndDbgopt, &rc);
  293. ZeroMemory(&lvC, sizeof(lvC));
  294. lvC.mask = LVCF_FMT | LVCF_SUBITEM | LVCF_WIDTH | LVCF_TEXT;
  295. lvC.fmt = LVCFMT_LEFT;
  296. lvC.cx = rc.right - GetSystemMetrics(SM_CXVSCROLL)
  297. - GetSystemMetrics(SM_CXSMICON)
  298. - 2 * GetSystemMetrics(SM_CXEDGE);
  299. // Add the column.
  300. if (-1 == ListView_InsertColumn(m_hwndDbgopt, 0, &lvC))
  301. {
  302. ERROR_OUT(("Could not insert column in list view"));
  303. return FALSE;
  304. }
  305. }
  306. return TRUE;
  307. }
  308. VOID CDebugMenu::InitOptionsData(HWND hDlg)
  309. {
  310. LV_ITEM lvI;
  311. // Fill in the LV_ITEM structure
  312. // The mask specifies the the .pszText, .iImage, .lParam and .state
  313. // members of the LV_ITEM structure are valid.
  314. ZeroMemory(&lvI, sizeof(lvI));
  315. lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE | LVIF_PARAM;
  316. lvI.stateMask = LVIS_STATEIMAGEMASK;
  317. lvI.cchTextMax = 256;
  318. AddDbgOptions(&lvI);
  319. AddASOptions(&lvI);
  320. }
  321. /* A D D O P T I O N */
  322. /*----------------------------------------------------------------------------
  323. %%Function: AddOption
  324. Add an option line to the listbox
  325. ----------------------------------------------------------------------------*/
  326. VOID CDebugMenu::AddOption(LV_ITEM * plvItem, CDebugOption * pDbgOpt)
  327. {
  328. plvItem->pszText = pDbgOpt->m_psz;
  329. plvItem->lParam = (LPARAM) pDbgOpt;
  330. plvItem->state &= ~LVIS_STATEIMAGEMASK;
  331. if (BST_CHECKED == pDbgOpt->m_bst)
  332. plvItem->state |= INDEXTOSTATEIMAGEMASK(iDbgChecked);
  333. else if (BST_UNCHECKED == pDbgOpt->m_bst)
  334. plvItem->state |= INDEXTOSTATEIMAGEMASK(iDbgUnchecked);
  335. if (-1 == ListView_InsertItem(m_hwndDbgopt, plvItem))
  336. {
  337. ERROR_OUT(("problem adding item entry to list view"));
  338. }
  339. else
  340. {
  341. plvItem->iItem++;
  342. }
  343. }
  344. /* A D D O P T I O N S E C T I O N */
  345. /*----------------------------------------------------------------------------
  346. %%Function: AddOptionSection
  347. Add a simple section title
  348. ----------------------------------------------------------------------------*/
  349. VOID CDebugMenu::AddOptionSection(LV_ITEM* plvItem, PTSTR psz)
  350. {
  351. CDebugOption * pDbgOpt = new CDebugOption(psz);
  352. if (NULL != pDbgOpt)
  353. AddOption(plvItem, pDbgOpt);
  354. }
  355. /* A D D O P T I O N P D W */
  356. /*----------------------------------------------------------------------------
  357. %%Function: AddOptionPdw
  358. Add an option (global memory flag)
  359. ----------------------------------------------------------------------------*/
  360. VOID CDebugMenu::AddOptionPdw(LV_ITEM * plvItem, PTSTR psz, DWORD dwMask, DWORD * pdw = &_dwDebugModuleFlags)
  361. {
  362. DBGOPTPDW * pDbgOpt = new DBGOPTPDW(psz, dwMask, pdw);
  363. if (NULL != pDbgOpt)
  364. AddOption(plvItem, (CDebugOption * ) pDbgOpt);
  365. }
  366. /* A D D O P T I O N R E G */
  367. /*----------------------------------------------------------------------------
  368. %%Function: AddOptionReg
  369. Add a registry option
  370. ----------------------------------------------------------------------------*/
  371. VOID CDebugMenu::AddOptionReg(LV_ITEM* plvItem, PTSTR psz, DWORD dwMask, DWORD dwDefault,
  372. PTSTR pszEntry, PTSTR pszSubKey = CONFERENCING_KEY, HKEY hkey = HKEY_CURRENT_USER)
  373. {
  374. DBGOPTREG * pDbgOpt = new DBGOPTREG(psz, dwMask, dwDefault, pszEntry, pszSubKey, hkey);
  375. if (NULL != pDbgOpt)
  376. AddOption(plvItem, (CDebugOption * ) pDbgOpt);
  377. }
  378. /* A D D O P T I O N C O M P R E S S */
  379. /*----------------------------------------------------------------------------
  380. %%Function: AddOptionCompress
  381. Add an option (compression data)
  382. ----------------------------------------------------------------------------*/
  383. VOID CDebugMenu::AddOptionCompress(LV_ITEM * plvItem, PTSTR psz, DWORD dwMask, BOOL bCheckedOn)
  384. {
  385. DBGOPTCOMPRESS * pDbgOpt = new DBGOPTCOMPRESS(psz, dwMask, bCheckedOn);
  386. if (NULL != pDbgOpt)
  387. AddOption(plvItem, (CDebugOption * ) pDbgOpt);
  388. }
  389. VOID CDebugMenu::AddDbgOptions(LV_ITEM * plvItem)
  390. {
  391. AddOptionSection(plvItem, TEXT("____Debug Output____"));
  392. AddOptionReg(plvItem, TEXT("Use OutputDebugString"), 1,DEFAULT_DBG_OUTPUT,
  393. REGVAL_DBG_OUTPUT, DEBUG_KEY, HKEY_LOCAL_MACHINE);
  394. AddOptionReg(plvItem, TEXT("Output to Window"), 1, DEFAULT_DBG_NO_WIN,
  395. REGVAL_DBG_WIN_OUTPUT, DEBUG_KEY, HKEY_LOCAL_MACHINE);
  396. AddOptionReg(plvItem, TEXT("Ouput to File"), 1, DEFAULT_DBG_NO_FILE,
  397. REGVAL_DBG_FILE_OUTPUT, DEBUG_KEY, HKEY_LOCAL_MACHINE);
  398. AddOptionReg(plvItem, TEXT("Show ThreadId"), 1, 0,
  399. REGVAL_DBG_SHOW_THREADID, DEBUG_KEY, HKEY_LOCAL_MACHINE);
  400. AddOptionReg(plvItem, TEXT("Show Module Name"), 1, 0,
  401. REGVAL_DBG_SHOW_MODULE, DEBUG_KEY, HKEY_LOCAL_MACHINE);
  402. AddOptionReg(plvItem, TEXT("Enable Retail Log Output"), 1, 0,
  403. REGVAL_RETAIL_LOG, DEBUG_KEY, HKEY_LOCAL_MACHINE);
  404. AddOptionReg(plvItem, TEXT("Show Time"), 1, 0,
  405. REGVAL_DBG_SHOW_TIME, DEBUG_KEY, HKEY_LOCAL_MACHINE);
  406. AddOptionReg(plvItem, TEXT("Format Time"), 2, 0,
  407. REGVAL_DBG_SHOW_TIME, DEBUG_KEY, HKEY_LOCAL_MACHINE);
  408. _dwDebugModuleFlags = GetDebugOutputFlags();
  409. AddOptionPdw(plvItem, TEXT("Function Level Indenting (conf)"),DEBUG_DFL_INDENT);
  410. }
  411. VOID CDebugMenu::AddPolicyOptions(LV_ITEM * plvItem)
  412. {
  413. AddOptionSection(plvItem, TEXT("____Calling____"));
  414. AddOptionReg(plvItem, TEXT("No Auto-Accept"), 1, DEFAULT_POL_NO_AUTOACCEPTCALLS, REGVAL_POL_NO_AUTOACCEPTCALLS, POLICIES_KEY);
  415. AddOptionReg(plvItem, TEXT("Do not allow directory services"), 1, DEFAULT_POL_NO_DIRECTORY_SERVICES, REGVAL_POL_NO_DIRECTORY_SERVICES, POLICIES_KEY);
  416. AddOptionReg(plvItem, TEXT("No Adding Directory Servers"), 1, 0, REGVAL_POL_NO_ADDING_NEW_ULS, POLICIES_KEY);
  417. AddOptionReg(plvItem, TEXT("No changing Call mode"), 1, 0, REGVAL_POL_NOCHANGECALLMODE, POLICIES_KEY);
  418. AddOptionReg(plvItem, TEXT("No web directory"), 1, 0, REGVAL_POL_NO_WEBDIR, POLICIES_KEY);
  419. AddOptionSection(plvItem, TEXT("____Applets____"));
  420. AddOptionReg(plvItem, TEXT("No Chat"), 1, DEFAULT_POL_NO_CHAT, REGVAL_POL_NO_CHAT, POLICIES_KEY);
  421. AddOptionReg(plvItem, TEXT("No Old Whiteboard"), 1, DEFAULT_POL_NO_OLDWHITEBOARD, REGVAL_POL_NO_OLDWHITEBOARD, POLICIES_KEY);
  422. AddOptionReg(plvItem, TEXT("No New Whiteboard"), 1, DEFAULT_POL_NO_NEWWHITEBOARD, REGVAL_POL_NO_NEWWHITEBOARD, POLICIES_KEY);
  423. AddOptionReg(plvItem, TEXT("No File Transfer Send"), 1, DEFAULT_POL_NO_FILETRANSFER_SEND, REGVAL_POL_NO_FILETRANSFER_SEND, POLICIES_KEY);
  424. AddOptionReg(plvItem, TEXT("No File Transfer Receive"), 1, DEFAULT_POL_NO_FILETRANSFER_RECEIVE, REGVAL_POL_NO_FILETRANSFER_RECEIVE, POLICIES_KEY);
  425. AddOptionReg(plvItem, TEXT("No Audio"), 1, DEFAULT_POL_NO_AUDIO, REGVAL_POL_NO_AUDIO, POLICIES_KEY);
  426. AddOptionReg(plvItem, TEXT("No Video Send"), 1, DEFAULT_POL_NO_VIDEO_SEND, REGVAL_POL_NO_VIDEO_SEND, POLICIES_KEY);
  427. AddOptionReg(plvItem, TEXT("No Video Receive"), 1, DEFAULT_POL_NO_VIDEO_RECEIVE, REGVAL_POL_NO_VIDEO_RECEIVE, POLICIES_KEY);
  428. AddOptionSection(plvItem, TEXT("____Sharing____"));
  429. AddOptionReg(plvItem, TEXT("Disable all Sharing features"), 1, DEFAULT_POL_NO_APP_SHARING, REGVAL_POL_NO_APP_SHARING, POLICIES_KEY);
  430. AddOptionReg(plvItem, TEXT("Prevent the user from sharing"), 1, DEFAULT_POL_NO_SHARING, REGVAL_POL_NO_SHARING, POLICIES_KEY);
  431. AddOptionReg(plvItem, TEXT("Disable sharing MS-DOS windows"), 1, DEFAULT_POL_NO_MSDOS_SHARING, REGVAL_POL_NO_MSDOS_SHARING, POLICIES_KEY);
  432. AddOptionReg(plvItem, TEXT("Disable sharing explorer windows"), 1, DEFAULT_POL_NO_EXPLORER_SHARING, REGVAL_POL_NO_EXPLORER_SHARING, POLICIES_KEY);
  433. AddOptionReg(plvItem, TEXT("Disable sharing the desktop"), 1, DEFAULT_POL_NO_DESKTOP_SHARING, REGVAL_POL_NO_DESKTOP_SHARING, POLICIES_KEY);
  434. AddOptionReg(plvItem, TEXT("Disable sharing in true color"), 1, DEFAULT_POL_NO_TRUECOLOR_SHARING, REGVAL_POL_NO_TRUECOLOR_SHARING, POLICIES_KEY);
  435. AddOptionReg(plvItem, TEXT("Prevent the user from allowing control"), 1, DEFAULT_POL_NO_ALLOW_CONTROL, REGVAL_POL_NO_ALLOW_CONTROL, POLICIES_KEY);
  436. AddOptionSection(plvItem, TEXT("____Options Dialog____"));
  437. AddOptionReg(plvItem, TEXT("Disable the 'General' page"), 1, DEFAULT_POL_NO_GENERALPAGE, REGVAL_POL_NO_GENERALPAGE, POLICIES_KEY);
  438. AddOptionReg(plvItem, TEXT("Disable the 'Advanced Calling' button"), 1, DEFAULT_POL_NO_ADVANCEDCALLING, REGVAL_POL_NO_ADVANCEDCALLING, POLICIES_KEY);
  439. AddOptionReg(plvItem, TEXT("Disable the 'Security' page"), 1, DEFAULT_POL_NO_SECURITYPAGE, REGVAL_POL_NO_SECURITYPAGE, POLICIES_KEY);
  440. AddOptionReg(plvItem, TEXT("Disable the 'Audio' page"), 1, DEFAULT_POL_NO_AUDIOPAGE, REGVAL_POL_NO_AUDIOPAGE, POLICIES_KEY);
  441. AddOptionReg(plvItem, TEXT("Disable the 'Video' page"), 1, DEFAULT_POL_NO_VIDEOPAGE, REGVAL_POL_NO_VIDEOPAGE, POLICIES_KEY);
  442. AddOptionSection(plvItem, TEXT("____Audio / NAC____"));
  443. AddOptionReg(plvItem, TEXT("No changing Direct Sound usage"), 1, 0, REGVAL_POL_NOCHANGE_DIRECTSOUND, POLICIES_KEY);
  444. AddOptionReg(plvItem, TEXT("Disable WinSock2"), 1, 0, REGVAL_DISABLE_WINSOCK2, NACOBJECT_KEY, HKEY_LOCAL_MACHINE);
  445. }
  446. VOID CDebugMenu::AddASOptions(LV_ITEM * plvItem)
  447. {
  448. AddOptionSection(plvItem, TEXT("____Application Sharing____"));
  449. AddOptionReg(plvItem, TEXT("Hatch Screen Data"), 1, 0, REGVAL_AS_HATCHSCREENDATA, AS_DEBUG_KEY, HKEY_LOCAL_MACHINE);
  450. AddOptionReg(plvItem, TEXT("Hatch Bitmap Orders"), 1, 0, REGVAL_AS_HATCHBMPORDERS, AS_DEBUG_KEY, HKEY_LOCAL_MACHINE);
  451. AddOptionCompress(plvItem, TEXT("Disable AS persist compression"), GCT_PERSIST_PKZIP, FALSE),
  452. AddOptionCompress(plvItem, TEXT("Disable AS compression"), GCT_PKZIP, FALSE);
  453. AddOptionReg(plvItem, TEXT("View own shared apps"), 1, 0, REGVAL_AS_VIEWSELF, AS_DEBUG_KEY, HKEY_LOCAL_MACHINE);
  454. AddOptionReg(plvItem, TEXT("No AS Flow Control"), 1, 0, REGVAL_AS_NOFLOWCONTROL, AS_DEBUG_KEY, HKEY_LOCAL_MACHINE);
  455. AddOptionReg(plvItem, TEXT("Disable OM compression"), 1, 0, REGVAL_OM_NOCOMPRESSION, AS_DEBUG_KEY, HKEY_LOCAL_MACHINE);
  456. }
  457. VOID CDebugMenu::AddUIOptions(LV_ITEM * plvItem)
  458. {
  459. AddOptionSection(plvItem, TEXT("____User Interface____"));
  460. AddOptionReg(plvItem, TEXT("Call Progress TopMost"), 1, DEFAULT_DBG_CALLTOP, REGVAL_DBG_CALLTOP, DEBUG_KEY, HKEY_LOCAL_MACHINE);
  461. AddOptionPdw(plvItem, TEXT("Display Frames Per Second"), 1, &g_fDisplayFPS);
  462. AddOptionPdw(plvItem, TEXT("Display View Status"), 1, &g_fDisplayViewStatus);
  463. AddOptionReg(plvItem, TEXT("Right to Left Layout"), 1, DEFAULT_DBG_RTL, REGVAL_DBG_RTL, DEBUG_KEY, HKEY_LOCAL_MACHINE);
  464. AddOptionReg(plvItem, TEXT("Fake CallTo"), 1, DEFAULT_DBG_FAKE_CALLTO, REGVAL_DBG_FAKE_CALLTO, DEBUG_KEY, HKEY_LOCAL_MACHINE);
  465. AddOptionSection(plvItem, TEXT("____Place a Call____"));
  466. AddOptionPdw(plvItem, TEXT("No ILS Filter"), nmDlgCallNoFilter, &g_dwPlaceCall);
  467. AddOptionPdw(plvItem, TEXT("No Server Edit"), nmDlgCallNoServerEdit,&g_dwPlaceCall);
  468. AddOptionPdw(plvItem, TEXT("No ILS View"), nmDlgCallNoIls, &g_dwPlaceCall);
  469. #if USE_GAL
  470. AddOptionPdw(plvItem, TEXT("No GAL View"), nmDlgCallNoGal, &g_dwPlaceCall);
  471. #endif // #if USE_GAL
  472. AddOptionPdw(plvItem, TEXT("No WAB View"), nmDlgCallNoWab, &g_dwPlaceCall);
  473. AddOptionPdw(plvItem, TEXT("No Speed Dial View"), nmDlgCallNoSpeedDial, &g_dwPlaceCall);
  474. AddOptionPdw(plvItem, TEXT("No History View"), nmDlgCallNoHistory, &g_dwPlaceCall);
  475. }
  476. /* T O G G L E O P T I O N */
  477. /*----------------------------------------------------------------------------
  478. %%Function: ToggleOption
  479. Toggle the checkbox for an option
  480. ----------------------------------------------------------------------------*/
  481. VOID CDebugMenu::ToggleOption(LV_ITEM * plvI)
  482. {
  483. UINT state = plvI->state & LVIS_STATEIMAGEMASK;
  484. if (0 == state)
  485. return; // nothing to toggle
  486. plvI->state &= ~LVIS_STATEIMAGEMASK;
  487. if (state == (UINT) INDEXTOSTATEIMAGEMASK(iDbgChecked))
  488. {
  489. ((CDebugOption *) (plvI->lParam))->m_bst = BST_UNCHECKED;
  490. plvI->state |= INDEXTOSTATEIMAGEMASK(iDbgUnchecked);
  491. }
  492. else
  493. {
  494. ((CDebugOption *) (plvI->lParam))->m_bst = BST_CHECKED;
  495. plvI->state |= INDEXTOSTATEIMAGEMASK(iDbgChecked);
  496. }
  497. if (!ListView_SetItem(m_hwndDbgopt, plvI))
  498. {
  499. ERROR_OUT(("error setting listview item info"));
  500. }
  501. }
  502. /* S A V E O P T I O N S D A T A */
  503. /*----------------------------------------------------------------------------
  504. %%Function: SaveOptionsData
  505. Save all of the data by calling the Update routine of each item
  506. ----------------------------------------------------------------------------*/
  507. BOOL CDebugMenu::SaveOptionsData(HWND hDlg)
  508. {
  509. LV_ITEM lvI;
  510. ZeroMemory(&lvI, sizeof(lvI));
  511. lvI.mask = LVIF_PARAM | LVIF_STATE;
  512. lvI.stateMask = LVIS_STATEIMAGEMASK;
  513. while (ListView_GetItem(m_hwndDbgopt, &lvI))
  514. {
  515. CDebugOption * pDbgOpt = (CDebugOption *) lvI.lParam;
  516. if (NULL != pDbgOpt)
  517. {
  518. pDbgOpt->Update();
  519. }
  520. lvI.iItem++;
  521. }
  522. return TRUE;
  523. }
  524. /* F R E E O P T I O N S D A T A */
  525. /*----------------------------------------------------------------------------
  526. %%Function: FreeOptionsData
  527. Free any allocated data associated with the options list
  528. ----------------------------------------------------------------------------*/
  529. VOID CDebugMenu::FreeOptionsData(HWND hDlg)
  530. {
  531. LV_ITEM lvI;
  532. ZeroMemory(&lvI, sizeof(lvI));
  533. // lvI.iItem = 0;
  534. // lvI.iSubItem = 0;
  535. lvI.mask = LVIF_PARAM | LVIF_STATE;
  536. lvI.stateMask = LVIS_STATEIMAGEMASK;
  537. while (ListView_GetItem(m_hwndDbgopt, &lvI))
  538. {
  539. CDebugOption * pDbgOpt = (CDebugOption *) lvI.lParam;
  540. if (NULL != pDbgOpt)
  541. {
  542. delete pDbgOpt;
  543. }
  544. lvI.iItem++;
  545. }
  546. }
  547. /* O N N O T I F Y D B G O P T */
  548. /*----------------------------------------------------------------------------
  549. %%Function: OnNotifyDbgopt
  550. Handle any notifications for the debug options dialog
  551. ----------------------------------------------------------------------------*/
  552. VOID CDebugMenu::OnNotifyDbgopt(LPARAM lParam)
  553. {
  554. NM_LISTVIEW FAR * lpnmlv = (NM_LISTVIEW FAR *)lParam;
  555. ASSERT(NULL != lpnmlv);
  556. switch (lpnmlv->hdr.code)
  557. {
  558. case LVN_KEYDOWN:
  559. {
  560. LV_ITEM lvI;
  561. LV_KEYDOWN * lplvkd = (LV_KEYDOWN *)lParam;
  562. if (lplvkd->wVKey == VK_SPACE)
  563. {
  564. ZeroMemory(&lvI, sizeof(lvI));
  565. lvI.iItem = ListView_GetNextItem(m_hwndDbgopt, -1, LVNI_FOCUSED|LVNI_SELECTED);
  566. // lvI.iSubItem = 0;
  567. lvI.mask = LVIF_PARAM | LVIF_STATE;
  568. lvI.stateMask = LVIS_STATEIMAGEMASK;
  569. if (ListView_GetItem(m_hwndDbgopt, &lvI))
  570. {
  571. ToggleOption(&lvI);
  572. }
  573. }
  574. break;
  575. }
  576. case NM_DBLCLK:
  577. case NM_CLICK:
  578. {
  579. LV_ITEM lvI;
  580. LV_HITTESTINFO lvH;
  581. int idx;
  582. ZeroMemory(&lvH, sizeof(lvH));
  583. GetCursorPos(&lvH.pt);
  584. ScreenToClient(m_hwndDbgopt, &lvH.pt);
  585. if ((NM_CLICK == lpnmlv->hdr.code) && ((UINT) lvH.pt.x) > 16)
  586. break;
  587. idx = ListView_HitTest(m_hwndDbgopt, &lvH);
  588. if (-1 == idx)
  589. break;
  590. ZeroMemory(&lvI, sizeof(lvI));
  591. lvI.iItem = idx;
  592. // lvI.iSubItem = 0;
  593. lvI.stateMask = LVIS_STATEIMAGEMASK;
  594. lvI.mask = LVIF_PARAM | LVIF_STATE;
  595. if (ListView_GetItem(m_hwndDbgopt, &lvI))
  596. {
  597. ToggleOption(&lvI);
  598. }
  599. break;
  600. }
  601. default:
  602. break;
  603. }
  604. }
  605. /* D L G O P T I O N S M S G */
  606. /*----------------------------------------------------------------------------
  607. %%Function: DlgOptionsMsg
  608. ----------------------------------------------------------------------------*/
  609. BOOL CDebugMenu::DlgOptionsMsg(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
  610. {
  611. switch (uMsg)
  612. {
  613. case WM_COMMAND:
  614. {
  615. switch (LOWORD(wParam))
  616. {
  617. case IDB_SHOWDBG:
  618. {
  619. ShowDbgView();
  620. return TRUE;
  621. }
  622. case IDOK:
  623. SaveOptionsData(hwnd);
  624. SetDebugOutputFlags(_dwDebugModuleFlags);
  625. SetDbgFlags();
  626. UpdateCrtDbgSettings();
  627. SaveNmDebugOptions();
  628. // fall thru to IDCANCEL
  629. case IDCANCEL:
  630. {
  631. FreeOptionsData(hwnd);
  632. EndDialog(hwnd, LOWORD(wParam));
  633. return TRUE;
  634. }
  635. default:
  636. break;
  637. } /* switch (wParam) */
  638. break;
  639. } /* WM_COMMAND */
  640. case WM_NOTIFY:
  641. if (IDL_DEBUG == wParam)
  642. OnNotifyDbgopt(lParam);
  643. break;
  644. default:
  645. break;
  646. } /* switch (uMsg) */
  647. return FALSE;
  648. }
  649. CDebugOption::CDebugOption()
  650. {
  651. }
  652. CDebugOption::CDebugOption(PTSTR psz, int bst)
  653. {
  654. m_psz = psz;
  655. m_bst = bst;
  656. }
  657. CDebugOption::~CDebugOption()
  658. {
  659. }
  660. VOID CDebugOption::Update(void)
  661. {
  662. }
  663. DBGOPTPDW::DBGOPTPDW(PTSTR psz, DWORD dwMask, DWORD * pdw)
  664. : CDebugOption(psz)
  665. {
  666. m_psz = psz;
  667. m_dwMask = dwMask;
  668. m_pdw =pdw;
  669. m_bst = IS_FLAG_SET(*m_pdw, m_dwMask) ? BST_CHECKED : BST_UNCHECKED;
  670. }
  671. void DBGOPTPDW::Update(void)
  672. {
  673. if (BST_CHECKED == m_bst)
  674. SET_FLAG(*m_pdw, m_dwMask);
  675. else if (BST_UNCHECKED == m_bst)
  676. CLEAR_FLAG(*m_pdw, m_dwMask);
  677. }
  678. DBGOPTREG::DBGOPTREG(PTSTR psz, DWORD dwMask, DWORD dwDefault,
  679. PTSTR pszEntry, PTSTR pszSubKey, HKEY hkey)
  680. : CDebugOption(psz)
  681. {
  682. m_psz = psz;
  683. m_dwMask = dwMask;
  684. m_dwDefault = dwDefault;
  685. m_pszEntry = pszEntry;
  686. m_pszSubKey = pszSubKey;
  687. m_hkey = hkey;
  688. RegEntry re(m_pszSubKey, m_hkey);
  689. DWORD dw = re.GetNumber(m_pszEntry, m_dwDefault);
  690. m_bst = IS_FLAG_SET(dw, m_dwMask) ? BST_CHECKED : BST_UNCHECKED;
  691. };
  692. DBGOPTREG::~DBGOPTREG()
  693. {
  694. }
  695. void DBGOPTREG::Update(void)
  696. {
  697. RegEntry re(m_pszSubKey, m_hkey);
  698. DWORD dw = re.GetNumber(m_pszEntry, m_dwDefault);
  699. if (BST_CHECKED == m_bst)
  700. SET_FLAG(dw, m_dwMask);
  701. else if (BST_UNCHECKED == m_bst)
  702. CLEAR_FLAG(dw, m_dwMask);
  703. re.SetValue(m_pszEntry, dw);
  704. }
  705. DBGOPTCOMPRESS::DBGOPTCOMPRESS(PTSTR psz, DWORD dwMask, BOOL bCheckedOn)
  706. : CDebugOption(psz)
  707. {
  708. m_psz = psz;
  709. m_total++; // count how many instances we are creating
  710. m_dwMask = dwMask;
  711. m_bCheckedOn = bCheckedOn;
  712. RegEntry re(m_pszSubKey, m_hkey);
  713. if (m_total == 1) // we only need to read the registry entry once
  714. m_dwCompression = re.GetNumber(m_pszEntry, m_dwDefault);
  715. if (m_bCheckedOn == TRUE) // check or uncheck the box depending on the semantics
  716. m_bst = IS_FLAG_SET(m_dwCompression, m_dwMask) ? BST_CHECKED : BST_UNCHECKED;
  717. else
  718. m_bst = IS_FLAG_SET(m_dwCompression, m_dwMask) ? BST_UNCHECKED : BST_CHECKED;
  719. }
  720. void DBGOPTCOMPRESS::Update(void)
  721. {
  722. m_count++; // count number of times this function has been executed
  723. if (m_bCheckedOn == TRUE)
  724. { // set or clear flag depending on semantics and whether the
  725. if (BST_CHECKED == m_bst) // user checked the option box
  726. SET_FLAG(m_dwCompression, m_dwMask);
  727. else if (BST_UNCHECKED == m_bst)
  728. CLEAR_FLAG(m_dwCompression, m_dwMask);
  729. }
  730. else
  731. {
  732. if (BST_CHECKED == m_bst)
  733. CLEAR_FLAG(m_dwCompression, m_dwMask);
  734. else if (BST_UNCHECKED == m_bst)
  735. SET_FLAG(m_dwCompression, m_dwMask);
  736. }
  737. if (m_count == m_total)
  738. { // if this is the last call, time to update the registry
  739. // If only GCT_PERSIST_PKZIP is set, then that means the user checked "Disable compression",
  740. // so set compression to GCT_NOCOMPRESSION
  741. if (GCT_PERSIST_PKZIP == m_dwCompression)
  742. m_dwCompression = GCT_NOCOMPRESSION;
  743. RegEntry re(m_pszSubKey, m_hkey);
  744. // If user has left everything at default, then simply delete the registry entry.
  745. if (m_dwCompression != GCT_DEFAULT)
  746. re.SetValue(m_pszEntry, m_dwCompression);
  747. else
  748. re.DeleteValue(m_pszEntry);
  749. }
  750. }
  751. /////////////////////////////////////////////////////////////////////////////
  752. // D I A L O G: Z O N E S
  753. /////////////////////////////////////////////////////////////////////////////
  754. VOID CDebugMenu::DbgChangeZones(VOID)
  755. {
  756. DialogBoxParam(GetInstanceHandle(), MAKEINTRESOURCE(IDD_DBG_OPTIONS),
  757. m_hwnd, CDebugMenu::DbgZonesDlgProc, (LPARAM) this);
  758. }
  759. INT_PTR CALLBACK CDebugMenu::DbgZonesDlgProc(HWND hDlg, UINT uMsg,
  760. WPARAM wParam, LPARAM lParam)
  761. {
  762. if (WM_INITDIALOG == uMsg)
  763. {
  764. if (NULL == lParam)
  765. return FALSE;
  766. SetWindowLongPtr(hDlg, DWLP_USER, lParam);
  767. ((CDebugMenu *) lParam)->InitOptionsDlg(hDlg);
  768. ((CDebugMenu *) lParam)->InitZonesData(hDlg);
  769. return TRUE;
  770. }
  771. CDebugMenu * ppd = (CDebugMenu*) GetWindowLongPtr(hDlg, DWLP_USER);
  772. if (NULL == ppd)
  773. return FALSE;
  774. return ppd->DlgZonesMsg(hDlg, uMsg, wParam, lParam);
  775. }
  776. BOOL CDebugMenu::DlgZonesMsg(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
  777. {
  778. switch (uMsg)
  779. {
  780. case WM_COMMAND:
  781. {
  782. switch (LOWORD(wParam))
  783. {
  784. case IDB_SHOWDBG:
  785. {
  786. ShowDbgView();
  787. return TRUE;
  788. }
  789. case IDOK:
  790. SaveOptionsData(hwnd);
  791. SaveZonesData();
  792. SetDbgFlags();
  793. // fall thru to IDCANCEL
  794. case IDCANCEL:
  795. {
  796. FreeOptionsData(hwnd);
  797. EndDialog(hwnd, LOWORD(wParam));
  798. return TRUE;
  799. }
  800. default:
  801. break;
  802. } /* switch (wParam) */
  803. break;
  804. } /* WM_COMMAND */
  805. case WM_NOTIFY:
  806. if (IDL_DEBUG == wParam)
  807. OnNotifyDbgopt(lParam);
  808. break;
  809. default:
  810. break;
  811. } /* switch (uMsg) */
  812. return FALSE;
  813. }
  814. VOID CDebugMenu::InitZonesData(HWND hDlg)
  815. {
  816. LV_ITEM lvI;
  817. // Fill in the LV_ITEM structure
  818. // The mask specifies the the .pszText, .iImage, .lParam and .state
  819. // members of the LV_ITEM structure are valid.
  820. ZeroMemory(&lvI, sizeof(lvI));
  821. lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE | LVIF_PARAM;
  822. lvI.stateMask = LVIS_STATEIMAGEMASK;
  823. lvI.cchTextMax = 256;
  824. AddZones(&lvI);
  825. SetWindowText(hDlg, TEXT("Debug Zone Settings"));
  826. }
  827. VOID CDebugMenu::AddZones(LV_ITEM * plvItem)
  828. {
  829. PDBGZONEINFO prgZones;
  830. PDBGZONEINFO pZone;
  831. UINT cModules;
  832. UINT iModule;
  833. UINT iZone;
  834. UINT cch;
  835. TCHAR sz[256];
  836. PTCHAR pch;
  837. if ((!NmDbgGetAllZoneParams(&prgZones, &cModules)) || (0 == cModules))
  838. return; // no zones?
  839. for (iModule = 0; iModule < cModules; iModule++)
  840. {
  841. pZone = &prgZones[iModule];
  842. AddOptionSection(plvItem, TEXT("----------------------------------------"));
  843. lstrcpy(sz, pZone->pszModule);
  844. cch = lstrlen(sz);
  845. if (0 == cch)
  846. continue;
  847. for (pch = sz + cch-1; _T(' ') == *pch; pch--)
  848. ;
  849. lstrcpy(++pch, TEXT(": "));
  850. pch += 2;
  851. for (iZone = 0; (iZone < MAXNUM_OF_ZONES) && (*(pZone->szZoneNames[iZone])); iZone++)
  852. {
  853. lstrcpy(pch, pZone->szZoneNames[iZone]);
  854. AddOptionPdw(plvItem, sz, 1 << iZone, &pZone->ulZoneMask);
  855. }
  856. }
  857. NmDbgFreeZoneParams(prgZones);
  858. }
  859. VOID CDebugMenu::SaveZonesData(VOID)
  860. {
  861. RegEntry reZones(ZONES_KEY, HKEY_LOCAL_MACHINE);
  862. PDBGZONEINFO prgZones;
  863. UINT cModules;
  864. UINT iModule;
  865. if ((!NmDbgGetAllZoneParams(&prgZones, &cModules)) || (0 == cModules))
  866. return; // no zones?
  867. for (iModule = 0; iModule < cModules; iModule++)
  868. {
  869. reZones.SetValue(prgZones[iModule].pszModule, prgZones[iModule].ulZoneMask);
  870. }
  871. NmDbgFreeZoneParams(prgZones);
  872. }
  873. /////////////////////////////////////////////////////////////////////////////
  874. // D I A L O G: S Y S P O L I C Y
  875. /////////////////////////////////////////////////////////////////////////////
  876. VOID CDebugMenu::DbgSysPolicy(VOID)
  877. {
  878. DialogBoxParam(GetInstanceHandle(), MAKEINTRESOURCE(IDD_DBG_OPTIONS),
  879. m_hwnd, CDebugMenu::DbgPolicyDlgProc, (LPARAM) this);
  880. }
  881. INT_PTR CALLBACK CDebugMenu::DbgPolicyDlgProc(HWND hDlg, UINT uMsg,
  882. WPARAM wParam, LPARAM lParam)
  883. {
  884. if (WM_INITDIALOG == uMsg)
  885. {
  886. if (NULL == lParam)
  887. return FALSE;
  888. SetWindowLongPtr(hDlg, DWLP_USER, lParam);
  889. ((CDebugMenu *) lParam)->InitOptionsDlg(hDlg);
  890. ((CDebugMenu *) lParam)->InitPolicyData(hDlg);
  891. return TRUE;
  892. }
  893. CDebugMenu * ppd = (CDebugMenu*) GetWindowLongPtr(hDlg, DWLP_USER);
  894. if (NULL == ppd)
  895. return FALSE;
  896. return ppd->DlgPolicyMsg(hDlg, uMsg, wParam, lParam);
  897. }
  898. BOOL CDebugMenu::DlgPolicyMsg(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
  899. {
  900. switch (uMsg)
  901. {
  902. case WM_COMMAND:
  903. {
  904. switch (LOWORD(wParam))
  905. {
  906. case IDOK:
  907. SaveOptionsData(hwnd);
  908. // fall thru to IDCANCEL
  909. case IDCANCEL:
  910. FreeOptionsData(hwnd);
  911. EndDialog(hwnd, LOWORD(wParam));
  912. return TRUE;
  913. default:
  914. break;
  915. } /* switch (wParam) */
  916. break;
  917. } /* WM_COMMAND */
  918. case WM_NOTIFY:
  919. if (IDL_DEBUG == wParam)
  920. OnNotifyDbgopt(lParam);
  921. break;
  922. default:
  923. break;
  924. } /* switch (uMsg) */
  925. return FALSE;
  926. }
  927. VOID CDebugMenu::InitPolicyData(HWND hDlg)
  928. {
  929. LV_ITEM lvI;
  930. ZeroMemory(&lvI, sizeof(lvI));
  931. lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE | LVIF_PARAM;
  932. lvI.stateMask = LVIS_STATEIMAGEMASK;
  933. lvI.cchTextMax = 256;
  934. AddPolicyOptions(&lvI);
  935. ShowWindow(GetDlgItem(hDlg, IDB_SHOWDBG), SW_HIDE);
  936. SetWindowText(hDlg, TEXT("System Policies"));
  937. }
  938. /////////////////////////////////////////////////////////////////////////////
  939. // D I A L O G: U S E R I N T E R F A C E
  940. /////////////////////////////////////////////////////////////////////////////
  941. VOID CDebugMenu::DbgUI(VOID)
  942. {
  943. DialogBoxParam(GetInstanceHandle(), MAKEINTRESOURCE(IDD_DBG_OPTIONS),
  944. m_hwnd, CDebugMenu::DbgUIDlgProc, (LPARAM) this);
  945. }
  946. INT_PTR CALLBACK CDebugMenu::DbgUIDlgProc(HWND hDlg, UINT uMsg,
  947. WPARAM wParam, LPARAM lParam)
  948. {
  949. if (WM_INITDIALOG == uMsg)
  950. {
  951. if (NULL == lParam)
  952. return FALSE;
  953. SetWindowLongPtr(hDlg, DWLP_USER, lParam);
  954. ((CDebugMenu *) lParam)->InitOptionsDlg(hDlg);
  955. ((CDebugMenu *) lParam)->InitUIData(hDlg);
  956. return TRUE;
  957. }
  958. CDebugMenu * ppd = (CDebugMenu*) GetWindowLongPtr(hDlg, DWLP_USER);
  959. if (NULL == ppd)
  960. return FALSE;
  961. return ppd->DlgPolicyMsg(hDlg, uMsg, wParam, lParam);
  962. }
  963. VOID CDebugMenu::InitUIData(HWND hDlg)
  964. {
  965. LV_ITEM lvI;
  966. ZeroMemory(&lvI, sizeof(lvI));
  967. lvI.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE | LVIF_PARAM;
  968. lvI.stateMask = LVIS_STATEIMAGEMASK;
  969. lvI.cchTextMax = 256;
  970. AddUIOptions(&lvI);
  971. ShowWindow(GetDlgItem(hDlg, IDB_SHOWDBG), SW_HIDE);
  972. SetWindowText(hDlg, TEXT("User Interface"));
  973. }
  974. /////////////////////////////////////////////////////////////////////////////
  975. // D I A L O G: V E R S I O N
  976. /////////////////////////////////////////////////////////////////////////////
  977. /****************************************************************************
  978. *
  979. * CLASS: CDebugMenu
  980. *
  981. * MEMBER: DbgVersion()
  982. *
  983. * PURPOSE: Brings up the debug options dialog box
  984. *
  985. ****************************************************************************/
  986. VOID CDebugMenu::DbgVersion(VOID)
  987. {
  988. if (SUCCEEDED(DLLVER::Init()))
  989. {
  990. DialogBoxParam(GetInstanceHandle(), MAKEINTRESOURCE(IDD_DBG_VERSION),
  991. m_hwnd, CDebugMenu::DbgVersionDlgProc, (LPARAM) this);
  992. }
  993. }
  994. /****************************************************************************
  995. *
  996. * CLASS: CDebugMenu
  997. *
  998. * MEMBER: DbgVersionDlgProc()
  999. *
  1000. * PURPOSE: Dialog Proc for version information
  1001. *
  1002. ****************************************************************************/
  1003. INT_PTR CALLBACK CDebugMenu::DbgVersionDlgProc(HWND hDlg, UINT uMsg,
  1004. WPARAM wParam, LPARAM lParam)
  1005. {
  1006. if (WM_INITDIALOG == uMsg)
  1007. {
  1008. if (NULL == lParam)
  1009. return FALSE;
  1010. SetWindowLongPtr(hDlg, DWLP_USER, lParam);
  1011. ((CDebugMenu *) lParam)->InitVerDlg(hDlg);
  1012. return TRUE;
  1013. }
  1014. CDebugMenu * ppd = (CDebugMenu*) GetWindowLongPtr(hDlg, DWLP_USER);
  1015. if (NULL == ppd)
  1016. return FALSE;
  1017. return ppd->DlgVersionMsg(hDlg, uMsg, wParam, lParam);
  1018. }
  1019. /****************************************************************************
  1020. *
  1021. * CLASS: CDebugMenu
  1022. *
  1023. * MEMBER: DlgVersionMsg()
  1024. *
  1025. * PURPOSE: processes all messages except WM_INITDIALOG
  1026. *
  1027. ****************************************************************************/
  1028. BOOL CDebugMenu::DlgVersionMsg(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
  1029. {
  1030. switch (uMsg)
  1031. {
  1032. case WM_COMMAND:
  1033. {
  1034. switch (LOWORD(wParam))
  1035. {
  1036. case IDC_DBG_VER_OPRAH:
  1037. case IDC_DBG_VER_AUDIO:
  1038. case IDC_DBG_VER_WINDOWS:
  1039. FillVerList(hwnd);
  1040. return TRUE;
  1041. case IDOK:
  1042. case IDCANCEL:
  1043. {
  1044. EndDialog(hwnd, LOWORD(wParam));
  1045. return TRUE;
  1046. }
  1047. default:
  1048. break;
  1049. } /* switch (wParam) */
  1050. break;
  1051. } /* WM_COMMAND */
  1052. #ifdef NOTUSED
  1053. case WM_NOTIFY:
  1054. {
  1055. if (IDL_DBG_VERINFO != wParam)
  1056. break;
  1057. NM_LISTVIEW * pnmv = (NM_LISTVIEW *) lParam;
  1058. if (pnmv->hdr.code == LVN_COLUMNCLICK)
  1059. {
  1060. ASSERT(pnmv->hdr.hwndFrom == GetDlgItem(hwnd, IDL_DBG_VERINFO));
  1061. SortVerList(pnmv->hdr.hwndFrom, pnmv->iSubItem);
  1062. }
  1063. break;
  1064. }
  1065. #endif /* NOTUSED */
  1066. default:
  1067. break;
  1068. } /* switch (uMsg) */
  1069. return FALSE;
  1070. }
  1071. /* I N I T V E R D L G */
  1072. /*----------------------------------------------------------------------------
  1073. %%Function: InitVerDlg
  1074. ----------------------------------------------------------------------------*/
  1075. BOOL CDebugMenu::InitVerDlg(HWND hDlg)
  1076. {
  1077. LV_COLUMN lvc;
  1078. int iCol;
  1079. HWND hwnd;
  1080. ASSERT(NULL != hDlg);
  1081. hwnd = GetDlgItem(hDlg, IDL_DBG_VERINFO);
  1082. ListView_SetExtendedListViewStyle(hwnd, LVS_EX_FULLROWSELECT);
  1083. for (int i = 0; i < ARRAY_ELEMENTS(_rgModules); i++)
  1084. CheckDlgButton(hDlg, _rgModules[i].id , _rgModules[i].fShow);
  1085. // Set up columns
  1086. ZeroMemory(&lvc, sizeof(lvc));
  1087. lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
  1088. for (iCol = 0; iCol < cVerInfo; iCol++)
  1089. {
  1090. lvc.iSubItem = iCol;
  1091. lvc.pszText = _rgVerTitle[iCol];
  1092. lvc.cx = _rgVerWidth[iCol];
  1093. lvc.fmt = (iCol == 1) ? LVCFMT_RIGHT : LVCFMT_LEFT;
  1094. ListView_InsertColumn(hwnd, iCol, &lvc);
  1095. }
  1096. return FillVerList(hDlg);
  1097. }
  1098. /* F I L L V E R L I S T */
  1099. /*----------------------------------------------------------------------------
  1100. %%Function: FillVerList
  1101. ----------------------------------------------------------------------------*/
  1102. BOOL CDebugMenu::FillVerList(HWND hDlg)
  1103. {
  1104. HWND hwnd;
  1105. ASSERT(NULL != hDlg);
  1106. hwnd = GetDlgItem(hDlg, IDL_DBG_VERINFO);
  1107. ghwndVerList = hwnd;
  1108. ListView_DeleteAllItems(hwnd);
  1109. for (int i = 0; i < ARRAY_ELEMENTS(_rgModules); i++)
  1110. {
  1111. _rgModules[i].fShow = IsDlgButtonChecked(hDlg, _rgModules[i].id);
  1112. if (_rgModules[i].fShow)
  1113. ShowVerInfo(hwnd, _rgModules[i].rgsz, _rgModules[i].cFiles);
  1114. }
  1115. return TRUE;
  1116. }
  1117. /* S H O W V E R I N F O */
  1118. /*----------------------------------------------------------------------------
  1119. %%Function: ShowVerInfo
  1120. ----------------------------------------------------------------------------*/
  1121. VOID CDebugMenu::ShowVerInfo(HWND hwnd, LPTSTR * rgsz, int cFiles)
  1122. {
  1123. int iCol;
  1124. int iPos;
  1125. DWORD dw;
  1126. DWORD dwSize;
  1127. UINT cbBytes;
  1128. TCHAR rgch[2048]; // a really big buffer;
  1129. TCHAR szField[256];
  1130. TCHAR szDir[MAX_PATH];
  1131. LPTSTR lpszVerIntl;
  1132. LPTSTR lpsz;
  1133. LV_ITEM lvItem;
  1134. HANDLE hFind;
  1135. WIN32_FIND_DATA findData;
  1136. SYSTEMTIME sysTime;
  1137. // Get and set data for each line
  1138. ZeroMemory(&lvItem, sizeof(lvItem));
  1139. lvItem.mask = LVIF_TEXT;
  1140. lvItem.iItem = ListView_GetItemCount(hwnd);
  1141. ListView_SetItemCount(hwnd, lvItem.iItem + cFiles);
  1142. GetInstallDirectory(szDir);
  1143. for (int i = 0; i < cFiles; i++, lvItem.iItem++)
  1144. {
  1145. lvItem.pszText = rgsz[i];
  1146. lvItem.cchTextMax = lstrlen(lvItem.pszText);
  1147. lvItem.lParam = lvItem.iItem;
  1148. iPos = ListView_InsertItem(hwnd, &lvItem);
  1149. // Find file and get attributes (size and creation date)
  1150. wsprintf(rgch, TEXT("%s%s"), szDir, lvItem.pszText);
  1151. hFind = FindFirstFile(rgch, &findData);
  1152. if (INVALID_HANDLE_VALUE == hFind)
  1153. {
  1154. GetSystemDirectory(rgch, sizeof(rgch));
  1155. lstrcat(rgch, TEXT("\\"));
  1156. lstrcat(rgch, lvItem.pszText);
  1157. hFind = FindFirstFile(rgch, &findData);
  1158. }
  1159. if (INVALID_HANDLE_VALUE == hFind)
  1160. {
  1161. ZeroMemory(&findData, sizeof(findData));
  1162. ListView_SetItemText(hwnd, iPos, 1, TEXT("-"));
  1163. ListView_SetItemText(hwnd, iPos, 2, TEXT("-"));
  1164. }
  1165. else
  1166. {
  1167. FindClose(hFind);
  1168. wsprintf(szField, TEXT("%d"), findData.nFileSizeLow);
  1169. ListView_SetItemText(hwnd, iPos, 1, szField);
  1170. FileTimeToSystemTime(&findData.ftLastWriteTime, &sysTime);
  1171. wsprintf(szField, TEXT("%d/%02d/%02d"), sysTime.wYear, sysTime.wMonth, sysTime.wDay);
  1172. ListView_SetItemText(hwnd, iPos, 2, szField);
  1173. }
  1174. // Get version information
  1175. dwSize = DLLVER::GetFileVersionInfoSize(lvItem.pszText, &dw);
  1176. if ((0 == dwSize) || (sizeof(rgch) < dwSize) ||
  1177. !DLLVER::GetFileVersionInfo(lvItem.pszText, dw, dwSize, rgch))
  1178. {
  1179. continue;
  1180. }
  1181. // attempt to determine intl version ("040904E4" or "040904B0")
  1182. wsprintf(szField, _szVerFormat, _szStringFileInfo, _szVerIntlUSA, _rgszVerInfo[VERSION_INDEX]);
  1183. if (DLLVER::VerQueryValue(rgch, szField, (LPVOID *) &lpsz, &cbBytes))
  1184. lpszVerIntl = _szVerIntlUSA;
  1185. else
  1186. lpszVerIntl = _szVerIntlAlt;
  1187. // FUTURE display the language/code page info
  1188. for (iCol = 3; iCol < cVerInfo; iCol++)
  1189. {
  1190. wsprintf(szField, _szVerFormat, _szStringFileInfo, lpszVerIntl, _rgszVerInfo[iCol]);
  1191. if (!DLLVER::VerQueryValue(rgch, szField, (LPVOID *) &lpsz, &cbBytes))
  1192. lpsz = TEXT("-");
  1193. ListView_SetItemText(hwnd, iPos, iCol, lpsz);
  1194. }
  1195. }
  1196. }
  1197. /////////////////////////////////////////////////////////////////////////////
  1198. // D I A L O G: M E M B E R
  1199. /////////////////////////////////////////////////////////////////////////////
  1200. static DWSTR _rgColMember[] = {
  1201. 80, TEXT("Name"),
  1202. 30, TEXT("Ver"),
  1203. 65, TEXT("GccId"),
  1204. 65, TEXT("Parent"),
  1205. 60, TEXT("Flags"),
  1206. 40, TEXT("Send"),
  1207. 40, TEXT("Recv"),
  1208. 45, TEXT("Using"),
  1209. 90, TEXT("IP"),
  1210. 80, TEXT("Email"),
  1211. 120, TEXT("ULS"),
  1212. };
  1213. enum {
  1214. ICOL_PART_NAME = 0,
  1215. ICOL_PART_VER,
  1216. ICOL_PART_GCCID,
  1217. ICOL_PART_PARENT,
  1218. ICOL_PART_FLAGS,
  1219. ICOL_PART_CAPS_SEND,
  1220. ICOL_PART_CAPS_RECV,
  1221. ICOL_PART_CAPS_INUSE,
  1222. ICOL_PART_IP,
  1223. ICOL_PART_EMAIL,
  1224. ICOL_PART_ULS,
  1225. };
  1226. VOID CDebugMenu::DbgMemberInfo(VOID)
  1227. {
  1228. DialogBoxParam(GetInstanceHandle(), MAKEINTRESOURCE(IDD_DBG_LIST),
  1229. m_hwnd, CDebugMenu::DbgListDlgProc, (LPARAM) this);
  1230. }
  1231. VOID CDebugMenu::InitMemberDlg(HWND hDlg)
  1232. {
  1233. LV_COLUMN lvc;
  1234. int iCol;
  1235. HWND hwnd;
  1236. ASSERT(NULL != hDlg);
  1237. hwnd = GetDlgItem(hDlg, IDL_DBG_LIST);
  1238. ListView_SetExtendedListViewStyle(hwnd, LVS_EX_FULLROWSELECT);
  1239. // Set up columns
  1240. ZeroMemory(&lvc, sizeof(lvc));
  1241. lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
  1242. for (iCol = 0; iCol < ARRAY_ELEMENTS(_rgColMember); iCol++)
  1243. {
  1244. lvc.iSubItem = iCol;
  1245. lvc.pszText = _rgColMember[iCol].psz;
  1246. lvc.cx = _rgColMember[iCol].dw;
  1247. ListView_InsertColumn(hwnd, iCol, &lvc);
  1248. }
  1249. FillMemberList(hDlg);
  1250. SetWindowText(hDlg, TEXT("Member Information"));
  1251. }
  1252. VOID CDebugMenu::FillMemberList(HWND hDlg)
  1253. {
  1254. HWND hwnd;
  1255. ASSERT(NULL != hDlg);
  1256. hwnd = GetDlgItem(hDlg, IDL_DBG_LIST);
  1257. ListView_DeleteAllItems(hwnd);
  1258. CConfRoom * pcr = ::GetConfRoom();
  1259. if (NULL == pcr)
  1260. return;
  1261. CSimpleArray<CParticipant*>& rMemberList = pcr->GetParticipantList();
  1262. for( int i = 0; i < rMemberList.GetSize(); ++i )
  1263. {
  1264. ASSERT( rMemberList[i] );
  1265. ShowMemberInfo( hwnd, rMemberList[i] );
  1266. }
  1267. }
  1268. VOID CDebugMenu::ShowMemberInfo(HWND hwnd, CParticipant * pPart)
  1269. {
  1270. HRESULT hr;
  1271. ULONG ul;
  1272. int iPos;
  1273. LV_ITEM lvItem;
  1274. TCHAR sz[MAX_PATH];
  1275. if (NULL == pPart)
  1276. return;
  1277. // Get and set data for each line
  1278. ZeroMemory(&lvItem, sizeof(lvItem));
  1279. lvItem.mask = LVIF_TEXT;
  1280. lvItem.pszText = pPart->GetPszName();
  1281. lvItem.cchTextMax = lstrlen(lvItem.pszText);
  1282. lvItem.lParam = (LPARAM) pPart;
  1283. iPos = ListView_InsertItem(hwnd, &lvItem);
  1284. wsprintf(sz, TEXT("%08X"), pPart->GetGccId());
  1285. ListView_SetItemText(hwnd, iPos, ICOL_PART_GCCID, sz);
  1286. INmMember * pMember = pPart->GetINmMember();
  1287. if (NULL != pMember)
  1288. {
  1289. hr = pMember->GetNmVersion(&ul);
  1290. wsprintf(sz, "%d", ul);
  1291. ListView_SetItemText(hwnd, iPos, ICOL_PART_VER, sz);
  1292. wsprintf(sz, TEXT("%08X"), ((CNmMember *) pMember)->GetGccIdParent());
  1293. ListView_SetItemText(hwnd, iPos, ICOL_PART_PARENT, sz);
  1294. }
  1295. lstrcpy(sz, TEXT("?"));
  1296. hr = pPart->GetIpAddr(sz, CCHMAX(sz));
  1297. ListView_SetItemText(hwnd, iPos, ICOL_PART_IP, sz);
  1298. lstrcpy(sz, TEXT("?"));
  1299. hr = pPart->GetUlsAddr(sz, CCHMAX(sz));
  1300. ListView_SetItemText(hwnd, iPos, ICOL_PART_ULS, sz);
  1301. lstrcpy(sz, TEXT("?"));
  1302. hr = pPart->GetEmailAddr(sz, CCHMAX(sz));
  1303. ListView_SetItemText(hwnd, iPos, ICOL_PART_EMAIL, sz);
  1304. DWORD dwFlags = pPart->GetDwFlags();
  1305. wsprintf(sz, TEXT("%s%s%s%s %s%s%s"),
  1306. dwFlags & PF_T120 ? "D" : "",
  1307. dwFlags & PF_H323 ? "H" : "",
  1308. dwFlags & PF_MEDIA_AUDIO ? "A" : "",
  1309. dwFlags & PF_MEDIA_VIDEO ? "V" : "",
  1310. pPart->FLocal() ? "L" : "",
  1311. pPart->FMcu() ? "M" : "",
  1312. dwFlags & PF_T120_TOP_PROV ? "T" : "");
  1313. ListView_SetItemText(hwnd, iPos, ICOL_PART_FLAGS, sz);
  1314. DWORD uCaps = pPart->GetDwCaps();
  1315. wsprintf(sz, TEXT("%s%s"),
  1316. uCaps & CAPFLAG_SEND_AUDIO ? "A" : "",
  1317. uCaps & CAPFLAG_SEND_VIDEO ? "V" : "");
  1318. ListView_SetItemText(hwnd, iPos, ICOL_PART_CAPS_SEND, sz);
  1319. wsprintf(sz, TEXT("%s%s"),
  1320. uCaps & CAPFLAG_RECV_AUDIO ? "A" : "",
  1321. uCaps & CAPFLAG_RECV_VIDEO ? "V" : "");
  1322. ListView_SetItemText(hwnd, iPos, ICOL_PART_CAPS_RECV, sz);
  1323. wsprintf(sz, TEXT("%s%s%s%s"),
  1324. uCaps & CAPFLAG_DATA_IN_USE ? "D" : "",
  1325. uCaps & CAPFLAG_AUDIO_IN_USE ? "A" : "",
  1326. uCaps & CAPFLAG_VIDEO_IN_USE ? "V" : "",
  1327. uCaps & CAPFLAG_H323_IN_USE ? "H" : "");
  1328. ListView_SetItemText(hwnd, iPos, ICOL_PART_CAPS_INUSE, sz);
  1329. if (pPart->FLocal())
  1330. {
  1331. ListView_SetItemState(hwnd, iPos, LVIS_FOCUSED | LVIS_SELECTED, 0x000F);
  1332. }
  1333. }
  1334. INT_PTR CALLBACK CDebugMenu::DbgListDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
  1335. {
  1336. if (WM_INITDIALOG == uMsg)
  1337. {
  1338. if (NULL == lParam)
  1339. return FALSE;
  1340. SetWindowLongPtr(hDlg, DWLP_USER, lParam);
  1341. ((CDebugMenu *) lParam)->InitMemberDlg(hDlg);
  1342. return TRUE;
  1343. }
  1344. CDebugMenu * ppd = (CDebugMenu*) GetWindowLongPtr(hDlg, DWLP_USER);
  1345. if (NULL == ppd)
  1346. return FALSE;
  1347. switch (uMsg)
  1348. {
  1349. case WM_COMMAND:
  1350. {
  1351. switch (LOWORD(wParam))
  1352. {
  1353. case IDOK:
  1354. case IDCANCEL:
  1355. {
  1356. EndDialog(hDlg, LOWORD(wParam));
  1357. return TRUE;
  1358. }
  1359. default:
  1360. break;
  1361. } /* switch (wParam) */
  1362. break;
  1363. } /* WM_COMMAND */
  1364. default:
  1365. break;
  1366. } /* switch (uMsg) */
  1367. return FALSE;
  1368. }
  1369. /////////////////////////////////////////////////////////////////////////////
  1370. // O T H E R F U N C T I O N S
  1371. /////////////////////////////////////////////////////////////////////////////
  1372. /* D B G W I Z A R D */
  1373. /*-------------------------------------------------------------------------
  1374. %%Function: DbgWizard
  1375. -------------------------------------------------------------------------*/
  1376. VOID DbgWizard(BOOL fVisible)
  1377. {
  1378. LONG lSoundCaps = SOUNDCARD_NONE;
  1379. HRESULT hr = StartRunOnceWizard(&lSoundCaps, TRUE, fVisible);
  1380. TRACE_OUT(("StartRunOnceWizard result=%08X", hr));
  1381. }
  1382. #if defined (_M_IX86)
  1383. #define _DbgBreak() __asm { int 3 }
  1384. #else
  1385. #define _DbgBreak() DebugBreak()
  1386. #endif
  1387. VOID DbgBreak(void)
  1388. {
  1389. // Break into the debugger
  1390. _DbgBreak();
  1391. }
  1392. /////////////////////////////////////////////////////////////////////////////
  1393. // T E S T F U N C T I O N S
  1394. /////////////////////////////////////////////////////////////////////////////
  1395. #include "splash.h"
  1396. VOID DbgSplash(HWND hwnd)
  1397. {
  1398. if (NULL == g_pSplashScreen)
  1399. {
  1400. StartSplashScreen(hwnd);
  1401. }
  1402. else
  1403. {
  1404. StopSplashScreen();
  1405. }
  1406. }
  1407. VOID DbgTest2(void)
  1408. {
  1409. TRACE_OUT(("Test 2 complete"));
  1410. }
  1411. VOID DbgTest3(void)
  1412. {
  1413. TRACE_OUT(("Test 3 complete"));
  1414. }
  1415. /////////////////////////////////////////////////////////////////////////////
  1416. //
  1417. /////////////////////////////////////////////////////////////////////////////
  1418. BOOL _FEnsureDbgMenu(void)
  1419. {
  1420. if (NULL != g_pDbgMenu)
  1421. return TRUE;
  1422. g_pDbgMenu = new CDebugMenu;
  1423. return (NULL != g_pDbgMenu);
  1424. }
  1425. VOID FreeDbgMenu(void)
  1426. {
  1427. delete g_pDbgMenu;
  1428. g_pDbgMenu = NULL;
  1429. }
  1430. VOID InitDbgMenu(HWND hwnd)
  1431. {
  1432. if (_FEnsureDbgMenu())
  1433. g_pDbgMenu->InitDebugMenu(hwnd);
  1434. }
  1435. BOOL OnDebugCommand(WPARAM wCmd)
  1436. {
  1437. if (!_FEnsureDbgMenu())
  1438. return FALSE;
  1439. return g_pDbgMenu->OnDebugCommand(wCmd);
  1440. }
  1441. /////////////////////////////////////////////////////////////////////////////
  1442. //
  1443. /////////////////////////////////////////////////////////////////////////////
  1444. VOID DbgGetComments(LPTSTR psz)
  1445. {
  1446. // NetMeeting version
  1447. lstrcpy(psz, "NM3." VERSIONBUILD_STR);
  1448. // OS version
  1449. if (IsWindowsNT())
  1450. {
  1451. RegEntry re(WINDOWS_NT_KEY, HKEY_LOCAL_MACHINE);
  1452. LPTSTR pszVer = re.GetString("CurrentVersion");
  1453. if (0 == lstrcmp(pszVer, "4.0"))
  1454. {
  1455. lstrcat(psz, ", NT4 ");
  1456. }
  1457. else if (0 == lstrcmp(pszVer, "5.0"))
  1458. {
  1459. lstrcat(psz, ", NT5 ");
  1460. }
  1461. else
  1462. {
  1463. lstrcat(psz, ", NT ");
  1464. lstrcat(psz, pszVer);
  1465. }
  1466. pszVer = re.GetString("CSDVersion");
  1467. if (!FEmptySz(pszVer))
  1468. {
  1469. if (0 == lstrcmp(pszVer, "Service Pack 3"))
  1470. lstrcat(psz, "SP-3");
  1471. else
  1472. lstrcat(psz, pszVer);
  1473. }
  1474. }
  1475. else
  1476. {
  1477. RegEntry re(WINDOWS_KEY, HKEY_LOCAL_MACHINE);
  1478. LPTSTR pszVer = re.GetString("Version");
  1479. if (0 == lstrcmp(pszVer, "Windows 95"))
  1480. {
  1481. lstrcat(psz, ", Win95");
  1482. }
  1483. else if (0 == lstrcmp(pszVer, "Windows 98"))
  1484. {
  1485. lstrcat(psz, ", Win98");
  1486. }
  1487. else if (NULL != pszVer)
  1488. {
  1489. lstrcat(psz, ", ");
  1490. lstrcat(psz, pszVer);
  1491. }
  1492. }
  1493. // Internet Explorer version
  1494. {
  1495. RegEntry re(TEXT("Software\\Microsoft\\Internet Explorer"), HKEY_LOCAL_MACHINE);
  1496. lstrcat(psz, ", IE");
  1497. lstrcat(psz, re.GetString("Version"));
  1498. }
  1499. }
  1500. /////////////////////////////////////////////////////////////////////////////
  1501. #define STRING_CASE(val) case val: pcsz = #val; break
  1502. LPCTSTR PszLastError(void)
  1503. {
  1504. static TCHAR _szErr[MAX_PATH];
  1505. DWORD dwErr = GetLastError();
  1506. if (0 == FormatMessage(
  1507. FORMAT_MESSAGE_FROM_SYSTEM, // source and processing options
  1508. NULL, // pointer to message source
  1509. dwErr, // requested message identifier
  1510. 0, // language identifier for requested message
  1511. _szErr, // pointer to message buffer
  1512. CCHMAX(_szErr), // maximum size of message buffer
  1513. NULL)) // address of array of message inserts
  1514. {
  1515. wsprintf(_szErr, TEXT("0x%08X (%d)"), dwErr, dwErr);
  1516. }
  1517. return _szErr;
  1518. }
  1519. LPCTSTR PszWSALastError(void)
  1520. {
  1521. LPCTSTR pcsz;
  1522. DWORD dwErr = WSAGetLastError();
  1523. switch (dwErr)
  1524. {
  1525. STRING_CASE(WSAEWOULDBLOCK);
  1526. STRING_CASE(WSAEINPROGRESS);
  1527. STRING_CASE(HOST_NOT_FOUND);
  1528. STRING_CASE(WSATRY_AGAIN);
  1529. STRING_CASE(WSANO_RECOVERY);
  1530. STRING_CASE(WSANO_DATA);
  1531. default:
  1532. {
  1533. static TCHAR _szErr[MAX_PATH];
  1534. wsprintf(_szErr, TEXT("0x%08X (%d)"), dwErr, dwErr);
  1535. pcsz = _szErr;
  1536. break;
  1537. }
  1538. }
  1539. return pcsz;
  1540. }
  1541. /* P S Z H R E S U L T */
  1542. /*-------------------------------------------------------------------------
  1543. %%Function: PszHResult
  1544. -------------------------------------------------------------------------*/
  1545. LPCTSTR PszHResult(HRESULT hr)
  1546. {
  1547. LPCSTR pcsz;
  1548. switch (hr)
  1549. {
  1550. // Common HResults
  1551. STRING_CASE(S_OK);
  1552. STRING_CASE(S_FALSE);
  1553. STRING_CASE(E_FAIL);
  1554. STRING_CASE(E_OUTOFMEMORY);
  1555. // NM COM API 2.0
  1556. STRING_CASE(NM_S_NEXT_CONFERENCE);
  1557. STRING_CASE(NM_S_ON_RESTART);
  1558. STRING_CASE(NM_CALLERR_NOT_INITIALIZED);
  1559. STRING_CASE(NM_CALLERR_MEDIA);
  1560. STRING_CASE(NM_CALLERR_NAME_RESOLUTION);
  1561. STRING_CASE(NM_CALLERR_PASSWORD);
  1562. STRING_CASE(NM_CALLERR_CONFERENCE_NAME);
  1563. STRING_CASE(NM_CALLERR_IN_CONFERENCE);
  1564. STRING_CASE(NM_CALLERR_NOT_FOUND);
  1565. STRING_CASE(NM_CALLERR_MCU);
  1566. STRING_CASE(NM_CALLERR_REJECTED);
  1567. STRING_CASE(NM_CALLERR_AUDIO);
  1568. STRING_CASE(NM_CALLERR_AUDIO_LOCAL);
  1569. STRING_CASE(NM_CALLERR_AUDIO_REMOTE);
  1570. STRING_CASE(NM_CALLERR_UNKNOWN);
  1571. STRING_CASE(NM_E_NOT_INITIALIZED);
  1572. STRING_CASE(NM_E_CHANNEL_ALREADY_EXISTS);
  1573. STRING_CASE(NM_E_NO_T120_CONFERENCE);
  1574. STRING_CASE(NM_E_NOT_ACTIVE);
  1575. // NM COM API 3.0
  1576. STRING_CASE(NM_CALLERR_LOOPBACK);
  1577. default:
  1578. pcsz = GetHRESULTString(hr);
  1579. break;
  1580. }
  1581. return pcsz;
  1582. }
  1583. /////////////////////////////////////////////////////////////////////////////
  1584. /* I N I T N M D E B U G O P T I O N S */
  1585. /*-------------------------------------------------------------------------
  1586. %%Function: InitNmDebugOptions
  1587. Initialize NetMeeting UI-specific debug options.
  1588. -------------------------------------------------------------------------*/
  1589. VOID InitNmDebugOptions(void)
  1590. {
  1591. RegEntry re(DEBUG_KEY, HKEY_LOCAL_MACHINE);
  1592. g_fDisplayFPS = re.GetNumber(REGVAL_DBG_DISPLAY_FPS, 0);
  1593. g_fDisplayViewStatus = re.GetNumber(REGVAL_DBG_DISPLAY_VIEWSTATUS, 0);
  1594. }
  1595. VOID SaveNmDebugOptions(void)
  1596. {
  1597. RegEntry re(DEBUG_KEY, HKEY_LOCAL_MACHINE);
  1598. re.SetValue(REGVAL_DBG_DISPLAY_FPS, g_fDisplayFPS);
  1599. re.SetValue(REGVAL_DBG_DISPLAY_VIEWSTATUS, g_fDisplayViewStatus);
  1600. }
  1601. /* U P D A T E C R T D B G S E T T I N G S */
  1602. /*-------------------------------------------------------------------------
  1603. %%Function: UpdateCrtDbgSettings
  1604. Update the C runtime debug memory settings
  1605. -------------------------------------------------------------------------*/
  1606. VOID UpdateCrtDbgSettings(void)
  1607. {
  1608. #if 0
  1609. // This depends on the use of the debug c runtime library
  1610. int tmpFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
  1611. // Always enable memory leak checking debug spew
  1612. tmpFlag |= _CRTDBG_LEAK_CHECK_DF;
  1613. _CrtSetDbgFlag(tmpFlag);
  1614. #endif // 0
  1615. }
  1616. /* I N I T D E B U G M E M O R Y O P T I O N S */
  1617. /*-------------------------------------------------------------------------
  1618. %%Function: InitDebugMemoryOptions
  1619. Initilize the runtime memory
  1620. -------------------------------------------------------------------------*/
  1621. BOOL InitDebugMemoryOptions(void)
  1622. {
  1623. InitNmDebugOptions();
  1624. UpdateCrtDbgSettings();
  1625. #if 0
  1626. _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_WNDW); // create a message box on errors
  1627. #endif // 0
  1628. return TRUE;
  1629. }
  1630. #endif /* DEBUG - whole file */
  1631.