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.

128 lines
3.3 KiB

  1. // File: CplMain.cpp
  2. #include "precomp.h"
  3. #include "resource.h"
  4. #include "Conf.h"
  5. #include "ConfCpl.h"
  6. #include "confwnd.h"
  7. #include "ConfPolicies.h"
  8. //*** Global Data *****************************************************
  9. // Global flag keeps setting that changed for windows msg broadcast
  10. DWORD g_dwChangedSettings = 0;
  11. BOOL g_fInOptionsDialog = FALSE;
  12. static const int nMaxPropPages = 7;
  13. INT_PTR CreatePropSheet(HWND hwndOwner, HINSTANCE hInst, int nStartPage)
  14. {
  15. int pageMap[nMaxPropPages];
  16. ZeroMemory(pageMap, sizeof(pageMap));
  17. PROPSHEETPAGE psp[nMaxPropPages];
  18. ZeroMemory(psp, sizeof(psp));
  19. RegEntry rePol(POLICIES_KEY, HKEY_CURRENT_USER);
  20. RegEntry reAudio(AUDIO_KEY, HKEY_CURRENT_USER);
  21. ASSERT(nStartPage < nMaxPropPages);
  22. int nPages = 0;
  23. if (!rePol.GetNumber( REGVAL_POL_NO_GENERALPAGE,
  24. DEFAULT_POL_NO_GENERALPAGE ))
  25. {
  26. pageMap[OPTIONS_GENERAL_PAGE] = nPages;
  27. FillInPropertyPage(&psp[nPages++], IDD_OPT_GENERAL,
  28. UserDlgProc);
  29. ASSERT(nPages <= nMaxPropPages);
  30. }
  31. if (!rePol.GetNumber( REGVAL_POL_NO_SECURITYPAGE,
  32. DEFAULT_POL_NO_SECURITYPAGE ))
  33. {
  34. pageMap[OPTIONS_SECURITY_PAGE] = nPages;
  35. FillInPropertyPage(&psp[nPages++], IDD_SECURITY,
  36. SecurityDlgProc);
  37. ASSERT(nPages <= nMaxPropPages);
  38. }
  39. if (!rePol.GetNumber( REGVAL_POL_NO_AUDIOPAGE,
  40. DEFAULT_POL_NO_AUDIOPAGE ) &&
  41. !rePol.GetNumber( REGVAL_POL_NO_AUDIO,
  42. DEFAULT_POL_NO_AUDIO) &&
  43. ISSOUNDCARDPRESENT(reAudio.GetNumber( REGVAL_SOUNDCARDCAPS,
  44. SOUNDCARD_NONE)) )
  45. {
  46. pageMap[OPTIONS_AUDIO_PAGE] = nPages;
  47. FillInPropertyPage(&psp[nPages++], IDD_AUDIO,
  48. AudioDlgProc);
  49. ASSERT(nPages <= nMaxPropPages);
  50. }
  51. if (!rePol.GetNumber( REGVAL_POL_NO_VIDEOPAGE,
  52. DEFAULT_POL_NO_VIDEOPAGE ) &&
  53. (!rePol.GetNumber( REGVAL_POL_NO_VIDEO_SEND,
  54. DEFAULT_POL_NO_VIDEO_SEND) ||
  55. !rePol.GetNumber( REGVAL_POL_NO_VIDEO_RECEIVE,
  56. DEFAULT_POL_NO_VIDEO_RECEIVE)))
  57. {
  58. pageMap[OPTIONS_VIDEO_PAGE] = nPages;
  59. FillInPropertyPage(&psp[nPages++], IDD_VIDEO,
  60. VideoDlgProc);
  61. ASSERT(nPages <= nMaxPropPages);
  62. }
  63. // If no pages are allowed, tell the user and get out
  64. if ( !nPages ) {
  65. ConfMsgBox ( hwndOwner, (LPCTSTR)IDS_ALLPAGESDISABLED );
  66. return 0;
  67. }
  68. PROPSHEETHEADER psh;
  69. InitStruct(&psh);
  70. psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW;
  71. psh.hwndParent = hwndOwner;
  72. psh.hInstance = hInst;
  73. ASSERT(NULL == psh.hIcon);
  74. psh.pszCaption = (LPSTR)IDS_CPLNAME;
  75. psh.nPages = nPages;
  76. psh.nStartPage = pageMap[nStartPage];
  77. // JOSEF WHAT IS THIS?????
  78. psh.ppsp = (LPCPROPSHEETPAGE) psp;
  79. return (PropertySheet(&psh));
  80. }
  81. /* L A U N C H C O N F C P L */
  82. /*-------------------------------------------------------------------------
  83. %%Function: LaunchConfCpl
  84. -------------------------------------------------------------------------*/
  85. VOID LaunchConfCpl(HWND hwnd, int nStartPage)
  86. {
  87. if (g_fInOptionsDialog)
  88. {
  89. return;
  90. }
  91. g_fInOptionsDialog = TRUE;
  92. CreatePropSheet(hwnd, GetInstanceHandle(), nStartPage);
  93. g_fInOptionsDialog = FALSE;
  94. // Broadcast change notification if anything changed
  95. if (g_dwChangedSettings)
  96. {
  97. HandleConfSettingsChange(g_dwChangedSettings);
  98. g_dwChangedSettings = 0;
  99. }
  100. }
  101. BOOL CanLaunchConfCpl()
  102. {
  103. return !g_fInOptionsDialog;
  104. }
  105.