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.

262 lines
5.6 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. Speckle.cpp : Defines the class behaviors for the application.
  5. File History:
  6. JonY Apr-96 created
  7. --*/
  8. #include "stdafx.h"
  9. #include "Speckle.h"
  10. #include "wizbased.h"
  11. #include "welcome.h"
  12. #include "prsinfo.h"
  13. #include "pwinfo.h"
  14. #include "userlist.h"
  15. #include "ginfo.h"
  16. #include "Profile.h"
  17. #include "finish.h"
  18. #include "RasPerm.h"
  19. #include "FPInfo.h"
  20. #include "Limit.h"
  21. #include "Timelist.h"
  22. #include "hours.h"
  23. #include "AccExp.h"
  24. #include "optdlg.h"
  25. #include "Restrct.h"
  26. #include "HomeDir.h"
  27. #include "LScript.h"
  28. #include "Exch.h"
  29. #include "NWLim.h"
  30. #include <fpnwcomm.h>
  31. #ifdef _DEBUG
  32. #undef THIS_FILE
  33. static char THIS_FILE[] = __FILE__;
  34. #endif
  35. TCHAR pszTreeEvent[] = _T("TreeThread");
  36. /////////////////////////////////////////////////////////////////////////////
  37. // CSpeckleApp
  38. BEGIN_MESSAGE_MAP(CSpeckleApp, CWinApp)
  39. //{{AFX_MSG_MAP(CSpeckleApp)
  40. //}}AFX_MSG
  41. // ON_COMMAND(ID_HELP, CWinApp::OnHelp)
  42. END_MESSAGE_MAP()
  43. /////////////////////////////////////////////////////////////////////////////
  44. // CSpeckleApp construction
  45. CSpeckleApp::CSpeckleApp()
  46. {
  47. m_bLocal = 0; // local or remote
  48. m_dwExpirationDate = TIMEQ_FOREVER;
  49. *m_pHours = NULL;
  50. m_sNWAllowedGraceLogins = 0x6;
  51. m_sNWRemainingGraceLogins = 0xff;
  52. m_sNWConcurrentConnections = NO_LIMIT;
  53. m_csNWHomeDir = (TCHAR*)DEFAULT_NWHOMEDIR;
  54. m_csAllowedLoginFrom = (TCHAR*)DEFAULT_NWLOGONFROM;
  55. m_bDisabled = FALSE;
  56. m_bChange_Password = FALSE;
  57. m_bMust_Change_PW = FALSE;
  58. m_bPW_Never_Expires = FALSE;
  59. m_bExpiration = FALSE;
  60. m_bHours = FALSE;
  61. m_bNW = FALSE;
  62. m_bProfile = FALSE;
  63. m_bRAS = FALSE;
  64. m_bWorkstation = FALSE;
  65. m_bExchange = FALSE;
  66. m_bHomeDir = FALSE;
  67. m_bLoginScript = FALSE;
  68. m_bDisabled = FALSE;
  69. m_bEnableRestrictions = FALSE;
  70. m_sCallBackType = 0;
  71. m_bPRSReset = TRUE;
  72. m_bPWReset = TRUE;
  73. m_bGReset = TRUE;
  74. }
  75. CSpeckleApp::~CSpeckleApp()
  76. {
  77. // zero out the password before we leave.
  78. m_csPassword1 = L"";
  79. }
  80. /////////////////////////////////////////////////////////////////////////////
  81. // The one and only CSpeckleApp object
  82. CSpeckleApp theApp;
  83. /////////////////////////////////////////////////////////////////////////////
  84. // CSpeckleApp initialization
  85. BOOL CSpeckleApp::IsSecondInstance()
  86. {
  87. HANDLE hSem;
  88. //create a semaphore object with max count of 1
  89. hSem = CreateSemaphore(NULL, 0, 1, L"Adduser Wizard Semaphore");
  90. if (hSem!=NULL && GetLastError() == ERROR_ALREADY_EXISTS) {
  91. CloseHandle(hSem);
  92. CString csAppName;
  93. csAppName.LoadString(AFX_IDS_APP_TITLE);
  94. CWnd* pWnd = CWnd::FindWindow(NULL, (LPCTSTR)csAppName);
  95. if (pWnd)
  96. pWnd->SetForegroundWindow();
  97. return TRUE;
  98. }
  99. return FALSE;
  100. }
  101. BOOL CSpeckleApp::InitInstance()
  102. {
  103. // check for OS version
  104. OSVERSIONINFO os;
  105. os.dwOSVersionInfoSize = sizeof(os);
  106. GetVersionEx(&os);
  107. if (os.dwMajorVersion < 4)
  108. {
  109. AfxMessageBox(IDS_BAD_VERSION, MB_ICONSTOP);
  110. ExitProcess(0);
  111. }
  112. if (IsSecondInstance())
  113. return FALSE;
  114. AfxEnableControlContainer();
  115. // Standard initialization
  116. #ifdef _AFXDLL
  117. Enable3dControls(); // Call this when using MFC in a shared DLL
  118. #else
  119. Enable3dControlsStatic(); // Call this when linking to MFC statically
  120. #endif
  121. // create the dialogs
  122. CWelcomeDlg* pWelcome = new CWelcomeDlg;
  123. CPersonalInfo* pInfo = new CPersonalInfo;
  124. CPasswordInfo* pPassword = new CPasswordInfo;
  125. CGroupInfo* pGroup = new CGroupInfo;
  126. CProfile* pProfile = new CProfile;
  127. CFinish* pFinish = new CFinish;
  128. CRasPerm* pRasP = new CRasPerm;
  129. CFPInfo* pFP = new CFPInfo;
  130. CLimitLogon* pLim = new CLimitLogon;
  131. CHoursDlg* pHours = new CHoursDlg;
  132. CAccExp* pExp = new CAccExp;
  133. COptionsDlg* pOpt = new COptionsDlg;
  134. CRestrictions* pRestrictions = new CRestrictions;
  135. CHomeDir* pHomeDir = new CHomeDir;
  136. CLoginScript* pLScript = new CLoginScript;
  137. CExch* pExch = new CExch;
  138. CNWLimitLogon* pNWLim = new CNWLimitLogon;
  139. // create the property sheet and set 'wizmode'
  140. m_cps1.SetWizardMode();
  141. // Add the dialogs
  142. m_cps1.AddPage(pWelcome);
  143. m_cps1.AddPage(pInfo);
  144. m_cps1.AddPage(pPassword);
  145. m_cps1.AddPage(pGroup);
  146. m_cps1.AddPage(pOpt);
  147. m_cps1.AddPage(pProfile);
  148. m_cps1.AddPage(pLScript);
  149. m_cps1.AddPage(pHomeDir);
  150. m_cps1.AddPage(pRasP);
  151. m_cps1.AddPage(pFP);
  152. m_cps1.AddPage(pExch);
  153. m_cps1.AddPage(pRestrictions);
  154. m_cps1.AddPage(pExp);
  155. m_cps1.AddPage(pHours);
  156. m_cps1.AddPage(pLim);
  157. m_cps1.AddPage(pNWLim);
  158. m_cps1.AddPage(pFinish);
  159. // start the wizard
  160. m_cps1.DoModal();
  161. // clean up
  162. delete pWelcome;
  163. delete pInfo;
  164. delete pPassword;
  165. delete pGroup;
  166. delete pProfile;
  167. delete pFinish;
  168. delete pRasP;
  169. delete pFP;
  170. delete pLim;
  171. delete pHours;
  172. delete pExp;
  173. delete pOpt;
  174. delete pRestrictions;
  175. delete pHomeDir;
  176. delete pLScript;
  177. delete pExch;
  178. delete pNWLim;
  179. return FALSE;
  180. }
  181. /////////////////////////////////////////////////////////////////////////////
  182. // CMySheet
  183. IMPLEMENT_DYNAMIC(CMySheet, CPropertySheet)
  184. CMySheet::CMySheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
  185. :CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
  186. {
  187. }
  188. CMySheet::CMySheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
  189. :CPropertySheet(pszCaption, pParentWnd, iSelectPage)
  190. {
  191. }
  192. CMySheet::CMySheet() : CPropertySheet()
  193. {
  194. }
  195. CMySheet::~CMySheet()
  196. {
  197. }
  198. BEGIN_MESSAGE_MAP(CMySheet, CPropertySheet)
  199. //{{AFX_MSG_MAP(CMySheet)
  200. //}}AFX_MSG_MAP
  201. END_MESSAGE_MAP()
  202. /////////////////////////////////////////////////////////////////////////////
  203. // CMySheet message handlers
  204. BOOL CMySheet::OnInitDialog()
  205. {
  206. CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp();
  207. HICON hIcon = LoadIcon(pApp->m_hInstance, MAKEINTRESOURCE(IDR_MAINFRAME));
  208. ::SetClassLong(m_hWnd, GCL_HICON, (long)hIcon);
  209. return CPropertySheet::OnInitDialog();
  210. }