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.

147 lines
3.2 KiB

  1. // Copyright (c) 1997-1999 Microsoft Corporation
  2. //
  3. // netid entry points
  4. //
  5. // 3-2-98 sburns
  6. #include "headers.hxx"
  7. #include "idpage.hpp"
  8. #include "resource.h"
  9. #include <DiagnoseDcNotFound.hpp>
  10. #include <DiagnoseDcNotFound.h>
  11. HINSTANCE hResourceModuleHandle = 0;
  12. HINSTANCE hDLLModuleHandle = 0;
  13. const wchar_t* HELPFILE_NAME = L"\\help\\sysdm.hlp";
  14. const wchar_t* RUNTIME_NAME = L"netid";
  15. // default: no debugging
  16. DWORD DEFAULT_LOGGING_OPTIONS = Burnslib::Log::OUTPUT_MUTE;
  17. Popup popup(IDS_APP_TITLE);
  18. BOOL
  19. APIENTRY
  20. DllMain(
  21. HINSTANCE hInstance,
  22. DWORD dwReason,
  23. PVOID /* lpReserved */ )
  24. {
  25. switch (dwReason)
  26. {
  27. case DLL_PROCESS_ATTACH:
  28. {
  29. hResourceModuleHandle = hInstance;
  30. hDLLModuleHandle = hInstance;
  31. LOG(L"DLL_PROCESS_ATTACH");
  32. break;
  33. }
  34. case DLL_PROCESS_DETACH:
  35. {
  36. LOG(L"DLL_PROCESS_DETACH");
  37. break;
  38. }
  39. case DLL_THREAD_ATTACH:
  40. case DLL_THREAD_DETACH:
  41. default:
  42. {
  43. break;
  44. }
  45. }
  46. return TRUE;
  47. }
  48. HPROPSHEETPAGE
  49. CreateNetIDPropertyPage()
  50. {
  51. LOG_FUNCTION(CreateNetIDPropertyPage);
  52. // CODEWORK: pass this along to the rest of the UI
  53. Computer c;
  54. HRESULT hr = c.Refresh();
  55. // This should always succeed, but if not, the object falls back to as
  56. // reasonable a default as can be expected.
  57. ASSERT(SUCCEEDED(hr));
  58. bool isWorkstation = false;
  59. switch (c.GetRole())
  60. {
  61. case Computer::STANDALONE_WORKSTATION:
  62. case Computer::MEMBER_WORKSTATION:
  63. {
  64. isWorkstation = true;
  65. break;
  66. }
  67. default:
  68. {
  69. // do nothing
  70. break;
  71. }
  72. }
  73. // JonN 10/4/00 Determine whether this is Whistler Personal
  74. bool isPersonal = false;
  75. OSVERSIONINFOEX osvi;
  76. ::ZeroMemory( &osvi, sizeof(osvi) );
  77. osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
  78. if (GetVersionEx( (LPOSVERSIONINFO)&osvi ))
  79. isPersonal = !!(osvi.wSuiteMask & VER_SUITE_PERSONAL);
  80. // this is deleted by the proppage callback function
  81. return (new NetIDPage(isWorkstation,isPersonal))->Create();
  82. }
  83. // this exported function is also used by the net access wizard.
  84. //
  85. // Bring up a modal error message dialog that shows the user an error message
  86. // and offers to run some diagnostic tests and point the user at some help to
  87. // try to resolve the problem.
  88. //
  89. // parent - in, the handle to the parent of this dialog.
  90. //
  91. // domainName - in, the name of the domain for which a domain controller can't
  92. // be located. If this parameter is null or the empty string, then the
  93. // function does nothing.
  94. //
  95. // dialogTitle - in, title string for the dialog
  96. void
  97. ShowDcNotFoundErrorDialog(
  98. HWND parent,
  99. PCWSTR domainName,
  100. PCWSTR dialogTitle)
  101. {
  102. LOG_FUNCTION(ShowDcNotFoundErrorDialog);
  103. ASSERT(Win::IsWindow(parent));
  104. ASSERT(domainName && domainName[0]);
  105. if (domainName && domainName[0])
  106. {
  107. ShowDcNotFoundErrorDialog(
  108. parent,
  109. -1,
  110. domainName,
  111. dialogTitle,
  112. String::format(IDS_GENERIC_DC_NOT_FOUND_PARAM, domainName),
  113. false);
  114. }
  115. }