From e611b132f9b8abe35b362e5870b74bce94a1e58e Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 16 May 2020 20:51:50 -0700 Subject: initial commit --- private/utils/wizards/addusrw/accexp.cpp | 330 ++++++ private/utils/wizards/addusrw/accexp.h | 102 ++ private/utils/wizards/addusrw/dapi.h | 1322 ++++++++++++++++++++++++ private/utils/wizards/addusrw/exch.cpp | 177 ++++ private/utils/wizards/addusrw/exch.h | 57 + private/utils/wizards/addusrw/finish.cpp | 794 ++++++++++++++ private/utils/wizards/addusrw/finish.h | 81 ++ private/utils/wizards/addusrw/fpinfo.cpp | 179 ++++ private/utils/wizards/addusrw/fpinfo.h | 65 ++ private/utils/wizards/addusrw/fpnwcomm.h | 307 ++++++ private/utils/wizards/addusrw/ginfo.cpp | 339 ++++++ private/utils/wizards/addusrw/ginfo.h | 65 ++ private/utils/wizards/addusrw/homedir.cpp | 245 +++++ private/utils/wizards/addusrw/homedir.h | 61 ++ private/utils/wizards/addusrw/hours.cpp | 165 +++ private/utils/wizards/addusrw/hours.h | 93 ++ private/utils/wizards/addusrw/hours1.cpp | 55 + private/utils/wizards/addusrw/hours1.h | 50 + private/utils/wizards/addusrw/limit.cpp | 276 +++++ private/utils/wizards/addusrw/limit.h | 94 ++ private/utils/wizards/addusrw/lscript.cpp | 83 ++ private/utils/wizards/addusrw/lscript.h | 52 + private/utils/wizards/addusrw/makefile | 6 + private/utils/wizards/addusrw/nwlim.cpp | 312 ++++++ private/utils/wizards/addusrw/nwlim.h | 92 ++ private/utils/wizards/addusrw/nwwks.cpp | 159 +++ private/utils/wizards/addusrw/nwwks.h | 51 + private/utils/wizards/addusrw/optdlg.cpp | 167 +++ private/utils/wizards/addusrw/optdlg.h | 59 ++ private/utils/wizards/addusrw/profile.cpp | 105 ++ private/utils/wizards/addusrw/profile.h | 52 + private/utils/wizards/addusrw/prsinfo.cpp | 162 +++ private/utils/wizards/addusrw/prsinfo.h | 54 + private/utils/wizards/addusrw/pwinfo.cpp | 207 ++++ private/utils/wizards/addusrw/pwinfo.h | 56 + private/utils/wizards/addusrw/rasperm.cpp | 155 +++ private/utils/wizards/addusrw/rasperm.h | 58 ++ private/utils/wizards/addusrw/res/bitmap1.bmp | Bin 0 -> 13680 bytes private/utils/wizards/addusrw/res/endflag.bmp | Bin 0 -> 13678 bytes private/utils/wizards/addusrw/res/global.bmp | Bin 0 -> 1386 bytes private/utils/wizards/addusrw/res/global_g.bmp | Bin 0 -> 1386 bytes private/utils/wizards/addusrw/res/group.bmp | Bin 0 -> 328 bytes private/utils/wizards/addusrw/res/net_tree.bmp | Bin 0 -> 544 bytes private/utils/wizards/addusrw/res/speckle.ico | Bin 0 -> 1078 bytes private/utils/wizards/addusrw/res/speckle.rc2 | 26 + private/utils/wizards/addusrw/res/user.bmp | Bin 0 -> 334 bytes private/utils/wizards/addusrw/res/user_bit.bmp | Bin 0 -> 334 bytes private/utils/wizards/addusrw/res/world.bmp | Bin 0 -> 344 bytes private/utils/wizards/addusrw/resource.h | 244 +++++ private/utils/wizards/addusrw/restrct.cpp | 190 ++++ private/utils/wizards/addusrw/restrct.h | 63 ++ private/utils/wizards/addusrw/rpcbak.h | 225 ++++ private/utils/wizards/addusrw/rpcpub.h | 387 +++++++ private/utils/wizards/addusrw/sadapi.h | 197 ++++ private/utils/wizards/addusrw/sources | 75 ++ private/utils/wizards/addusrw/speckle.cpp | 262 +++++ private/utils/wizards/addusrw/speckle.h | 176 ++++ private/utils/wizards/addusrw/speckle.rc | 766 ++++++++++++++ private/utils/wizards/addusrw/stdafx.cpp | 6 + private/utils/wizards/addusrw/stdafx.h | 32 + private/utils/wizards/addusrw/timelist.cpp | 92 ++ private/utils/wizards/addusrw/timelist.h | 53 + private/utils/wizards/addusrw/transbmp.cpp | 175 ++++ private/utils/wizards/addusrw/transbmp.h | 42 + private/utils/wizards/addusrw/trstlist.cpp | 414 ++++++++ private/utils/wizards/addusrw/trstlist.h | 56 + private/utils/wizards/addusrw/userlist.cpp | 216 ++++ private/utils/wizards/addusrw/userlist.h | 61 ++ private/utils/wizards/addusrw/welcome.cpp | 576 +++++++++++ private/utils/wizards/addusrw/welcome.h | 62 ++ private/utils/wizards/addusrw/wizbased.cpp | 68 ++ private/utils/wizards/addusrw/wizbased.h | 57 + 72 files changed, 11208 insertions(+) create mode 100644 private/utils/wizards/addusrw/accexp.cpp create mode 100644 private/utils/wizards/addusrw/accexp.h create mode 100644 private/utils/wizards/addusrw/dapi.h create mode 100644 private/utils/wizards/addusrw/exch.cpp create mode 100644 private/utils/wizards/addusrw/exch.h create mode 100644 private/utils/wizards/addusrw/finish.cpp create mode 100644 private/utils/wizards/addusrw/finish.h create mode 100644 private/utils/wizards/addusrw/fpinfo.cpp create mode 100644 private/utils/wizards/addusrw/fpinfo.h create mode 100644 private/utils/wizards/addusrw/fpnwcomm.h create mode 100644 private/utils/wizards/addusrw/ginfo.cpp create mode 100644 private/utils/wizards/addusrw/ginfo.h create mode 100644 private/utils/wizards/addusrw/homedir.cpp create mode 100644 private/utils/wizards/addusrw/homedir.h create mode 100644 private/utils/wizards/addusrw/hours.cpp create mode 100644 private/utils/wizards/addusrw/hours.h create mode 100644 private/utils/wizards/addusrw/hours1.cpp create mode 100644 private/utils/wizards/addusrw/hours1.h create mode 100644 private/utils/wizards/addusrw/limit.cpp create mode 100644 private/utils/wizards/addusrw/limit.h create mode 100644 private/utils/wizards/addusrw/lscript.cpp create mode 100644 private/utils/wizards/addusrw/lscript.h create mode 100644 private/utils/wizards/addusrw/makefile create mode 100644 private/utils/wizards/addusrw/nwlim.cpp create mode 100644 private/utils/wizards/addusrw/nwlim.h create mode 100644 private/utils/wizards/addusrw/nwwks.cpp create mode 100644 private/utils/wizards/addusrw/nwwks.h create mode 100644 private/utils/wizards/addusrw/optdlg.cpp create mode 100644 private/utils/wizards/addusrw/optdlg.h create mode 100644 private/utils/wizards/addusrw/profile.cpp create mode 100644 private/utils/wizards/addusrw/profile.h create mode 100644 private/utils/wizards/addusrw/prsinfo.cpp create mode 100644 private/utils/wizards/addusrw/prsinfo.h create mode 100644 private/utils/wizards/addusrw/pwinfo.cpp create mode 100644 private/utils/wizards/addusrw/pwinfo.h create mode 100644 private/utils/wizards/addusrw/rasperm.cpp create mode 100644 private/utils/wizards/addusrw/rasperm.h create mode 100644 private/utils/wizards/addusrw/res/bitmap1.bmp create mode 100644 private/utils/wizards/addusrw/res/endflag.bmp create mode 100644 private/utils/wizards/addusrw/res/global.bmp create mode 100644 private/utils/wizards/addusrw/res/global_g.bmp create mode 100644 private/utils/wizards/addusrw/res/group.bmp create mode 100644 private/utils/wizards/addusrw/res/net_tree.bmp create mode 100644 private/utils/wizards/addusrw/res/speckle.ico create mode 100644 private/utils/wizards/addusrw/res/speckle.rc2 create mode 100644 private/utils/wizards/addusrw/res/user.bmp create mode 100644 private/utils/wizards/addusrw/res/user_bit.bmp create mode 100644 private/utils/wizards/addusrw/res/world.bmp create mode 100644 private/utils/wizards/addusrw/resource.h create mode 100644 private/utils/wizards/addusrw/restrct.cpp create mode 100644 private/utils/wizards/addusrw/restrct.h create mode 100644 private/utils/wizards/addusrw/rpcbak.h create mode 100644 private/utils/wizards/addusrw/rpcpub.h create mode 100644 private/utils/wizards/addusrw/sadapi.h create mode 100644 private/utils/wizards/addusrw/sources create mode 100644 private/utils/wizards/addusrw/speckle.cpp create mode 100644 private/utils/wizards/addusrw/speckle.h create mode 100644 private/utils/wizards/addusrw/speckle.rc create mode 100644 private/utils/wizards/addusrw/stdafx.cpp create mode 100644 private/utils/wizards/addusrw/stdafx.h create mode 100644 private/utils/wizards/addusrw/timelist.cpp create mode 100644 private/utils/wizards/addusrw/timelist.h create mode 100644 private/utils/wizards/addusrw/transbmp.cpp create mode 100644 private/utils/wizards/addusrw/transbmp.h create mode 100644 private/utils/wizards/addusrw/trstlist.cpp create mode 100644 private/utils/wizards/addusrw/trstlist.h create mode 100644 private/utils/wizards/addusrw/userlist.cpp create mode 100644 private/utils/wizards/addusrw/userlist.h create mode 100644 private/utils/wizards/addusrw/welcome.cpp create mode 100644 private/utils/wizards/addusrw/welcome.h create mode 100644 private/utils/wizards/addusrw/wizbased.cpp create mode 100644 private/utils/wizards/addusrw/wizbased.h (limited to 'private/utils/wizards/addusrw') diff --git a/private/utils/wizards/addusrw/accexp.cpp b/private/utils/wizards/addusrw/accexp.cpp new file mode 100644 index 000000000..0916848bc --- /dev/null +++ b/private/utils/wizards/addusrw/accexp.cpp @@ -0,0 +1,330 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + AccExp.cpp : implementation file + + CPropertyPage support for User mgmt wizard + +File History: + + JonY Apr-96 created + +--*/ + +#include "stdafx.h" +#include "speckle.h" +#include "wizbased.h" +#include "AccExp.h" + +#include + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CAccExp property page + +IMPLEMENT_DYNCREATE(CAccExp, CWizBaseDlg) + +CAccExp::CAccExp() : CWizBaseDlg(CAccExp::IDD) +{ + //{{AFX_DATA_INIT(CAccExp) + m_sDayEdit = 0; + m_sYearEdit = 0; + m_sMonthEdit = 0; + //}}AFX_DATA_INIT + CTime t = CTime::GetCurrentTime(); + + m_sDayEdit = t.GetDay(); + m_sMonthEdit = t.GetMonth(); + m_sYearEdit = t.GetYear() + 1; +} + +CAccExp::~CAccExp() +{ +} + +void CAccExp::DoDataExchange(CDataExchange* pDX) +{ + CPropertyPage::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CAccExp) + DDX_Control(pDX, IDC_STATIC2, m_cStatic2); + DDX_Control(pDX, IDC_STATIC1, m_cStatic1); + DDX_Control(pDX, IDC_DATE_SPIN, m_sbSpin); + DDX_Text(pDX, IDC_MONTH_EDIT, m_csMonthEdit); + DDX_Text(pDX, IDC_DAY_EDIT, m_csDayEdit); + DDX_Text(pDX, IDC_YEAR_EDIT, m_csYearEdit); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CAccExp, CWizBaseDlg) + //{{AFX_MSG_MAP(CAccExp) + ON_EN_SETFOCUS(IDC_DAY_EDIT, OnSetfocusDayEdit) + ON_EN_SETFOCUS(IDC_MONTH_EDIT, OnSetfocusMonthEdit) + ON_EN_SETFOCUS(IDC_YEAR_EDIT, OnSetfocusYearEdit) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CAccExp message handlers + +BOOL CAccExp::OnInitDialog() +{ + CWizBaseDlg::OnInitDialog(); + + GetDlgItem(IDC_DAY_EDIT)->EnableWindow(TRUE); + GetDlgItem(IDC_MONTH_EDIT)->EnableWindow(TRUE); + GetDlgItem(IDC_YEAR_EDIT)->EnableWindow(TRUE); + GetDlgItem(IDC_DATE_SPIN)->EnableWindow(TRUE); + +// get date format from registry + DWORD dwRet; + HKEY hKey; + DWORD cbProv = 0; + TCHAR* lpProv = NULL; + + dwRet = RegOpenKey(HKEY_CURRENT_USER, + TEXT("Control Panel\\International"), &hKey ); + + TCHAR* lpSep; + +// date separator + if ((dwRet = RegQueryValueEx( hKey, TEXT("sDate"), NULL, NULL, NULL, &cbProv )) == ERROR_SUCCESS) + { + lpSep = (TCHAR*)malloc(cbProv); + if (lpSep == NULL) + { + AfxMessageBox(IDS_GENERIC_NO_HEAP, MB_ICONEXCLAMATION); + ExitProcess(1); + } + dwRet = RegQueryValueEx( hKey, TEXT("sDate"), NULL, NULL, (LPBYTE) lpSep, &cbProv ); + } + + m_cStatic2.m_csDateSep = lpSep; + +// only use one char + m_cStatic2.m_csDateSep = m_cStatic2.m_csDateSep.Left(1); + m_cStatic1.m_csDateSep = m_cStatic2.m_csDateSep; + +// date order + TCHAR* lpTemp; + if ((dwRet = RegQueryValueEx( hKey, TEXT("sShortDate"), NULL, NULL, NULL, &cbProv )) == ERROR_SUCCESS) + { + lpTemp = (TCHAR*)malloc(cbProv); + if (lpTemp == NULL) + { + AfxMessageBox(IDS_GENERIC_NO_HEAP, MB_ICONEXCLAMATION); + ExitProcess(1); + } + dwRet = RegQueryValueEx( hKey, TEXT("sShortDate"), NULL, NULL, (LPBYTE) lpTemp, &cbProv ); + } + +// determine the order + TCHAR* pTemp = _tcstok(lpTemp, lpSep); + USHORT xPos = 170; // left most control + USHORT yPos = 41; + USHORT sCount = 0; + while(pTemp != NULL) + { + CRect cr; + if ((*pTemp == 'm') || (*pTemp == 'M')) + { + GetDlgItem(IDC_MONTH_EDIT)->SetWindowPos(0, xPos, yPos, 0, 0, SWP_NOSIZE | SWP_NOZORDER); + GetDlgItem(IDC_MONTH_EDIT)->GetWindowRect(&cr); + xPos += cr.Width(); + } + + else if ((*pTemp == 'd') || (*pTemp == 'D')) + { + GetDlgItem(IDC_DAY_EDIT)->SetWindowPos(0, xPos, yPos, 0, 0, SWP_NOSIZE | SWP_NOZORDER); + GetDlgItem(IDC_DAY_EDIT)->GetWindowRect(&cr); + xPos += cr.Width(); + } + + else if ((*pTemp == 'y') || (*pTemp == 'Y')) + { + GetDlgItem(IDC_YEAR_EDIT)->SetWindowPos(0, xPos, yPos, 0, 0, SWP_NOSIZE | SWP_NOZORDER); + GetDlgItem(IDC_YEAR_EDIT)->GetWindowRect(&cr); + xPos += cr.Width(); + } + + if (sCount == 0) + { + GetDlgItem(IDC_STATIC1)->SetWindowPos(0, xPos, yPos, 0, 0, SWP_NOSIZE | SWP_NOZORDER); + GetDlgItem(IDC_STATIC1)->GetWindowRect(&cr); + xPos += cr.Width(); + } + + if (sCount == 1) + { + GetDlgItem(IDC_STATIC2)->SetWindowPos(0, xPos, yPos, 0, 0, SWP_NOSIZE | SWP_NOZORDER); + GetDlgItem(IDC_STATIC2)->GetWindowRect(&cr); + xPos += cr.Width(); + } + + pTemp = _tcstok(NULL, lpSep); + sCount++; + } + + free(lpTemp); + free(lpSep); + RegCloseKey(hKey); + +// put the initial numeric values into the edit controls + TCHAR pTemp2[4]; + wsprintf(pTemp2, L"%d", m_sDayEdit); + m_csDayEdit = pTemp2; + wsprintf(pTemp2, L"%d", m_sMonthEdit); + m_csMonthEdit = pTemp2; + wsprintf(pTemp2, L"%d", m_sYearEdit); + m_csYearEdit = pTemp2; + + UpdateData(FALSE); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void CAccExp::OnSetfocusDayEdit() +{ + m_sbSpin.SetBuddy(GetDlgItem(IDC_DAY_EDIT)); + m_sbSpin.SetRange(1,31); +} + +void CAccExp::OnSetfocusMonthEdit() +{ + m_sbSpin.SetBuddy(GetDlgItem(IDC_MONTH_EDIT)); + m_sbSpin.SetRange(1,12); +} + +void CAccExp::OnSetfocusYearEdit() +{ + m_sbSpin.SetBuddy(GetDlgItem(IDC_YEAR_EDIT)); + m_sbSpin.SetRange(1996, 2030); +} + + +LRESULT CAccExp::OnWizardNext() +{ + UpdateData(TRUE); + +// get the numberic values back out of the edit control(s) + m_sDayEdit = _wtoi((LPCTSTR)m_csDayEdit); + m_sMonthEdit = _wtoi((LPCTSTR)m_csMonthEdit); + m_sYearEdit = _wtoi((LPCTSTR)m_csYearEdit); + +// check for valid values + USHORT sDays[] = {31,28,31,30,31,30,31,31,30,31,30,31}; + +// leap year? + if (((m_sYearEdit - 1992) % 4) == 0) sDays[1] = 29; + + if ((m_sDayEdit > sDays[m_sMonthEdit - 1]) || (m_sDayEdit < 1)) + { + AfxMessageBox(IDS_INVALID_DAY); + GetDlgItem(IDC_DAY_EDIT)->SetFocus(); + return -1; + } + + if ((m_sMonthEdit > 12) || (m_sMonthEdit < 1)) + { + AfxMessageBox(IDS_INVALID_MONTH); + GetDlgItem(IDC_MONTH_EDIT)->SetFocus(); + return -1; + } + + if ((m_sYearEdit > 2030) || (m_sYearEdit < 1970)) + { + AfxMessageBox(IDS_INVALID_YEAR); + GetDlgItem(IDC_YEAR_EDIT)->SetFocus(); + return -1; + } + + CTime t = CTime::GetCurrentTime(); + CTime tSet = CTime(m_sYearEdit, m_sMonthEdit, m_sDayEdit + 1, 23, 59, 59); + + if (tSet < t) + { + if (AfxMessageBox(IDS_ALREADY_EXPIRED, MB_YESNO) != IDYES) return -1; + } + +// convert both values to GMT + struct tm* GMTTime; + GMTTime = tSet.GetGmtTm(NULL); + CTime tGMTSet = CTime((GMTTime->tm_year + 1900), + GMTTime->tm_mon + 1, + GMTTime->tm_mday, + 0, 0, 30, GMTTime->tm_isdst); + + CTime tStart = CTime(1970, 1, 1, 0, 0, 0); + GMTTime = tStart.GetGmtTm(NULL); + CTime tGMTStart = CTime((GMTTime->tm_year + 1900), + GMTTime->tm_mon + 1, + GMTTime->tm_mday, + 0, 0, 0, GMTTime->tm_isdst); + + CTimeSpan ct = tGMTSet - tGMTStart; + + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + pApp->m_dwExpirationDate = ct.GetTotalSeconds(); + + if (pApp->m_bHours) return IDD_HOURS_DLG; + else if (pApp->m_bWorkstation) return IDD_LOGONTO_DLG; + else if (pApp->m_bNW) return IDD_NWLOGON_DIALOG; + else return IDD_FINISH; + return CWizBaseDlg::OnWizardNext(); +} + +LRESULT CAccExp::OnWizardBack() +{ + return IDD_RESTRICTIONS_DIALOG; +} + + +///////////////////////////////////////////////////////////////////////////// +// CStaticDelim + +CStaticDelim::CStaticDelim() +{ + m_pFont = new CFont; + LOGFONT lf; + + memset(&lf, 0, sizeof(LOGFONT)); // Clear out structure. + lf.lfHeight = 15; + _tcscpy(lf.lfFaceName, TEXT("Arial")); + lf.lfWeight = 100; + m_pFont->CreateFontIndirect(&lf); // Create the font. + +} + +CStaticDelim::~CStaticDelim() +{ + delete m_pFont; +} + + +BEGIN_MESSAGE_MAP(CStaticDelim, CStatic) + //{{AFX_MSG_MAP(CStaticDelim) + ON_WM_PAINT() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CStaticDelim message handlers + +void CStaticDelim::OnPaint() +{ + CPaintDC dc(this); // device context for painting + + dc.SetBkColor(RGB(255, 255, 255)); + + dc.SelectObject(m_pFont); + dc.TextOut(0, 0, m_csDateSep); + // Do not call CStatic::OnPaint() for painting messages +} diff --git a/private/utils/wizards/addusrw/accexp.h b/private/utils/wizards/addusrw/accexp.h new file mode 100644 index 000000000..05901adc6 --- /dev/null +++ b/private/utils/wizards/addusrw/accexp.h @@ -0,0 +1,102 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + AccExp.h : header file + + CPropertyPage support for User mgmt wizard + +File History: + + JonY Apr-96 created + +--*/ + +///////////////////////////////////////////////////////////////////////////// +// CStaticDelim window + +class CStaticDelim : public CStatic +{ +// Construction +public: + CStaticDelim(); + CString m_csDateSep; + +// Attributes +public: + +// Operations +public: + CFont* m_pFont; + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CStaticDelim) + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CStaticDelim(); + + // Generated message map functions +protected: + //{{AFX_MSG(CStaticDelim) + afx_msg void OnPaint(); + //}}AFX_MSG + + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +///////////////////////////////////////////////////////////////////////////// +// CAccExp dialog + +class CAccExp : public CWizBaseDlg +{ + DECLARE_DYNCREATE(CAccExp) + +// Construction +public: + CAccExp(); + ~CAccExp(); + +// Dialog Data + //{{AFX_DATA(CAccExp) + enum { IDD = IDD_ACCOUNT_EXP_DIALOG }; + CStaticDelim m_cStatic2; + CStaticDelim m_cStatic1; + CSpinButtonCtrl m_sbSpin; + CString m_csDayEdit; + CString m_csYearEdit; + CString m_csMonthEdit; + //}}AFX_DATA + + short m_sDayEdit; + short m_sYearEdit; + short m_sMonthEdit; + + // Overrides + // ClassWizard generate virtual function overrides + //{{AFX_VIRTUAL(CAccExp) + public: + virtual LRESULT OnWizardNext(); + virtual LRESULT OnWizardBack(); + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + // Generated message map functions + //{{AFX_MSG(CAccExp) + virtual BOOL OnInitDialog(); + afx_msg void OnSetfocusDayEdit(); + afx_msg void OnSetfocusMonthEdit(); + afx_msg void OnSetfocusYearEdit(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + +}; diff --git a/private/utils/wizards/addusrw/dapi.h b/private/utils/wizards/addusrw/dapi.h new file mode 100644 index 000000000..10d3c0b01 --- /dev/null +++ b/private/utils/wizards/addusrw/dapi.h @@ -0,0 +1,1322 @@ + +/******************************************************************* + * + * Copyright (c) Microsoft Corp. 1986-1996. All Rights Reserved. + * + * + * DESCRIPTION: This header file defines the functions, structures, + * and macros used to access the Microsoft Exchange + * APIs for modifying entries in the Exchange 4.0 DIT. + * These APIs permit a calling process to create, + * modify, or delete DIT objects by specifying the + * name of a CSV text file containing attributes + * for objects to import into ( or to modify) + * the DIT. See the Directory Access Functions + * section of the Exchange Developer's Kit for + * more detailed description of this interface. + * + * Calling programs must link with DAPI.LIB. + * + * Error and warning codes are defined in DAPIMSG.H + * + * + *******************************************************************/ + +/** include files **/ +#ifndef _WINDOWS_ +#include +#endif + +/** local definitions **/ + +#ifndef _DAPI_INCLUDED_ +#define _DAPI_INCLUDED_ + +#ifdef __cplusplus +extern "C" +{ +#endif + +// Import / Export APIs check for the presence of this signature in +// the dwDAPISignature field in the import parameter blocks. +// This signature will be incremented each time one of the parameter +// blocks is changed so that header synchronization problems can be +// detected. +#define DAPI_SIGNATURE 0x46414400 + + +// Combinable flags used to control the API functions. + + // The following flags control filtering of DAPI events + // The default action is DAPI_EVENT_ALL +#define DAPI_EVENT_MASK 0x00000007 /* bit-field containing event-filtering requested + if none of these bits are set, DAPI_EVENT_ALL is assumed */ +#define DAPI_EVENT_MIN 0x00000001 /* No warning or error logging. + Log start and stop messages */ +#define DAPI_EVENT_SOME 0x00000002 /* Start, Stop, and Error messages will be logged. */ +#define DAPI_EVENT_ALL 0x00000004 /* Start, Stop, Error, and Warning messages + will be logged. */ + + // The following flags control schema read and use of the schema +#define DAPI_FORCE_SCHEMA_LOAD 0x00000010 /* Unload previously loaded schema + and read schema again. + Default action is to re-use + previously loaded schema if read + from the same messaging domain */ +#define DAPI_RAW_MODE 0x00000020 /* Import / Export in "Raw" mode. Import + lines are taken literally. No + attributes will be inherited, + constructed, etc. Aliases for + attribute and class names will + not be recognized. */ + +#define DAPI_OVERRIDE_CONTAINER 0x00000040 /* Container specified in the parameter block + overrides the contents of the container column. + Default behaviour is for the value specified + in the Obj-Container column to override + that specified in the parameter block */ + +#define DAPI_IMPORT_NO_ERR_FILE 0x00000080 /* Do not create Error File -- BatchImport only */ +#define DAPI_IMPORT_WRITE_THROUGH 0x00400000 /* Commit write operations immediately */ + +// Flags defined for "Batch" operations only -- ignored by DAPIRead, DAPIWrite +#define DAPI_YES_TO_ALL 0x00000100 /* Force "yes" response on any + user-prompt UI + (i.e., continue w/o proxy addresses, etc.) */ + +#define DAPI_SUPPRESS_PROGRESS 0x00000200 /* Suppress progress thermometer on batch operations. + Default is to display progress */ +#define DAPI_SUPPRESS_COMPLETION 0x00000400 /* Suppress completion notification message box on batch operations */ + +#define DAPI_SUPPRESS_ARCHIVES 0x00000800 /* Suppress creation of "archive" copies + of output files -- BatchImport and BatchExport only*/ + + + +// Flags defined for BatchExport +#define DAPI_EXPORT_MAILBOX 0x00001000 /* Export Mailbox recipients */ +#define DAPI_EXPORT_CUSTOM 0x00002000 /* Export remote address recipients */ +#define DAPI_EXPORT_DIST_LIST 0x00004000 /* Export Distribution Lists */ +#define DAPI_EXPORT_RECIPIENTS (DAPI_EXPORT_MAILBOX | DAPI_EXPORT_CUSTOM | DAPI_EXPORT_DIST_LIST) + /* Export all recipient objects */ + +#define DAPI_EXPORT_ALL_CLASSES 0x00008000 /* If this flag is set, all objects meeting other restrictions + (i.e., USN level, container scope, etc.) will be exported, + regardless of class */ + +#define DAPI_EXPORT_HIDDEN 0x00010000 /* Include Hidden objects in export. + Default is no export if Hide-From-Address-Book */ +#define DAPI_EXPORT_SUBTREE 0x00020000 /* Traverse the Directory Information Tree hierarchy, + exporting objects that meet the export restrictions */ +#define DAPI_EXPORT_BASEPOINT_ONLY 0x00040000 /* Export only the requested attributes from + the named BasePoint object. All other + export restrictions are ignored (class flags, + rgpszClasses, pszServerName). + This flag implies DAPI_SUPPRESS_PROGRESS + and DAPI_SUPPRESS_COMPLETION */ + +// Flags defined only for BatchImport +#define DAPI_OVERRIDE_SYNCH_STATE 0x00080000 /* Override server's synchronization status, + normally checked on BatchImport. + NOTE: This flag should normally NOT be set. + The normal behaviour is to prevent BatchImport + operations from possible conflict with directory + synchronization */ + + +// Flags defined only for DAPIRead +#define DAPI_READ_DEFINED_ATTRIBUTES 0x00100000 /* return all attributes that are set + for the current object. + This flag is ignored if pAttributes is specified. */ + +#define DAPI_READ_ALL_ATTRIBUTES 0x00200000 /* return all attributes that are defined + for the class of the current object. + This flag is ignored if pAttributes is specified. */ + + + // The following flags control NT Security management +#define DAPI_RESTRICT_ACCESS 0x01000000 /* Apply NT Security Descriptor to + created objects */ +#define DAPI_CREATE_NT_ACCOUNT 0x02000000 /* Create NT accounts + (valid only in Create/Modify mode) */ +#define DAPI_CREATE_RANDOM_PASSWORD 0x04000000 /* Generate random passwords for + created NT accounts. Ignored if DAPI_CREATE_NT_ACCOUNT + is not set */ + +#define DAPI_DELETE_NT_ACCOUNT 0x08000000 /* Delete ASSOC-NT-ACCOUNT when + deleting mailbox */ +// Flags defined only for DAPIWrite +#define DAPI_MODIFY_REPLACE_PROPERTIES 0x00800000 /* Append values to multi-value attributes when modifying */ + +#define DAPI_WRITE_UPDATE 0x10000000 /* Modify if object exists, create if it doesn't. + NOTE: This is the default mode */ +#define DAPI_WRITE_CREATE 0x20000000 /* Create object -- fail if object exists */ +#define DAPI_WRITE_MODIFY 0x30000000 /* Modify object -- fail if object does not exist */ +#define DAPI_WRITE_DELETE 0x40000000 /* Delete object */ +#define DAPI_WRITE_MODE_MASK 0x70000000 + + + +// Callback flags +#define DAPI_CALLBACK_CHAIN 0x00000001 /* If set in dwFlags field of the ERROR_CALLBACK + and the CALLBACKPROGRESS structures, the default + handler will be invoked after calling out to the + caller-supplied handler function, unless the user + function returns FALSE, indicating cancel. + NOTE: This flag is not defined for the EXPORT_CALLBACK + structure. + NOTE: This flag should not be set in the dwFlags + field of the main parameter block */ + + +// default delimiter values used when parsing the import file + +#define DAPI_DEFAULT_DELIMA ',' +#define DAPI_DEFAULT_QUOTEA '"' +#define DAPI_DEFAULT_MV_SEPA '%' +#define DAPI_DEFAULT_DELIMW L',' +#define DAPI_DEFAULT_QUOTEW L'"' +#define DAPI_DEFAULT_MV_SEPW L'%' + + +#define DAPI_CTRL_FILE_PTRA '=' +#define DAPI_CTRL_FILE_PTRW L'=' +#define DAPI_CTRL_META_CHARA '~' +#define DAPI_CTRL_META_CHARW L'~' +#define pszSubstServerA "~SERVER" +#define pszSubstServerW L"~SERVER" +#define cchSubstServer ((sizeof (pszSubstServerA) / sizeof(CHAR)) - 1) +#define pszDeleteKeyA "~DEL" +#define pszDeleteKeyW L"~DEL" +#define cchDeleteKey ((sizeof (pszDeleteKeyA) / sizeof(CHAR)) - 1) + +#define DAPI_UNICODE_FILE ((UINT)-1) + +#ifdef UNICODE + +#define DAPI_DEFAULT_DELIM DAPI_DEFAULT_DELIMW +#define DAPI_DEFAULT_QUOTE DAPI_DEFAULT_QUOTEW +#define DAPI_DEFAULT_MV_SEP DAPI_DEFAULT_MV_SEPW +#define DAPI_CTRL_FILE_PTR DAPI_CTRL_FILE_PTRW +#define DAPI_CTRL_META_CHAR DAPI_CTRL_META_CHARW +#define pszSubstServer pszSubstServerW +#define pszDeleteKey pszDeleteKeyW + +#else + +#define DAPI_DEFAULT_DELIM DAPI_DEFAULT_DELIMA +#define DAPI_DEFAULT_QUOTE DAPI_DEFAULT_QUOTEA +#define DAPI_DEFAULT_MV_SEP DAPI_DEFAULT_MV_SEPA +#define DAPI_CTRL_FILE_PTR DAPI_CTRL_FILE_PTRA +#define DAPI_CTRL_META_CHAR DAPI_CTRL_META_CHARA +#define pszSubstServer pszSubstServerA +#define pszDeleteKey pszDeleteKeyA + +#endif + + +/******************************************************************************* +* Batch Operation Progress Callback Function Definitions +* Pointers to functions of these types are provided by the caller via the +* CALLBACKPROGRESS structure in the Batch function parameter block +* +******************************************************************************** +* +* procedure : PDAPI_FInitProgress +* +* purpose : Initialize progress handler (possibly progress display dialog) +* +* parameters : lpvAppDefined value provided in the progress callback structure +* nMac Maximum Anticipated Calls. If non-zero, this indicates +* the number of progress events anticipated. +* If zero, the number of items to process is unknown, +* so the number of calls to UpdateProgress is indeterminate. +* +* returns : TRUE Indicates that all is well +* FALSE Could not initialize progress handler, cancel session. +* +******************************************************************************** +* +* procedure : PDAPI_FResetProgress +* +* purpose : Re-initialize progress handler (possibly reset progress bar) +* +* parameters : lpvAppDefined value provided in the progress callback structure +* nMac Maximum Anticipated Calls. If non-zero, this indicates +* the number of progress events anticipated. +* If zero, the number of items to process is unknown, +* so the number of calls to UpdateProgress is indeterminate. +* +* returns : TRUE Indicates that all is well +* FALSE Could not re-initialize progress handler, cancel session. +* +******************************************************************************** +* +* procedure : PDAPI_FEndProgress +* +* purpose : Terminate progress handler (possibly progress display dialog) +* +* parameters : lpvAppDefined value provided in the progress callback structure +* +* returns : TRUE Indicates that all is well +* FALSE Could not terminate progress handler, cancel session. +* +******************************************************************************** +* +* procedure : PDAPI_FUpdateProgress +* +* purpose : Completed processing item. Called to indicate time to increment +* progress display. +* +* parameters : lpvAppDefined value provided in the progress callback structure +* +* returns : TRUE Indicates that all is well +* FALSE Cancel session (i.e., cancel button pressed). +* +******************************************************************************** +* +* procedure : PDAPI_FUpdateProgressText +* +* purpose : Replace progress text area with provided text string +* +* parameters : lpvAppDefined value provided in the progress callback structure +* +* returns : TRUE Indicates that all is well +* FALSE Cancel session (i.e., cancel button pressed). +* +********************************************************************************/ +typedef BOOL (PASCAL * PDAPI_FInitProgress) + (LPVOID lpvAppDefined, INT nMac); +typedef BOOL (PASCAL * PDAPI_FUpdateProgress) + (LPVOID lpvAppDefined); +typedef BOOL (PASCAL * PDAPI_FEndProgress) + (LPVOID lpvAppDefined); +typedef BOOL (PASCAL * PDAPI_FResetProgress) + (LPVOID lpvAppDefined, INT nMac); +typedef BOOL (PASCAL * PDAPI_FUpdateProgressText) + (LPVOID lpvAppDefined, LPTSTR pszText); + +typedef struct CallBackProgressEntryPoints +{ + DWORD dwFlags; + LPVOID lpvAppDefined; + PDAPI_FInitProgress pfnInitProgress; + PDAPI_FUpdateProgress pfnUpdateProgress; + PDAPI_FEndProgress pfnEndProgress; + PDAPI_FResetProgress pfnResetProgress; + PDAPI_FUpdateProgressText pfnUpdateProgressText; +} CALLBACKPROGRESS, *PCALLBACKPROGRESS; + + + +// Values specified in the ulEvalTag field of the +// DAPI_ENTRY and EXPORT_CALLBACK structures +// +typedef enum _DAPI_EVAL +{ + VALUE_ARRAY = 0, // Each attribute has an entry in the array + // Text strings and object names exported as text + // Numerical values exported as numbers + // Binary data exported as binary string + TEXT_VALUE_ARRAY, // Each attribute has an entry in the array + // All values converted to text representation + TEXT_LINE // first item in the rgEntryValues array + // is a delimited text line +} DAPI_EVAL, *PDAPI_EVAL; + +typedef enum _EXP_TYPE_TAG +{ + EXPORT_HEADER = 0, // export item contains column headers + EXPORT_ENTRY // export item contains attribute values +} EXP_TYPE, * PEXP_TYPE; + + +typedef enum enumDAPI_DATA_TYPE +{ + DAPI_NO_VALUE = 0, + DAPI_STRING8, + DAPI_UNICODE, + DAPI_BINARY, + DAPI_INT, + DAPI_BOOL, +} DAPI_DATA_TYPE, * PDAPI_DATA_TYPE; + +#ifdef UNICODE +#define DAPI_TEXT DAPI_UNICODE +#else +#define DAPI_TEXT DAPI_STRING8 +#endif + +typedef union _DAPI_VALUE +{ + LPSTR pszA; + LPWSTR pszW; +#ifdef UNICODE + LPWSTR pszValue; +#else + LPSTR pszValue; +#endif + LPBYTE lpBinary; + INT iValue; + BOOL bool; +} DAPI_VALUE, * PDAPI_VALUE; + + + +// The ATT_VALUE structure contains a text representation of an attribute value +// A linked list of these structures is used for a multi-valued attribute +typedef struct _ATT_VALUE +{ + DAPI_DATA_TYPE DapiType; // How to evaluate DAPI_VALUE union + DAPI_VALUE Value; + UINT size; // size of the value -- + // # chars if string type + // else, # bytes + struct _ATT_VALUE * pNextValue; +} ATT_VALUE, * PATT_VALUE; + + +typedef struct _DAPI_ENTRY +{ + UINT unAttributes; // Number of attributes exported + DAPI_EVAL ulEvalTag; // rgEntryValues is interpreted based on this value + PATT_VALUE rgEntryValues; // if (ulEvalTag == TEXT_LINE) + // There is a single value, w/ delimited line + // else + // unAttributes, each w/ 1 or more value in list +} DAPI_ENTRY, * PDAPI_ENTRY; + +// Define type for address of application routine +// for call-back on each exported entry. +// Return value of FALSE indicates that export operation should be cancelled +typedef BOOL (PASCAL DAPI_FNExportEntry) ( + EXP_TYPE ExportDataType, // What type of data is being exported + LPVOID lpvAppDefined, // Application-defined parameter, + // passed in EXPORT_CALLBACK structure + // on initialization + PDAPI_ENTRY pExportEntry // pointer to exported entry data + // NOTE: Data in this structure + // will NOT remain valid after return + // from this function + ); +typedef DAPI_FNExportEntry * PDAPI_FNExportEntry; + +typedef struct _EXPORT_CALLBACK +{ + DWORD dwFlags; // Flags defined to control callback functionality + // See flag definitions below + DAPI_EVAL ulEvalTag; // Specifies data format on callback + LPVOID lpvAppDefined; // Application-defined field, passed as parm to callback + PDAPI_FNExportEntry pfnExportEntry; // Pointer to function called to process + // each exported entry + +} EXPORT_CALLBACK, * PEXPORT_CALLBACK; + + + +/******************************************************************************* +* procedure : pfnErrorCallback +* +* purpose : The following section defines structures for the error callback +* mechanism of the Batch Import APIs +* Events will be filtered based on the ControlfFlags set in the +* API parameter block +* +********************************************************************************/ + +// Define flags used for export callback + +// Define the maximum number of substitutions in a single event string +#define DAPI_MAX_SUBST 8 + + +typedef struct _DAPI_EVENTA +{ + DWORD dwDAPIError; // Message ID for event log + LPSTR rgpszSubst[DAPI_MAX_SUBST]; // Event message substitution array + UINT unSubst; // number of substitution strings + LPSTR pszAttribute; // Name of attribute specifically affected + // Note: may be NULL on some errors + LPSTR pszHoldLine; // point to buffer containing copy + // of current import line + HINSTANCE hinstDAPI; // Instance of DAPI DLL + struct _DAPI_EVENTA * pNextEvent; // Pointer to next event +} DAPI_EVENTA, *PDAPI_EVENTA; + +typedef struct _DAPI_EVENTW +{ + DWORD dwDAPIError; // Message ID for event log + LPWSTR rgpszSubst[DAPI_MAX_SUBST]; // Event message substitution array + UINT unSubst; // number of substitution strings + LPWSTR pszAttribute; // Name of attribute specifically affected + // Note: may be NULL on some errors + LPWSTR pszHoldLine; // point to buffer containing copy + // of current import line + HINSTANCE hinstDAPI; // Instance of DAPI DLL + struct _DAPI_EVENTW * pNextEvent; // Pointer to next event +} DAPI_EVENTW, *PDAPI_EVENTW; + +#ifdef UNICODE +typedef DAPI_EVENTW DAPI_EVENT; +typedef PDAPI_EVENTW PDAPI_EVENT; +#else +typedef DAPI_EVENTA DAPI_EVENT; +typedef PDAPI_EVENTA PDAPI_EVENT; +#endif + +// Define type for address of application routine +// for call-back on each error encountered. +// Return value of FALSE indicates that operation should be cancelled +typedef BOOL (PASCAL DAPI_FNErrorCallback) ( + LPVOID lpvAppDefined, // Application-defined parameter, + // passed in EXPORT_CALLBACK structure + // on initialization + PDAPI_EVENT pDapiEvent // Event information structure + // NOTE: Data in the event record + // will NOT remain valid after return + // from this function + ); +typedef DAPI_FNErrorCallback * PDAPI_FNErrorCallback; + + +typedef struct tagERROR_CALLBACK +{ + DWORD dwFlags; // Flags defined to control callback functionality + // See flag definitions above + LPVOID lpvAppDefined; // Application-defined field, passed back in callback + PDAPI_FNErrorCallback pfnErrorCallback; // Address of function that should be + // called on each error encountered + // If not supplied (NULL), default + // error handler is called, which + // writes the error into the + // NT Application event log + +} ERROR_CALLBACK, * PERROR_CALLBACK; + + + + + +/******************************************************************************* +* +* Batch Directory Import Interface definitions +* +********************************************************************************/ + +/******************************************************************************* +* procedure : DAPIUninitialize +* +* purpose : Notify DAPI that it is time to terminate background threads +* and such in preparation for process shutdown +* +* parameters : dwFlags combinable bits which may be set to control function +* +* returns : nothing +* +* created : 11/01/95 +* +* changes : +* +********************************************************************************/ +extern void APIENTRY DAPIUninitialize ( + DWORD dwFlags // Flags for call +); + + + +/******************************************************************************* +* procedure : SchemaPreload +* +* purpose : Called to perform asyncronous schema load. This entry point +* spawns a thread that initializes all the attribute and class +* tables for normal import/export operation. +* +* parameters : pSchemaPreloadParms pointer to SchemaPreloadParameter block +* +* returns : nothing +* +* history : +* +********************************************************************************/ +extern void APIENTRY SchemaPreloadA ( + DWORD dwFlags, // Flags used to control schema load. + LPSTR pszDSA // name of DSA from which to read schema +); + +extern void APIENTRY SchemaPreloadW ( + DWORD dwFlags, // Flags used to control schema load. + LPWSTR pszDSA // name of DSA from which to read schema +); + +#ifdef UNICODE +#define SchemaPreload SchemaPreloadW +#else +#define SchemaPreload SchemaPreloadA +#endif + +typedef struct _BIMPORT_PARMSW +{ + // NOTE: the order of the first three fields of this structure + // should NOT be changed. + DWORD dwDAPISignature; + DWORD dwFlags; // Bitmapped flags that control import action + HWND hwndParent; // Windows handle to use when displaying message boxes + LPWSTR pszImportFile; // Fully qualified pathname to Import Data file + // On Batch Import, objects are imported into + // the DIT from this file. + UINT uCodePage; // Code page specification for import file. + // The following values are interpreted: + // DAPI_UNICODE_FILE Import file is Unicode + // Will return error if file is ANSI + // 0 Auto-detect file type + // If ANSI, assume CP_ACP + // other File contains text in the + // specified code page + // Will return error if file is Unicode + // Will return error if code page is not + // supported by the system + LPWSTR pszDSAName; // Computer name of DSA to update + // Default: local DSA (if operating) + // if no local DSA, first DSA found + // on network is used + LPWSTR pszBasePoint; // DN of base-point in DIT for bulk operations + // Default values: + // if NULL, Messaging Site containing bound server + // if empty string, enterprise containing bound server + LPWSTR pszContainer; // RDN of default container under which + // to perform bulk import operations + // NOTE: This container is assumed to be + // at the level below that indicated by + // the pszBasePoint. If NULL, + // bulk operations will be performed at + // the level below BaseImportPoint. + // Container names specified in the + // import file will override this value. + WCHAR chColSep; // Column Separator -- + // DEFAULT_DELIM is used if this value is zero + WCHAR chQuote; // String enclosing character -- + // DEFAULT_QUOTE is used if this value is zero + WCHAR chMVSep; // Multi-value Property Separator -- + // DEFAULT_MV_SEP is used if this value is zero + WCHAR creserved; // alignment + CALLBACKPROGRESS ProgressCallBacks; // Progress call-back entry points + ERROR_CALLBACK ErrorCallback; + + LPWSTR pszNTDomain; // Name of NT Domain in which to lookup / create NT accounts. + // Defaults to current logon domain if NULL or empty + LPWSTR pszCreateTemplate; // DN of the Default User (NULL if none) from which + // to draw template values + +} BIMPORT_PARMSW, *PBIMPORT_PARMSW, *LPBIMPORT_PARMSW; + +typedef struct _BIMPORT_PARMSA +{ + // NOTE: the order of the first three fields of this structure + // should NOT be changed. + DWORD dwDAPISignature; + DWORD dwFlags; // Bitmapped flags that control import action + HWND hwndParent; // Windows handle to use when displaying message boxes + LPSTR pszImportFile; // Fully qualified pathname to Import Data file + // On Batch Import, objects are imported into + // the DIT from this file. + UINT uCodePage; // Code page specification for import file. + // The following values are interpreted: + // DAPI_UNICODE_FILE Import file is Unicode + // Will return error if file is ANSI + // 0 Auto-detect file type + // If ANSI, assume CP_ACP + // other File contains text in the + // specified code page + // Will return error if file is Unicode + // Will return error if code page is not + // supported by the system + LPSTR pszDSAName; // Computer name of DSA to update + // Default: local DSA (if operating) + // if no local DSA, first DSA found + // on network is used + LPSTR pszBasePoint; // DN of base-point in DIT for bulk operations + // Default values: + // if NULL, Messaging Site containing bound server + // if empty string, enterprise containing bound server + LPSTR pszContainer; // RDN of default container under which + // to perform bulk import operations + // NOTE: This container is assumed to be + // at the level below that indicated by + // the pszBasePoint. If NULL, + // bulk operations will be performed at + // the level below BaseImportPoint. + // Container names specified in the + // import file will override this value. + CHAR chColSep; // Column Separator -- + // DEFAULT_DELIM is used if this value is zero + CHAR chQuote; // String enclosing character -- + // DEFAULT_QUOTE is used if this value is zero + CHAR chMVSep; // Multi-value Property Separator -- + // DEFAULT_MV_SEP is used if this value is zero + CHAR creserved; // alignment + CALLBACKPROGRESS ProgressCallBacks; // Progress call-back entry points + ERROR_CALLBACK ErrorCallback; + + LPSTR pszNTDomain; // Name of NT Domain in which to lookup / create NT accounts. + // Defaults to current logon domain if NULL or empty + LPSTR pszCreateTemplate; // DN of the Default User (NULL if none) from which + // to draw template values + +} BIMPORT_PARMSA, *PBIMPORT_PARMSA, *LPBIMPORT_PARMSA; + +#ifdef UNICODE +typedef BIMPORT_PARMSW BIMPORT_PARMS; +typedef PBIMPORT_PARMSW PBIMPORT_PARMS; +typedef LPBIMPORT_PARMSW LPBIMPORT_PARMS; +#else +typedef BIMPORT_PARMSA BIMPORT_PARMS; +typedef PBIMPORT_PARMSA PBIMPORT_PARMS; +typedef LPBIMPORT_PARMSA LPBIMPORT_PARMS; +#endif + +// The BatchImport function provides single-call BatchImport from the +// specified import file. All import parameters are specified in the +// BIMPORT_PARMS structure pointed to by lpBimportParms. +// The return value indicates the number of errors logged in the +// NT Application log. Please note that this does not indicate +// success or failure of the Batch Import. +// UI and Logging of errors and warnings into the Application log +// are controlled through import parameters. +extern DWORD APIENTRY BatchImportW (LPBIMPORT_PARMSW lpBimportParms); +extern DWORD APIENTRY BatchImportA (LPBIMPORT_PARMSA lpBimportParms); + +#ifdef UNICODE +#define BatchImport BatchImportW +#else +#define BatchImport BatchImportA +#endif + +/******************************************************************************* +* +* Batch Directory Export Interface definitions +* +********************************************************************************/ + +typedef struct _BEXPORT_PARMSW +{ + DWORD dwDAPISignature; + DWORD dwFlags; // Bitmapped flags that control export action + HWND hwndParent; // Windows handle to use when displaying message boxes + LPWSTR pszExportFile; // Fully qualified pathname of file to export into + // Ignored if ExportCallback is specified + UINT uCodePage; // Code page specification for export file. + // The following values are interpreted: + // DAPI_UNICODE_FILE Export file is Unicode. + // Will return error + // if file exists and is ANSI + // 0 Auto-detect file type + // If file does not exist, + // export file will contain CP_ACP text. + // If file exists and is ANSI + // export file will contain CP_ACP text. + // If file exists and is Unicode, + // export file will contain Unicode + // other Export text to file in the + // specified code page + // Will return error + // if file exists and is Unicode + // Will return error if code page is not + // supported by the system + LPWSTR pszDSAName; // Computer name of DSA from which to export + // Default: local DSA (if operating) + // if no local DSA, first DSA found + // on network is used + LPWSTR pszBasePoint; // DN of base-point in DIT for bulk operations + // Default values: + // if NULL, Messaging Site containing bound server + // if empty string, enterprise containing bound server + LPWSTR pszContainer; // RDN of container from which to export objects + // NOTE: This container is assumed to be + // at the level below that indicated by + // the pszBasePoint. If NULL, + // the contents of all containers below + // the BaseImportPoint will be exported. + WCHAR chColSep; // Column Separator -- + // DEFAULT_DELIM is used if this value is zero + WCHAR chQuote; // String enclosing character -- + // DEFAULT_QUOTE is used if this value is zero + WCHAR chMVSep; // Multi-value Property Separator -- + // DEFAULT_MV_SEP is used if this value is zero + WCHAR cReserved; // alignment + + CALLBACKPROGRESS ProgressCallBacks; // Progress call-back entry points + ERROR_CALLBACK ErrorCallback; + EXPORT_CALLBACK ExportCallback; // Structure filled in by calling app to + // receive callback on each exported item + // NOTE: Callback functions are optional + // The default export function (write to file) + // will be called if these pointers are NULL + PDAPI_ENTRY pAttributes; // DAPI_ENTRY filled with names of attributes to export + // Optional if pszExportFile specified + // Required if ExportCallback specified + LPWSTR pszHomeServer; // Name of server for server-associated export + LPWSTR * rgpszClasses; // array of pointers to zero-terminated object classes to export + // The last entry must be NULL + // NOTE: The Directory will be queried for objects + // of the classes in the specified order. + ULONG ulUSNBase; // Base USN to use for export restriction. + // If non-zero, only items having USN-Changed >= ulUSNBase will be exported + LPVOID pReserved; // Reserved -- Must be zero + +} BEXPORT_PARMSW, *PBEXPORT_PARMSW, *LPBEXPORT_PARMSW; + +typedef struct _BEXPORT_PARMSA +{ + DWORD dwDAPISignature; + DWORD dwFlags; // Bitmapped flags that control export action + HWND hwndParent; // Windows handle to use when displaying message boxes + LPSTR pszExportFile; // Fully qualified pathname of file to export into + // Ignored if ExportCallback is specified + UINT uCodePage; // Code page specification for export file. + // The following values are interpreted: + // DAPI_UNICODE_FILE Export file is Unicode. + // Will return error + // if file exists and is ANSI + // 0 Auto-detect file type + // If file does not exist, + // export file will contain CP_ACP text. + // If file exists and is ANSI + // export file will contain CP_ACP text. + // If file exists and is Unicode, + // export file will contain Unicode + // other Export text to file in the + // specified code page + // Will return error + // if file exists and is Unicode + // Will return error if code page is not + // supported by the system + LPSTR pszDSAName; // Computer name of DSA from which to export + // Default: local DSA (if operating) + // if no local DSA, first DSA found + // on network is used + LPSTR pszBasePoint; // DN of base-point in DIT for bulk operations + // Default values: + // if NULL, Messaging Site containing bound server + // if empty string, enterprise containing bound server + LPSTR pszContainer; // RDN of container from which to export objects + // NOTE: This container is assumed to be + // at the level below that indicated by + // the pszBasePoint. If NULL, + // the contents of all containers below + // the BaseImportPoint will be exported. + CHAR chColSep; // Column Separator -- + // DEFAULT_DELIM is used if this value is zero + CHAR chQuote; // String enclosing character -- + // DEFAULT_QUOTE is used if this value is zero + CHAR chMVSep; // Multi-value Property Separator -- + // DEFAULT_MV_SEP is used if this value is zero + CHAR cReserved; // alignment + + CALLBACKPROGRESS ProgressCallBacks; // Progress call-back entry points + ERROR_CALLBACK ErrorCallback; + EXPORT_CALLBACK ExportCallback; // Structure filled in by calling app to + // receive callback on each exported item + // NOTE: Callback functions are optional + // The default export function (write to file) + // will be called if these pointers are NULL + PDAPI_ENTRY pAttributes; // DAPI_ENTRY filled with names of attributes to export + // Optional if pszExportFile specified + // Required if ExportCallback specified + LPSTR pszHomeServer; // Name of server for server-associated export + LPSTR * rgpszClasses; // array of pointers to zero-terminated object classes to export + // The last entry must be NULL + // NOTE: The Directory will be queried for objects + // of the classes in the specified order. + ULONG ulUSNBase; // Base USN to use for export restriction. + // If non-zero, only items having USN-Changed >= ulUSNBase will be exported + LPVOID pReserved; // Reserved -- Must be zero + +} BEXPORT_PARMSA, *PBEXPORT_PARMSA, *LPBEXPORT_PARMSA; + + +#ifdef UNICODE +typedef BEXPORT_PARMSW BEXPORT_PARMS; +typedef PBEXPORT_PARMSW PBEXPORT_PARMS; +typedef LPBEXPORT_PARMSW LPBEXPORT_PARMS; +#else +typedef BEXPORT_PARMSA BEXPORT_PARMS; +typedef PBEXPORT_PARMSA PBEXPORT_PARMS; +typedef LPBEXPORT_PARMSA LPBEXPORT_PARMS; +#endif + + + +// Batch Export entry points + +// The BatchExport function provides single-call BatchExport from the +// specified import file. All import parameters are specified in the +// BEXPORT_PARMS structure pointed to by lpBexportParms. +// The return value indicates the number of errors logged in the +// NT Application log. Please note that this does not indicate +// success or failure of the Batch Export. +// UI and Logging of errors and warnings into the Application log +// are controlled through import parameters. +extern DWORD APIENTRY BatchExportW (LPBEXPORT_PARMSW lpBexportParms); +extern DWORD APIENTRY BatchExportA (LPBEXPORT_PARMSA lpBexportParms); + +#ifdef UNICODE +#define BatchExport BatchExportW +#else +#define BatchExport BatchExportA +#endif + + +/******************************************************************************* +* +* Single-Object Interface definitions +* +********************************************************************************/ + +typedef struct _DAPI_PARMSW +{ + DWORD dwDAPISignature; + DWORD dwFlags; // Bitmapped flags that control import action + // See Import Control flags defined above. + LPWSTR pszDSAName; // Computer name of DSA to update + // Default: local DSA (if operating) + // if no local DSA, first DSA found + // on network is used + LPWSTR pszBasePoint; // DN of base-point in DIT for bulk operations + // Default values: + // if NULL, Messaging Site containing bound server + // if empty string, enterprise containing bound server + LPWSTR pszContainer; // RDN of default container under which + // to perform bulk import operations + // NOTE: This container is assumed to be + // at the level below that indicated by + // the pszBasePoint. If NULL, + // bulk operations will be performed at + // the level below BaseImportPoint. + // Container names specified in the + // import file will override this value. + LPWSTR pszNTDomain; // Name of NT Domain in which to lookup accounts + // and to create NT accounts. + // Current logon domain is used if NULL or empty string. + LPWSTR pszCreateTemplate;// DN of the template object used for default values + PDAPI_ENTRY pAttributes; // DAPI_ENTRY filled with default attribute list +} DAPI_PARMSW, *PDAPI_PARMSW, FAR *LPDAPI_PARMSW; + +typedef struct _DAPI_PARMSA +{ + DWORD dwDAPISignature; + DWORD dwFlags; // Bitmapped flags that control import action + // See Import Control flags defined above. + LPSTR pszDSAName; // Computer name of DSA to update + // Default: local DSA (if operating) + // if no local DSA, first DSA found + // on network is used + LPSTR pszBasePoint; // DN of base-point in DIT for bulk operations + // Default values: + // if NULL, Messaging Site containing bound server + // if empty string, enterprise containing bound server + LPSTR pszContainer; // RDN of default container under which + // to perform bulk import operations + // NOTE: This container is assumed to be + // at the level below that indicated by + // the pszBasePoint. If NULL, + // bulk operations will be performed at + // the level below BaseImportPoint. + // Container names specified in the + // import file will override this value. + LPSTR pszNTDomain; // Name of NT Domain in which to lookup accounts + // and to create NT accounts. + // Current logon domain is used if NULL or empty string. + LPSTR pszCreateTemplate; // DN of the template object used for default values + PDAPI_ENTRY pAttributes; // DAPI_ENTRY filled with default attribute list +} DAPI_PARMSA, *PDAPI_PARMSA, FAR *LPDAPI_PARMSA; + + +#ifdef UNICODE +typedef DAPI_PARMSW DAPI_PARMS; +typedef PDAPI_PARMSW PDAPI_PARMS; +typedef LPDAPI_PARMSW LPDAPI_PARMS; +#else +typedef DAPI_PARMSA DAPI_PARMS; +typedef PDAPI_PARMSA PDAPI_PARMS; +typedef LPDAPI_PARMSA LPDAPI_PARMS; +#endif + + +typedef LPVOID DAPI_HANDLE; +typedef LPVOID * PDAPI_HANDLE; +typedef LPVOID FAR * LPDAPI_HANDLE; + +#define DAPI_INVALID_HANDLE ((DAPI_HANDLE) -1) + + + +// DAPIStart initializes a DAPI session. +// for use by DAPIRead and DAPIWrite. The return value is 0 if no errors +// are encountered. A pointer to a DAPI_EVENT structure is returned if an +// error is encountered. +// NOTE: The DAPI_HANDLE must be returned via a call to DAPIEnd. +// If a non-NULL value is returned, its memory must be freed by +// a call to DAPIFreeMemory +extern PDAPI_EVENTW APIENTRY DAPIStartW (LPDAPI_HANDLE lphDAPISession, + LPDAPI_PARMSW lpDAPIParms); +extern PDAPI_EVENTA APIENTRY DAPIStartA (LPDAPI_HANDLE lphDAPISession, + LPDAPI_PARMSA lpDAPIParms); + +#ifdef UNICODE +#define DAPIStart DAPIStartW +#else +#define DAPIStart DAPIStartA +#endif + +// DAPIEnd invalidates the DAPI_HANDLE obtained by the call to DAPIStart. +// NOTE: There are no separate Unicode / Ansi entry points defined +extern void APIENTRY DAPIEnd (LPDAPI_HANDLE lphDAPISession); + + +// DAPIRead() Reads indicated attributes from the named Directory Object +// Parameters: +// Returned value: NULL indicates no difficulties encountered. +// Else, pointer to structure containing description of +// error(s) or warning(s) encountered. +// Must be freed by call to DAPIFreeMemory. +// hDAPISession DAPI Session handle obtained via InitDAPISession +// dwFlags control operation +// pszObjectName String containing name of object to read. +// If specified as RDN, combined w/ session's +// pszBasePoint and pszParentContainer. +// If specified w/ prefix of "/cn=", the string +// is concatenated to the session pszBasePoint. +// If specified w/ prefix of "/o=", the string +// is taken to be a fully-qualified DN. +// pAttList Pointer to DAPI_ENTRY structure containing names of +// attributes to read. The session default list is +// overridden for the present call only. +// ppValues Address of variable receiving pointer to DAPI_ENTRY +// structure containing the values read from the DIT entry. +// The pointer returned must be freed by call to +// DAPIFreeMemory. +// ppAttributes Address of variable receiving pointer to DAPI_ENTRY +// structure containing the names of attributes read +// from the DIT IFF DAPI_ALL_ATTRIBUTES or DAPI_LEGAL_ATTRIBUTES +// were set in dwFlags. +// The pointer returned must be freed by call to +// DAPIFreeMemory. +extern PDAPI_EVENTW APIENTRY DAPIReadW (DAPI_HANDLE hDAPISession, + DWORD dwFlags, + LPWSTR pszObjectName, + PDAPI_ENTRY pAttList, + PDAPI_ENTRY * ppValues, + PDAPI_ENTRY * ppAttributes); +extern PDAPI_EVENTA APIENTRY DAPIReadA (DAPI_HANDLE hDAPISession, + DWORD dwFlags, + LPSTR pszObjectName, + PDAPI_ENTRY pAttList, + PDAPI_ENTRY * ppValues, + PDAPI_ENTRY * ppAttributes); + +#ifdef UNICODE +#define DAPIRead DAPIReadW +#else +#define DAPIRead DAPIReadA +#endif + + +// DAPIWrite() +// Perform the indicated write operation on the named object +// Returned value: NULL indicates no difficulties encountered. +// Else, pointer to structure containing description of +// error(s) or warning(s) encountered. +// Must be freed by call to DAPIFreeMemory. +// Parameters: +// hDAPISession DAPI Session handle obtained via InitDAPISession +// dwFlags Operational control +// pAttributes Pointer to DAPI_ENTRY structure containing names of +// attributes to write. The session default list is +// used if this parameter is NULL +// pValues Pointer to DAPI_ENTRY structure containing the values +// to set on the DIT entry. +// lpulUSN Optional: Address of variable receiving USN of updated +// DIT entry. May be specified as NULL to suppress this +// return value. +// lppszCreatedAccount Address receiving pointer to name of created NT account +// lppszPassword Address receiving pointer to password generated if +// NT Account is created. +extern PDAPI_EVENTW APIENTRY DAPIWriteW (DAPI_HANDLE hDAPISession, + DWORD dwFlags, + PDAPI_ENTRY pAttributes, + PDAPI_ENTRY pValues, + PULONG lpulUSN, + LPWSTR * lppszCreatedAccount, + LPWSTR * lppszPassword); +extern PDAPI_EVENTA APIENTRY DAPIWriteA (DAPI_HANDLE hDAPISession, + DWORD dwFlags, + PDAPI_ENTRY pAttributes, + PDAPI_ENTRY pValues, + PULONG lpulUSN, + LPSTR * lppszCreatedAccount, + LPSTR * lppszPassword); +#ifdef UNICODE +#define DAPIWrite DAPIWriteW +#else +#define DAPIWrite DAPIWriteA +#endif + + +/******************************************************************************* +* procedure : DAPIAllocBuffer +* +* purpose : Allocate buffer, logically linking it to the pvAllocBase +* The first buffer in logically linked set of allocations must be +* freed by call to DAPIFreeMemory +* +* parameters : cbSize dword containing size of allocation request (in bytes) +* pvAllocBase base for logical linking of allocated block +* May be NULL +* If non-NULL, must be a block previously allocated +* by DAPIAllocBuffer or returned by DAPI function +* +* returns : ptr to allocated block +* +* history : +* +********************************************************************************/ +extern LPVOID APIENTRY DAPIAllocBuffer (DWORD cbSize, LPVOID pvAllocBase); + + +/******************************************************************************* +* procedure : DAPIFreeMemory +* +* purpose : Release memory allocated for structures returned by DAPI calls. +* +* parameters : lpVoid pointer to block to free +* +* returns : nothing +* +* history : +* +********************************************************************************/ +extern void APIENTRY DAPIFreeMemory (LPVOID lpVoid); + + +/* + * NetUserList interface definitions + */ +// When getting callbacks from NTExport / NWExport, these indices +// can be used to interpret the value array returned in the callback +// >>>> NOTE: These indices are NOT valid for Bexport callback! <<<< +#define NET_CLASS 0 +#define NET_COMMON_NAME 1 +#define NET_DISPLAY_NAME 2 +#define NET_HOME_SERVER 3 +#define NET_COMMENT 4 /* NTExport only */ + +#define NTEXP_ENTRY_COUNT 5 /* number of parts in NT User export */ +#define NWEXP_ENTRY_COUNT 4 /* number of parts in NetWare user export */ + + + +/******************************************************************************* +* +* NTIMPORT Interface definitions +* +********************************************************************************/ + +typedef struct _NTEXPORT_PARMSW +{ + DWORD dwDAPISignature; + DWORD dwFlags; // Bitmapped flags that control the user export + HWND hwndParent; // Windows handle to use when displaying message boxes + LPWSTR pszExportFile; // Name of file to create + // Ignored if using callbacks + CALLBACKPROGRESS ProgressCallBacks;// Progress call-back entry points + ERROR_CALLBACK ErrorCallback; + EXPORT_CALLBACK ExportCallback; // Structure filled in by calling app to + // receive callback on each exported item + // NOTE: Callback functions are optional + // The default export function (write to file) + // will be called if these pointers are NULL + LPWSTR pszDCName; // Name of Domain Controller from which to get users + // NOTE: Specification of Domain Controller overrides + // the NTDomain + LPWSTR pszNTDomain; // Name of Domain from which to read users + // If neither pszNTDomain and pszDCName are specified, + // users are extracted from the current login domain +} NTEXPORT_PARMSW, *PNTEXPORT_PARMSW, FAR *LPNTEXPORT_PARMSW; + +typedef struct _NTEXPORT_PARMSA +{ + DWORD dwDAPISignature; + DWORD dwFlags; // Bitmapped flags that control the user export + HWND hwndParent; // Windows handle to use when displaying message boxes + LPSTR pszExportFile; // Name of file to create + // Ignored if using callbacks + CALLBACKPROGRESS ProgressCallBacks;// Progress call-back entry points + ERROR_CALLBACK ErrorCallback; + EXPORT_CALLBACK ExportCallback; // Structure filled in by calling app to + // receive callback on each exported item + // NOTE: Callback functions are optional + // The default export function (write to file) + // will be called if these pointers are NULL + LPSTR pszDCName; // NOTE: Specification of Domain Controller overrides + // the NTDomain + // Name of Domain from which to read users + LPSTR pszNTDomain; // If neither pszNTDomain and pszDCName are specified, + // users are extracted from the current login domain + +} NTEXPORT_PARMSA, *PNTEXPORT_PARMSA, FAR *LPNTEXPORT_PARMSA; + +#ifdef UNICODE +typedef NTEXPORT_PARMSW NTEXPORT_PARMS; +typedef PNTEXPORT_PARMSW PNTEXPORT_PARMS; +typedef LPNTEXPORT_PARMSW LPNTEXPORT_PARMS; +#else +typedef NTEXPORT_PARMSA NTEXPORT_PARMS; +typedef PNTEXPORT_PARMSA PNTEXPORT_PARMS; +typedef LPNTEXPORT_PARMSA LPNTEXPORT_PARMS; +#endif + +extern DWORD APIENTRY NTExportW (LPNTEXPORT_PARMSW pNTExportParms); +extern DWORD APIENTRY NTExportA (LPNTEXPORT_PARMSA pNTExportParms); + +#ifdef UNICODE +#define NTExport NTExportW +#else +#define NTExport NTExportA +#endif + + +/******************************************************************************* +* +* NWIMPORT Interface definitions +* +********************************************************************************/ + +typedef struct _NWEXPORT_PARMSW +{ + DWORD dwDAPISignature; + DWORD dwFlags; // Bitmapped flags that control the user export + HWND hwndParent; // Windows handle to use when displaying message boxes + LPWSTR pszExportFile; // Name of file to create + // Ignored if using callbacks + CALLBACKPROGRESS ProgressCallBacks;// Progress call-back entry points + ERROR_CALLBACK ErrorCallback; + EXPORT_CALLBACK ExportCallback; // Structure filled in by calling app to + // receive callback on each exported item + // NOTE: Callback functions are optional + // The default export function (write to file) + // will be called if these pointers are NULL + LPWSTR pszFileServer; // Name of the file server to connect to + LPWSTR pszUserName; // User Name -- Must have administrator priviliges + LPWSTR pszPassword; // Password to connect to the server +} NWEXPORT_PARMSW, *PNWEXPORT_PARMSW, *LPNWEXPORT_PARMSW; + +typedef struct _NWEXPORT_PARMSA +{ + DWORD dwDAPISignature; + DWORD dwFlags; // Bitmapped flags that control the user export + HWND hwndParent; // Windows handle to use when displaying message boxes + LPSTR pszExportFile; // Name of file to create + // Ignored if using callbacks + CALLBACKPROGRESS ProgressCallBacks;// Progress call-back entry points + ERROR_CALLBACK ErrorCallback; + EXPORT_CALLBACK ExportCallback; // Structure filled in by calling app to + // receive callback on each exported item + // NOTE: Callback functions are optional + // The default export function (write to file) + // will be called if these pointers are NULL + LPSTR pszFileServer; // Name of the file server to connect to + LPSTR pszUserName; // User Name -- Must have administrator priviliges + LPSTR pszPassword; // Password to connect to the server +} NWEXPORT_PARMSA, *PNWEXPORT_PARMSA, *LPNWEXPORT_PARMSA; + +#ifdef UNICODE +typedef NWEXPORT_PARMSW NWEXPORT_PARMS; +typedef PNWEXPORT_PARMSW PNWEXPORT_PARMS; +typedef LPNWEXPORT_PARMSW LPNWEXPORT_PARMS; +#else +typedef NWEXPORT_PARMSA NWEXPORT_PARMS; +typedef PNWEXPORT_PARMSA PNWEXPORT_PARMS; +typedef LPNWEXPORT_PARMSA LPNWEXPORT_PARMS; +#endif + +extern DWORD APIENTRY NWExportW (LPNWEXPORT_PARMSW pNWExportParms); +extern DWORD APIENTRY NWExportA (LPNWEXPORT_PARMSA pNWExportParms); + +#ifdef UNICODE +#define NWExport NWExportW +#else +#define NWExport NWExportA +#endif + + +// Definitions for the DAPIGetSiteInfo call + +typedef struct _NAME_INFOA +{ + LPSTR pszName; // Simple object name + LPSTR pszDNString; // DN of object + LPSTR pszDisplayName; // Display name of object +} NAME_INFOA, *PNAME_INFOA; + +typedef struct _NAME_INFOW +{ + LPWSTR pszName; // Simple object name + LPWSTR pszDNString; // DN of object + LPWSTR pszDisplayName; // Display name of object +} NAME_INFOW, *PNAME_INFOW; + +typedef struct _PSITE_INFOA +{ + LPSTR pszCountry; // Country code + NAME_INFOA objServer; // Name information for server + NAME_INFOA objSite; // Name information for site containing server + NAME_INFOA objEnterprise; // Name information for enterprise containing server +} SITE_INFOA, *PSITE_INFOA; + +typedef struct _PSITE_INFOW +{ + LPWSTR pszCountry; // Country code + NAME_INFOW objServer; // Name information for server + NAME_INFOW objSite; // Name information for site containing server + NAME_INFOW objEnterprise; // Name information for enterprise containing server +} SITE_INFOW, *PSITE_INFOW; + +#ifdef UNICODE +typedef NAME_INFOW NAME_INFO; +typedef PNAME_INFOW PNAME_INFO; +typedef SITE_INFOW SITE_INFO; +typedef PSITE_INFOW PSITE_INFO; +#else +typedef NAME_INFOA NAME_INFO; +typedef PNAME_INFOA PNAME_INFO; +typedef SITE_INFOA SITE_INFO; +typedef PSITE_INFOA PSITE_INFO; +#endif + +extern PDAPI_EVENTA APIENTRY DAPIGetSiteInfoA ( + DWORD dwFlags, // Flags for request + LPSTR pszDSA, // name of DSA from which to get information + PSITE_INFOA * ppSiteInfo // Address receiving pointer to pSiteInfo structure + // containing return data +); + +extern PDAPI_EVENTW APIENTRY DAPIGetSiteInfoW ( + DWORD dwFlags, // Flags for request + LPWSTR pszDSA, // name of DSA from which to get information + PSITE_INFOW * ppSiteInfo // Address receiving pointer to pSiteInfo structure + // containing return dataname of DSA from which to read schema +); + +#ifdef UNICODE +#define DAPIGetSiteInfo DAPIGetSiteInfoW +#else +#define DAPIGetSiteInfo DAPIGetSiteInfoA +#endif + + + +#ifdef __cplusplus +} +#endif + +#endif // _DAPI_INCLUDED diff --git a/private/utils/wizards/addusrw/exch.cpp b/private/utils/wizards/addusrw/exch.cpp new file mode 100644 index 000000000..1edbb8042 --- /dev/null +++ b/private/utils/wizards/addusrw/exch.cpp @@ -0,0 +1,177 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + Exch.cpp : implementation file + + CPropertyPage support for User mgmt wizard + +File History: + + JonY Apr-96 created + +--*/ + +#include "stdafx.h" +#include "speckle.h" +#include "Exch.h" + +#include "sadapi.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + + + + + + + +///////////////////////////////////////////////////////////////////////////// +// CExch property page + +IMPLEMENT_DYNCREATE(CExch, CPropertyPage) + +CExch::CExch() : CPropertyPage(CExch::IDD) +{ + //{{AFX_DATA_INIT(CExch) + m_csDomainName = _T(""); + m_csServerName = _T(""); + //}}AFX_DATA_INIT +} + +CExch::~CExch() +{ +} + +void CExch::DoDataExchange(CDataExchange* pDX) +{ + CPropertyPage::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CExch) + DDX_Text(pDX, IDC_STATIC_DOMAIN, m_csDomainName); + DDX_Text(pDX, IDC_SERVERNAME_EDIT, m_csServerName); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CExch, CPropertyPage) + //{{AFX_MSG_MAP(CExch) + ON_WM_SHOWWINDOW() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CExch message handlers + +LRESULT CExch::OnWizardNext() +{ + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + + UpdateData(TRUE); + if (m_csServerName == L"") + { + AfxMessageBox(IDS_NO_EXCH_SERVER); + GetDlgItem(IDC_SERVERNAME_EDIT)->SetFocus(); + return -1; + } + + pApp->m_csExchangeServer = m_csServerName; + return IDD_RESTRICTIONS_DIALOG; + +} + +LRESULT CExch::OnWizardBack() +{ + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + + if (pApp->m_bNW) return IDD_FPNW_DLG; + else if (pApp->m_bRAS) return IDD_RAS_PERM_DIALOG; + else if (pApp->m_bHomeDir) return IDD_HOMEDIR_DIALOG; + else if (pApp->m_bLoginScript) return IDD_LOGON_SCRIPT_DIALOG; + else if (pApp->m_bProfile) return IDD_PROFILE; + else return IDD_OPTIONS_DIALOG; + +} + + +void CExch::OnShowWindow(BOOL bShow, UINT nStatus) +{ + CPropertyPage::OnShowWindow(bShow, nStatus); + + if (bShow) + { + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + m_csDomainName = pApp->m_csDomain; + UpdateData(FALSE); + +// bind to the first Exch server +/* PRPCBINDINFO pBindInfo = new RPCBINDINFO; + ZeroMemory(pBindInfo, sizeof(RPCBINDINFO)); + + TCHAR wszServer[256]; +// ZeroMemory(wszServer, 256); + _tcscpy(wszServer, L""); + + RPC_SC rVal = SAD_ScBind(pBindInfo, wszServer); + if (rVal != ERROR_SUCCESS) + { + AfxMessageBox(L"cant bind"); + return; + } + +// using the first server, enumerate the rest + BackupListNode* BackupNode = NULL; + rVal = SAD_ScGetBackupListNodeW(pBindInfo->wszServer, &BackupNode); + + SAD_FreeBackupListNode(BackupNode); + SAD_Unbind(pBindInfo); + + delete pBindInfo; */ + + + /* + RPC_NS_HANDLE ic; + RPC_STATUS rpcstat; + RPC_BINDING_HANDLE h; + BackupListNode * pBLN = NULL; + +#define szRPCEntryNameSAA L"/.:/MSExchangeSAA" + + // create context for looking up entries in the RPC name service + rpcstat = RpcNsBindingImportBegin(RPC_C_NS_SYNTAX_DEFAULT, + szRPCEntryNameSAA, + TriggerBackupRPC_ClientIfHandle, + NULL, + &ic); + + if (rpcstat == RPC_S_OK) + { + do + { + FreeBackupListNode(pBLN); + pBLN = NULL; + + // bind to a server somewhere out there + rpcstat = RpcNsBindingImportNext(ic, &h); + if (rpcstat == RPC_S_OK) + { + // bind successful - try to get the list of servers + RPC_SC rVal = ScGetBackupListNode(h, &pBLN); + RpcBindingFree(&h); + if (pBLN != NULL) + { + ASSERT(0); + break; + } + } + } + while (rpcstat != RPC_S_NO_MORE_BINDINGS); + RpcNsBindingImportDone(&ic); + } */ + } +} diff --git a/private/utils/wizards/addusrw/exch.h b/private/utils/wizards/addusrw/exch.h new file mode 100644 index 000000000..bcc364a90 --- /dev/null +++ b/private/utils/wizards/addusrw/exch.h @@ -0,0 +1,57 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + Exch.h : header file + +File History: + + JonY Apr-96 created + +--*/ + + +///////////////////////////////////////////////////////////////////////////// +// CExch dialog + +class CExch : public CPropertyPage +{ + DECLARE_DYNCREATE(CExch) + +// Construction +public: + CExch(); + ~CExch(); + +// Dialog Data + //{{AFX_DATA(CExch) + enum { IDD = IDD_EXCHANGE_DIALOG }; + CString m_csDomainName; + CString m_csServerName; + //}}AFX_DATA + + +// Overrides + // ClassWizard generate virtual function overrides + //{{AFX_VIRTUAL(CExch) + public: + virtual LRESULT OnWizardNext(); + virtual LRESULT OnWizardBack(); + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +private: + CString m_csDomain; + +// Implementation +protected: + // Generated message map functions + //{{AFX_MSG(CExch) + afx_msg void OnShowWindow(BOOL bShow, UINT nStatus); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + +}; diff --git a/private/utils/wizards/addusrw/finish.cpp b/private/utils/wizards/addusrw/finish.cpp new file mode 100644 index 000000000..1d41c7470 --- /dev/null +++ b/private/utils/wizards/addusrw/finish.cpp @@ -0,0 +1,794 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + Finish.cpp : implementation file + + CPropertyPage support for User mgmt wizard + +File History: + + JonY Apr-96 created + +--*/ + + +#include "stdafx.h" +#include "Speckle.h" +#include "wizbased.h" +#include "Finish.h" +#include "transbmp.h" + +#include +#include +#include + +typedef long NTSTATUS; + +#include "usrprop.h" +#include +#include "dapi.h" + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +typedef ULONG (*SWAPOBJECTID) (ULONG); +typedef ULONG (*MAPRIDTOOBJECTID) (DWORD, LPWSTR, BOOL, BOOL); +typedef NTSTATUS (*GETREMOTENCPSECRETKEY) (PUNICODE_STRING, CHAR *); +typedef NTSTATUS (*RETURNNETWAREFORM)(const char *, DWORD, const WCHAR *, UCHAR *); +typedef NTSTATUS (*SETUSERPROPERTY)(LPWSTR, LPWSTR, UNICODE_STRING, WCHAR, LPWSTR*, BOOL*); + +typedef DWORD (*RASADMINGETUSERACCOUNTSERVER)(const WCHAR*, const WCHAR*, LPWSTR); +typedef DWORD (*RASADMINUSERSETINFO)(const WCHAR*, const WCHAR*, const PRAS_USER_0); + +typedef DWORD (*BATCHIMPORT) (LPBIMPORT_PARMSW); + +///////////////////////////////////////////////////////////////////////////// +// CFinish property page + +IMPLEMENT_DYNCREATE(CFinish, CWizBaseDlg) + +CFinish::CFinish() : CWizBaseDlg(CFinish::IDD) +{ + //{{AFX_DATA_INIT(CFinish) + m_csCaption = _T(""); + //}}AFX_DATA_INIT +} + +CFinish::~CFinish() +{ +} + +void CFinish::DoDataExchange(CDataExchange* pDX) +{ + CPropertyPage::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CFinish) + DDX_Text(pDX, IDC_STATIC1, m_csCaption); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CFinish, CWizBaseDlg) + //{{AFX_MSG_MAP(CFinish) + ON_WM_SHOWWINDOW() + ON_WM_PAINT() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CFinish message handlers +BOOL CFinish::OnInitDialog() +{ + CPropertyPage::OnInitDialog(); + + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +LRESULT CFinish::OnWizardBack() +{ + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + pApp->m_cps1.SetWizardButtons(PSWIZB_BACK | PSWIZB_NEXT); + + if (pApp->m_bNW & pApp->m_bEnableRestrictions) return IDD_NWLOGON_DIALOG; + else if (pApp->m_bWorkstation & pApp->m_bEnableRestrictions) return IDD_LOGONTO_DLG; + else if (pApp->m_bHours & pApp->m_bEnableRestrictions) return IDD_HOURS_DLG; + else if (pApp->m_bExpiration & pApp->m_bEnableRestrictions) return IDD_ACCOUNT_EXP_DIALOG; + return IDD_RESTRICTIONS_DIALOG; + +} + +BOOL CFinish::OnWizardFinish() +{ + CString csSuccess, csTemp; + + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + + CWaitCursor wait; + + TCHAR* pDomainServer = pApp->m_csServer.GetBuffer(pApp->m_csServer.GetLength()); + + PUSER_INFO_3 pui1 = (PUSER_INFO_3)VirtualAlloc(NULL, sizeof(_USER_INFO_3), MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); + + pui1->usri3_name = pApp->m_csUserName.GetBuffer(pApp->m_csUserName.GetLength()); + pui1->usri3_password = pApp->m_csPassword1.GetBuffer(pApp->m_csPassword1.GetLength()); + pui1->usri3_priv = USER_PRIV_USER; + pui1->usri3_comment = pApp->m_csDescription.GetBuffer(pApp->m_csDescription.GetLength()); + pui1->usri3_flags = dwPasswordFlags(); +// availability hours - has to stay here to get the proper defaults! + if (pApp->m_bHours) pui1->usri3_logon_hours = NULL; + + DWORD dwRet; + NET_API_STATUS napi = NetUserAdd((unsigned short*)pDomainServer, (DWORD)1, (unsigned char*)pui1, &dwRet); + VirtualFree(pui1, 0, MEM_RELEASE | MEM_DECOMMIT); + if (napi != 0) + { + csTemp.LoadString(IDS_NO_NEW_USER); + csSuccess.Format(csTemp, pApp->m_csFullName, pApp->m_csUserName); + if (AfxMessageBox(csSuccess, MB_YESNO | MB_ICONEXCLAMATION) == IDYES) + { + pApp->m_cps1.SetActivePage(0); + return FALSE; + } + else return TRUE; + } + +// set local group memberships + short sGroupCount = pApp->m_csaSelectedLocalGroups.GetSize(); + short sCount; + CString csVal; + for (sCount = 0; sCount < sGroupCount; sCount++) + { + csVal = pApp->m_csaSelectedLocalGroups.GetAt(sCount); + if (!bAddLocalGroups(csVal.GetBuffer(csVal.GetLength()))) + { + AfxMessageBox(IDS_NO_LOCAL_GROUP); + break; + } + } + +// set global group memberships + sGroupCount = pApp->m_csaSelectedGlobalGroups.GetSize(); + for (sCount = 0; sCount < sGroupCount; sCount++) + { + csVal = pApp->m_csaSelectedGlobalGroups.GetAt(sCount); + if (!bAddGlobalGroups(csVal.GetBuffer(csVal.GetLength()))) + { + AfxMessageBox(IDS_NO_GLOBAL_GROUP); + break; + } + } + + pApp->m_csUserName.ReleaseBuffer(); + pApp->m_csPassword1.ReleaseBuffer(); + pApp->m_csDescription.ReleaseBuffer(); + +// more information to be set + PUSER_INFO_3 pui2 = (PUSER_INFO_3)VirtualAlloc(NULL, sizeof(_USER_INFO_3), MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); + + napi = NetUserGetInfo((unsigned short*)pDomainServer, + pApp->m_csUserName.GetBuffer(pApp->m_csUserName.GetLength()), + 3, + (LPBYTE*)&pui2); + + if (napi != ERROR_SUCCESS) goto failure; + + if (pApp->m_bHours) pui2->usri3_logon_hours = pApp->m_pHours; + +// full name + pui2->usri3_full_name = pApp->m_csFullName.GetBuffer(pApp->m_csFullName.GetLength()); + pApp->m_csFullName.ReleaseBuffer(); + +// seconds till expiration + if (pApp->m_bExpiration) pui2->usri3_acct_expires = pApp->m_dwExpirationDate; + + if (pApp->m_bLoginScript) + { + pui2->usri3_script_path = pApp->m_csLogonScript.GetBuffer(pApp->m_csLogonScript.GetLength()); + pApp->m_csLogonScript.ReleaseBuffer(); + } + + if (pApp->m_bHomeDir) + { + pui2->usri3_home_dir = pApp->m_csHomeDir.GetBuffer(pApp->m_csHomeDir.GetLength()); + pApp->m_csHomeDir.ReleaseBuffer(); + } + + if (pApp->m_bProfile) + { + pui2->usri3_profile = pApp->m_csProfilePath.GetBuffer(pApp->m_csProfilePath.GetLength()); + pApp->m_csProfilePath.ReleaseBuffer(); + } + +// home dir drive + if (pApp->m_bHomeDir) + { + pui2->usri3_home_dir_drive = pApp->m_csHome_dir_drive.GetBuffer(pApp->m_csHome_dir_drive.GetLength()); + pApp->m_csHome_dir_drive.ReleaseBuffer(); + } + +// available workstations + if (pApp->m_bWorkstation) + { + pui2->usri3_workstations = pApp->m_csAllowedMachines.GetBuffer(pApp->m_csAllowedMachines.GetLength()); + pApp->m_csAllowedMachines.ReleaseBuffer(); + } + + if (pApp->m_bMust_Change_PW) pui2->usri3_password_expired = 1; + +// primary group id //accept the default! will become domain users. + pui2->usri3_primary_group_id = DOMAIN_GROUP_RID_USERS; + + DWORD dwBuf; + napi = NetUserSetInfo((unsigned short*)pDomainServer, + pApp->m_csUserName.GetBuffer(pApp->m_csUserName.GetLength()), + 3, + (LPBYTE)pui2, + &dwBuf); + + VirtualFree(pui2, 0, MEM_RELEASE | MEM_DECOMMIT); + if (napi != ERROR_SUCCESS) goto failure; + +// NetWare compatible? + if (pApp->m_bNW) + { + TCHAR* pUsername = pApp->m_csUserName.GetBuffer(pApp->m_csUserName.GetLength()); + pApp->m_csUserName.ReleaseBuffer(); + + // get NWSETINFO fn + HINSTANCE hLib = LoadLibrary(L"fpnwclnt.dll"); + SETUSERPROPERTY pSetUserProperty = (SETUSERPROPERTY)GetProcAddress(hLib, "SetUserProperty"); + + UNICODE_STRING uString; + BOOL bRet; + +// first set the password + CString ucPW = pApp->m_csPassword1; + ucPW.MakeUpper(); + UCHAR* pNWPW = (UCHAR*)malloc(16); + ULONG ulRet = ReturnNetwareEncryptedPassword(pui2->usri3_user_id, + pui2->usri3_name, + pApp->m_bDomain, + (LPCTSTR)ucPW, + pNWPW); + + if (ulRet != 0) + { + AfxMessageBox(IDS_NW_PW_ERROR); + goto failure; + } + + try + { + uString.Length = NWENCRYPTEDPASSWORDLENGTH * sizeof(WCHAR); + uString.MaximumLength = NWENCRYPTEDPASSWORDLENGTH * sizeof(WCHAR); + uString.Buffer = (PWCHAR)pNWPW; + + bRet = SetUserParam(uString, NWPASSWORD); + } + catch(...) + { + AfxMessageBox(IDS_NW_PW_ERROR); + goto failure; + } + +// grace logins - allowed + try + { + uString.Length = 2; + uString.MaximumLength = 2; + uString.Buffer = &pApp->m_sNWRemainingGraceLogins; + bRet = SetUserParam(uString, GRACELOGINREMAINING); + + uString.Buffer = &pApp->m_sNWAllowedGraceLogins; + bRet = SetUserParam(uString, GRACELOGINALLOWED); + } + catch(...) + { + AfxMessageBox(IDS_NW_GRACELOGIN_ERROR); + goto failure; + } + +// concurrent connections + try + { + uString.Length = 2; + uString.MaximumLength = 2; + uString.Buffer = &pApp->m_sNWConcurrentConnections; + + bRet = SetUserParam(uString, MAXCONNECTIONS); + } + catch(...) + { + AfxMessageBox(IDS_NW_CONCON_ERROR); + goto failure; + } + +// set allowed machines + try + { + TCHAR* pNWWks = pApp->m_csAllowedLoginFrom.GetBuffer(pApp->m_csAllowedLoginFrom.GetLength()); + pApp->m_csAllowedLoginFrom.ReleaseBuffer(); + + if (SetNWWorkstations(pNWWks) != ERROR_SUCCESS) + { + AfxMessageBox(IDS_NOFP_WS); + goto failure; + } + } + catch(...) + { + AfxMessageBox(IDS_NOFP_WS); + goto failure; + } + +// all done? + FreeLibrary(hLib); + if (pNWPW != NULL) free(pNWPW); + } + +// RAS + HINSTANCE hLib; + if ((hLib = LoadLibrary(L"rassapi.dll")) != NULL && pApp->m_bRAS) + { + RASADMINGETUSERACCOUNTSERVER pRasAdminGetUserAccountServer = (RASADMINGETUSERACCOUNTSERVER)GetProcAddress(hLib, "RasAdminGetUserAccountServer"); + RASADMINUSERSETINFO pRasAdminUserSetInfo = (RASADMINUSERSETINFO)GetProcAddress(hLib, "RasAdminUserSetInfo"); + + TCHAR pAccount[30]; + TCHAR* pDomain = pApp->m_csDomain.GetBuffer(pApp->m_csDomain.GetLength()); + pApp->m_csDomain.ReleaseBuffer(); + + DWORD dwErr = pRasAdminGetUserAccountServer(pDomain, pDomainServer, pAccount); + + PRAS_USER_0 pBit = (PRAS_USER_0)malloc(sizeof(_RAS_USER_0) + 1); +ZeroMemory(pBit, sizeof(RAS_USER_0)); + pBit->bfPrivilege = 0; + +// this is always set since they selected RAS in the first place + pBit->bfPrivilege |= RASPRIV_DialinPrivilege; + + switch(pApp->m_sCallBackType) + { + case 0: + pBit->bfPrivilege |= RASPRIV_NoCallback; + break; + + case 1: + pBit->bfPrivilege |= RASPRIV_CallerSetCallback; + break; + + case 2: + pBit->bfPrivilege |= RASPRIV_AdminSetCallback; + _tcscpy(pBit->szPhoneNumber, (LPCTSTR)pApp->m_csRasPhoneNumber); + break; + } + + dwErr = pRasAdminUserSetInfo(pAccount, pui1->usri3_name, pBit); + if (dwErr != ERROR_SUCCESS) + { + AfxMessageBox(IDS_RAS_ERROR); +DWORD dd = GetLastError(); +CString cs; +cs.Format(L"getlasterror = %d, dwerr = %d", dd, dwErr); +AfxMessageBox(cs); + goto failure; + } + + FreeLibrary(hLib); + free(pBit); + } + + +// exchange? + if (pApp->m_bExchange) + { +// pApp->m_csExchangeServer = L"IRIS2"; + // first create the script file + TCHAR lpPath[MAX_PATH]; + UINT ui = GetTempFileName(L".", L"auw", 0, lpPath); + if (ui == 0) + goto failure; + + HANDLE hFile = CreateFile(lpPath, + GENERIC_READ | GENERIC_WRITE, + 0, + NULL, + CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL, + NULL); + + if (hFile == INVALID_HANDLE_VALUE) + goto failure; + + TCHAR pHeader[] = L"OBJ-CLASS, Common-Name, Home-Server, Comment, Hide-from-address-book, Display-name\n\r"; + DWORD dwLen = _tcslen(pHeader) * sizeof(TCHAR); + DWORD dwBytesWritten; + BOOL bVal = WriteFile(hFile, + pHeader, + dwLen, + &dwBytesWritten, + NULL); + + if (!bVal) + goto failure; + + // now write the user's info + CString csExchangeVal; + csExchangeVal.Format(L"MAILBOX, %s, %s, %s, 0, %s", + pApp->m_csUserName, + pApp->m_csExchangeServer, + pApp->m_csDescription, + pApp->m_csFullName); + + bVal = WriteFile(hFile, + (LPCTSTR)csExchangeVal, + csExchangeVal.GetLength() * sizeof(TCHAR), + &dwBytesWritten, + NULL); + + if (!bVal) + goto failure; + + // batch import function + BIMPORT_PARMSW* pBImport = (BIMPORT_PARMSW*)malloc(sizeof(BIMPORT_PARMSW) * sizeof(TCHAR)); + ZeroMemory(pBImport, sizeof(BIMPORT_PARMSW) * sizeof(TCHAR)); + + pBImport->dwDAPISignature = DAPI_SIGNATURE; + pBImport->dwFlags = DAPI_YES_TO_ALL | DAPI_SUPPRESS_PROGRESS | + DAPI_SUPPRESS_COMPLETION | DAPI_SUPPRESS_ARCHIVES; + pBImport->hwndParent = GetSafeHwnd(); + pBImport->pszImportFile = lpPath; // path to filename + pBImport->uCodePage = DAPI_UNICODE_FILE; // UNICODE file + pBImport->pszDSAName = pApp->m_csExchangeServer.GetBuffer(pApp->m_csExchangeServer.GetLength()); // this is the exchange server we are adding to + pApp->m_csExchangeServer.ReleaseBuffer(); + pBImport->pszBasePoint = NULL; + pBImport->pszContainer = L"Recipients"; + pBImport->chColSep = DAPI_DEFAULT_DELIMW; // default column sep + pBImport->chQuote = DAPI_DEFAULT_QUOTEW; // default quote mark + pBImport->chMVSep = DAPI_DEFAULT_MV_SEPW; // multi value column sep + pBImport->pszNTDomain = pApp->m_csDomain.GetBuffer(pApp->m_csDomain.GetLength());// Domain to lookup accounts in + pApp->m_csDomain.ReleaseBuffer(); + pBImport->pszCreateTemplate = NULL; // template user + + HINSTANCE hExLib = LoadLibrary(L"dapi.dll"); + if (hExLib == NULL) + goto failure; + + BATCHIMPORT pBatchImport = (BATCHIMPORT)GetProcAddress(hExLib, "BatchImportW@4"); + if (pBatchImport == NULL) + goto failure; + + CloseHandle(hFile);// have to close the file before exch can see it + DWORD dw = pBatchImport(pBImport); + +// don't forget to delete the tmp file + FreeLibrary(hExLib); + DeleteFile(lpPath); + free(pBImport); + + if (dw != ERROR_SUCCESS) goto failure; + } + + if (pApp->m_csFullName != L"") + { + csTemp.LoadString(IDS_SUCCESS); + csSuccess.Format(csTemp, pApp->m_csFullName, pApp->m_csUserName); + } + else + { + csTemp.LoadString(IDS_SUCCESS2); + csSuccess.Format(csTemp, pApp->m_csUserName); + } + + if (AfxMessageBox(csSuccess, MB_YESNO | MB_ICONEXCLAMATION) == IDYES) + { + pApp->m_cps1.SetWizardButtons(PSWIZB_NEXT); + pApp->m_cps1.SetActivePage(0); + pApp->m_bPRSReset = TRUE; + pApp->m_bPWReset = TRUE; +// pApp->m_bGReset = TRUE; + return FALSE; + } + else return TRUE; + +failure: + if (pApp->m_csFullName != L"") + { + csTemp.LoadString(IDS_BAD_USER_DATA); + csSuccess.Format(csTemp, pApp->m_csFullName, pApp->m_csUserName); + } + else + { + csTemp.LoadString(IDS_BAD_USER_DATA2); + csSuccess.Format(csTemp, pApp->m_csUserName); + } + + csSuccess.Format(csTemp, pApp->m_csFullName, pApp->m_csUserName); + if (AfxMessageBox(csSuccess, MB_YESNO | MB_ICONEXCLAMATION) == IDYES) + { + pApp->m_cps1.SetWizardButtons(PSWIZB_NEXT); + pApp->m_cps1.SetActivePage(0); + pApp->m_bPRSReset = TRUE; + pApp->m_bPWReset = TRUE; + + return FALSE; + } + else return TRUE; + +} + +DWORD CFinish::dwPasswordFlags() +{ + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + + DWORD dwFlags = UF_SCRIPT; + + if (pApp->m_bDisabled) dwFlags |= UF_ACCOUNTDISABLE; + if (!pApp->m_bChange_Password) dwFlags |= UF_PASSWD_CANT_CHANGE; + if (pApp->m_bPW_Never_Expires) dwFlags |= UF_DONT_EXPIRE_PASSWD; + + return dwFlags; + +} + +BOOL CFinish::bAddLocalGroups(LPWSTR lpwGroupName) +{ + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + TCHAR* pDomainServer = pApp->m_csServer.GetBuffer(pApp->m_csServer.GetLength()); + + LOCALGROUP_MEMBERS_INFO_3 localgroup_members; + + localgroup_members.lgrmi3_domainandname = pApp->m_csUserName.GetBuffer(pApp->m_csUserName.GetLength()); + + DWORD err = NetLocalGroupAddMembers( (unsigned short*)pDomainServer, /* PDC name */ + lpwGroupName, /* group name */ + 3, /* passing in name */ + (LPBYTE)&localgroup_members, /* Buffer */ + 1 ); /* count passed in */ + + pApp->m_csUserName.ReleaseBuffer(); + pApp->m_csServer.ReleaseBuffer(); + + if (err != 0) return FALSE; + return TRUE; +} + +BOOL CFinish::bAddGlobalGroups(LPTSTR lpwGroupName) +{ + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + TCHAR* pDomainServer = pApp->m_csServer.GetBuffer(pApp->m_csServer.GetLength()); + + DWORD dwErr = NetGroupAddUser((LPTSTR)pDomainServer, + lpwGroupName, + pApp->m_csUserName.GetBuffer(pApp->m_csUserName.GetLength())); + + pApp->m_csUserName.ReleaseBuffer(); + pApp->m_csServer.ReleaseBuffer(); + + if ((dwErr != 0) && (dwErr != 2236)) return FALSE; + return TRUE; +} + + + +ULONG +CFinish::ReturnNetwareEncryptedPassword(DWORD UserId, + LPWSTR pszUserName, + BOOL bDomain, + LPCTSTR clearTextPassword, + UCHAR* NetwareEncryptedPassword ) // 16 byte encrypted password +{ + char lsaSecret[20]; + NTSTATUS status; + ULONG objectId; + + HINSTANCE hLib = LoadLibrary(L"fpnwclnt.dll"); + if (hLib == NULL) return 1; + +// if this is a server, modify the User ID: + if (bDomain) UserId |= 0x10000000; + +// get lsa key from GetNcpSecretKey + GETREMOTENCPSECRETKEY pGetRemoteNcpSecretKey = (GETREMOTENCPSECRETKEY)GetProcAddress(hLib, "GetRemoteNcpSecretKey"); + if (pGetRemoteNcpSecretKey == NULL) return 1; + + UNICODE_STRING usServer; + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + usServer.Length = pApp->m_csServer.GetLength() * sizeof(WCHAR); + usServer.MaximumLength = pApp->m_csServer.GetLength() * sizeof(WCHAR); + usServer.Buffer = pApp->m_csServer.GetBuffer(pApp->m_csServer.GetLength()); + pApp->m_csServer.ReleaseBuffer(); + + status = (*pGetRemoteNcpSecretKey)( &usServer, lsaSecret ); + if (status != ERROR_SUCCESS) return 1; + +// Convert rid to object id + MAPRIDTOOBJECTID pMapRidToObjectId = (MAPRIDTOOBJECTID)GetProcAddress(hLib, "MapRidToObjectId"); + if (pMapRidToObjectId == NULL) return 1; + + objectId = (*pMapRidToObjectId)( UserId, pszUserName, bDomain, FALSE ); + +// now get the password + RETURNNETWAREFORM pReturnNetwareForm = (RETURNNETWAREFORM)GetProcAddress(hLib, "ReturnNetwareForm"); + if (pReturnNetwareForm == NULL) return 1; + + try + { + status = (*pReturnNetwareForm)( lsaSecret, + objectId, + clearTextPassword, + NetwareEncryptedPassword); + } + catch(...) + { + FreeLibrary(hLib); + return 1L; + } + + // clean up + FreeLibrary(hLib); + + return 0L; + +} + + +BOOL CFinish::SetUserParam(UNICODE_STRING uString, LPWSTR lpwProp) +{ +// get existing prop value + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + TCHAR* pUsername = pApp->m_csUserName.GetBuffer(pApp->m_csUserName.GetLength()); + pApp->m_csUserName.ReleaseBuffer(); + + TCHAR* pServer = pApp->m_csServer.GetBuffer(pApp->m_csServer.GetLength()); + pApp->m_csServer.ReleaseBuffer(); + + PUSER_INFO_3 pui2 = (PUSER_INFO_3)VirtualAlloc(NULL, sizeof(_USER_INFO_3), MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); + + NET_API_STATUS napi = NetUserGetInfo(pServer, + pUsername, + 3, + (LPBYTE*)&pui2); + +// set NW prop + HINSTANCE hLib = LoadLibrary(L"fpnwclnt.dll"); + SETUSERPROPERTY pSetUserProperty = (SETUSERPROPERTY)GetProcAddress(hLib, "SetUserProperty"); + + LPWSTR lpNewProp = NULL; + BOOL bUpdate; + + NTSTATUS status = (*pSetUserProperty)((LPWSTR)pui2->usri3_parms, + (LPWSTR)lpwProp, + uString, + USER_PROPERTY_TYPE_ITEM, + &lpNewProp, + &bUpdate); + + if (status != ERROR_SUCCESS) return FALSE; + +// reset user prop + DWORD dwBuf; + if (bUpdate) + { + pui2->usri3_parms = lpNewProp; + napi = NetUserSetInfo(pServer, + pUsername, + 3, + (LPBYTE)pui2, + &dwBuf); + + } + + if (lpNewProp != NULL) LocalFree(lpNewProp); + VirtualFree(pui2, 0, MEM_RELEASE | MEM_DECOMMIT); + FreeLibrary(hLib); + return TRUE; + +} + +void CFinish::OnShowWindow(BOOL bShow, UINT nStatus) +{ + CWizBaseDlg::OnShowWindow(bShow, nStatus); + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + + if (bShow) + { + pApp->m_cps1.SetWizardButtons(PSWIZB_BACK | PSWIZB_FINISH); + + CString csTemp; + csTemp.LoadString(IDS_FINISH_CAPTION); + + CString csTemp2; + csTemp2.Format(csTemp, pApp->m_csUserName); + m_csCaption = csTemp2; + UpdateData(FALSE); + } +// else pApp->m_cps1.SetWizardButtons(PSWIZB_BACK | PSWIZB_NEXT); + +} + +/******************************************************************* + + NAME: USER_NW::SetNWWorkstations + + SYNOPSIS: Store NetWare allowed workstation addresses to UserParms + If pchNWWorkstations is NULL, this function will delete + "NWLgonFrom" field from UserParms. + + EXIT: + + HISTORY: + CongpaY 01-Oct-93 Created. + +********************************************************************/ + +DWORD CFinish::SetNWWorkstations( const TCHAR * pchNWWorkstations) +{ + DWORD err = ERROR_SUCCESS; + UNICODE_STRING uniNWWorkstations; + CHAR * pchTemp = NULL; + + if (pchNWWorkstations == NULL) + { + uniNWWorkstations.Buffer = NULL; + uniNWWorkstations.Length = 0; + uniNWWorkstations.MaximumLength = 0; + } + else + { + BOOL fDummy; + INT nStringLength = lstrlen(pchNWWorkstations) + 1; + pchTemp = (CHAR *) LocalAlloc (LPTR, nStringLength); + + if ( pchTemp == NULL ) + err = ERROR_NOT_ENOUGH_MEMORY; + + if ( err == ERROR_SUCCESS && + !WideCharToMultiByte (CP_ACP, + 0, + pchNWWorkstations, + nStringLength, + pchTemp, + nStringLength, + NULL, + &fDummy)) + { + err = ::GetLastError(); + } + + if ( err == ERROR_SUCCESS ) + { + uniNWWorkstations.Buffer = (WCHAR *) pchTemp; + uniNWWorkstations.Length = nStringLength; + uniNWWorkstations.MaximumLength = nStringLength; + } + } + + if (!SetUserParam(uniNWWorkstations, NWLOGONFROM)) err = 1; + else err = ERROR_SUCCESS; + + if (pchTemp != NULL) + { + LocalFree (pchTemp); + } + + return err; +} + +void CFinish::OnPaint() +{ + CPaintDC dc(this); // device context for painting + + CTransBmp* pBitmap = new CTransBmp; + pBitmap->LoadBitmap(IDB_ENDFLAG); + + pBitmap->DrawTrans(&dc, 0,0); + delete pBitmap; + +} diff --git a/private/utils/wizards/addusrw/finish.h b/private/utils/wizards/addusrw/finish.h new file mode 100644 index 000000000..5d712ca33 --- /dev/null +++ b/private/utils/wizards/addusrw/finish.h @@ -0,0 +1,81 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + Finish.h : header file + +File History: + + JonY Apr-96 created + +--*/ + + +// Finish.h : header file +// + +///////////////////////////////////////////////////////////////////////////// +// CFinish dialog + +// these will have to be revised for NTBUILD +typedef struct _UNICODE_STRING { + USHORT Length; + USHORT MaximumLength; +#ifdef MIDL_PASS + [size_is(MaximumLength / 2), length_is((Length) / 2) ] USHORT * Buffer; +#else // MIDL_PASS + PWSTR Buffer; +#endif // MIDL_PASS +} UNICODE_STRING; +typedef UNICODE_STRING *PUNICODE_STRING; + + +class CFinish : public CWizBaseDlg +{ + DECLARE_DYNCREATE(CFinish) + +// Construction +public: + CFinish(); + ~CFinish(); + virtual BOOL OnWizardFinish(); +// Dialog Data + //{{AFX_DATA(CFinish) + enum { IDD = IDD_FINISH }; + CString m_csCaption; + //}}AFX_DATA + + DWORD dwPasswordFlags(); + BOOL bAddLocalGroups(LPWSTR lpwGroupName); + BOOL bAddGlobalGroups(LPWSTR lpwGroupName); + LRESULT OnWizardBack(); + + + ULONG ReturnNetwareEncryptedPassword(DWORD UserId, + LPWSTR pszUserName, + BOOL bDomain, + LPCTSTR clearTextPassword, + UCHAR* NetwareEncryptedPassword ); // 16 byte encrypted password + + BOOL SetUserParam(UNICODE_STRING uString, LPWSTR lpwProp); + DWORD SetNWWorkstations( const TCHAR * pchNWWorkstations); +// Overrides + // ClassWizard generate virtual function overrides + //{{AFX_VIRTUAL(CFinish) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + // Generated message map functions + //{{AFX_MSG(CFinish) + virtual BOOL OnInitDialog(); + afx_msg void OnShowWindow(BOOL bShow, UINT nStatus); + afx_msg void OnPaint(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + +}; diff --git a/private/utils/wizards/addusrw/fpinfo.cpp b/private/utils/wizards/addusrw/fpinfo.cpp new file mode 100644 index 000000000..48324503e --- /dev/null +++ b/private/utils/wizards/addusrw/fpinfo.cpp @@ -0,0 +1,179 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + FPInfo.cpp : implementation file + + CPropertyPage support for User mgmt wizard + +File History: + + JonY Apr-96 created + +--*/ + + +#include "stdafx.h" +#include "speckle.h" +#include "wizbased.h" +#include "FPInfo.h" + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CFPInfo property page + +IMPLEMENT_DYNCREATE(CFPInfo, CWizBaseDlg) + +CFPInfo::CFPInfo() : CWizBaseDlg(CFPInfo::IDD) +{ + //{{AFX_DATA_INIT(CFPInfo) + m_nGraceLogins = 0; + m_nConcurrentConnections = 0; + m_csCaption = _T(""); + m_sAllowedGraceLogins = 6; + m_sConcurrentConnections = 1; + //}}AFX_DATA_INIT +} +CFPInfo::~CFPInfo() +{ +} + +void CFPInfo::DoDataExchange(CDataExchange* pDX) +{ + CPropertyPage::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CFPInfo) + DDX_Control(pDX, IDC_CONCURRENT_CONNECTIONS_SPIN, m_sbConconSpin); + DDX_Control(pDX, IDC_GRACE_LOGIN_SPIN, m_sbGraceLogins); + DDX_Radio(pDX, IDC_GRACE_LOGIN_RADIO, m_nGraceLogins); + DDX_Radio(pDX, IDC_CONCURRENT_CONNECTIONS_RADIO1, m_nConcurrentConnections); + DDX_Text(pDX, IDC_STATIC1, m_csCaption); + DDX_Text(pDX, IDC_ALLOWED_GRACE_LOGINS_EDIT, m_sAllowedGraceLogins); + DDV_MinMaxUInt(pDX, m_sAllowedGraceLogins, 0, 200); + DDX_Text(pDX, IDC_CONCURRENT_CONNECTIONS_EDIT, m_sConcurrentConnections); + DDV_MinMaxUInt(pDX, m_sConcurrentConnections, 1, 1000); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CFPInfo, CWizBaseDlg) + //{{AFX_MSG_MAP(CFPInfo) + ON_BN_CLICKED(IDC_GRACE_LOGIN_RADIO, OnGraceLoginRadio) + ON_BN_CLICKED(IDC_GRACE_LOGIN_RADIO2, OnGraceLoginRadio2) + ON_BN_CLICKED(IDC_CONCURRENT_CONNECTIONS_RADIO1, OnConcurrentConnectionsRadio) + ON_BN_CLICKED(IDC_CONCURRENT_CONNECTIONS_RADIO2, OnConcurrentConnectionsRadio2) + ON_WM_SHOWWINDOW() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CFPInfo message handlers + +// Disable the contents of the group control +void CFPInfo::OnGraceLoginRadio() +{ + m_nGraceLogins = 0; + GetDlgItem(IDC_ALLOWED_GRACE_LOGINS_EDIT)->EnableWindow(FALSE); + GetDlgItem(IDC_GRACE_LOGIN_SPIN)->EnableWindow(FALSE); + +} + +// Enable the contents of the group control +void CFPInfo::OnGraceLoginRadio2() +{ + m_nGraceLogins = 1; + GetDlgItem(IDC_ALLOWED_GRACE_LOGINS_EDIT)->EnableWindow(TRUE); + GetDlgItem(IDC_GRACE_LOGIN_SPIN)->EnableWindow(TRUE); + + m_sbGraceLogins.SetRange(0,200); + +} + +BOOL CFPInfo::OnInitDialog() +{ + CWizBaseDlg::OnInitDialog(); + +// set group box defaults + GetDlgItem(IDC_ALLOWED_GRACE_LOGINS_EDIT)->EnableWindow(FALSE); + GetDlgItem(IDC_GRACE_LOGIN_SPIN)->EnableWindow(FALSE); + + GetDlgItem(IDC_CONCURRENT_CONNECTIONS_EDIT)->EnableWindow(FALSE); + GetDlgItem(IDC_CONCURRENT_CONNECTIONS_SPIN)->EnableWindow(FALSE); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +// disable +void CFPInfo::OnConcurrentConnectionsRadio() +{ + GetDlgItem(IDC_CONCURRENT_CONNECTIONS_EDIT)->EnableWindow(FALSE); + GetDlgItem(IDC_CONCURRENT_CONNECTIONS_SPIN)->EnableWindow(FALSE); +} + +// enable +void CFPInfo::OnConcurrentConnectionsRadio2() +{ + GetDlgItem(IDC_CONCURRENT_CONNECTIONS_EDIT)->EnableWindow(TRUE); + GetDlgItem(IDC_CONCURRENT_CONNECTIONS_SPIN)->EnableWindow(TRUE); + m_sbConconSpin.SetRange(1, 1000); +} + +LRESULT CFPInfo::OnWizardNext() +{ + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + UpdateData(TRUE); + + if (m_nGraceLogins != 0) // limited + { + pApp->m_sNWAllowedGraceLogins = m_sAllowedGraceLogins; + pApp->m_sNWRemainingGraceLogins = m_sAllowedGraceLogins; + } + else // unlimited + { + pApp->m_sNWAllowedGraceLogins = 0x6; + pApp->m_sNWRemainingGraceLogins = 0xff; + } + + if (m_nConcurrentConnections == 0) pApp->m_sNWConcurrentConnections = 0xffff; + else pApp->m_sNWConcurrentConnections = m_sConcurrentConnections; + + if (pApp->m_bExchange) return IDD_EXCHANGE_DIALOG; + else return IDD_RESTRICTIONS_DIALOG; + +} + +LRESULT CFPInfo::OnWizardBack() +{ + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + if (pApp->m_bRAS) return IDD_RAS_PERM_DIALOG; + else if (pApp->m_bHomeDir) return IDD_HOMEDIR_DIALOG; + else if (pApp->m_bLoginScript) return IDD_LOGON_SCRIPT_DIALOG; + else if (pApp->m_bProfile) return IDD_PROFILE; + else return IDD_OPTIONS_DIALOG; + +} + +void CFPInfo::OnShowWindow(BOOL bShow, UINT nStatus) +{ + CWizBaseDlg::OnShowWindow(bShow, nStatus); + + if (bShow) + { + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + + CString csTemp; + csTemp.LoadString(IDS_FPNW_CAPTION); + + CString csTemp2; + csTemp2.Format(csTemp, pApp->m_csUserName); + m_csCaption = csTemp2; + UpdateData(FALSE); + } + +} diff --git a/private/utils/wizards/addusrw/fpinfo.h b/private/utils/wizards/addusrw/fpinfo.h new file mode 100644 index 000000000..74ac16799 --- /dev/null +++ b/private/utils/wizards/addusrw/fpinfo.h @@ -0,0 +1,65 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + FPInfo.h : header file + +File History: + + JonY Apr-96 created + +--*/ + + +///////////////////////////////////////////////////////////////////////////// +// CFPInfo dialog + +class CFPInfo : public CWizBaseDlg +{ + DECLARE_DYNCREATE(CFPInfo) + +// Construction +public: + CFPInfo(); + ~CFPInfo(); + +// Dialog Data + //{{AFX_DATA(CFPInfo) + enum { IDD = IDD_FPNW_DLG }; + CSpinButtonCtrl m_sbConconSpin; + CSpinButtonCtrl m_sbGraceLogins; + BOOL m_bExpireNWPassword; + int m_nGraceLogins; + int m_nConcurrentConnections; + CString m_csCaption; + UINT m_sAllowedGraceLogins; + UINT m_sConcurrentConnections; + //}}AFX_DATA + + +// Overrides + // ClassWizard generate virtual function overrides + //{{AFX_VIRTUAL(CFPInfo) + public: + virtual LRESULT OnWizardNext(); + virtual LRESULT OnWizardBack(); + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + // Generated message map functions + //{{AFX_MSG(CFPInfo) + afx_msg void OnGraceLoginRadio(); + afx_msg void OnGraceLoginRadio2(); + virtual BOOL OnInitDialog(); + afx_msg void OnConcurrentConnectionsRadio(); + afx_msg void OnConcurrentConnectionsRadio2(); + afx_msg void OnShowWindow(BOOL bShow, UINT nStatus); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + +}; diff --git a/private/utils/wizards/addusrw/fpnwcomm.h b/private/utils/wizards/addusrw/fpnwcomm.h new file mode 100644 index 000000000..8c3509199 --- /dev/null +++ b/private/utils/wizards/addusrw/fpnwcomm.h @@ -0,0 +1,307 @@ +/*++ + +Copyright (c) 1993-1995 Microsoft Corporation + +Module Name: + + nw\inc\ncmcomm.h + +Abstract: + + This module contains common constants and types for the NCP server. + +Author: + + Shawn Walker (vswalk) 06-17-1993 + Andy Herron (andyhe) + +Revision History: + +--*/ + +#ifndef _NCPCOMM_ +#define _NCPCOMM_ + +// +// signature for pserver +// +#define NCP_PSERVER_SIGNATURE L"PS_" + +// +// well known object IDs +// +#define NCP_WELL_KNOWN_SUPERVISOR_ID (ULONG) 0x00000001 +#define NCP_WELL_KNOWN_SUPERVISOR_ID_SWAPPED (ULONG) 0x01000000 +#define NCP_WELL_KNOWN_SUPERVISOR_ID_CHICAGO (ULONG) 0x00010000 +#define NCP_WELL_KNOWN_PSERVER_ID (ULONG) 0x00000002 + +// +// misc macros that are useful +// +#define SWAPWORD(w) ((WORD)((w & 0xFF) << 8)|(WORD)(w >> 8)) +#define SWAPLONG(l) MAKELONG(SWAPWORD(HIWORD(l)),SWAPWORD(LOWORD(l))) + +#define SWAP_OBJECT_ID(id) (id == NCP_WELL_KNOWN_SUPERVISOR_ID) ? \ + NCP_WELL_KNOWN_SUPERVISOR_ID_SWAPPED : \ + MAKELONG(LOWORD(id),SWAPWORD(HIWORD(id))) + +#define UNSWAP_OBJECT_ID(id) (id == NCP_WELL_KNOWN_SUPERVISOR_ID_SWAPPED || id == NCP_WELL_KNOWN_SUPERVISOR_ID_CHICAGO) ?\ + NCP_WELL_KNOWN_SUPERVISOR_ID : \ + MAKELONG(LOWORD(id),SWAPWORD(HIWORD(id))) + + +// +// misc masks/bits for Object ID munging +// + +#define BINDLIB_ID_MASK 0xF0000000 + +#define BINDLIB_NCP_SAM 0x00000000 + +// +// This bit is set when the server is running on a NTAS machine or +// the object is from a trusted domain. +// +// !! Note that there are places where we check this bit to see if either +// !! BINDLIB_REMOTE_DOMAIN_BIAS or BINDLIB_LOCAL_USER_BIAS is set. +// + +#define BINDLIB_REMOTE_DOMAIN_BIAS 0x10000000 + +// +// If the client is from the builtin domain, this bit will be set. This +// is opposed to the local domain, which is different. +// + +#define BINDLIB_BUILTIN_BIAS 0x20000000 + +// +// If the client is from a trusted domain and the rid is from the +// local domain and the client's rid is the same as the rid from the +// sid, we will mark that the rid is the same as the local user's sid. +// +// !! Note... this is a value, not a flag. This will require special casing +// !! everywhere but we can't spare any more bits. +// + +#define BINDLIB_LOCAL_USER_BIAS 0x70000000 + +// +// User defined objects that is stored in the registry. +// + +#define BINDLIB_NCP_USER_DEFINED 0x40000000 + +// +// Print Queues and Print Servers that is stored in the registry. +// The bindery keeps a list of print queues in a link list so that +// the bindery does not have to go look in the registry all the time. +// + +#define BINDLIB_NCP_REGISTRY 0x80000000 + +// +// The SAP Agent uses these bits. The SAP Agent cannot go any higher +// than the value below. +// + +#define BINDLIB_NCP_SAP 0xC0000000 +#define BINDLIB_NCP_MAX_SAP 0xCFFFFFFF + +// +// We have some reserved fields for unknown users that will go into the +// following range.... +// + +#define NCP_UNKNOWN_USER 0xD0000000 +#define NCP_SAME_RID_AS_CLIENT_BUT_LOCAL 0xDFFFFFFF +#define NCP_USER_IS_CONNECTED_BUT_REMOTE(connid) (0xD0000000 | (connid)) +#define NCP_WELL_KNOWN_RID(rid) (0xD1000000 | (rid)) + +// +// Chicago will use a range of object ids that start at the below value +// and go to 0xFFFFFFFF. We should never see these on our server when +// a chicago server is passing through to us. +// + +#define BINDLIB_CHICAGO 0xE0000000 + +// +// This is used to remove the domain bias from a object id. +// + +#define BINDLIB_MASK_OUT_DOMAIN_BIAS 0x70000000 + + +#define NCP_INITIAL_SEARCH (ULONG) 0xFFFFFFFF +#define NCP_ANY_TARGET_SERVER (ULONG) 0xFFFFFFFF + +#define NCP_OBJECT_HAS_PROPERTIES (UCHAR) 0xFF +#define NCP_OBJECT_HAS_NO_PROPERTIES (UCHAR) 0 + +#define NCP_PROPERTY_HAS_VALUE (UCHAR) 0xFF +#define NCP_PROPERTY_HAS_NO_VALUE (UCHAR) 0 + +#define NCP_MORE_PROPERTY (UCHAR) 0xFF +#define NCP_NO_MORE_PROPERTY (UCHAR) 0 + +#define NCP_MORE_SEGMENTS (UCHAR) 0xFF +#define NCP_NO_MORE_SEGMENTS (UCHAR) 0 + +#define NCP_DO_REMOVE_REMAINING_SEGMENTS (UCHAR) 0 +#define NCP_DO_NOT_REMOVE_REMAINING_SEGMENTS (UCHAR) 0xFF + + +/*++ +******************************************************************* + Maximum length for the Bindery +******************************************************************* +--*/ + +#define NETWARE_OBJECTNAMELENGTH 47 +#define NETWARE_PROPERTYNAMELENGTH 16 +#define NETWARE_PROPERTYVALUELENGTH 128 +#define NETWARE_TIME_RESTRICTION_LENGTH 42 + +#define NETWARE_PASSWORDLENGTH 128 +#define NCP_MAX_ENCRYPTED_PASSWORD_LENGTH 16 + +#define NETWARE_MAX_OBJECT_IDS_IN_SET 32 + +#define NETWARE_SERVERNAMELENGTH 48 +#define NETWARE_VOLUMENAMELENGTH 16 +#define NETWARE_MAX_PATH_LENGTH 255 + + +/*++ +******************************************************************* + Well known NetWare object types +******************************************************************* +--*/ + +#define NCP_OT_WILD 0xFFFF +#define NCP_OT_UNKNOWN 0x0000 +#define NCP_OT_USER 0x0001 +#define NCP_OT_USER_GROUP 0x0002 +#define NCP_OT_PRINT_QUEUE 0x0003 +#define NCP_OT_FILE_SERVER 0x0004 +#define NCP_OT_JOB_SERVER 0x0005 +#define NCP_OT_GATEWAY 0x0006 +#define NCP_OT_PRINT_SERVER 0x0007 +#define NCP_OT_ARCHIVE_QUEUE 0x0008 +#define NCP_OT_ARCHIVE_SEVER 0x0009 +#define NCP_OT_JOB_QUEUE 0x000A +#define NCP_OT_ADMINISTRATION 0x000B +#define NCP_OT_SNA_GATEWAY 0x0021 +#define NCP_OT_REMOTE_BRIDGE 0x0024 +#define NCP_OT_REMOTE_BRIDGE_SERVER 0x0026 +#define NCP_OT_ADVERTISING_PRINT_SERVER 0x0047 + + +/*++ +******************************************************************* + Bindery flags +******************************************************************* +--*/ + +/** NetWare Bindery Flags **/ + +#define NCP_STATIC 0x00 /* Property or Object exists until it + is deleted with Delete Property or + Object */ +#define NCP_DYNAMIC 0x01 /* Property or Object is deleted from + bindery when file server is started */ +#define NCP_ITEM 0x00 /* Values are defined and interpreted by + applications or by APIs */ +#define NCP_SET 0x02 /* Series of Object ID numbers, each 4 + bytes long */ + +/** NetWare Bindery Security Flags **/ + +#define NCP_ANY_READ 0x00 /* Readable by anyone */ +#define NCP_LOGGED_READ 0x01 /* Must be logged in to read */ +#define NCP_OBJECT_READ 0x02 /* Readable by same object or super */ +#define NCP_BINDERY_READ 0x04 /* Readable only by the bindery */ + +#define NCP_SUPER_READ NCP_LOGGED_READ | NCP_OBJECT_READ + +#define NCP_ALL_READ NCP_ANY_READ | NCP_LOGGED_READ | NCP_OBJECT_READ + +#define NCP_ANY_WRITE 0x00 /* Writeable by anyone */ +#define NCP_LOGGED_WRITE 0x10 /* Must be logged in to write */ +#define NCP_OBJECT_WRITE 0x20 /* Writeable by same object or super */ +#define NCP_BINDERY_WRITE 0x40 /* Writeable only by the bindery */ + +#define NCP_SUPER_WRITE NCP_LOGGED_WRITE | NCP_OBJECT_WRITE + +#define NCP_ALL_WRITE NCP_ANY_WRITE | NCP_LOGGED_WRITE | NCP_OBJECT_WRITE + +// File Attributes + +#define NW_ATTRIBUTE_SHARABLE 0x80 +#define NW_ATTRIBUTE_ARCHIVE 0x20 +#define NW_ATTRIBUTE_DIRECTORY 0x10 +#define NW_ATTRIBUTE_EXECUTE_ONLY 0x08 +#define NW_ATTRIBUTE_SYSTEM 0x04 +#define NW_ATTRIBUTE_HIDDEN 0x02 +#define NW_ATTRIBUTE_READ_ONLY 0x01 + +// Open Flags + +#define NW_OPEN_EXCLUSIVE 0x10 +#define NW_DENY_WRITE 0x08 +#define NW_DENY_READ 0x04 +#define NW_OPEN_FOR_WRITE 0x02 +#define NW_OPEN_FOR_READ 0x01 + +// +// Connection status flags +// + +#define NCP_STATUS_BAD_CONNECTION 0x01 +#define NCP_STATUS_NO_CONNECTIONS 0x02 +#define NCP_STATUS_SERVER_DOWN 0x04 +#define NCP_STATUS_MSG_PENDING 0x08 + +// +// Special values for SmallWorld PDC object and property name +// + +#define MS_WINNT_NAME "MS_WINNT" +#define MS_SYNC_PDC_NAME "SYNCPDC" +#define MS_WINNT_OBJ_TYPE 0x06BB + +// +// User Property values (ie. User Parms stuff) +// + +#define USER_PROPERTY_SIGNATURE L'P' + +#define NWPASSWORD L"NWPassword" +#define OLDNWPASSWORD L"OldNWPassword" +#define MAXCONNECTIONS L"MaxConnections" +#define NWTIMEPASSWORDSET L"NWPasswordSet" +#define SZTRUE L"TRUE" +#define GRACELOGINALLOWED L"GraceLoginAllowed" +#define GRACELOGINREMAINING L"GraceLoginRemaining" +#define NWLOGONFROM L"NWLogonFrom" +#define NWHOMEDIR L"NWHomeDir" +#define NW_PRINT_SERVER_REF_COUNT L"PSRefCount" + +#define SUPERVISOR_USERID NCP_WELL_KNOWN_SUPERVISOR_ID +#define SUPERVISOR_NAME_STRING L"Supervisor" +#define SYSVOL_NAME_STRING L"SYS" +#define NWENCRYPTEDPASSWORDLENGTH 8 +#define NO_LIMIT 0xffff + +#define DEFAULT_MAXCONNECTIONS NO_LIMIT +#define DEFAULT_NWPASSWORDEXPIRED FALSE +#define DEFAULT_GRACELOGINALLOWED 6 +#define DEFAULT_GRACELOGINREMAINING 6 +#define DEFAULT_NWLOGONFROM NULL +#define DEFAULT_NWHOMEDIR NULL + +#define USER_PROPERTY_TYPE_ITEM 1 +#define USER_PROPERTY_TYPE_SET 2 + +#endif /* _NCPCOMM_ */ diff --git a/private/utils/wizards/addusrw/ginfo.cpp b/private/utils/wizards/addusrw/ginfo.cpp new file mode 100644 index 000000000..bc9b3d9e5 --- /dev/null +++ b/private/utils/wizards/addusrw/ginfo.cpp @@ -0,0 +1,339 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + ginfo.cpp : implementation file + + CPropertyPage support for User mgmt wizard + +File History: + + JonY Apr-96 created + +--*/ + + +#include "stdafx.h" +#include "Speckle.h" +#include "userlist.h" +#include "wizbased.h" +#include "ginfo.h" + +#include +#include +#include + +#ifdef _DEBUG +//#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CGroupInfo property page + +IMPLEMENT_DYNCREATE(CGroupInfo, CWizBaseDlg) + +CGroupInfo::CGroupInfo() : CWizBaseDlg(CGroupInfo::IDD) +{ + //{{AFX_DATA_INIT(CGroupInfo) + m_csCaption = _T(""); + //}}AFX_DATA_INIT +} + +CGroupInfo::~CGroupInfo() +{ +} + +void CGroupInfo::DoDataExchange(CDataExchange* pDX) +{ + CPropertyPage::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CGroupInfo) + DDX_Control(pDX, IDC_GROUP_MEMBER_LIST, m_lbSelectedGroups); + DDX_Control(pDX, IDC_GROUP_AVAILABLE_LIST, m_lbAvailableGroups); + DDX_Text(pDX, IDC_STATIC1, m_csCaption); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CGroupInfo, CWizBaseDlg) + //{{AFX_MSG_MAP(CGroupInfo) + ON_BN_CLICKED(IDC_ADD_BUTTON, OnAddButton) + ON_BN_CLICKED(IDC_REMOVE_BUTTON, OnRemoveButton) + ON_LBN_SETFOCUS(IDC_GROUP_AVAILABLE_LIST, OnSetfocusGroupAvailableList) + ON_LBN_SETFOCUS(IDC_GROUP_MEMBER_LIST, OnSetfocusGroupMemberList) + ON_LBN_SELCHANGE(IDC_GROUP_MEMBER_LIST, OnSelchangeGroupMemberList) + ON_WM_SHOWWINDOW() + ON_LBN_DBLCLK(IDC_GROUP_AVAILABLE_LIST, OnDblclkGroupAvailableList) + ON_LBN_DBLCLK(IDC_GROUP_MEMBER_LIST, OnDblclkGroupMemberList) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CGroupInfo message handlers + +BOOL CGroupInfo::OnInitDialog() +{ + CWizBaseDlg::OnInitDialog(); + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void CGroupInfo::OnAddButton() +{ + UpdateData(TRUE); + USHORT usSel = m_lbAvailableGroups.GetCurSel(); + if (usSel == LB_ERR) + { + GetDlgItem(IDC_ADD_BUTTON)->EnableWindow(FALSE); + GetDlgItem(IDC_REMOVE_BUTTON)->EnableWindow(TRUE); + m_lbSelectedGroups.SetCurSel(0); + return; + } + + CString csSel; + m_lbAvailableGroups.GetText(usSel, csSel); + USHORT usBmp = m_lbAvailableGroups.GetBitmapID(usSel); + m_lbSelectedGroups.AddString(csSel, usBmp); + m_lbAvailableGroups.DeleteString(usSel); + +// anybody left? + if (m_lbAvailableGroups.GetCount() != 0) + m_lbAvailableGroups.SetCurSel(0); + + else + { + m_lbSelectedGroups.SetCurSel(0); + GetDlgItem(IDC_REMOVE_BUTTON)->EnableWindow(TRUE); + GetDlgItem(IDC_ADD_BUTTON)->EnableWindow(FALSE); + m_lbAvailableGroups.SetHorizontalExtent(0); + } + + +} + +void CGroupInfo::OnRemoveButton() +{ + UpdateData(TRUE); + USHORT usSel = m_lbSelectedGroups.GetCurSel(); + if (usSel == 65535) + { + GetDlgItem(IDC_REMOVE_BUTTON)->EnableWindow(FALSE); + GetDlgItem(IDC_ADD_BUTTON)->EnableWindow(TRUE); + m_lbAvailableGroups.SetCurSel(0); + return; + } + + CString csSel; + m_lbSelectedGroups.GetText(usSel, csSel); + + USHORT usBmp = m_lbSelectedGroups.GetBitmapID(usSel); + m_lbAvailableGroups.AddString(csSel, usBmp); + m_lbSelectedGroups.DeleteString(usSel); + +// anybody left? + if (m_lbSelectedGroups.GetCount() != 0) + m_lbSelectedGroups.SetCurSel(0); + + else + { + m_lbAvailableGroups.SetCurSel(0); + GetDlgItem(IDC_ADD_BUTTON)->EnableWindow(TRUE); + GetDlgItem(IDC_REMOVE_BUTTON)->EnableWindow(FALSE); + m_lbSelectedGroups.SetHorizontalExtent(0); + } +} + +LRESULT CGroupInfo::OnWizardBack() +{ + return CPropertyPage::OnWizardBack(); +} + +LRESULT CGroupInfo::OnWizardNext() +{ + UpdateData(TRUE); + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + +// add selected groups to list + pApp->m_csaSelectedLocalGroups.RemoveAll(); + pApp->m_csaSelectedGlobalGroups.RemoveAll(); + short sGroupCount = m_lbSelectedGroups.GetCount(); + short sCount; + CString csVal; + for (sCount = 0; sCount < sGroupCount; sCount++) + { + USHORT usBmp = m_lbSelectedGroups.GetBitmapID(sCount); + m_lbSelectedGroups.GetText(sCount, csVal); + + if (usBmp == 3) pApp->m_csaSelectedLocalGroups.Add(csVal); + else if (usBmp == 1) pApp->m_csaSelectedGlobalGroups.Add(csVal); + } + + pApp->m_cps1.SetWizardButtons(PSWIZB_NEXT | PSWIZB_BACK); + + return CPropertyPage::OnWizardNext(); +} + +void CGroupInfo::OnSetfocusGroupAvailableList() +{ + m_lbSelectedGroups.SetCurSel(-1); + GetDlgItem(IDC_ADD_BUTTON)->EnableWindow(TRUE); + GetDlgItem(IDC_REMOVE_BUTTON)->EnableWindow(FALSE); + +} + +void CGroupInfo::OnSetfocusGroupMemberList() +{ + UpdateData(TRUE); + m_lbAvailableGroups.SetCurSel(-1); + GetDlgItem(IDC_ADD_BUTTON)->EnableWindow(FALSE); + GetDlgItem(IDC_REMOVE_BUTTON)->EnableWindow(TRUE); + +} + +void CGroupInfo::OnSelchangeGroupMemberList() +{ + UpdateData(TRUE); +} + +void CGroupInfo::OnShowWindow(BOOL bShow, UINT nStatus) +{ + CWizBaseDlg::OnShowWindow(bShow, nStatus); + + if (!bShow) return; + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + + if (!pApp->m_bGReset) return; + pApp->m_bGReset = FALSE; + m_lbAvailableGroups.ResetContent(); + m_lbSelectedGroups.ResetContent(); + + CWaitCursor wait; + + DWORD dwEntriesRead = 0; + DWORD dwTotalEntries = 0; + DWORD dwResumeHandle = 0; + + NET_API_STATUS nApi; + unsigned long sIndex; + + TCHAR* pServer = pApp->m_csServer.GetBuffer(pApp->m_csServer.GetLength()); + pApp->m_csServer.ReleaseBuffer(); + +// if this is on a domain, check for global groups + if (pApp->m_bDomain) + { + PGROUP_INFO_1 pInfo; + + do + { + nApi = NetGroupEnum(pServer, + (DWORD)1, + (PBYTE*)&pInfo, + (DWORD)5000, + &dwEntriesRead, + &dwTotalEntries, + &dwResumeHandle); + + for (sIndex = 0; sIndex < dwEntriesRead; sIndex++) + { + TCHAR sTemp[50]; + + swprintf(sTemp, TEXT("%s"), pInfo[sIndex].grpi1_name); + m_lbAvailableGroups.AddString(1, sTemp); + } + + NetApiBufferFree(pInfo); + } while (dwResumeHandle != 0); + +// m_lbSelectedGroups.AddString(1, TEXT("Domain Users")); + + UpdateData(FALSE); + } + + PLOCALGROUP_INFO_1 pLocalInfo; + dwResumeHandle = 0; + do + { + nApi = NetLocalGroupEnum(pServer, + (DWORD)1, + (PBYTE*)&pLocalInfo, + (DWORD)5000, + &dwEntriesRead, + &dwTotalEntries, + &dwResumeHandle); + + for (sIndex = 0; sIndex < dwEntriesRead; sIndex++) + { + TCHAR sTemp[50]; + + swprintf(sTemp, TEXT("%s"), pLocalInfo[sIndex].lgrpi1_name); + m_lbAvailableGroups.AddString(3, sTemp); + } + + NetApiBufferFree(pLocalInfo); + } while (dwResumeHandle != 0); + + m_lbAvailableGroups.SetCurSel(0); + +// set caption text + CString csTemp; + csTemp.LoadString(IDS_GROUP_CAPTION); + + CString csTemp2; + csTemp2.Format(csTemp, pApp->m_csUserName); + m_csCaption = csTemp2; + UpdateData(FALSE); + +} + +void CGroupInfo::OnDblclkGroupAvailableList() +{ + UpdateData(TRUE); + USHORT usSel = m_lbAvailableGroups.GetCurSel(); + CString csSel; + m_lbAvailableGroups.GetText(usSel, csSel); + USHORT usBmp = m_lbAvailableGroups.GetBitmapID(usSel); + m_lbSelectedGroups.AddString(csSel, usBmp); + m_lbAvailableGroups.DeleteString(usSel); + +// anybody left? + if (m_lbAvailableGroups.GetCount() != 0) + m_lbAvailableGroups.SetCurSel(0); + + else + { + m_lbSelectedGroups.SetCurSel(0); + GetDlgItem(IDC_REMOVE_BUTTON)->EnableWindow(TRUE); + GetDlgItem(IDC_ADD_BUTTON)->EnableWindow(FALSE); + m_lbAvailableGroups.SetHorizontalExtent(0); + } + +} + +void CGroupInfo::OnDblclkGroupMemberList() +{ + UpdateData(TRUE); + USHORT usSel = m_lbSelectedGroups.GetCurSel(); + CString csSel; + m_lbSelectedGroups.GetText(usSel, csSel); + + USHORT usBmp = m_lbSelectedGroups.GetBitmapID(usSel); + m_lbAvailableGroups.AddString(csSel, usBmp); + m_lbSelectedGroups.DeleteString(usSel); + +// anybody left? + if (m_lbSelectedGroups.GetCount() != 0) + m_lbSelectedGroups.SetCurSel(0); + + else + { + m_lbAvailableGroups.SetCurSel(0); + GetDlgItem(IDC_ADD_BUTTON)->EnableWindow(TRUE); + GetDlgItem(IDC_REMOVE_BUTTON)->EnableWindow(FALSE); + m_lbSelectedGroups.SetHorizontalExtent(0); + } + +} diff --git a/private/utils/wizards/addusrw/ginfo.h b/private/utils/wizards/addusrw/ginfo.h new file mode 100644 index 000000000..76b6ac5d1 --- /dev/null +++ b/private/utils/wizards/addusrw/ginfo.h @@ -0,0 +1,65 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + GInfo.h : header file + +File History: + + JonY Apr-96 created + +--*/ + + +///////////////////////////////////////////////////////////////////////////// +// CGroupInfo dialog + +class CGroupInfo : public CWizBaseDlg +{ + DECLARE_DYNCREATE(CGroupInfo) + +// Construction +public: + CGroupInfo(); + ~CGroupInfo(); + +// Dialog Data + //{{AFX_DATA(CGroupInfo) + enum { IDD = IDD_GROUP_INFO }; + CUserList m_lbSelectedGroups; + CUserList m_lbAvailableGroups; + CString m_csCaption; + //}}AFX_DATA + + +// Overrides + // ClassWizard generate virtual function overrides + //{{AFX_VIRTUAL(CGroupInfo) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + public: + virtual LRESULT OnWizardBack(); + virtual LRESULT OnWizardNext(); + +// Implementation +protected: + // Generated message map functions + //{{AFX_MSG(CGroupInfo) + virtual BOOL OnInitDialog(); + afx_msg void OnAddButton(); + afx_msg void OnRemoveButton(); + afx_msg void OnSetfocusGroupAvailableList(); + afx_msg void OnSetfocusGroupMemberList(); + afx_msg void OnSelchangeGroupMemberList(); + afx_msg void OnShowWindow(BOOL bShow, UINT nStatus); + afx_msg void OnDblclkGroupAvailableList(); + afx_msg void OnDblclkGroupMemberList(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + +private: + +}; diff --git a/private/utils/wizards/addusrw/homedir.cpp b/private/utils/wizards/addusrw/homedir.cpp new file mode 100644 index 000000000..109be9def --- /dev/null +++ b/private/utils/wizards/addusrw/homedir.cpp @@ -0,0 +1,245 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + HomeDir.cpp : implementation file + + CPropertyPage support for User mgmt wizard + +File History: + + JonY Apr-96 created + +--*/ + +#include "stdafx.h" +#include "speckle.h" +#include "wizbased.h" +#include "HomeDir.h" + +#ifdef _DEBUG +//#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CHomeDir property page + +IMPLEMENT_DYNCREATE(CHomeDir, CWizBaseDlg) + +CHomeDir::CHomeDir() : CWizBaseDlg(CHomeDir::IDD) +{ + //{{AFX_DATA_INIT(CHomeDir) + m_csHome_dir_drive = _T(""); + m_csRemotePath = _T(""); + m_rbPathLocale = 0; + m_csCaption = _T(""); + //}}AFX_DATA_INIT +} + +CHomeDir::~CHomeDir() +{ +} + +void CHomeDir::DoDataExchange(CDataExchange* pDX) +{ + CPropertyPage::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CHomeDir) + DDX_Control(pDX, IDC_DRIVE_LETTER, m_cbDriveLetter); + DDX_CBString(pDX, IDC_DRIVE_LETTER, m_csHome_dir_drive); + DDX_Text(pDX, IDC_REMOTE_PATH, m_csRemotePath); + DDX_Radio(pDX, IDC_LOCAL_PATH_BUTTON, m_rbPathLocale); + DDX_Text(pDX, IDC_STATIC1, m_csCaption); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CHomeDir, CWizBaseDlg) + //{{AFX_MSG_MAP(CHomeDir) + ON_WM_SHOWWINDOW() + ON_BN_CLICKED(IDC_LOCAL_PATH_BUTTON, OnLocalPathButton) + ON_BN_CLICKED(IDC_REMOTE_PATH_BUTTON, OnRemotePathButton) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CHomeDir message handlers +LRESULT CHomeDir::OnWizardNext() +{ + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + + UpdateData(TRUE); + if (m_rbPathLocale == 0) // local + { + pApp->m_csHomeDir = L""; // leave this empty per JonN and spec + pApp->m_csHome_dir_drive = ""; + } + else // remote + { + if (m_csRemotePath.Left(2) != L"\\\\") + { + AfxMessageBox(IDS_INVALID_PATH); + GetDlgItem(IDC_REMOTE_PATH)->SetFocus(); + return -1; + } + + if (m_csHome_dir_drive == L"") + { + AfxMessageBox(IDS_NO_HOMEDIR_DRIVE_LETTER); + GetDlgItem(IDC_DRIVE_LETTER)->SetFocus(); + return -1; + } + + CWaitCursor wait; +// make sure directory exists + if (CreateFile((const TCHAR*)m_csRemotePath, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL) == INVALID_HANDLE_VALUE) + { + DWORD dwErr = GetLastError(); + if (dwErr == 5) // access denied + { + AfxMessageBox(IDS_NO_DIR_PERMISSION, MB_ICONSTOP); + return -1; + } + +// store the current dir so it can be restored + CString csCurDir; + GetCurrentDirectory(256, csCurDir.GetBufferSetLength(256)); + csCurDir.ReleaseBuffer(); + + CString csMessage; + AfxFormatString1(csMessage, IDS_INVALID_DIRECTORY_NAME, m_csRemotePath); + if (AfxMessageBox(csMessage, MB_YESNO) != IDYES) return -1; + if (!CreateNewDirectory((const TCHAR*)m_csRemotePath)) + { + if (AfxMessageBox(IDS_CANT_CREATE_DIRECTORY, MB_YESNO) != IDYES) return -1; + } + SetCurrentDirectory((LPCTSTR)csCurDir); + } + + pApp->m_csHomeDir = m_csRemotePath; + GetDlgItem(IDC_DRIVE_LETTER)->GetWindowText(pApp->m_csHome_dir_drive); + pApp->m_csHome_dir_drive = pApp->m_csHome_dir_drive.Left(2); // trim off trailing blank + pApp->m_csHome_dir_drive.MakeUpper(); + } + + if (pApp->m_bRAS) return IDD_RAS_PERM_DIALOG; + else if (pApp->m_bNW) return IDD_FPNW_DLG; + else if (pApp->m_bExchange) return IDD_EXCHANGE_DIALOG; + else return IDD_RESTRICTIONS_DIALOG; + +} + +BOOL CHomeDir::CreateNewDirectory(const TCHAR* m_csDirectoryName) +{ +// first remove the \\server\share info and CD to it + CString csDir = m_csDirectoryName; + csDir = csDir.Right(csDir.GetLength() - 2); + CString csServer = csDir.Left(csDir.Find(L"\\")); + csDir = csDir.Right((csDir.GetLength() - csServer.GetLength()) - 1); + CString csShare = csDir.Left(csDir.Find(L"\\")); + csDir = csDir.Right((csDir.GetLength() - csShare.GetLength()) - 1); + + CString csPath; + csPath.Format(L"\\\\%s\\%s", csServer, csShare); + if (!SetCurrentDirectory(csPath)) return FALSE; + +// parse out the individual path names and cd / md them + TCHAR* pDirectory = new TCHAR[_tcslen(csDir) * sizeof(TCHAR)]; + _tcscpy(pDirectory, csDir); + TCHAR* ppDir = pDirectory; + + TCHAR* pDir; + pDir = _tcstok(pDirectory, L"\\"); + + while (pDir != NULL) + { + if (!SetCurrentDirectory(pDir)) + { + CreateDirectory(pDir, NULL); + if (!SetCurrentDirectory(pDir)) + { + delete ppDir; + return FALSE; + } + } + pDir = _tcstok(NULL, L"\\"); + } + + delete ppDir; + + TCHAR pCurDir[256]; + GetCurrentDirectory(256, pCurDir); + CString csNewDir, csTemp; + csTemp.LoadString(IDS_NEW_DIR_CREATED); + csNewDir.Format(csTemp, pCurDir); + AfxMessageBox(csNewDir); + return TRUE; +} + + +LRESULT CHomeDir::OnWizardBack() +{ + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + if (pApp->m_bLoginScript) return IDD_LOGON_SCRIPT_DIALOG; + else if (pApp->m_bProfile) return IDD_PROFILE; + else return IDD_OPTIONS_DIALOG; + +} + +BOOL CHomeDir::OnInitDialog() +{ + CWizBaseDlg::OnInitDialog(); + +// m_csLocalPath = "c:\\users\\default"; + +// create list of available drives + int drive; + TCHAR tDrive[3]; + + for( drive = 3; drive <= 26; drive++ ) + { + swprintf(tDrive, L"%c: ", drive + 'A' - 1 ); + m_cbDriveLetter.AddString(tDrive); + } + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void CHomeDir::OnShowWindow(BOOL bShow, UINT nStatus) +{ + CWizBaseDlg::OnShowWindow(bShow, nStatus); + + if (bShow) + { + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + + CString csTemp; + csTemp.LoadString(IDS_HOMEDIR_CAPTION); + + CString csTemp2; + csTemp2.Format(csTemp, pApp->m_csUserName); + m_csCaption = csTemp2; + UpdateData(FALSE); + } + + +} + +void CHomeDir::OnLocalPathButton() +{ + GetDlgItem(IDC_DRIVE_LETTER)->EnableWindow(FALSE); + GetDlgItem(IDC_REMOTE_PATH)->EnableWindow(FALSE); + +} + +void CHomeDir::OnRemotePathButton() +{ + GetDlgItem(IDC_DRIVE_LETTER)->EnableWindow(TRUE); + GetDlgItem(IDC_REMOTE_PATH)->EnableWindow(TRUE); + +} diff --git a/private/utils/wizards/addusrw/homedir.h b/private/utils/wizards/addusrw/homedir.h new file mode 100644 index 000000000..c3b603f02 --- /dev/null +++ b/private/utils/wizards/addusrw/homedir.h @@ -0,0 +1,61 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + HomeDir.h : header file + +File History: + + JonY Apr-96 created + +--*/ + + + +///////////////////////////////////////////////////////////////////////////// +// CHomeDir dialog + +class CHomeDir : public CWizBaseDlg +{ + DECLARE_DYNCREATE(CHomeDir) + +// Construction +public: + CHomeDir(); + ~CHomeDir(); + +// Dialog Data + //{{AFX_DATA(CHomeDir) + enum { IDD = IDD_HOMEDIR_DIALOG }; + CComboBox m_cbDriveLetter; + CString m_csHome_dir_drive; + CString m_csRemotePath; + int m_rbPathLocale; + CString m_csCaption; + //}}AFX_DATA + + BOOL CreateNewDirectory(const TCHAR* m_csDirectoryName); + +// Overrides + // ClassWizard generate virtual function overrides + //{{AFX_VIRTUAL(CHomeDir) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + LRESULT OnWizardBack(); + LRESULT OnWizardNext(); + +// Implementation +protected: + // Generated message map functions + //{{AFX_MSG(CHomeDir) + virtual BOOL OnInitDialog(); + afx_msg void OnShowWindow(BOOL bShow, UINT nStatus); + afx_msg void OnLocalPathButton(); + afx_msg void OnRemotePathButton(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + +}; diff --git a/private/utils/wizards/addusrw/hours.cpp b/private/utils/wizards/addusrw/hours.cpp new file mode 100644 index 000000000..d2e723d3b --- /dev/null +++ b/private/utils/wizards/addusrw/hours.cpp @@ -0,0 +1,165 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + Hours.cpp : implementation file + + CPropertyPage support for User mgmt wizard + +File History: + + JonY Apr-96 created + +--*/ + +#include "stdafx.h" +#include "Speckle.h" +#include "wizbased.h" +#include "Timelist.h" +#include "Hours.h" +#include "hours1.h" + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CHoursDlg property page + +IMPLEMENT_DYNCREATE(CHoursDlg, CWizBaseDlg) + +CHoursDlg::CHoursDlg() : CWizBaseDlg(CHoursDlg::IDD) +{ + //{{AFX_DATA_INIT(CHoursDlg) + //}}AFX_DATA_INIT + + m_swDisAllowed.bWhich = FALSE; + m_swAllowed.bWhich = TRUE; + +} + +CHoursDlg::~CHoursDlg() +{ +} + +void CHoursDlg::DoDataExchange(CDataExchange* pDX) +{ + CPropertyPage::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CHoursDlg) + DDX_Control(pDX, IDC_STATIC_DISALLOWEDTIMES, m_swDisAllowed); + DDX_Control(pDX, IDC_STATIC_ALLOWEDTIMES, m_swAllowed); + DDX_Control(pDX, IDC_HOURSCTRL1, m_ccHours); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CHoursDlg, CWizBaseDlg) + //{{AFX_MSG_MAP(CHoursDlg) + ON_WM_SHOWWINDOW() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CHoursDlg message handlers + +BOOL CHoursDlg::OnInitDialog() +{ + CWizBaseDlg::OnInitDialog(); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +LRESULT CHoursDlg::OnWizardNext() +{ + UpdateData(TRUE); + + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + +// build a SAFEARRAY to receive data from the control + VARIANT vaResult; + VariantInit(&vaResult); + + vaResult.vt = VT_ARRAY | VT_UI1; + + SAFEARRAYBOUND sab[1]; + sab[0].cElements = 21; + sab[0].lLbound = 0; + + vaResult.parray = SafeArrayCreate(VT_UI1, 1, sab); + + void* vRet; + BYTE* bRet; + +// get the data from the control + vaResult = m_ccHours.GetDateData(); + + SafeArrayAccessData(vaResult.parray, &vRet); + + USHORT sCount = 0; + bRet = (BYTE*)vRet; + while (sCount < 21) + { + memcpy(&pApp->m_pHours[sCount], bRet + (sCount * sizeof(BYTE)), sizeof(BYTE)); + sCount++; + } + + if (pApp->m_bWorkstation) return IDD_LOGONTO_DLG; + else if (pApp->m_bNW) return IDD_NWLOGON_DIALOG; + else return IDD_FINISH; + +} + +LRESULT CHoursDlg::OnWizardBack() +{ + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + if (pApp->m_bExpiration) return IDD_ACCOUNT_EXP_DIALOG; + return IDD_RESTRICTIONS_DIALOG; + +} + +void CHoursDlg::OnShowWindow(BOOL bShow, UINT nStatus) +{ + CWizBaseDlg::OnShowWindow(bShow, nStatus); + if (bShow) + { + m_ccHours.SetCrPermitColor(GetSysColor(COLOR_ACTIVECAPTION)); + m_ccHours.SetCrDenyColor(GetSysColor(COLOR_CAPTIONTEXT)); + } + +} + +///////////////////////////////////////////////////////////////////////////// +// CSWnd + +CSWnd::CSWnd() +{ +} + +CSWnd::~CSWnd() +{ +} + + +BEGIN_MESSAGE_MAP(CSWnd, CStatic) + //{{AFX_MSG_MAP(CSWnd) + ON_WM_PAINT() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CSWnd message handlers + +void CSWnd::OnPaint() +{ + CPaintDC dc(this); // device context for painting + + if (bWhich) dc.FillRect(&dc.m_ps.rcPaint, CBrush::FromHandle(CreateSolidBrush(GetSysColor(COLOR_ACTIVECAPTION)))); + else dc.FillRect(&dc.m_ps.rcPaint, CBrush::FromHandle(CreateSolidBrush(GetSysColor(COLOR_CAPTIONTEXT)))); + + // Do not call CStatic::OnPaint() for painting messages +} + diff --git a/private/utils/wizards/addusrw/hours.h b/private/utils/wizards/addusrw/hours.h new file mode 100644 index 000000000..178510f03 --- /dev/null +++ b/private/utils/wizards/addusrw/hours.h @@ -0,0 +1,93 @@ +//{{AFX_INCLUDES() +#include "hours1.h" +//}}AFX_INCLUDES +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + Hours.h : header file + +File History: + + JonY Apr-96 created + +--*/ +// +///////////////////////////////////////////////////////////////////////////// +// CSWnd window + +class CSWnd : public CStatic +{ +// Construction +public: + CSWnd(); + BOOL bWhich; +// Attributes +public: + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CSWnd) + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CSWnd(); + + // Generated message map functions +protected: + //{{AFX_MSG(CSWnd) + afx_msg void OnPaint(); + //}}AFX_MSG + + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// + +///////////////////////////////////////////////////////////////////////////// +// CHoursDlg dialog + +class CHoursDlg : public CWizBaseDlg +{ + DECLARE_DYNCREATE(CHoursDlg) + +// Construction +public: + CHoursDlg(); + ~CHoursDlg(); + +// Dialog Data + //{{AFX_DATA(CHoursDlg) + enum { IDD = IDD_HOURS_DLG }; + CSWnd m_swDisAllowed; + CSWnd m_swAllowed; + CHours m_ccHours; + //}}AFX_DATA + + +// Overrides + // ClassWizard generate virtual function overrides + //{{AFX_VIRTUAL(CHoursDlg) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + // Generated message map functions + //{{AFX_MSG(CHoursDlg) + virtual BOOL OnInitDialog(); + afx_msg void OnShowWindow(BOOL bShow, UINT nStatus); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + + LRESULT OnWizardNext(); + LRESULT OnWizardBack(); + +}; diff --git a/private/utils/wizards/addusrw/hours1.cpp b/private/utils/wizards/addusrw/hours1.cpp new file mode 100644 index 000000000..9d4445ad4 --- /dev/null +++ b/private/utils/wizards/addusrw/hours1.cpp @@ -0,0 +1,55 @@ +// Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++ + +// NOTE: Do not modify the contents of this file. If this class is regenerated by +// Microsoft Visual C++, your modifications will be overwritten. + + +#include "stdafx.h" +#include "hours1.h" + +///////////////////////////////////////////////////////////////////////////// +// CHours + +IMPLEMENT_DYNCREATE(CHours, CWnd) + +///////////////////////////////////////////////////////////////////////////// +// CHours properties + +unsigned long CHours::GetCrPermitColor() +{ + unsigned long result; + GetProperty(0x1, VT_I4, (void*)&result); + return result; +} + +void CHours::SetCrPermitColor(unsigned long propVal) +{ + SetProperty(0x1, VT_I4, propVal); +} + +unsigned long CHours::GetCrDenyColor() +{ + unsigned long result; + GetProperty(0x2, VT_I4, (void*)&result); + return result; +} + +void CHours::SetCrDenyColor(unsigned long propVal) +{ + SetProperty(0x2, VT_I4, propVal); +} + +VARIANT CHours::GetDateData() +{ + VARIANT result; + GetProperty(0x3, VT_VARIANT, (void*)&result); + return result; +} + +void CHours::SetDateData(const VARIANT& propVal) +{ + SetProperty(0x3, VT_VARIANT, &propVal); +} + +///////////////////////////////////////////////////////////////////////////// +// CHours operations diff --git a/private/utils/wizards/addusrw/hours1.h b/private/utils/wizards/addusrw/hours1.h new file mode 100644 index 000000000..bee62f321 --- /dev/null +++ b/private/utils/wizards/addusrw/hours1.h @@ -0,0 +1,50 @@ +#ifndef __HOURS1_H__ +#define __HOURS1_H__ + +// Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++ + +// NOTE: Do not modify the contents of this file. If this class is regenerated by +// Microsoft Visual C++, your modifications will be overwritten. + +///////////////////////////////////////////////////////////////////////////// +// CHours wrapper class + +class CHours : public CWnd +{ +protected: + DECLARE_DYNCREATE(CHours) +public: + CLSID const& GetClsid() + { + static CLSID const clsid + = { 0xa44ea7ad, 0x9d58, 0x11cf, { 0xa3, 0x5f, 0x0, 0xaa, 0x0, 0xb6, 0x74, 0x3b } }; + return clsid; + } + virtual BOOL Create(LPCTSTR lpszClassName, + LPCTSTR lpszWindowName, DWORD dwStyle, + const RECT& rect, + CWnd* pParentWnd, UINT nID, + CCreateContext* pContext = NULL) + { return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID); } + + BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle, + const RECT& rect, CWnd* pParentWnd, UINT nID, + CFile* pPersist = NULL, BOOL bStorage = FALSE, + BSTR bstrLicKey = NULL) + { return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID, + pPersist, bStorage, bstrLicKey); } + +// Attributes +public: + unsigned long GetCrPermitColor(); + void SetCrPermitColor(unsigned long); + unsigned long GetCrDenyColor(); + void SetCrDenyColor(unsigned long); + VARIANT GetDateData(); + void SetDateData(const VARIANT&); + +// Operations +public: +}; + +#endif // __HOURS1_H__ diff --git a/private/utils/wizards/addusrw/limit.cpp b/private/utils/wizards/addusrw/limit.cpp new file mode 100644 index 000000000..e66abd685 --- /dev/null +++ b/private/utils/wizards/addusrw/limit.cpp @@ -0,0 +1,276 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + Limit.cpp : implementation file + + CPropertyPage support for User mgmt wizard + +File History: + + JonY Apr-96 created + +--*/ + +#include "stdafx.h" +#include "Speckle.h" +#include "wizbased.h" +#include "Limit.h" + +#ifdef _DEBUG +//#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CLimitLogon property page + +IMPLEMENT_DYNCREATE(CLimitLogon, CWizBaseDlg) + +CLimitLogon::CLimitLogon() : CWizBaseDlg(CLimitLogon::IDD) +{ + //{{AFX_DATA_INIT(CLimitLogon) + m_nWorkstationRadio = 0; + m_csCaption = _T(""); + //}}AFX_DATA_INIT +} + +CLimitLogon::~CLimitLogon() +{ +} + +void CLimitLogon::DoDataExchange(CDataExchange* pDX) +{ + CPropertyPage::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CLimitLogon) + DDX_Control(pDX, IDC_LIST1, m_lbWksList); + DDX_Radio(pDX, IDC_WORKSTATION_RADIO, m_nWorkstationRadio); + DDX_Text(pDX, IDC_STATIC2, m_csCaption); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CLimitLogon, CWizBaseDlg) + //{{AFX_MSG_MAP(CLimitLogon) + ON_BN_CLICKED(IDC_ADD_BUTTON, OnAddButton) + ON_BN_CLICKED(IDC_REMOVE_BUTTON, OnRemoveButton) + ON_BN_CLICKED(IDC_WORKSTATION_RADIO, OnWorkstationRadio) + ON_BN_CLICKED(IDC_WORKSTATION_RADIO2, OnWorkstationRadio2) + ON_WM_SHOWWINDOW() + ON_LBN_SETFOCUS(IDC_LIST1, OnSetfocusList1) + ON_WM_DESTROY() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CLimitLogon message handlers +LRESULT CLimitLogon::OnWizardNext() +{ + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + UpdateData(TRUE); + + if ((m_nWorkstationRadio == 1) && (m_lbWksList.GetCount() == 0)) + { + AfxMessageBox(IDS_NEEDA_WORKSTATION); + return -1; + } + + if (m_nWorkstationRadio == 0) pApp->m_csAllowedMachines = L""; + else + { +// make workstation list and store it + USHORT sCount; + CString csWksList; + for (sCount = 0; sCount < m_lbWksList.GetCount(); sCount++) + { + CString csWks; + m_lbWksList.GetText(sCount, csWks); + csWksList += csWks; + csWksList += L","; + } + +// remove trailing ',' + csWksList = csWksList.Left(csWksList.GetLength() - 1); + pApp->m_csAllowedMachines = csWksList; + } + + if (pApp->m_bNW) return IDD_NWLOGON_DIALOG; + else return IDD_FINISH; + +} + +LRESULT CLimitLogon::OnWizardBack() +{ + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + if (pApp->m_bHours) return IDD_HOURS_DLG; + else if (pApp->m_bExpiration) return IDD_ACCOUNT_EXP_DIALOG; + return IDD_RESTRICTIONS_DIALOG; + +} + + +void CLimitLogon::OnAddButton() +{ + CAddWorkstation pWks; + pWks.pListBox = &m_lbWksList; + pWks.DoModal(); + + if (m_lbWksList.GetCount() > 0) GetDlgItem(IDC_REMOVE_BUTTON)->EnableWindow(TRUE); + else GetDlgItem(IDC_REMOVE_BUTTON)->EnableWindow(FALSE); + + GetDlgItem(IDC_LIST1)->SetFocus(); + m_lbWksList.SetCurSel(0); + +} + +void CLimitLogon::OnRemoveButton() +{ + int ui = m_lbWksList.GetCurSel(); + if (ui == LB_ERR) return; + + m_lbWksList.DeleteString(ui); + if (ui > 0) m_lbWksList.SetCurSel(ui - 1); + else if (m_lbWksList.GetCount() > 0) m_lbWksList.SetCurSel(0); + else GetDlgItem(IDC_REMOVE_BUTTON)->EnableWindow(FALSE); + +} + +///////////////////////////////////////////////////////////////////////////// +// CAddWorkstation dialog + + +CAddWorkstation::CAddWorkstation(CWnd* pParent /*=NULL*/) + : CDialog(CAddWorkstation::IDD, pParent) +{ + //{{AFX_DATA_INIT(CAddWorkstation) + m_csWorkstation = _T(""); + //}}AFX_DATA_INIT +} + + +void CAddWorkstation::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CAddWorkstation) + DDX_Text(pDX, IDC_WORKSTATION_EDIT, m_csWorkstation); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CAddWorkstation, CDialog) + //{{AFX_MSG_MAP(CAddWorkstation) + ON_BN_CLICKED(IDOK, OnAdd) + ON_BN_CLICKED(IDCANCEL, OnClose) + ON_EN_CHANGE(IDC_WORKSTATION_EDIT, OnChangeWorkstationEdit) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CAddWorkstation message handlers + +void CAddWorkstation::OnAdd() +{ + UpdateData(TRUE); + if (m_csWorkstation == L"") + { + GetDlgItem(IDC_WORKSTATION_EDIT)->SetFocus(); + return; + } + +// check for validity + if (m_csWorkstation.FindOneOf(L"/.,<>;;'[{]}=+)(*&^%$#@!~`| ") != -1) + { + AfxMessageBox(IDS_BAD_WS_NAME); + GetDlgItem(IDC_WORKSTATION_EDIT)->SetFocus(); + } + + if (m_csWorkstation.GetLength() > 15) + { + AfxMessageBox(IDS_WSNAME_TOOLONG); + GetDlgItem(IDC_WORKSTATION_EDIT)->SetFocus(); + return; + } + + while (m_csWorkstation.Left(1) == L"\\") + m_csWorkstation = m_csWorkstation.Right(m_csWorkstation.GetLength() - 1); + +// make sure its unique + if (pListBox->FindString(-1, m_csWorkstation) == LB_ERR) pListBox->AddString(m_csWorkstation); + UpdateData(FALSE); + EndDialog(1); + +} + +void CAddWorkstation::OnClose() +{ + EndDialog(0); + +} + +void CLimitLogon::OnWorkstationRadio() +{ + GetDlgItem(IDC_STATIC1)->EnableWindow(FALSE); + GetDlgItem(IDC_LIST1)->EnableWindow(FALSE); + GetDlgItem(IDC_ADD_BUTTON)->EnableWindow(FALSE); + GetDlgItem(IDC_REMOVE_BUTTON)->EnableWindow(FALSE); + +} + +void CLimitLogon::OnWorkstationRadio2() +{ + GetDlgItem(IDC_STATIC1)->EnableWindow(TRUE); + GetDlgItem(IDC_LIST1)->EnableWindow(TRUE); + GetDlgItem(IDC_ADD_BUTTON)->EnableWindow(TRUE); + if (m_lbWksList.GetCount() > 0) GetDlgItem(IDC_REMOVE_BUTTON)->EnableWindow(TRUE); + else GetDlgItem(IDC_REMOVE_BUTTON)->EnableWindow(FALSE); + +} + +void CLimitLogon::OnShowWindow(BOOL bShow, UINT nStatus) +{ + CWizBaseDlg::OnShowWindow(bShow, nStatus); + + if (bShow) + { + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + + CString csTemp; + csTemp.LoadString(IDS_WORKSTATION_CAPTION); + + CString csTemp2; + csTemp2.Format(csTemp, pApp->m_csUserName); + m_csCaption = csTemp2; + UpdateData(FALSE); + } + +} + +void CLimitLogon::OnSetfocusList1() +{ + if (m_lbWksList.GetCount() > 0) GetDlgItem(IDC_REMOVE_BUTTON)->EnableWindow(TRUE); + else GetDlgItem(IDC_REMOVE_BUTTON)->EnableWindow(FALSE); + +} + +void CAddWorkstation::OnChangeWorkstationEdit() +{ + UpdateData(TRUE); + +// check for validity + if (m_csWorkstation.FindOneOf(L"/.,<>;;'[{]}=+)(*&^%$#@!~`| ") != -1) + { + AfxMessageBox(IDS_BAD_WS_NAME); + GetDlgItem(IDC_WORKSTATION_EDIT)->SetFocus(); + } + + if (m_csWorkstation.GetLength() > 15) + { + AfxMessageBox(IDS_WSNAME_TOOLONG); + GetDlgItem(IDC_WORKSTATION_EDIT)->SetFocus(); + return; + } + +} diff --git a/private/utils/wizards/addusrw/limit.h b/private/utils/wizards/addusrw/limit.h new file mode 100644 index 000000000..253499145 --- /dev/null +++ b/private/utils/wizards/addusrw/limit.h @@ -0,0 +1,94 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + Limit.h : header file + +File History: + + JonY Apr-96 created + +--*/ +///////////////////////////////////////////////////////////////////////////// +// CAddWorkstation dialog + +class CAddWorkstation : public CDialog +{ +// Construction +public: + CAddWorkstation(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(CAddWorkstation) + enum { IDD = IDD_ADD_WKS_DIALOG }; + CString m_csWorkstation; + //}}AFX_DATA + + CListBox* pListBox; +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CAddWorkstation) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CAddWorkstation) + afx_msg void OnAdd(); + afx_msg void OnClose(); + afx_msg void OnChangeWorkstationEdit(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// +// CLimitLogon dialog + +class CLimitLogon : public CWizBaseDlg +{ + DECLARE_DYNCREATE(CLimitLogon) + +// Construction +public: + CLimitLogon(); + ~CLimitLogon(); + +// Dialog Data + //{{AFX_DATA(CLimitLogon) + enum { IDD = IDD_LOGONTO_DLG }; + CListBox m_lbWksList; + int m_nWorkstationRadio; + CString m_csCaption; + //}}AFX_DATA + + +// Overrides + // ClassWizard generate virtual function overrides + //{{AFX_VIRTUAL(CLimitLogon) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + LRESULT OnWizardNext(); + LRESULT OnWizardBack(); +// Implementation +protected: + // Generated message map functions + //{{AFX_MSG(CLimitLogon) + afx_msg void OnAddButton(); + afx_msg void OnRemoveButton(); + afx_msg void OnWorkstationRadio(); + afx_msg void OnWorkstationRadio2(); + afx_msg void OnShowWindow(BOOL bShow, UINT nStatus); + afx_msg void OnSetfocusList1(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + +private: + void Toggle(BOOL bParam); + +}; diff --git a/private/utils/wizards/addusrw/lscript.cpp b/private/utils/wizards/addusrw/lscript.cpp new file mode 100644 index 000000000..fb70dffc4 --- /dev/null +++ b/private/utils/wizards/addusrw/lscript.cpp @@ -0,0 +1,83 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + LScript.cpp : implementation file + + CPropertyPage support for User mgmt wizard + +File History: + + JonY Apr-96 created + +--*/ + + +#include "stdafx.h" +#include "speckle.h" +#include "wizbased.h" +#include "LScript.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CLoginScript property page + +IMPLEMENT_DYNCREATE(CLoginScript, CWizBaseDlg) + +CLoginScript::CLoginScript() : CWizBaseDlg(CLoginScript::IDD) +{ + //{{AFX_DATA_INIT(CLoginScript) + m_csLogonScript = _T(""); + //}}AFX_DATA_INIT +} + +CLoginScript::~CLoginScript() +{ +} + +void CLoginScript::DoDataExchange(CDataExchange* pDX) +{ + CPropertyPage::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CLoginScript) + DDX_Text(pDX, IDC_LOGON_SCRIPT, m_csLogonScript); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CLoginScript, CWizBaseDlg) + //{{AFX_MSG_MAP(CLoginScript) + // NOTE: the ClassWizard will add message map macros here + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CLoginScript message handlers + +LRESULT CLoginScript::OnWizardNext() +{ + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + UpdateData(TRUE); + pApp->m_csLogonScript = m_csLogonScript; + + if (pApp->m_bHomeDir) return IDD_HOMEDIR_DIALOG; + else if (pApp->m_bRAS) return IDD_RAS_PERM_DIALOG; + else if (pApp->m_bNW) return IDD_FPNW_DLG; + else if (pApp->m_bExchange) return IDD_EXCHANGE_DIALOG; + else return IDD_RESTRICTIONS_DIALOG; + +} + +LRESULT CLoginScript::OnWizardBack() +{ + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + if (pApp->m_bProfile) return IDD_PROFILE; + else return IDD_OPTIONS_DIALOG; + +} diff --git a/private/utils/wizards/addusrw/lscript.h b/private/utils/wizards/addusrw/lscript.h new file mode 100644 index 000000000..3494cdd61 --- /dev/null +++ b/private/utils/wizards/addusrw/lscript.h @@ -0,0 +1,52 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + LScript.h : header file + +File History: + + JonY Apr-96 created + +--*/ + +///////////////////////////////////////////////////////////////////////////// +// CLoginScript dialog + +class CLoginScript : public CWizBaseDlg +{ + DECLARE_DYNCREATE(CLoginScript) + +// Construction +public: + CLoginScript(); + ~CLoginScript(); + +// Dialog Data + //{{AFX_DATA(CLoginScript) + enum { IDD = IDD_LOGON_SCRIPT_DIALOG }; + CString m_csLogonScript; + //}}AFX_DATA + + +// Overrides + // ClassWizard generate virtual function overrides + //{{AFX_VIRTUAL(CLoginScript) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + LRESULT OnWizardBack(); + LRESULT OnWizardNext(); + +// Implementation +protected: + // Generated message map functions + //{{AFX_MSG(CLoginScript) + // NOTE: the ClassWizard will add member functions here + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + +}; diff --git a/private/utils/wizards/addusrw/makefile b/private/utils/wizards/addusrw/makefile new file mode 100644 index 000000000..6ee4f43fa --- /dev/null +++ b/private/utils/wizards/addusrw/makefile @@ -0,0 +1,6 @@ +# +# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source +# file to this component. This file merely indirects to the real make file +# that is shared by all the components of NT OS/2 +# +!INCLUDE $(NTMAKEENV)\makefile.def diff --git a/private/utils/wizards/addusrw/nwlim.cpp b/private/utils/wizards/addusrw/nwlim.cpp new file mode 100644 index 000000000..0abded1b8 --- /dev/null +++ b/private/utils/wizards/addusrw/nwlim.cpp @@ -0,0 +1,312 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + NWLim.cpp : implementation file + + CPropertyPage support for User mgmt wizard + +File History: + + JonY Apr-96 created + +--*/ + + +#include "stdafx.h" +#include "speckle.h" +#include "NWLim.h" +#include "NWWKS.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +class WKSMember + { + public: + CString csWKSAddress; + CString csWKSNode; + }; + +///////////////////////////////////////////////////////////////////////////// +// CNWLimitLogon dialog +IMPLEMENT_DYNCREATE(CNWLimitLogon, CPropertyPage) +CNWLimitLogon::CNWLimitLogon() : CPropertyPage(CNWLimitLogon::IDD) +{ + //{{AFX_DATA_INIT(CNWLimitLogon) + m_nWorkstationRadio = 0; + m_csCaption = _T(""); + //}}AFX_DATA_INIT +} + + +void CNWLimitLogon::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CNWLimitLogon) + DDX_Control(pDX, IDC_NWLOGON_LIST, m_lbWksList); + DDX_Radio(pDX, IDC_WORKSTATION_RADIO, m_nWorkstationRadio); + DDX_Text(pDX, IDC_STATIC1, m_csCaption); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CNWLimitLogon, CPropertyPage) + //{{AFX_MSG_MAP(CNWLimitLogon) + ON_BN_CLICKED(IDC_ADD_BUTTON, OnAddButton) + ON_BN_CLICKED(IDC_REMOVE_BUTTON, OnRemoveButton) + ON_BN_CLICKED(IDC_WORKSTATION_RADIO, OnWorkstationRadio) + ON_BN_CLICKED(IDC_WORKSTATION_RADIO2, OnWorkstationRadio2) + ON_WM_SHOWWINDOW() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CNWLimitLogon message handlers +LRESULT CNWLimitLogon::OnWizardNext() +{ + UpdateData(TRUE); + if ((m_nWorkstationRadio == 1) && (m_lbWksList.GetCount() == 0)) + { + AfxMessageBox(IDS_NEEDA_WORKSTATION); + return -1; + } + + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + + USHORT sCount = 0; + BOOL bMatch = FALSE; + pApp->m_csAllowedLoginFrom = L""; + while (sCount < m_lbWksList.GetCount()) + { + WKSMember* pMem = (WKSMember*)m_lbWksList.GetItemData(sCount); + CString csTemp; + if (pMem->csWKSNode == L"0000000000-1") csTemp.Format(L"%s%s", pMem->csWKSAddress, L"ffffffffffff"); + else csTemp.Format(L"%s%s", pMem->csWKSAddress, pMem->csWKSNode); + + pApp->m_csAllowedLoginFrom += csTemp; + sCount++; + } + + if (m_lbWksList.GetCount() > 0) pApp->m_csAllowedLoginFrom += L"00"; + + return IDD_FINISH; + +} + +LRESULT CNWLimitLogon::OnWizardBack() +{ + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + + if (pApp->m_bWorkstation) return IDD_LOGONTO_DLG; + else if (pApp->m_bHours) return IDD_HOURS_DLG; + else if (pApp->m_bExpiration) return IDD_ACCOUNT_EXP_DIALOG; + else return IDD_RESTRICTIONS_DIALOG; + +} + + +void CNWLimitLogon::OnAddButton() +{ + CAddNWWKS add; + if (add.DoModal() == 1) + { + // check for uniqueness + USHORT sCount = 0; + BOOL bMatch = FALSE; + while (sCount < m_lbWksList.GetCount()) + { + WKSMember* pMem = (WKSMember*)m_lbWksList.GetItemData(sCount); + if ((pMem->csWKSAddress == add.m_csNetworkAddress) && + (pMem->csWKSNode == add.m_csNodeAddress)) + { + bMatch = TRUE; + break; + } + + sCount++; + } + + if (bMatch) return; + + WKSMember* member = new WKSMember; + member->csWKSAddress = add.m_csNetworkAddress; + member->csWKSNode = add.m_csNodeAddress; + + int nEntry = m_lbWksList.AddString(L" "); + m_lbWksList.SetItemData(nEntry, (DWORD)member); + + // enable the remove button since there is something to remove + GetDlgItem(IDC_REMOVE_BUTTON)->EnableWindow(TRUE); + GetDlgItem(IDC_NWLOGON_LIST)->SetFocus(); + m_lbWksList.SetCurSel(0); + } + +} + +void CNWLimitLogon::OnRemoveButton() +{ + USHORT sSel = m_lbWksList.GetCurSel(); + + WKSMember* member = (WKSMember*)m_lbWksList.GetItemData(sSel); + free(member); + m_lbWksList.DeleteString(sSel); + + if (m_lbWksList.GetCount() == 0) GetDlgItem(IDC_REMOVE_BUTTON)->EnableWindow(FALSE); + else if (sSel > 0) m_lbWksList.SetCurSel(sSel - 1); + else m_lbWksList.SetCurSel(0); + +} + +void CNWLimitLogon::OnWorkstationRadio() +{ + GetDlgItem(IDC_NWSTATIC1)->EnableWindow(FALSE); + GetDlgItem(IDC_NWSTATIC2)->EnableWindow(FALSE); + GetDlgItem(IDC_NWLOGON_LIST)->EnableWindow(FALSE); + GetDlgItem(IDC_ADD_BUTTON)->EnableWindow(FALSE); + GetDlgItem(IDC_REMOVE_BUTTON)->EnableWindow(FALSE); + +} + +void CNWLimitLogon::OnWorkstationRadio2() +{ + GetDlgItem(IDC_NWSTATIC1)->EnableWindow(TRUE); + GetDlgItem(IDC_NWSTATIC2)->EnableWindow(TRUE); + GetDlgItem(IDC_NWLOGON_LIST)->EnableWindow(TRUE); + GetDlgItem(IDC_ADD_BUTTON)->EnableWindow(TRUE); + +} + + +///////////////////////////////////////////////////////////////////////////// +// CWorkstationList + +CWorkstationList::CWorkstationList() +{ +} + +CWorkstationList::~CWorkstationList() +{ +} + + +BEGIN_MESSAGE_MAP(CWorkstationList, CListBox) + //{{AFX_MSG_MAP(CWorkstationList) + ON_WM_DESTROY() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CWorkstationList message handlers + +void CWorkstationList::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) +{ + COLORREF crefOldText; + COLORREF crefOldBk; + HBRUSH hBrush; + + CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC); + switch (lpDrawItemStruct->itemAction) + { + case ODA_SELECT: + case ODA_DRAWENTIRE: +// Is the item selected? + if (lpDrawItemStruct->itemState & ODS_SELECTED) + { + hBrush = CreateSolidBrush( GetSysColor(COLOR_HIGHLIGHT)); + crefOldText = pDC->SetTextColor(GetSysColor(COLOR_HIGHLIGHTTEXT) ); + crefOldBk = pDC->SetBkColor(GetSysColor(COLOR_HIGHLIGHT) ); + } + else + { + hBrush = (HBRUSH)GetStockObject( GetSysColor(COLOR_WINDOW)); + crefOldText = pDC->SetTextColor(GetSysColor(COLOR_WINDOWTEXT)); + crefOldBk = pDC->SetBkColor(GetSysColor(COLOR_WINDOW)); + } + +// fill in the background + pDC->FillRect(&(lpDrawItemStruct->rcItem), CBrush::FromHandle(hBrush)); + +// display text + TCHAR* pName = (TCHAR*)malloc(255 * sizeof(TCHAR)); + if (pName == NULL) + { + AfxMessageBox(IDS_GENERIC_NO_HEAP, MB_ICONEXCLAMATION); + exit(1); + } + + DWORD dwAddr = GetItemData(lpDrawItemStruct->itemID); + + WKSMember* member = (WKSMember*)dwAddr; + +// format the name + comment + int nTop = (lpDrawItemStruct->rcItem.bottom + lpDrawItemStruct->rcItem.top) / 2; + pDC->TextOut(0, + (nTop - 8), + member->csWKSAddress); + + if (member->csWKSNode == L"0000000000-1") + pDC->TextOut(130, + (nTop - 8), + L"All Nodes"); + + else + pDC->TextOut(130, + (nTop - 8), + member->csWKSNode); + + free(pName); + break; + } + + pDC->SetBkColor(crefOldBk ); + pDC->SetTextColor(crefOldText ); +} + +int CWorkstationList::CompareItem(LPCOMPAREITEMSTRUCT lpCompareItemStruct) +{ + // TODO: Add your code to determine the sorting order of the specified items + // return -1 = item 1 sorts before item 2 + // return 0 = item 1 and item 2 sort the same + // return 1 = item 1 sorts after item 2 + + return 0; +} + +void CWorkstationList::OnDestroy() +{ + while(GetCount() > 0) + { + WKSMember* member = (WKSMember*)GetItemData(0); + delete member; + DeleteString(0); + } + CListBox::OnDestroy(); + + +} + + +void CNWLimitLogon::OnShowWindow(BOOL bShow, UINT nStatus) +{ + CPropertyPage::OnShowWindow(bShow, nStatus); + + if (bShow) + { + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + + CString csTemp; + csTemp.LoadString(IDS_NWLOGON_CAPTION); + + CString csTemp2; + csTemp2.Format(csTemp, pApp->m_csUserName); + m_csCaption = csTemp2; + UpdateData(FALSE); + } + +} diff --git a/private/utils/wizards/addusrw/nwlim.h b/private/utils/wizards/addusrw/nwlim.h new file mode 100644 index 000000000..6fc6ecb4b --- /dev/null +++ b/private/utils/wizards/addusrw/nwlim.h @@ -0,0 +1,92 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + NWLim.h : header file + +File History: + + JonY Apr-96 created + +--*/ + +///////////////////////////////////////////////////////////////////////////// +// CWorkstationList window + +class CWorkstationList : public CListBox +{ +// Construction +public: + CWorkstationList(); + +// Attributes +public: + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CWorkstationList) + public: + virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); + virtual int CompareItem(LPCOMPAREITEMSTRUCT lpCompareItemStruct); + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CWorkstationList(); + + // Generated message map functions +protected: + //{{AFX_MSG(CWorkstationList) + afx_msg void OnDestroy(); + //}}AFX_MSG + + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////// +// CNWLimitLogon dialog + +class CNWLimitLogon : public CPropertyPage +{ +DECLARE_DYNCREATE(CNWLimitLogon) +// Construction +public: + CNWLimitLogon(); // standard constructor + +// Dialog Data + //{{AFX_DATA(CNWLimitLogon) + enum { IDD = IDD_NWLOGON_DIALOG }; + CWorkstationList m_lbWksList; + int m_nWorkstationRadio; + CString m_csCaption; + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CNWLimitLogon) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + LRESULT OnWizardNext(); + LRESULT OnWizardBack(); + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CNWLimitLogon) + afx_msg void OnAddButton(); + afx_msg void OnRemoveButton(); + afx_msg void OnWorkstationRadio(); + afx_msg void OnWorkstationRadio2(); + afx_msg void OnShowWindow(BOOL bShow, UINT nStatus); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; diff --git a/private/utils/wizards/addusrw/nwwks.cpp b/private/utils/wizards/addusrw/nwwks.cpp new file mode 100644 index 000000000..e33fc3ba4 --- /dev/null +++ b/private/utils/wizards/addusrw/nwwks.cpp @@ -0,0 +1,159 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + NWWKS.cpp : implementation file + + CPropertyPage support for User mgmt wizard + +File History: + + JonY Apr-96 created + +--*/ + + +#include "stdafx.h" +#include "speckle.h" +#include "NWWKS.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CAddNWWKS dialog + + +CAddNWWKS::CAddNWWKS(CWnd* pParent /*=NULL*/) + : CDialog(CAddNWWKS::IDD, pParent) +{ + //{{AFX_DATA_INIT(CAddNWWKS) + m_csNetworkAddress = _T(""); + m_csNodeAddress = _T(""); + //}}AFX_DATA_INIT +} + + +void CAddNWWKS::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CAddNWWKS) + DDX_Text(pDX, IDC_NETWORK_ADDRESS_EDIT, m_csNetworkAddress); + DDX_Text(pDX, IDC_NODE_ADDRESS_EDIT, m_csNodeAddress); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CAddNWWKS, CDialog) + //{{AFX_MSG_MAP(CAddNWWKS) + ON_EN_CHANGE(IDC_NETWORK_ADDRESS_EDIT, OnChangeNetworkAddressEdit) + ON_EN_CHANGE(IDC_NODE_ADDRESS_EDIT, OnChangeNodeAddressEdit) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CAddNWWKS message handlers + +void CAddNWWKS::OnOK() +{ +// 8 digit address +// 12 digit node +// network is req'd. Node is not. + UpdateData(TRUE); + + if (m_csNetworkAddress == L"") + { + AfxMessageBox(IDS_NEED_ADDRESS); + GetDlgItem(IDC_NETWORK_ADDRESS_EDIT)->SetFocus(); + return; + } + + if (m_csNetworkAddress.FindOneOf(L"GgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz~`!@#$%^&*()-_+={[}}]|\\:;\"',<.>/?") != -1) + { + AfxMessageBox(IDS_BAD_NWADDRESS); + GetDlgItem(IDC_NETWORK_ADDRESS_EDIT)->SetFocus(); + return; + } + + if (m_csNetworkAddress.GetLength() > 8) + { + AfxMessageBox(IDS_TOOLONG_NWADDRESS); + GetDlgItem(IDC_NETWORK_ADDRESS_EDIT)->SetFocus(); + return; + } + + if (m_csNodeAddress.FindOneOf(L"GgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz~`!@#$%^&*()-_+={[}}]|\\:;\"',<.>/?") != -1) + { + AfxMessageBox(IDS_BAD_NWNODE); + GetDlgItem(IDC_NODE_ADDRESS_EDIT)->SetFocus(); + return; + } + + if (m_csNodeAddress.GetLength() > 12) + { + AfxMessageBox(IDS_TOOLONG_NWNODE); + GetDlgItem(IDC_NODE_ADDRESS_EDIT)->SetFocus(); + return; + } + + if (m_csNodeAddress == L"") + { + if (AfxMessageBox(IDS_ALL_NODES, MB_YESNO | MB_ICONEXCLAMATION) == IDYES) + m_csNodeAddress = L"-1"; + + else return; + } + +// pad out the numbers to the appropriate length + while (m_csNodeAddress.GetLength() < 12) m_csNodeAddress = L"0" + m_csNodeAddress; + while (m_csNetworkAddress.GetLength() < 8) m_csNetworkAddress = L"0" + m_csNetworkAddress; + + EndDialog(1); + +} + +void CAddNWWKS::OnCancel() +{ + EndDialog(0); +} + +BOOL CAddNWWKS::OnInitDialog() +{ + CDialog::OnInitDialog(); + + GetDlgItem(IDC_NETWORK_ADDRESS_EDIT)->SetFocus(); + + return FALSE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +void CAddNWWKS::OnChangeNetworkAddressEdit() +{ + UpdateData(TRUE); + if (m_csNetworkAddress.FindOneOf(L"GgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz~`!@#$%^&*()-_+={[}}]|\\:;\"',<.>/?") != -1) + { + AfxMessageBox(IDS_BAD_NWADDRESS); + } + + if (m_csNetworkAddress.GetLength() > 8) + { + AfxMessageBox(IDS_TOOLONG_NWADDRESS); + } + +} + +void CAddNWWKS::OnChangeNodeAddressEdit() +{ + UpdateData(TRUE); + if (m_csNodeAddress.FindOneOf(L"GgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz~`!@#$%^&*()-_+={[}}]|\\:;\"',<.>/?") != -1) + AfxMessageBox(IDS_BAD_NWNODE); + + if (m_csNodeAddress.GetLength() > 12) + AfxMessageBox(IDS_TOOLONG_NWNODE); + +} diff --git a/private/utils/wizards/addusrw/nwwks.h b/private/utils/wizards/addusrw/nwwks.h new file mode 100644 index 000000000..5c0049e74 --- /dev/null +++ b/private/utils/wizards/addusrw/nwwks.h @@ -0,0 +1,51 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + NWWKS.h : header file + +File History: + + JonY Apr-96 created + +--*/ + +///////////////////////////////////////////////////////////////////////////// +// CAddNWWKS dialog + +class CAddNWWKS : public CDialog +{ +// Construction +public: + CAddNWWKS(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(CAddNWWKS) + enum { IDD = IDD_ADD_NWWKS_DIALOG }; + CString m_csNetworkAddress; + CString m_csNodeAddress; + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CAddNWWKS) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CAddNWWKS) + virtual void OnOK(); + virtual void OnCancel(); + virtual BOOL OnInitDialog(); + afx_msg void OnChangeNetworkAddressEdit(); + afx_msg void OnChangeNodeAddressEdit(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; diff --git a/private/utils/wizards/addusrw/optdlg.cpp b/private/utils/wizards/addusrw/optdlg.cpp new file mode 100644 index 000000000..29b0c0914 --- /dev/null +++ b/private/utils/wizards/addusrw/optdlg.cpp @@ -0,0 +1,167 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + OptDlg.cpp : implementation file + + CPropertyPage support for User mgmt wizard + +File History: + + JonY Apr-96 created + +--*/ + + +#include "stdafx.h" +#include "speckle.h" +#include "wizbased.h" +#include "OptDlg.h" + +#include +#include +#include +#include + +#ifdef _DEBUG +//#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// COptionsDlg property page + +IMPLEMENT_DYNCREATE(COptionsDlg, CWizBaseDlg) + +COptionsDlg::COptionsDlg() : CWizBaseDlg(COptionsDlg::IDD) +{ + //{{AFX_DATA_INIT(COptionsDlg) + m_bNW = FALSE; + m_bProfile = FALSE; + m_bRAS = FALSE; + m_bExchange = FALSE; + m_bHomeDir = FALSE; + m_bLoginScript = FALSE; + m_csCaption = _T(""); + //}}AFX_DATA_INIT +} + +COptionsDlg::~COptionsDlg() +{ +} + +void COptionsDlg::DoDataExchange(CDataExchange* pDX) +{ + CPropertyPage::DoDataExchange(pDX); + //{{AFX_DATA_MAP(COptionsDlg) + DDX_Check(pDX, IDC_NW_CHECK, m_bNW); + DDX_Check(pDX, IDC_PROFILE_CHECK, m_bProfile); + DDX_Check(pDX, IDC_RAS_CHECK, m_bRAS); + DDX_Check(pDX, IDC_EXCHANGE_CHECK, m_bExchange); + DDX_Check(pDX, IDC_HOMEDIR_CHECK, m_bHomeDir); + DDX_Check(pDX, IDC_LOGIN_SCRIPT_CHECK, m_bLoginScript); + DDX_Text(pDX, IDC_STATIC1, m_csCaption); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(COptionsDlg, CWizBaseDlg) + //{{AFX_MSG_MAP(COptionsDlg) + ON_WM_SHOWWINDOW() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// COptionsDlg message handlers + +void COptionsDlg::OnShowWindow(BOOL bShow, UINT nStatus) +{ + CWizBaseDlg::OnShowWindow(bShow, nStatus); + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + + if (bShow) + { + CString csTemp; + csTemp.LoadString(IDS_OPTION_CAPTION); + + CString csTemp2; + csTemp2.Format(csTemp, pApp->m_csUserName); + m_csCaption = csTemp2; + UpdateData(FALSE); + +// first find out whats installed so we know what to enable/disable + TCHAR* pServer = (TCHAR*)pApp->m_csServer.GetBuffer(pApp->m_csServer.GetLength()); + pApp->m_csServer.ReleaseBuffer(); + + SERVER_INFO_102* pInfo; + NET_API_STATUS nApi = NetServerGetInfo(pServer, + 102, + (LPBYTE*)&pInfo); + + if (nApi != ERROR_SUCCESS) + { + AfxMessageBox(IDS_UNKNOWN_COMPONENTS); + GetDlgItem(IDC_NW_CHECK)->EnableWindow(FALSE); + return; + } + +// FPNW + GetDlgItem(IDC_NW_CHECK)->EnableWindow(pInfo->sv102_type & SV_TYPE_SERVER_MFPN); + m_bNW = (pInfo->sv102_type & SV_TYPE_SERVER_MFPN) ? m_bNW : FALSE; + UpdateData(FALSE); + +// exchange- look for the usrmgr extension entry + HKEY hKey; + + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + long lRet = RegConnectRegistry( + (LPTSTR)pApp->m_csServer.GetBuffer(pApp->m_csServer.GetLength()), + HKEY_LOCAL_MACHINE, + &hKey); + + if (lRet != ERROR_SUCCESS) + { + GetDlgItem(IDC_EXCHANGE_CHECK)->EnableWindow(FALSE); + m_bExchange = FALSE; + UpdateData(FALSE); + return; + } + + DWORD cbProv = 0; + DWORD dwRet = RegOpenKey(hKey, + TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Network\\UMAddOns"), &hKey ); + + TCHAR* lpPrimaryDomain = NULL; + if ((dwRet = RegQueryValueEx( hKey, TEXT("Mailumx"), NULL, NULL, NULL, &cbProv )) == ERROR_SUCCESS) + GetDlgItem(IDC_EXCHANGE_CHECK)->EnableWindow(TRUE); + else GetDlgItem(IDC_EXCHANGE_CHECK)->EnableWindow(FALSE); + + RegCloseKey(hKey); + } + +} + +LRESULT COptionsDlg::OnWizardNext() +{ + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + + UpdateData(TRUE); + pApp->m_bProfile = m_bProfile; + pApp->m_bLoginScript = m_bLoginScript; + pApp->m_bHomeDir = m_bHomeDir; + pApp->m_bRAS = m_bRAS; + pApp->m_bNW = m_bNW; + pApp->m_bExchange = m_bExchange; + + if (m_bProfile) return IDD_PROFILE; + else if (m_bLoginScript) return IDD_LOGON_SCRIPT_DIALOG; + else if (m_bHomeDir) return IDD_HOMEDIR_DIALOG; + else if (m_bRAS) return IDD_RAS_PERM_DIALOG; + else if (m_bNW) return IDD_FPNW_DLG; + else if (m_bExchange) return IDD_EXCHANGE_DIALOG; + else return IDD_RESTRICTIONS_DIALOG; + +} diff --git a/private/utils/wizards/addusrw/optdlg.h b/private/utils/wizards/addusrw/optdlg.h new file mode 100644 index 000000000..081a37be7 --- /dev/null +++ b/private/utils/wizards/addusrw/optdlg.h @@ -0,0 +1,59 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + OptDlg.h : header file + +File History: + + JonY Apr-96 created + +--*/ + + +///////////////////////////////////////////////////////////////////////////// +// COptionsDlg dialog + +class COptionsDlg : public CWizBaseDlg +{ + DECLARE_DYNCREATE(COptionsDlg) + +// Construction +public: + COptionsDlg(); + ~COptionsDlg(); + +// Dialog Data + //{{AFX_DATA(COptionsDlg) + enum { IDD = IDD_OPTIONS_DIALOG }; + BOOL m_bNW; + BOOL m_bProfile; + BOOL m_bRAS; + BOOL m_bExchange; + BOOL m_bHomeDir; + BOOL m_bLoginScript; + CString m_csCaption; + //}}AFX_DATA + + +// Overrides + // ClassWizard generate virtual function overrides + //{{AFX_VIRTUAL(COptionsDlg) + public: + virtual LRESULT OnWizardNext(); + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + // Generated message map functions + //{{AFX_MSG(COptionsDlg) + afx_msg void OnShowWindow(BOOL bShow, UINT nStatus); + + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + +}; diff --git a/private/utils/wizards/addusrw/profile.cpp b/private/utils/wizards/addusrw/profile.cpp new file mode 100644 index 000000000..688d6f410 --- /dev/null +++ b/private/utils/wizards/addusrw/profile.cpp @@ -0,0 +1,105 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + Profile.cpp : implementation file + + CPropertyPage support for User mgmt wizard + +File History: + + JonY Apr-96 created + +--*/ + + +#include "stdafx.h" +#include "Speckle.h" +#include "wizbased.h" +#include "Profile.h" + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CProfile property page + +IMPLEMENT_DYNCREATE(CProfile, CWizBaseDlg) + +CProfile::CProfile() : CWizBaseDlg(CProfile::IDD) +{ + //{{AFX_DATA_INIT(CProfile) + m_csProfilePath = _T(""); + //}}AFX_DATA_INIT +} + +CProfile::~CProfile() +{ +} + +void CProfile::DoDataExchange(CDataExchange* pDX) +{ + CPropertyPage::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CProfile) + DDX_Text(pDX, IDC_PROFILE_PATH, m_csProfilePath); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CProfile, CWizBaseDlg) + //{{AFX_MSG_MAP(CProfile) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CProfile message handlers +BOOL CProfile::OnInitDialog() +{ + CPropertyPage::OnInitDialog(); + + UpdateData(FALSE); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + /* +void CProfile::OnBrowseButton() +{ + static TCHAR szFilter[] = _T("All Files (*.*)|*.*||"); + + CFileDialog cf(TRUE, L"", NULL, OFN_FILEMUSTEXIST | OFN_EXPLORER | OFN_PATHMUSTEXIST, szFilter); + if (cf.DoModal() == IDOK) + { + m_csProfilePath = cf.GetPathName(); + UpdateData(FALSE); + } + + +} */ + +LRESULT CProfile::OnWizardNext() +{ + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + + UpdateData(TRUE); + pApp->m_csProfilePath = m_csProfilePath; + + if (pApp->m_bLoginScript) return IDD_LOGON_SCRIPT_DIALOG; + else if (pApp->m_bHomeDir) return IDD_HOMEDIR_DIALOG; + else if (pApp->m_bRAS) return IDD_RAS_PERM_DIALOG; + else if (pApp->m_bNW) return IDD_FPNW_DLG; + else if (pApp->m_bExchange) return IDD_EXCHANGE_DIALOG; + else return IDD_RESTRICTIONS_DIALOG; + + +} + +LRESULT CProfile::OnWizardBack() +{ + return IDD_OPTIONS_DIALOG; + +} diff --git a/private/utils/wizards/addusrw/profile.h b/private/utils/wizards/addusrw/profile.h new file mode 100644 index 000000000..4b6d9b849 --- /dev/null +++ b/private/utils/wizards/addusrw/profile.h @@ -0,0 +1,52 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + Profile.h : header file + +File History: + + JonY Apr-96 created + +--*/ + + +///////////////////////////////////////////////////////////////////////////// +// CProfile dialog + +class CProfile : public CWizBaseDlg +{ + DECLARE_DYNCREATE(CProfile) + +// Construction +public: + CProfile(); + ~CProfile(); + +// Dialog Data + //{{AFX_DATA(CProfile) + enum { IDD = IDD_PROFILE }; + CString m_csProfilePath; + //}}AFX_DATA + + LRESULT OnWizardNext(); +// Overrides + // ClassWizard generate virtual function overrides + //{{AFX_VIRTUAL(CProfile) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + // Generated message map functions + //{{AFX_MSG(CProfile) + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + + LRESULT OnWizardBack(); + +}; diff --git a/private/utils/wizards/addusrw/prsinfo.cpp b/private/utils/wizards/addusrw/prsinfo.cpp new file mode 100644 index 000000000..aabd0c3f7 --- /dev/null +++ b/private/utils/wizards/addusrw/prsinfo.cpp @@ -0,0 +1,162 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + PersonalInfo.cpp : implementation file + + CPropertyPage support for User mgmt wizard + +File History: + + JonY Apr-96 created + +--*/ + +#include "stdafx.h" +#include "Speckle.h" +#include "wizbased.h" +#include "Prsinfo.h" + +#include +#include + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CPersonalInfo dialog +IMPLEMENT_DYNCREATE(CPersonalInfo, CWizBaseDlg) + +CPersonalInfo::CPersonalInfo() : CWizBaseDlg(CPersonalInfo::IDD) +{ + //{{AFX_DATA_INIT(CPersonalInfo) + m_csDescription = _T(""); + m_csFullName = _T(""); + m_csUserName = _T(""); + //}}AFX_DATA_INIT +} + + +void CPersonalInfo::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CPersonalInfo) + DDX_Text(pDX, IDC_DESCRIPTION, m_csDescription); + DDX_Text(pDX, IDC_FULLNAME, m_csFullName); + DDX_Text(pDX, IDC_USERNAME, m_csUserName); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CPersonalInfo, CWizBaseDlg) + //{{AFX_MSG_MAP(CPersonalInfo) + ON_WM_SHOWWINDOW() + ON_EN_CHANGE(IDC_USERNAME, OnChangeUsername) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CPersonalInfo message handlers +LRESULT CPersonalInfo::OnWizardBack() +{ + SetButtonAccess(PSWIZB_NEXT | PSWIZB_BACK); + + return CPropertyPage::OnWizardBack(); +} + +LRESULT CPersonalInfo::OnWizardNext() +{ + SetButtonAccess(PSWIZB_NEXT | PSWIZB_BACK); + +// eventually this needs to be changed to I_NetNameValidate from private\net\inc\icanon.h from netlib.lib + UpdateData(TRUE); + if (m_csUserName == "") + { + AfxMessageBox(IDS_NO_USERNAME); + GetDlgItem(IDC_USERNAME)->SetFocus(); + return -1; + } + + if (m_csUserName.GetLength() > 20) + { + AfxMessageBox(IDS_USERNAME_TOOLONG); + GetDlgItem(IDC_USERNAME)->SetFocus(); + return -1; + } + + if (m_csUserName.FindOneOf(L"\"\\/[];:|=,+*?<>") != -1) + { + AfxMessageBox(IDS_BAD_USERNAME); + GetDlgItem(IDC_USERNAME)->SetFocus(); + return -1; + } + + CWaitCursor wait; + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + TCHAR* pServer = pApp->m_csServer.GetBuffer(pApp->m_csServer.GetLength()); + pApp->m_csServer.ReleaseBuffer(); + + TCHAR* pUser = m_csUserName.GetBuffer(m_csUserName.GetLength()); + m_csUserName.ReleaseBuffer(); + +// is username unique? + LPBYTE* pUserInfo = new LPBYTE[256]; + NET_API_STATUS nAPI = NetUserGetInfo(pServer, + pUser, + 0, + pUserInfo); + + delete (pUserInfo); + if (nAPI == NERR_Success) + { + CString csDup; + csDup.Format(IDS_DUPLICATE_NAME, m_csUserName, m_csUserName, pApp->m_csDomain); + AfxMessageBox(csDup); + GetDlgItem(IDC_USERNAME)->SetFocus(); + return -1; + } + + pApp->m_csDescription = m_csDescription; + pApp->m_csFullName = m_csFullName; + pApp->m_csUserName = m_csUserName; + + return CPropertyPage::OnWizardNext(); + +} + +void CPersonalInfo::OnShowWindow(BOOL bShow, UINT nStatus) +{ + CWizBaseDlg::OnShowWindow(bShow, nStatus); + + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + if (bShow && pApp->m_bPRSReset) + { + m_csDescription = L""; + m_csFullName = L""; + m_csUserName = L""; + pApp->m_bPRSReset = FALSE; + UpdateData(FALSE); + } +} + +void CPersonalInfo::OnChangeUsername() +{ + UpdateData(TRUE); + + if (m_csUserName.GetLength() > 20) + { + AfxMessageBox(IDS_USERNAME_TOOLONG); + GetDlgItem(IDC_USERNAME)->SetFocus(); + } + + if (m_csUserName.FindOneOf(L"\"\\/[];:|=,+*?<>") != -1) + { + AfxMessageBox(IDS_BAD_USERNAME); + GetDlgItem(IDC_USERNAME)->SetFocus(); + } + +} diff --git a/private/utils/wizards/addusrw/prsinfo.h b/private/utils/wizards/addusrw/prsinfo.h new file mode 100644 index 000000000..d74678417 --- /dev/null +++ b/private/utils/wizards/addusrw/prsinfo.h @@ -0,0 +1,54 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + PrsInfo.h : header file + +File History: + + JonY Apr-96 created + +--*/ + + +///////////////////////////////////////////////////////////////////////////// +// CPersonalInfo dialog + +class CPersonalInfo : public CWizBaseDlg +{ +DECLARE_DYNCREATE(CPersonalInfo) + +// Construction +public: + CPersonalInfo(); // standard constructor + +// Dialog Data + //{{AFX_DATA(CPersonalInfo) + enum { IDD = IDD_USER_NAME }; + CString m_csDescription; + CString m_csFullName; + CString m_csUserName; + //}}AFX_DATA + + LRESULT OnWizardBack(); + LRESULT OnWizardNext(); + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CPersonalInfo) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CPersonalInfo) + afx_msg void OnShowWindow(BOOL bShow, UINT nStatus); + afx_msg void OnChangeUsername(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; diff --git a/private/utils/wizards/addusrw/pwinfo.cpp b/private/utils/wizards/addusrw/pwinfo.cpp new file mode 100644 index 000000000..3669c1d88 --- /dev/null +++ b/private/utils/wizards/addusrw/pwinfo.cpp @@ -0,0 +1,207 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + PasswordInfo.cpp : implementation file + + CPropertyPage support for User mgmt wizard + +File History: + + JonY Apr-96 created + +--*/ + +#include "stdafx.h" +#include "Speckle.h" +#include "wizbased.h" +#include "PwInfo.h" + +#include +#include + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CPasswordInfo property page + +IMPLEMENT_DYNCREATE(CPasswordInfo, CWizBaseDlg) + +CPasswordInfo::CPasswordInfo() : CWizBaseDlg(CPasswordInfo::IDD) +{ + //{{AFX_DATA_INIT(CPasswordInfo) + m_csPassword1 = _T(""); + m_csPassword2 = _T(""); + m_nPWOptions = 0; + m_bNeverExpirePW = FALSE; + m_csCaption = _T(""); + //}}AFX_DATA_INIT +} + +CPasswordInfo::~CPasswordInfo() +{ +} + +void CPasswordInfo::DoDataExchange(CDataExchange* pDX) +{ + CPropertyPage::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CPasswordInfo) + DDX_Text(pDX, IDC_PASSWORD1, m_csPassword1); + DDX_Text(pDX, IDC_PASSWORD2, m_csPassword2); + DDX_Radio(pDX, IDC_PWOPTIONS_RADIO, m_nPWOptions); + DDX_Check(pDX, IDC_EXPIREPW_CHECK, m_bNeverExpirePW); + DDX_Text(pDX, IDC_STATIC1, m_csCaption); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CPasswordInfo, CWizBaseDlg) + //{{AFX_MSG_MAP(CPasswordInfo) + ON_WM_SHOWWINDOW() + ON_EN_CHANGE(IDC_PASSWORD1, OnChangePassword1) + ON_EN_CHANGE(IDC_PASSWORD2, OnChangePassword2) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CPasswordInfo message handlers + +LRESULT CPasswordInfo::OnWizardNext() +{ + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + UpdateData(TRUE); + SetButtonAccess(PSWIZB_NEXT | PSWIZB_BACK); + + TCHAR* pServer = pApp->m_csServer.GetBuffer(pApp->m_csServer.GetLength()); + pApp->m_csServer.ReleaseBuffer(); + + if (m_csPassword1 != m_csPassword2) + { + CString csPW; + csPW.Format(IDS_PW_NOMATCH, pApp->m_csUserName); + AfxMessageBox(csPW); + GetDlgItem(IDC_PASSWORD1)->SetFocus(); + return -1; + } + + if (m_csPassword1.GetLength() > 14) + { + AfxMessageBox(IDS_PW_TOOLONG); + GetDlgItem(IDC_PASSWORD1)->SetFocus(); + return -1; + } + + if (m_csPassword2.GetLength() > 14) + { + AfxMessageBox(IDS_PW_TOOLONG); + GetDlgItem(IDC_PASSWORD2)->SetFocus(); + return -1; + } + + LPBYTE pBuf; + NET_API_STATUS nAPI = NetUserModalsGet( + pServer, + 0, + &pBuf); + + PUSER_MODALS_INFO_0 pModals = (PUSER_MODALS_INFO_0)pBuf; + + if (nAPI != NERR_Success) + { + AfxMessageBox(IDS_BAD_GETMODALS); + ExitProcess(1); + } + + if (m_csPassword1.GetLength() < (int)pModals->usrmod0_min_passwd_len) + { + CString csMin; + csMin.Format(IDS_PW_TOOSHORT, + pModals->usrmod0_min_passwd_len); + + AfxMessageBox(csMin); + GetDlgItem(IDC_PASSWORD1)->SetFocus(); + return -1; + } + + pApp->m_csPassword1 = m_csPassword1; + m_csPassword1 = L""; + + if (m_nPWOptions == 0 && m_bNeverExpirePW) AfxMessageBox(IDS_WONT_REQUIRE); + + + pApp->m_bPW_Never_Expires = m_bNeverExpirePW; + + if (m_nPWOptions == 0) + { + pApp->m_bMust_Change_PW = TRUE; + pApp->m_bChange_Password = TRUE; + } + else if (m_nPWOptions == 1) + { + pApp->m_bChange_Password = TRUE; + pApp->m_bMust_Change_PW = FALSE; + } + + else pApp->m_bChange_Password = FALSE; + + return CPropertyPage::OnWizardNext(); + +} + + +void CPasswordInfo::OnShowWindow(BOOL bShow, UINT nStatus) +{ + CWizBaseDlg::OnShowWindow(bShow, nStatus); + + if (bShow) + { + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + + CString csTemp; + csTemp.LoadString(IDS_PASSWORD_CAPTION); + + CString csTemp2; + csTemp2.Format(csTemp, pApp->m_csUserName); + m_csCaption = csTemp2; + + if (pApp->m_bPWReset) + { + m_csPassword1 = L""; + m_csPassword2 = L""; + m_nPWOptions = 0; + m_bNeverExpirePW = FALSE; + pApp->m_bPWReset = FALSE; + } + UpdateData(FALSE); + } + +} + +void CPasswordInfo::OnChangePassword1() +{ + UpdateData(TRUE); + + if (m_csPassword1.GetLength() > 14) + { + AfxMessageBox(IDS_PW_TOOLONG); + GetDlgItem(IDC_PASSWORD1)->SetFocus(); + } + +} + +void CPasswordInfo::OnChangePassword2() +{ + UpdateData(TRUE); + + if (m_csPassword2.GetLength() > 14) + { + AfxMessageBox(IDS_PW_TOOLONG); + GetDlgItem(IDC_PASSWORD2)->SetFocus(); + } + +} diff --git a/private/utils/wizards/addusrw/pwinfo.h b/private/utils/wizards/addusrw/pwinfo.h new file mode 100644 index 000000000..f049b0cf1 --- /dev/null +++ b/private/utils/wizards/addusrw/pwinfo.h @@ -0,0 +1,56 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + PwInfo.h : header file + +File History: + + JonY Apr-96 created + +--*/ + +///////////////////////////////////////////////////////////////////////////// +// CPasswordInfo dialog +class CPasswordInfo : public CWizBaseDlg +{ + DECLARE_DYNCREATE(CPasswordInfo) + +// Construction +public: + CPasswordInfo(); + ~CPasswordInfo(); + + LRESULT OnWizardNext(); + +// Dialog Data + //{{AFX_DATA(CPasswordInfo) + enum { IDD = IDD_PASSWORD_INFO }; + CString m_csPassword1; + CString m_csPassword2; + int m_nPWOptions; + BOOL m_bNeverExpirePW; + CString m_csCaption; + //}}AFX_DATA + + +// Overrides + // ClassWizard generate virtual function overrides + //{{AFX_VIRTUAL(CPasswordInfo) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + // Generated message map functions + //{{AFX_MSG(CPasswordInfo) + afx_msg void OnShowWindow(BOOL bShow, UINT nStatus); + afx_msg void OnChangePassword1(); + afx_msg void OnChangePassword2(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + +}; diff --git a/private/utils/wizards/addusrw/rasperm.cpp b/private/utils/wizards/addusrw/rasperm.cpp new file mode 100644 index 000000000..c2e82546a --- /dev/null +++ b/private/utils/wizards/addusrw/rasperm.cpp @@ -0,0 +1,155 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + CRasPerm.cpp : implementation file + + CPropertyPage support for User mgmt wizard + +File History: + + JonY Apr-96 created + +--*/ + +#include "stdafx.h" +#include "Speckle.h" +#include "wizbased.h" +#include "RasPerm.h" +#include + +#ifdef _DEBUG +//#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CRasPerm property page + +IMPLEMENT_DYNCREATE(CRasPerm, CWizBaseDlg) + +CRasPerm::CRasPerm() : CWizBaseDlg(CRasPerm::IDD) +{ + //{{AFX_DATA_INIT(CRasPerm) + m_csRasPhoneNumber = _T(""); + m_nCallBackRadio = 0; + m_csCaption = _T(""); + //}}AFX_DATA_INIT +} + +CRasPerm::~CRasPerm() +{ +} + +void CRasPerm::DoDataExchange(CDataExchange* pDX) +{ + CPropertyPage::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CRasPerm) + DDX_Text(pDX, IDC_RASPHONE_EDIT, m_csRasPhoneNumber); + DDX_Radio(pDX, IDC_CALL_BACK_RADIO, m_nCallBackRadio); + DDX_Text(pDX, IDC_STATIC1, m_csCaption); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CRasPerm, CWizBaseDlg) + //{{AFX_MSG_MAP(CRasPerm) + ON_WM_SHOWWINDOW() + ON_BN_CLICKED(IDC_RADIO3, OnRadio3) + ON_BN_CLICKED(IDC_RADIO2, OnRadio2) + ON_BN_CLICKED(IDC_CALL_BACK_RADIO, OnCallBackRadio) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CRasPerm message handlers +LRESULT CRasPerm::OnWizardNext() +{ + UpdateData(TRUE); + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + + if ((m_nCallBackRadio == 2) && (m_csRasPhoneNumber == L"")) + { + AfxMessageBox(IDS_NO_RAS_NUMBER); + return -1; + } + +// check for invalid phone number + if (m_nCallBackRadio == 2) + { + if (m_csRasPhoneNumber.GetLength() > RASSAPI_MAX_PHONENUMBER_SIZE) + { + AfxMessageBox(IDS_RAS_NUMBER_TOO_LONG); + GetDlgItem(IDC_RASPHONE_EDIT)->SetFocus(); + return -1; + } + + TCHAR* pNum = m_csRasPhoneNumber.GetBuffer(m_csRasPhoneNumber.GetLength()); + TCHAR pValid[] = {L"0123456789TPW()@- "}; + + if (_tcsspnp(pNum, pValid) != NULL) + { + AfxMessageBox(IDS_BAD_RAS_NUMBER); + GetDlgItem(IDC_RASPHONE_EDIT)->SetFocus(); + return -1; + } + } + + pApp->m_csRasPhoneNumber = m_csRasPhoneNumber; + pApp->m_sCallBackType = m_nCallBackRadio; + + if (pApp->m_bNW) return IDD_FPNW_DLG; + else if (pApp->m_bExchange) return IDD_EXCHANGE_DIALOG; + else return IDD_RESTRICTIONS_DIALOG; + +} + +LRESULT CRasPerm::OnWizardBack() +{ + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + if (pApp->m_bHomeDir) return IDD_HOMEDIR_DIALOG; + else if (pApp->m_bLoginScript) return IDD_LOGON_SCRIPT_DIALOG; + else if (pApp->m_bProfile) return IDD_PROFILE; + else return IDD_OPTIONS_DIALOG; + +} + +void CRasPerm::OnShowWindow(BOOL bShow, UINT nStatus) +{ + CWizBaseDlg::OnShowWindow(bShow, nStatus); + if (bShow) + { + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + + CString csTemp; + csTemp.LoadString(IDS_RAS_CAPTION); + + CString csTemp2; + csTemp2.Format(csTemp, pApp->m_csUserName); + m_csCaption = csTemp2; + UpdateData(FALSE); + } + +} + +void CRasPerm::OnRadio3() +{ + GetDlgItem(IDC_RASPHONE_EDIT)->EnableWindow(TRUE); + GetDlgItem(IDC_RASPHONE_EDIT)->SetFocus(); + +} + +void CRasPerm::OnRadio2() +{ + GetDlgItem(IDC_RASPHONE_EDIT)->EnableWindow(FALSE); + +} + +void CRasPerm::OnCallBackRadio() +{ + GetDlgItem(IDC_RASPHONE_EDIT)->EnableWindow(FALSE); + +} diff --git a/private/utils/wizards/addusrw/rasperm.h b/private/utils/wizards/addusrw/rasperm.h new file mode 100644 index 000000000..c239222a2 --- /dev/null +++ b/private/utils/wizards/addusrw/rasperm.h @@ -0,0 +1,58 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + RasPerm.h : header file + +File History: + + JonY Apr-96 created + +--*/ + + +///////////////////////////////////////////////////////////////////////////// +// CRasPerm dialog + +class CRasPerm : public CWizBaseDlg +{ + DECLARE_DYNCREATE(CRasPerm) + +// Construction +public: + CRasPerm(); + ~CRasPerm(); + +// Dialog Data + //{{AFX_DATA(CRasPerm) + enum { IDD = IDD_RAS_PERM_DIALOG }; + CString m_csRasPhoneNumber; + int m_nCallBackRadio; + CString m_csCaption; + //}}AFX_DATA + + +// Overrides + // ClassWizard generate virtual function overrides + //{{AFX_VIRTUAL(CRasPerm) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + + LRESULT OnWizardNext(); + LRESULT OnWizardBack(); + +// Implementation +protected: + // Generated message map functions + //{{AFX_MSG(CRasPerm) + afx_msg void OnShowWindow(BOOL bShow, UINT nStatus); + afx_msg void OnRadio3(); + afx_msg void OnRadio2(); + afx_msg void OnCallBackRadio(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + +}; diff --git a/private/utils/wizards/addusrw/res/bitmap1.bmp b/private/utils/wizards/addusrw/res/bitmap1.bmp new file mode 100644 index 000000000..3643a9d03 Binary files /dev/null and b/private/utils/wizards/addusrw/res/bitmap1.bmp differ diff --git a/private/utils/wizards/addusrw/res/endflag.bmp b/private/utils/wizards/addusrw/res/endflag.bmp new file mode 100644 index 000000000..2deab795c Binary files /dev/null and b/private/utils/wizards/addusrw/res/endflag.bmp differ diff --git a/private/utils/wizards/addusrw/res/global.bmp b/private/utils/wizards/addusrw/res/global.bmp new file mode 100644 index 000000000..aab380fbf Binary files /dev/null and b/private/utils/wizards/addusrw/res/global.bmp differ diff --git a/private/utils/wizards/addusrw/res/global_g.bmp b/private/utils/wizards/addusrw/res/global_g.bmp new file mode 100644 index 000000000..aab380fbf Binary files /dev/null and b/private/utils/wizards/addusrw/res/global_g.bmp differ diff --git a/private/utils/wizards/addusrw/res/group.bmp b/private/utils/wizards/addusrw/res/group.bmp new file mode 100644 index 000000000..c0886c97f Binary files /dev/null and b/private/utils/wizards/addusrw/res/group.bmp differ diff --git a/private/utils/wizards/addusrw/res/net_tree.bmp b/private/utils/wizards/addusrw/res/net_tree.bmp new file mode 100644 index 000000000..89a17b4d2 Binary files /dev/null and b/private/utils/wizards/addusrw/res/net_tree.bmp differ diff --git a/private/utils/wizards/addusrw/res/speckle.ico b/private/utils/wizards/addusrw/res/speckle.ico new file mode 100644 index 000000000..1cdd35abc Binary files /dev/null and b/private/utils/wizards/addusrw/res/speckle.ico differ diff --git a/private/utils/wizards/addusrw/res/speckle.rc2 b/private/utils/wizards/addusrw/res/speckle.rc2 new file mode 100644 index 000000000..d110b38b6 --- /dev/null +++ b/private/utils/wizards/addusrw/res/speckle.rc2 @@ -0,0 +1,26 @@ +// +// SPECKLE.RC2 - resources Microsoft Visual C++ does not edit directly +// + +#ifdef APSTUDIO_INVOKED + #error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// Add manually edited resources here... + +///////////////////////////////////////////////////////////////////////////// +// +// Version resources +// +#include +#include +#define VER_FILETYPE VFT_APP +#define VER_FILESUBTYPE VFT2_UNKNOWN +#define VER_FILEDESCRIPTION_STR "user account management wizard" +#define VER_INTERNALNAME_STR "speckle.exe" +#define VER_ORIGINALFILENAME_STR "addusrw.exe" +#include + + diff --git a/private/utils/wizards/addusrw/res/user.bmp b/private/utils/wizards/addusrw/res/user.bmp new file mode 100644 index 000000000..b615d743c Binary files /dev/null and b/private/utils/wizards/addusrw/res/user.bmp differ diff --git a/private/utils/wizards/addusrw/res/user_bit.bmp b/private/utils/wizards/addusrw/res/user_bit.bmp new file mode 100644 index 000000000..b615d743c Binary files /dev/null and b/private/utils/wizards/addusrw/res/user_bit.bmp differ diff --git a/private/utils/wizards/addusrw/res/world.bmp b/private/utils/wizards/addusrw/res/world.bmp new file mode 100644 index 000000000..d4c1f2a31 Binary files /dev/null and b/private/utils/wizards/addusrw/res/world.bmp differ diff --git a/private/utils/wizards/addusrw/resource.h b/private/utils/wizards/addusrw/resource.h new file mode 100644 index 000000000..f1e37afcd --- /dev/null +++ b/private/utils/wizards/addusrw/resource.h @@ -0,0 +1,244 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by speckle.rc +// +#define IDS_GENERIC_NO_HEAP 1 +#define IDS_GENERIC_NO_PDC 2 +#define IDS_GENERIC_BAD_MACHINE 3 +#define IDS_NO_GROUP_NAME 4 +#define IDS_GROUP_INVALID_NAME 5 +#define IDS_DOMAIN_SET 6 +#define IDS_TREE_ROOT 7 +#define IDS_NET_ERROR 8 +#define IDS_NET_NO_SERVERS 9 +#define IDS_ERROR 10 +#define IDS_GROUP_EXISTS 11 +#define IDS_INSUFFICIENT_PERMISSION 12 +#define IDS_CANT_ADD_NAMES 13 +#define IDS_LOCAL_GROUP 14 +#define IDS_GLOBAL_GROUP 15 +#define IDS_NO_MACHINE_NAME 16 +#define IDS_NO_VALID_WORKSTATIONS 17 +#define IDS_NO_NEW_USER 18 +#define IDS_BAD_USER_DATA 19 +#define IDS_NO_LOCAL_GROUP 20 +#define IDS_NO_GLOBAL_GROUP 21 +#define IDD_SPECKLE_DIALOG 102 +#define IDD_RAS_PERM_DIALOG 102 +#define IDR_MAINFRAME 128 +#define IDD_BASE_DIALOG 129 +#define IDB_BITMAP1 130 +#define IDD_WELCOME_DIALOG 131 +#define IDD_LOCAL_REMOTE 132 +#define IDD_REMOTE_NAME 133 +#define IDD_USER_NAME 134 +#define IDB_USER_BITMAP 134 +#define IDD_PASSWORD_INFO 135 +#define IDB_GLOBAL_GROUP_BITMAP 136 +#define IDD_GROUP_INFO 138 +#define IDB_NET_TREE 138 +#define IDD_PROFILE 139 +#define IDB_USER_BITMAP1 139 +#define IDD_FINISH 140 +#define IDD_FPNW_DLG 142 +#define IDB_LOCAL_GROUP_BITMAP 143 +#define IDB_WORLD 144 +#define IDD_ADD_NWWKS_DIALOG 145 +#define IDD_ACCOUNT_EXP_DIALOG 146 +#define IDD_OPTIONS_DIALOG 148 +#define IDD_HOMEDIR_DIALOG 150 +#define IDD_LOGON_SCRIPT_DIALOG 151 +#define IDD_RESTRICTIONS_DIALOG 152 +#define IDD_NWLOGON_DIALOG 153 +#define IDD_EXCHANGE_DIALOG 154 +#define IDD_ADD_WKS_DIALOG 155 +#define IDB_ENDFLAG 156 +#define IDD_HOURS_DLG 164 +#define IDD_LOGONTO_DLG 165 +#define IDC_PAINT_BOX 1000 +#define IDC_RADIO_LOCAL 1001 +#define IDC_RADIO_REMOTE 1002 +#define IDC_REMOTE_SERVER 1003 +#define IDC_USERNAME 1004 +#define IDC_FULLNAME 1005 +#define IDC_DESCRIPTION 1006 +#define IDC_LOCATION 1007 +#define IDC_MUST_CHANGE_PASSWORD 1010 +#define IDC_CANNOT_CHANGE_PASSWORD 1011 +#define IDC_PASSWORD_NEVER_EXPIRES 1012 +#define IDC_ACCOUNT_DISABLED 1013 +#define IDC_PASSWORD1 1015 +#define IDC_PASSWORD2 1016 +#define IDC_AVAILABLE_GROUPS 1017 +#define IDC_SELECTED_GROUPS 1018 +#define IDC_GROUP_MEMBER_LIST 1018 +#define IDC_ADD_GROUP 1019 +#define IDC_GROUP_AVAILABLE_LIST 1019 +#define IDC_REMOVE_GROUP 1020 +#define IDC_ADD_BUTTON 1020 +#define IDC_LOGON_SCRIPT 1021 +#define IDC_REMOVE_BUTTON 1021 +#define IDC_LOCAL_PATH_BUTTON 1022 +#define IDC_LOCALPATH_TEXT 1023 +#define IDC_REMOTE_PATH_BUTTON 1024 +#define IDC_DRIVE_LETTER 1026 +#define IDC_REMOTE_PATH 1027 +#define IDC_DIALIN_CHECK 1028 +#define IDC_CALL_BACK_RADIO 1029 +#define IDC_RADIO2 1030 +#define IDC_RADIO3 1031 +#define IDC_RASPHONE_EDIT 1032 +#define IDC_EXPIRE_NW_PASSWORD 1033 +#define IDC_GRACE_LOGIN_RADIO 1034 +#define IDC_ALLOWED_GRACE_LOGINS_EDIT 1035 +#define IDC_GRACE_LOGIN_SPIN 1036 +#define IDC_REMAINING_GRACE_LOGINS_EDIT 1037 +#define IDC_CONCURRENT_CONNECTIONS_RADIO 1038 +#define IDC_CONCURRENT_CONNECTIONS_RADIO2 1039 +#define IDC_CONCURRENT_CONNNECTIONS_EDIT 1040 +#define IDC_CONNCURRENT_CONNECTIONS_SPIN 1041 +#define IDC_STATIC1 1042 +#define IDC_STATIC2 1043 +#define IDC_STATIC3 1044 +#define IDC_GRACE_LOGIN_RADIO2 1045 +#define IDC_NETTREE 1048 +#define IDC_NETTREE_EDIT 1049 +#define IDC_NWPATH_EDIT 1051 +#define IDC_PROFILE_PATH 1052 +#define IDC_NWLOGON_RADIO 1053 +#define IDC_NWLOGON_LIST 1054 +#define IDC_NWLOGON_RADIO2 1057 +#define IDC_NWSTATIC1 1058 +#define IDC_NWSTATIC2 1059 +#define IDC_NETWORK_ADDRESS_EDIT 1060 +#define IDC_AVAILABLE_TIMES 1061 +#define IDC_NODE_ADDRESS_EDIT 1061 +#define IDC_SU_BUTTON 1064 +#define IDC_DAY_EDIT 1064 +#define IDC_MONTH_EDIT 1065 +#define IDC_YEAR_EDIT 1066 +#define IDC_WHERE_LOGON_RADIO 1068 +#define IDC_DATE_SPIN 1068 +#define IDC_LOCATION_EDIT1 1069 +#define IDC_M_BUTTON 1069 +#define IDC_LOCATION_EDIT2 1070 +#define IDC_TU_BUTTON 1070 +#define IDC_LOCATION_EDIT3 1071 +#define IDC_W_BUTTON 1071 +#define IDC_LOCATION_EDIT4 1072 +#define IDC_TH_BUTTON 1072 +#define IDC_LOCATION_EDIT5 1073 +#define IDC_F_BUTTON 1073 +#define IDC_NW_CHECK 1073 +#define IDC_LOCATION_EDIT6 1074 +#define IDC_SA_BUTTON 1074 +#define IDC_RAS_CHECK 1074 +#define IDC_LOCATION_EDIT7 1075 +#define IDC_LOCATION_EDIT8 1076 +#define IDC_STATIC4 1078 +#define IDC_PROFILE_CHECK 1078 +#define IDC_STATIC5 1079 +#define IDC_STATIC6 1080 +#define IDC_STATIC7 1081 +#define IDC_STATIC8 1082 +#define IDC_WHERE_LOGON_RADIO2 1083 +#define IDC_DOMAIN_LIST 1090 +#define IDC_PWOPTIONS_RADIO 1091 +#define IDC_EXPIREPW_CHECK 1092 +#define IDC_BROWSE_BUTTON 1093 +#define IDC_LOGIN_SCRIPT_CHECK 1094 +#define IDC_HOMEDIR_CHECK 1095 +#define IDC_EXCHANGE_CHECK 1096 +#define IDC_RESTRICTIONS_RADIO 1097 +#define IDC_RESTRICTIONS_RADIO2 1098 +#define IDC_ACCOUNT_EXPIRE_CHECK 1099 +#define IDC_LOGIN_TIMES_CHECK 1100 +#define IDC_WORKSTATIONS_CHECK 1101 +#define IDC_PRIMARY_GROUP 1102 +#define IDC_DISABLED_CHECK 1102 +#define IDC_SET_PRIMARY_GROUP_BUTTON 1103 +#define IDC_LIST1 1103 +#define IDC_CONCURRENT_CONNECTIONS_RADIO1 1106 +#define IDC_CONCURRENT_CONNECTIONS_EDIT 1107 +#define IDC_CONCURRENT_CONNECTIONS_SPIN 1109 +#define IDC_WORKSTATION_EDIT 1110 +#define IDC_RADIO1 1113 +#define IDC_WORKSTATION_RADIO 1113 +#define IDC_BUTTON1 1114 +#define IDC_COMBO2 1117 +#define IDC_WORKSTATION_RADIO2 1118 +#define IDC_STATIC_ALLOWEDTIMES 1119 +#define IDC_STATIC_DISALLOWEDTIMES 1120 +#define IDC_SERVER_LIST 1121 +#define IDC_STATIC_FRAME 1124 +#define IDC_STATIC_DOMAIN 1130 +#define IDC_SERVERNAME_EDIT 1131 +#define IDC_HOURSCTRL1 1132 +#define IDS_BAD_VERSION 57345 +#define IDS_WELCOME_STRING 57346 +#define IDS_PASSWORD_CAPTION 57347 +#define IDS_FINISH_CAPTION 57348 +#define IDS_OPTION_CAPTION 57349 +#define IDS_FPNW_CAPTION 57350 +#define IDS_GROUP_CAPTION 57351 +#define IDS_RAS_CAPTION 57352 +#define IDS_WORKSTATION_CAPTION 57353 +#define IDS_HOMEDIR_CAPTION 57354 +#define IDS_RESTRICTION_CAPTION 57355 +#define IDS_NWLOGON_CAPTION 57356 +#define IDS_SUCCESS 57357 +#define IDS_NW_PW_ERROR 57358 +#define IDS_NW_GRACELOGIN_ERROR 57359 +#define IDS_NW_CONCON_ERROR 57360 +#define IDS_RAS_ERROR 57361 +#define IDS_NEEDA_WORKSTATION 57362 +#define IDS_NEED_ADDRESS 57363 +#define IDS_UNKNOWN_COMPONENTS 57364 +#define IDS_BAD_WS_NAME 57365 +#define IDS_BAD_USERNAME 57366 +#define IDS_DUPLICATE_NAME 57367 +#define IDS_PW_NOMATCH 57368 +#define IDS_PW_TOOLONG 57369 +#define IDS_BAD_GETMODALS 57370 +#define IDS_PW_TOOSHORT 57371 +#define IDS_NODC 57372 +#define IDS_NO_USERNAME 57373 +#define IDS_USERNAME_TOOLONG 57374 +#define IDS_NOFP_WS 57375 +#define IDS_ALL_NODES 57376 +#define IDS_NOT_ADMIN 57377 +#define IDS_WSNAME_TOOLONG 57378 +#define IDS_INVALID_DAY 57379 +#define IDS_INVALID_MONTH 57380 +#define IDS_INVALID_YEAR 57381 +#define IDS_BAD_NWADDRESS 57382 +#define IDS_BAD_NWNODE 57383 +#define IDS_TOOLONG_NWADDRESS 57384 +#define IDS_TOOLONG_NWNODE 57385 +#define IDS_ALREADY_EXPIRED 57386 +#define IDS_INVALID_DIRECTORY_NAME 57388 +#define IDS_NO_DIR_PERMISSION 57389 +#define IDS_CANT_CREATE_DIRECTORY 57390 +#define IDS_INVALID_PATH 57391 +#define IDS_NEW_DIR_CREATED 57392 +#define IDS_SUCCESS2 57393 +#define IDS_WONT_REQUIRE 57394 +#define IDS_BAD_USER_DATA2 57395 +#define IDC_NO_WKSALLOWED 57396 +#define IDS_NO_HOMEDIR_DRIVE_LETTER 57397 +#define IDS_NO_RAS_NUMBER 57398 +#define IDS_NO_EXCH_SERVER 57399 +#define IDS_BAD_RAS_NUMBER 57400 +#define IDS_RAS_NUMBER_TOO_LONG 57401 +#define IDS_INVALID_GL_NUMBER 57402 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 158 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1133 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/private/utils/wizards/addusrw/restrct.cpp b/private/utils/wizards/addusrw/restrct.cpp new file mode 100644 index 000000000..1b3e4995d --- /dev/null +++ b/private/utils/wizards/addusrw/restrct.cpp @@ -0,0 +1,190 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + Restrct.cpp : implementation file + + CPropertyPage support for User mgmt wizard + +File History: + + JonY Apr-96 created + +--*/ + +// +// + +#include "stdafx.h" +#include "speckle.h" +#include "wizbased.h" +#include "Restrct.h" + +#ifdef _DEBUG +//#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CRestrictions property page + +IMPLEMENT_DYNCREATE(CRestrictions, CWizBaseDlg) + +CRestrictions::CRestrictions() : CWizBaseDlg(CRestrictions::IDD) +{ + //{{AFX_DATA_INIT(CRestrictions) + m_bAccountExpire = FALSE; + m_bAccountDisabled = FALSE; + m_bLoginTimes = FALSE; + m_bLimitWorkstations = FALSE; + m_nRestrictions = 0; + m_csCaption = _T(""); + //}}AFX_DATA_INIT + + m_bEnable = FALSE; + m_bHours = FALSE; + +} + +CRestrictions::~CRestrictions() +{ +} + +void CRestrictions::DoDataExchange(CDataExchange* pDX) +{ + CPropertyPage::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CRestrictions) + DDX_Check(pDX, IDC_ACCOUNT_EXPIRE_CHECK, m_bAccountExpire); + DDX_Check(pDX, IDC_DISABLED_CHECK, m_bAccountDisabled); + DDX_Check(pDX, IDC_LOGIN_TIMES_CHECK, m_bLoginTimes); + DDX_Check(pDX, IDC_WORKSTATIONS_CHECK, m_bLimitWorkstations); + DDX_Radio(pDX, IDC_RESTRICTIONS_RADIO, m_nRestrictions); + DDX_Text(pDX, IDC_STATIC1, m_csCaption); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CRestrictions, CWizBaseDlg) + //{{AFX_MSG_MAP(CRestrictions) + ON_BN_CLICKED(IDC_RESTRICTIONS_RADIO, OnRestrictionsRadio) + ON_BN_CLICKED(IDC_RESTRICTIONS_RADIO2, OnRestrictionsRadio2) + ON_WM_SHOWWINDOW() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CRestrictions message handlers + +LRESULT CRestrictions::OnWizardBack() +{ + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + + if (pApp->m_bExchange) return IDD_EXCHANGE_DIALOG; + else if (pApp->m_bNW) return IDD_FPNW_DLG; + else if (pApp->m_bRAS) return IDD_RAS_PERM_DIALOG; + else if (pApp->m_bHomeDir) return IDD_HOMEDIR_DIALOG; + else if (pApp->m_bLoginScript) return IDD_LOGON_SCRIPT_DIALOG; + else if (pApp->m_bProfile) return IDD_PROFILE; + else return IDD_OPTIONS_DIALOG; + +} + +LRESULT CRestrictions::OnWizardNext() +{ + UpdateData(TRUE); + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + + pApp->m_bEnableRestrictions = m_bEnable; + pApp->m_bExpiration = m_bAccountExpire & m_bEnable; + pApp->m_bDisabled = m_bAccountDisabled & m_bEnable; + pApp->m_bHours = m_bLoginTimes & m_bEnable; + pApp->m_bWorkstation = m_bLimitWorkstations & m_bEnable; + + if (m_bAccountExpire & m_bEnable) return IDD_ACCOUNT_EXP_DIALOG; + else if (m_bLoginTimes & m_bEnable) return IDD_HOURS_DLG; + else if (m_bLimitWorkstations & m_bEnable) return IDD_LOGONTO_DLG; + else if (pApp->m_bNW & m_bEnable) return IDD_NWLOGON_DIALOG; + else return IDD_FINISH; + + return CWizBaseDlg::OnWizardNext(); + +} + +void CRestrictions::OnRestrictionsRadio() +{ + GetDlgItem(IDC_ACCOUNT_EXPIRE_CHECK)->EnableWindow(FALSE); + GetDlgItem(IDC_DISABLED_CHECK)->EnableWindow(FALSE); + GetDlgItem(IDC_LOGIN_TIMES_CHECK)->EnableWindow(FALSE); + GetDlgItem(IDC_WORKSTATIONS_CHECK)->EnableWindow(FALSE); + + m_bEnable = FALSE; + +} + +void CRestrictions::OnRestrictionsRadio2() +{ + GetDlgItem(IDC_ACCOUNT_EXPIRE_CHECK)->EnableWindow(TRUE); + GetDlgItem(IDC_DISABLED_CHECK)->EnableWindow(TRUE); + GetDlgItem(IDC_LOGIN_TIMES_CHECK)->EnableWindow(m_bHours); + GetDlgItem(IDC_WORKSTATIONS_CHECK)->EnableWindow(TRUE); + + m_bEnable = TRUE; + +} + +void CRestrictions::OnShowWindow(BOOL bShow, UINT nStatus) +{ + CWizBaseDlg::OnShowWindow(bShow, nStatus); + + if (bShow) + { + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + + CString csTemp; + csTemp.LoadString(IDS_RESTRICTION_CAPTION); + + CString csTemp2; + csTemp2.Format(csTemp, pApp->m_csUserName); + m_csCaption = csTemp2; + UpdateData(FALSE); + } + +} + +BOOL CRestrictions::OnInitDialog() +{ + CWizBaseDlg::OnInitDialog(); + + CString csPath; + TCHAR pDir[256]; + GetSystemDirectory(pDir, 256); + csPath = pDir; + csPath += L"\\hours.ocx"; + + HINSTANCE hLib = LoadLibrary((LPCTSTR)csPath); + + if (hLib < (HINSTANCE)HINSTANCE_ERROR) + { + m_bHours = FALSE; //unable to load DLL + return TRUE; + } + + // Find the entry point. + FARPROC lpDllEntryPoint = NULL; + (FARPROC&)lpDllEntryPoint = GetProcAddress(hLib, + "DllRegisterServer"); + if (lpDllEntryPoint != NULL) + { + HRESULT h = (*lpDllEntryPoint)(); + if (h == 0) m_bHours = TRUE; + else m_bHours = FALSE; + } + else + m_bHours = FALSE; + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} diff --git a/private/utils/wizards/addusrw/restrct.h b/private/utils/wizards/addusrw/restrct.h new file mode 100644 index 000000000..36429536b --- /dev/null +++ b/private/utils/wizards/addusrw/restrct.h @@ -0,0 +1,63 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + Restrct.h : header file + +File History: + + JonY Apr-96 created + +--*/ + +///////////////////////////////////////////////////////////////////////////// +// CRestrictions dialog + +class CRestrictions : public CWizBaseDlg +{ + DECLARE_DYNCREATE(CRestrictions) + +// Construction +public: + CRestrictions(); + ~CRestrictions(); + +// Dialog Data + //{{AFX_DATA(CRestrictions) + enum { IDD = IDD_RESTRICTIONS_DIALOG }; + BOOL m_bAccountExpire; + BOOL m_bAccountDisabled; + BOOL m_bLoginTimes; + BOOL m_bLimitWorkstations; + int m_nRestrictions; + CString m_csCaption; + //}}AFX_DATA + + +// Overrides + // ClassWizard generate virtual function overrides + //{{AFX_VIRTUAL(CRestrictions) + public: + virtual LRESULT OnWizardBack(); + virtual LRESULT OnWizardNext(); + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + // Generated message map functions + //{{AFX_MSG(CRestrictions) + afx_msg void OnRestrictionsRadio(); + afx_msg void OnRestrictionsRadio2(); + afx_msg void OnShowWindow(BOOL bShow, UINT nStatus); + virtual BOOL OnInitDialog(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + +private: + BOOL m_bEnable; + BOOL m_bHours; +}; diff --git a/private/utils/wizards/addusrw/rpcbak.h b/private/utils/wizards/addusrw/rpcbak.h new file mode 100644 index 000000000..47c66b17e --- /dev/null +++ b/private/utils/wizards/addusrw/rpcbak.h @@ -0,0 +1,225 @@ +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + +/* File created by MIDL compiler version 2.00.0102 */ +/* at Thu Apr 11 13:52:52 1996 + */ +//@@MIDL_FILE_HEADING( ) +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __rpcbak_h__ +#define __rpcbak_h__ + +#ifdef __cplusplus +extern "C"{ +#endif + +/* Forward Declarations */ + +void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t); +void __RPC_USER MIDL_user_free( void __RPC_FAR * ); + +#ifndef __TriggerBackupRPC_INTERFACE_DEFINED__ +#define __TriggerBackupRPC_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: TriggerBackupRPC + * at Thu Apr 11 13:52:52 1996 + * using MIDL 2.00.0102 + ****************************************/ +/* [auto_handle][unique][version][uuid] */ + + +#ifndef RPC_COMMON_IDL +#define RPC_COMMON_IDL +#define szTriggerRPCProtocol TEXT("ncacn_np") +#define szTriggerRPCSecurity TEXT("Security=impersonation dynamic true") + /* size is 4 */ +typedef long RPC_BOOL; + + /* size is 1 */ +typedef small RPC_BYTE; + + /* size is 4 */ +typedef long RPC_INT; + + /* size is 4 */ +typedef long RPC_SC; + + /* size is 4 */ +typedef long RPC_EC; + + /* size is 4 */ +typedef long RPC_DWORD; + + /* size is 2 */ +typedef wchar_t RPC_CHAR; + + /* size is 4 */ +typedef /* [string] */ RPC_CHAR __RPC_FAR *RPC_SZ; + + /* size is 16 */ +typedef struct __MIDL_TriggerBackupRPC_0001 + { + short rgwSystemTime[ 8 ]; + } RPC_SYSTEMTIME; + + /* size is 172 */ +typedef struct __MIDL_TriggerBackupRPC_0002 + { + RPC_BYTE rgbTzi[ 172 ]; + } RPC_TIME_ZONE_INFORMATION; + + /* size is 28 */ +typedef struct __MIDL_TriggerBackupRPC_0003 + { + long rgdwServiceStatus[ 7 ]; + } RPC_SERVICE_STATUS; + +#define ecOK 0 // no error +#define ecGeneralFailure 50001 // a failure occurred that caused proxy generation to stop +#define ecSomeProxiesFailed 50002 // some proxies failed to get generated +#define ecTargetNotValid 50003 // supplied target address not valid +#define ecTargetNotUnique 50004 // supplied target address not unique +#define ecProxyDLLNotImplemented 50005 // not implemented yet +#define ecProxyDLLOOM 50006 // memory allocation error +#define ecProxyDLLError 50007 // general error +#define ecProxyDLLProtocol 50008 // protocol error +#define ecProxyDLLSyntax 50009 // syntax error +#define ecProxyDLLEOF 50010 // end of file +#define ecProxyDLLSoftware 50011 // error in software +#define ecProxyDLLConfig 50012 // configuration error +#define ecProxyDLLContention 50013 // contention error +#define ecProxyDLLNotFound 50014 // not found +#define ecProxyDLLDiskSpace 50015 // out of disk space +#define ecProxyDLLException 50016 // exception thrown +#define ecProxyDLLDefault 50017 // unknown error +#define ecProxyNotValid 50018 // supplied proxy not valid +#define ecProxyNotUnique 50019 // supplied proxy not unique or unable to generate a unique proxy +#define ecProxyDuplicate 50020 // a primary proxy of the same type was also supplied + /* size is 16 */ +typedef struct _PROXYNODE + { + struct _PROXYNODE __RPC_FAR *pnodeNext; + RPC_SZ wszProxy; + RPC_EC ec; + RPC_SZ wszDN; + } PROXYNODE; + + /* size is 4 */ +typedef struct _PROXYNODE __RPC_FAR *PPROXYNODE; + + /* size is 48 */ +typedef struct _PROXYINFO + { + RPC_BOOL fContinueOnError; + RPC_BOOL fIgnoreOldSecondaries; + RPC_SZ wszDN; + RPC_SZ wszNickName; + RPC_SZ wszCommonName; + RPC_SZ wszDisplayName; + RPC_SZ wszSurName; + RPC_SZ wszGivenName; + RPC_SZ wszInitials; + RPC_SZ wszTargetAddress; + PROXYNODE __RPC_FAR *pPNVerifyProxy; + PROXYNODE __RPC_FAR *pPNExcludeProxy; + } PROXYINFO; + + /* size is 4 */ +typedef struct _PROXYINFO __RPC_FAR *PPROXYINFO; + + /* size is 8 */ +typedef struct _PROXYLIST + { + PROXYNODE __RPC_FAR *__RPC_FAR *ppPNProxy; + PROXYNODE __RPC_FAR *__RPC_FAR *ppPNFailedProxyType; + } PROXYLIST; + + /* size is 4 */ +typedef struct _PROXYLIST __RPC_FAR *PPROXYLIST; + + /* size is 192 */ +typedef struct __MIDL_TriggerBackupRPC_0004 + { + RPC_SYSTEMTIME st; + RPC_TIME_ZONE_INFORMATION tzi; + RPC_DWORD dwReturn; + } RemoteSystemTimeInfo; + + /* size is 48 */ +typedef struct _RemoteServiceStatus + { + RPC_SC sc; + RPC_SZ szShortName; + RPC_SZ szDisplayName; + RPC_SZ szVersion; + RPC_SERVICE_STATUS ss; + struct _RemoteServiceStatus __RPC_FAR *prssNext; + } RemoteServiceStatus; + +#define rmsSuspendRepair 0x0001 +#define rmsSuspendNotif 0x0002 + /* size is 24 */ +typedef struct _RemoteMaintenanceStatus + { + RPC_DWORD dwStatus; + RPC_SYSTEMTIME st; + RPC_SZ szUser; + } RemoteMaintenanceStatus; + + /* size is 12 */ +typedef struct _BackupListNode + { + struct _BackupListNode __RPC_FAR *pnodeNext; + struct _BackupListNode __RPC_FAR *pnodeChildren; + RPC_SZ szName; + } BackupListNode; + + /* size is 44 */ +typedef struct _DistributedLockOwner + { + RPC_CHAR rgchComputer[ 17 ]; + RPC_DWORD dwPID; + RPC_DWORD dwTID; + } DistributedLockOwner; + +#define DLR_NO_WAIT 0x00000001 +#define cchMaxLockName 17 + /* size is 84 */ +typedef struct _DistributedLockRequest + { + RPC_CHAR rgchLockName[ 17 ]; + RPC_DWORD dwFlags; + DistributedLockOwner dlo; + } DistributedLockRequest; + + /* size is 48 */ +typedef struct _DistributedLockReply + { + RPC_BOOL fGranted; + DistributedLockOwner dlo; + } DistributedLockReply; + +#endif // #ifndef RPC_COMMON_IDL + /* size is 4 */ +RPC_SC __cdecl ScGetBackupListNode( + /* [in] */ handle_t h, + /* [out][in] */ BackupListNode __RPC_FAR *__RPC_FAR *ppnode); + + + +extern RPC_IF_HANDLE TriggerBackupRPC_ClientIfHandle; +extern RPC_IF_HANDLE TriggerBackupRPC_ServerIfHandle; +#endif /* __TriggerBackupRPC_INTERFACE_DEFINED__ */ + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/private/utils/wizards/addusrw/rpcpub.h b/private/utils/wizards/addusrw/rpcpub.h new file mode 100644 index 000000000..fd831750c --- /dev/null +++ b/private/utils/wizards/addusrw/rpcpub.h @@ -0,0 +1,387 @@ +/* this ALWAYS GENERATED file contains the definitions for the interfaces */ + + +/* File created by MIDL compiler version 2.00.0102 */ +/* at Thu Apr 11 09:26:39 1996 + */ +//@@MIDL_FILE_HEADING( ) +#include "rpc.h" +#include "rpcndr.h" + +#ifndef __rpcpub_h__ +#define __rpcpub_h__ + +#ifdef __cplusplus +extern "C"{ +#endif + +/* Forward Declarations */ + +void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t); +void __RPC_USER MIDL_user_free( void __RPC_FAR * ); + +#ifndef __TriggerPublicRPC_INTERFACE_DEFINED__ +#define __TriggerPublicRPC_INTERFACE_DEFINED__ + +/**************************************** + * Generated header for interface: TriggerPublicRPC + * at Thu Apr 11 09:26:39 1996 + * using MIDL 2.00.0102 + ****************************************/ +/* [auto_handle][unique][version][uuid] */ + + +#ifndef RPC_COMMON_IDL +#define RPC_COMMON_IDL +#define szTriggerRPCProtocol TEXT("ncacn_np") +#define szTriggerRPCSecurity TEXT("Security=impersonation dynamic true") + /* size is 4 */ +typedef long RPC_BOOL; + + /* size is 1 */ +typedef small RPC_BYTE; + + /* size is 4 */ +typedef long RPC_INT; + + /* size is 4 */ +typedef long RPC_SC; + + /* size is 4 */ +typedef long RPC_EC; + + /* size is 4 */ +typedef long RPC_DWORD; + + /* size is 2 */ +typedef wchar_t RPC_CHAR; + + /* size is 4 */ +typedef /* [string] */ RPC_CHAR __RPC_FAR *RPC_SZ; + + /* size is 16 */ +typedef struct __MIDL_TriggerPublicRPC_0001 + { + short rgwSystemTime[ 8 ]; + } RPC_SYSTEMTIME; + + /* size is 172 */ +typedef struct __MIDL_TriggerPublicRPC_0002 + { + RPC_BYTE rgbTzi[ 172 ]; + } RPC_TIME_ZONE_INFORMATION; + + /* size is 28 */ +typedef struct __MIDL_TriggerPublicRPC_0003 + { + long rgdwServiceStatus[ 7 ]; + } RPC_SERVICE_STATUS; + +#define ecOK 0 // no error +#define ecGeneralFailure 50001 // a failure occurred that caused proxy generation to stop +#define ecSomeProxiesFailed 50002 // some proxies failed to get generated +#define ecTargetNotValid 50003 // supplied target address not valid +#define ecTargetNotUnique 50004 // supplied target address not unique +#define ecProxyDLLNotImplemented 50005 // not implemented yet +#define ecProxyDLLOOM 50006 // memory allocation error +#define ecProxyDLLError 50007 // general error +#define ecProxyDLLProtocol 50008 // protocol error +#define ecProxyDLLSyntax 50009 // syntax error +#define ecProxyDLLEOF 50010 // end of file +#define ecProxyDLLSoftware 50011 // error in software +#define ecProxyDLLConfig 50012 // configuration error +#define ecProxyDLLContention 50013 // contention error +#define ecProxyDLLNotFound 50014 // not found +#define ecProxyDLLDiskSpace 50015 // out of disk space +#define ecProxyDLLException 50016 // exception thrown +#define ecProxyDLLDefault 50017 // unknown error +#define ecProxyNotValid 50018 // supplied proxy not valid +#define ecProxyNotUnique 50019 // supplied proxy not unique or unable to generate a unique proxy +#define ecProxyDuplicate 50020 // a primary proxy of the same type was also supplied + /* size is 16 */ +typedef struct _PROXYNODE + { + struct _PROXYNODE __RPC_FAR *pnodeNext; + RPC_SZ wszProxy; + RPC_EC ec; + RPC_SZ wszDN; + } PROXYNODE; + + /* size is 4 */ +typedef struct _PROXYNODE __RPC_FAR *PPROXYNODE; + + /* size is 48 */ +typedef struct _PROXYINFO + { + RPC_BOOL fContinueOnError; + RPC_BOOL fIgnoreOldSecondaries; + RPC_SZ wszDN; + RPC_SZ wszNickName; + RPC_SZ wszCommonName; + RPC_SZ wszDisplayName; + RPC_SZ wszSurName; + RPC_SZ wszGivenName; + RPC_SZ wszInitials; + RPC_SZ wszTargetAddress; + PROXYNODE __RPC_FAR *pPNVerifyProxy; + PROXYNODE __RPC_FAR *pPNExcludeProxy; + } PROXYINFO; + + /* size is 4 */ +typedef struct _PROXYINFO __RPC_FAR *PPROXYINFO; + + /* size is 8 */ +typedef struct _PROXYLIST + { + PROXYNODE __RPC_FAR *__RPC_FAR *ppPNProxy; + PROXYNODE __RPC_FAR *__RPC_FAR *ppPNFailedProxyType; + } PROXYLIST; + + /* size is 4 */ +typedef struct _PROXYLIST __RPC_FAR *PPROXYLIST; + + /* size is 192 */ +typedef struct __MIDL_TriggerPublicRPC_0004 + { + RPC_SYSTEMTIME st; + RPC_TIME_ZONE_INFORMATION tzi; + RPC_DWORD dwReturn; + } RemoteSystemTimeInfo; + + /* size is 48 */ +typedef struct _RemoteServiceStatus + { + RPC_SC sc; + RPC_SZ szShortName; + RPC_SZ szDisplayName; + RPC_SZ szVersion; + RPC_SERVICE_STATUS ss; + struct _RemoteServiceStatus __RPC_FAR *prssNext; + } RemoteServiceStatus; + +#define rmsSuspendRepair 0x0001 +#define rmsSuspendNotif 0x0002 + /* size is 24 */ +typedef struct _RemoteMaintenanceStatus + { + RPC_DWORD dwStatus; + RPC_SYSTEMTIME st; + RPC_SZ szUser; + } RemoteMaintenanceStatus; + + /* size is 12 */ +typedef struct _BackupListNode + { + struct _BackupListNode __RPC_FAR *pnodeNext; + struct _BackupListNode __RPC_FAR *pnodeChildren; + RPC_SZ szName; + } BackupListNode; + + /* size is 44 */ +typedef struct _DistributedLockOwner + { + RPC_CHAR rgchComputer[ 17 ]; + RPC_DWORD dwPID; + RPC_DWORD dwTID; + } DistributedLockOwner; + +#define DLR_NO_WAIT 0x00000001 +#define cchMaxLockName 17 + /* size is 84 */ +typedef struct _DistributedLockRequest + { + RPC_CHAR rgchLockName[ 17 ]; + RPC_DWORD dwFlags; + DistributedLockOwner dlo; + } DistributedLockRequest; + + /* size is 48 */ +typedef struct _DistributedLockReply + { + RPC_BOOL fGranted; + DistributedLockOwner dlo; + } DistributedLockReply; + +#endif // #ifndef RPC_COMMON_IDL + /* size is 4 */ +RPC_SC __cdecl ScNetworkTimingTest( + /* [in] */ handle_t h, + /* [in] */ long cbSend, + /* [size_is][in] */ small __RPC_FAR rgbSend[ ], + /* [in] */ long cbReceive, + /* [size_is][out] */ small __RPC_FAR rgbReceive[ ]); + + /* size is 4 */ +RPC_SC __cdecl ScRunRID( + /* [in] */ handle_t h); + + /* size is 4 */ +RPC_SC __cdecl ScRunRIDEx( + /* [in] */ handle_t h, + /* [in] */ RPC_BOOL fProxySpace, + /* [in] */ RPC_BOOL fGwart); + + /* size is 4 */ +RPC_SC __cdecl ScRunDRACheck( + /* [in] */ handle_t h, + RPC_DWORD dw); + +#define BPTAdd 1 +#define BPTRemove 2 +#define BPTUpdate 3 + /* size is 4 */ +RPC_SC __cdecl ScBulkCreateProxy( + /* [in] */ handle_t h, + /* [in] */ RPC_SZ szHeader, + /* [in] */ RPC_DWORD dwOptions); + + /* size is 4 */ +RPC_SC __cdecl ScBulkCreateMultiProxy( + /* [in] */ handle_t h, + /* [in] */ RPC_INT cszHeader, + /* [size_is][in] */ RPC_SZ __RPC_FAR rgszRecipients[ ], + /* [in] */ RPC_DWORD dwOptions); + + /* size is 4 */ +RPC_SC __cdecl ScBulkUpdateMultiProxy( + /* [in] */ handle_t h, + /* [in] */ RPC_INT cszSiteAddress, + /* [size_is][in] */ RPC_SZ __RPC_FAR rgszOldSiteAddress[ ], + /* [size_is][in] */ RPC_SZ __RPC_FAR rgszNewSiteAddress[ ], + /* [in] */ RPC_BOOL fSaveSiteAddress); + + /* size is 4 */ +RPC_SC __cdecl ScGetBulkProxyStatus( + /* [in] */ handle_t h, + /* [out] */ RPC_SYSTEMTIME __RPC_FAR *pstTimeStart, + /* [out] */ RPC_DWORD __RPC_FAR *pdwTimeStart, + /* [out] */ RPC_DWORD __RPC_FAR *pdwTimeCur, + /* [out] */ RPC_INT __RPC_FAR *piRecipients, + /* [out] */ RPC_INT __RPC_FAR *pcRecipients); + + /* size is 4 */ +RPC_SC __cdecl ScBulkProxyHalt( + /* [in] */ handle_t h, + /* [in] */ RPC_BOOL fWaitForShutdown); + + /* size is 4 */ +RPC_EC __cdecl EcGetProxies( + /* [in] */ handle_t h, + /* [in] */ PPROXYINFO pProxyInfo, + /* [out][in] */ PPROXYLIST pProxyList); + + /* size is 4 */ +RPC_SC __cdecl ScIsProxyUnique( + /* [in] */ handle_t h, + /* [in] */ RPC_SZ szProxy, + /* [out] */ RPC_BOOL __RPC_FAR *pfUnique, + /* [out] */ RPC_SZ __RPC_FAR *pszOwner); + + /* size is 4 */ +RPC_SC __cdecl ScProxyValidate( + /* [in] */ handle_t h, + /* [in] */ RPC_SZ szProxy, + /* [out] */ RPC_BOOL __RPC_FAR *pfValid, + /* [out] */ RPC_SZ __RPC_FAR *pszProxyCorrected); + + /* size is 4 */ +RPC_SC __cdecl ScSiteProxyValidate( + /* [in] */ handle_t h, + /* [in] */ RPC_SZ szSiteProxy, + /* [out] */ RPC_BOOL __RPC_FAR *pfValid, + /* [out] */ RPC_SZ __RPC_FAR *pszSiteProxyCorrected); + + /* size is 4 */ +RPC_SC __cdecl ScProxyReset( + /* [in] */ handle_t h, + /* [in] */ RPC_BOOL fWaitUntilCompleted); + +#define scNoError 0 +#define scInvalidData 1 +#define scCannotLogData 2 + /* size is 4 */ +RPC_SC __cdecl ScSaveTrackingData( + /* [in] */ handle_t h, + /* [in] */ RPC_INT cb, + /* [size_is][in] */ RPC_BYTE __RPC_FAR pb[ ], + /* [in] */ RPC_DWORD dwFlags); + +#define tevtMessageTransferIn 0 +#define tevtReportTransferIn 2 +#define tevtMessageSubmission 4 +#define tevtMessageTransferOut 7 +#define tevtReportTransferOut 8 +#define tevtMessageDelivery 9 +#define tevtReportDelivery 10 +#define tevtStartAssocByMTSUser 18 +#define tevtReleaseAssocByMTSUser 23 +#define tevtDLExpansion 26 +#define tevtRedirection 28 +#define tevtRerouting 29 +#define tevtDowngrading 31 +#define tevtReportAbsorption 33 +#define tevtReportGenerated 34 +#define tevtUnroutableReportDiscard 43 +#define tevtMessageLocalDelivery 1000 +#define tevtMessageBackboneTransferIn 1001 +#define tevtMessageBackboneTransferOut 1002 +#define tevtMessageGatewayTransferOut 1003 +#define tevtMessageGatewayTransferIn 1004 +#define tevtReportGatewayTransferIn 1005 +#define tevtReportGatewayTransferOut 1006 +#define tevtReportGatewayGenerated 1007 +#define tevtUserMin 2000 + /* size is 60 */ +typedef struct __MIDL_TriggerPublicRPC_0005 + { + RPC_INT nEventType; + RPC_SYSTEMTIME stEvent; + RPC_SZ szGatewayName; + RPC_SZ szPartner; + RPC_SZ szMTSID; + RPC_SZ szRemoteID; + RPC_SZ szOriginator; + RPC_INT nPriority; + RPC_INT nLength; + RPC_INT nSeconds; + RPC_INT nCost; + RPC_SZ szSubjectID; + } RPC_GATEWAY_TRACK_INFORMATION; + + /* size is 4 */ +RPC_SC __cdecl ScSaveGatewayTrackingData( + /* [in] */ handle_t h, + /* [in] */ RPC_GATEWAY_TRACK_INFORMATION __RPC_FAR *pgti, + /* [in] */ RPC_INT cszRecipients, + /* [size_is][in] */ RPC_SZ __RPC_FAR rgszRecipients[ ]); + + + +extern RPC_IF_HANDLE TriggerPublicRPC_ClientIfHandle; +extern RPC_IF_HANDLE TriggerPublicRPC_ServerIfHandle; +#endif /* __TriggerPublicRPC_INTERFACE_DEFINED__ */ + +/**************************************** + * Generated header for interface: __MIDL__intf_0001 + * at Thu Apr 11 09:26:39 1996 + * using MIDL 2.00.0102 + ****************************************/ +/* [local] */ + + +#define szTrackReportRecipientInfoDelivered L("\t0") +#define szTrackReportRecipientInfoNonDelivered L("\t1") + + +extern RPC_IF_HANDLE __MIDL__intf_0001_ClientIfHandle; +extern RPC_IF_HANDLE __MIDL__intf_0001_ServerIfHandle; + +/* Additional Prototypes for ALL interfaces */ + +/* end of Additional Prototypes */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/private/utils/wizards/addusrw/sadapi.h b/private/utils/wizards/addusrw/sadapi.h new file mode 100644 index 000000000..3f024ed0b --- /dev/null +++ b/private/utils/wizards/addusrw/sadapi.h @@ -0,0 +1,197 @@ +/* + * sadapi.h + * + * Copyright (c) Microsoft Corp. 1986-1996. All Rights Reserved. + * + * Definition of the public RPC APIs from the SAD Exchange service + * + */ + + +#ifndef _SADLIB_H_ +#define _SADLIB_H_ + +#include "rpcpub.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + + +/* + * Return codes for all functions except SAD_EcGetProxies() and SAD_EcGetProxiesBI(). + * In addition to this list are all normal NT error codes... + */ +typedef enum _SC_RETURN_VALUES +{ + SC_OK = 0, // no error + SC_Error = 49001, // general error + SC_BPActive, // bulk proxy generation is currently running + SC_BPInactive, // bulk proxy generation is not currently running + SC_BPShutdownPending, // a shutdown in bulk proxy generation is in progress + SC_BPSiteAddressMismatch, // a Site Address Mismatch between rgszOldSiteAddress + // and rgszNewSiteAddress lists in ScBulkUpdateMultiProxy +} SC_RETURN_VALUES; + + +#define cchMaxServer (MAX_COMPUTERNAME_LENGTH + 1) + +typedef struct _RPCBINDINFO +{ + handle_t h; + WCHAR wszServer[cchMaxServer]; + RPC_IF_HANDLE hClientIfHandle; +} RPCBINDINFO, *PRPCBINDINFO; + + +// Utility entry points +RPC_SC WINAPI SAD_ScBindA(PRPCBINDINFO pBI, LPSTR szServer); +RPC_SC WINAPI SAD_ScBindW(PRPCBINDINFO pBI, LPWSTR wszServer); +void WINAPI SAD_Unbind(PRPCBINDINFO pBI); + +#ifdef UNICODE +#define SAD_ScBind SAD_ScBindW +#else +#define SAD_ScBind SAD_ScBindA +#endif + + + +// Message Tracking group +RPC_SC WINAPI SAD_ScSaveGatewayTrackingData(PRPCBINDINFO pBI, + RPC_GATEWAY_TRACK_INFORMATION * pgti, + INT cszRecipients, + LPWSTR rgwszRecipients[]); + +// for Microsoft Internal Use ONLY +RPC_SC WINAPI SAD_ScSaveTrackingData(PRPCBINDINFO pBI, INT cb, BYTE pb[], DWORD dwFlags); + + +// for Gateways - cause the routing table to be recalculated +RPC_SC WINAPI SAD_ScRunRIDA(LPSTR szServer); +RPC_SC WINAPI SAD_ScRunRIDW(LPWSTR wszServer); +RPC_SC WINAPI SAD_ScRunRIDExA(LPSTR szServer, RPC_BOOL fProxySpace, RPC_BOOL fGwart); +RPC_SC WINAPI SAD_ScRunRIDExW(LPWSTR wszServer, RPC_BOOL fProxySpace, RPC_BOOL fGwart); + +#ifdef UNICODE +#define SAD_ScRunRID SAD_ScRunRIDW +#define SAD_ScRunRIDEx SAD_ScRunRIDExW +#else +#define SAD_ScRunRID SAD_ScRunRIDA +#define SAD_ScRunRIDEx SAD_ScRunRIDExA +#endif + + + +// Proxy Entry points + +RPC_EC WINAPI SAD_EcGetProxies(LPWSTR wszServer, PPROXYINFO pProxyInfo, PPROXYLIST pProxyList); +RPC_EC WINAPI SAD_EcGetProxiesBI(PRPCBINDINFO pBI, PPROXYINFO pProxyInfo, PPROXYLIST pProxyList); +void WINAPI SAD_FreeProxyListNode(PPROXYNODE pnode); +RPC_SC WINAPI SAD_ScIsProxyUniqueA(LPSTR szServer, + LPSTR szProxy, RPC_BOOL * pfUnique, LPSTR * pszExisting); +RPC_SC WINAPI SAD_ScIsProxyUniqueW(LPWSTR wszServer, + LPWSTR szProxy, RPC_BOOL * pfUnique, LPWSTR * pszExisting); + +// dwOptions values for SAD_ScBulkCreateProxy() and SAD_ScBulkCreateMultiProxy() +#define BPTAdd 1 +#define BPTRemove 2 +#define BPTUpdate 3 + +RPC_SC WINAPI SAD_ScBulkCreateProxyA(LPSTR szServer, LPSTR szHeader, DWORD dwOptions); +RPC_SC WINAPI SAD_ScBulkCreateProxyW(LPWSTR wszServer, LPWSTR wszHeader, DWORD dwOptions); +RPC_SC WINAPI SAD_ScBulkCreateMultiProxyA(LPSTR szServer, + INT cszHeader, + LPSTR rgszHeader[], + DWORD dwOptions); +RPC_SC WINAPI SAD_ScBulkCreateMultiProxyW(LPWSTR wszServer, + INT cwszHeader, + LPWSTR rgwszHeader[], + DWORD dwOptions); +RPC_SC WINAPI SAD_ScBulkUpdateMultiProxy(LPWSTR wszServer, + INT cwszSiteAddress, + LPWSTR rgwszOldSiteAddress[], + LPWSTR rgwszNewSiteAddress[], + RPC_BOOL fSaveSiteAddress); + + +RPC_SC WINAPI SAD_ScGetBulkProxyStatusA(LPSTR szServer, + RPC_SYSTEMTIME * pstTimeStart, + DWORD * pdwTimeStart, + DWORD * pdwTimeCur, + INT * piRecipients, + INT * pcRecipients); +RPC_SC WINAPI SAD_ScGetBulkProxyStatusW(LPWSTR wszServer, + RPC_SYSTEMTIME * pstTimeStart, + DWORD * pdwTimeStart, + DWORD * pdwTimeCur, + INT * piRecipients, + INT * pcRecipients); +RPC_SC WINAPI SAD_ScBulkProxyHaltA(LPSTR szServer, RPC_BOOL fWaitForShutdown); +RPC_SC WINAPI SAD_ScBulkProxyHaltW(LPWSTR wszServer, RPC_BOOL fWaitForShutdown); + +#ifdef UNICODE +#define SAD_ScIsProxyUnique SAD_ScIsProxyUniqueW +#define SAD_ScBulkCreateProxy SAD_ScBulkCreateProxyW +#define SAD_ScBulkCreateMultiProxy SAD_ScBulkCreateMultiProxyW +#define SAD_ScGetBulkProxyStatus SAD_ScGetBulkProxyStatusW +#define SAD_ScBulkProxyHalt SAD_ScBulkProxyHaltW +#else +#define SAD_ScIsProxyUnique SAD_ScIsProxyUniqueA +#define SAD_ScBulkCreateProxy SAD_ScBulkCreateProxyA +#define SAD_ScBulkCreateMultiProxy SAD_ScBulkCreateMultiProxyA +#define SAD_ScGetBulkProxyStatus SAD_ScGetBulkProxyStatusA +#define SAD_ScBulkProxyHalt SAD_ScBulkProxyHaltA +#endif + + + + + + +// Backup entry point (available only in UNICODE!) + +RPC_SC WINAPI SAD_ScGetBackupListNodeW(LPWSTR wszServer, BackupListNode ** ppnode); +void WINAPI SAD_FreeBackupListNode(BackupListNode * pnode); + + +// Run DRA Check calling parameters (dwCheck) +#define INTRASITE_CHECK 0 +#define INTERSITE_CHECK 1 + +RPC_SC WINAPI SAD_ScRunDRACheck(LPWSTR wszServer, RPC_DWORD dwCheck); + + + +// These few lines (or equivalent) need to be supplied by the application that links +// with SADAPI.LIB. +#ifdef _SAMPLE_CODE +void __RPC_FAR * __RPC_API midl_user_allocate(size_t cb) +{ + void * pv; + + pv = GlobalAlloc(GMEM_FIXED, cb); + if (!pv) + RpcRaiseException(RPC_S_OUT_OF_MEMORY); + + return pv; +} + +void __RPC_API midl_user_free(void __RPC_FAR * pv) +{ + GlobalFree(pv); +} +#endif + + + + + + + +#ifdef __cplusplus +} +#endif + +#endif // #ifndef _SADLIB_H_ diff --git a/private/utils/wizards/addusrw/sources b/private/utils/wizards/addusrw/sources new file mode 100644 index 000000000..5fa1a7827 --- /dev/null +++ b/private/utils/wizards/addusrw/sources @@ -0,0 +1,75 @@ +!IF 0 + +Copyright (c) 1989 Microsoft Corporation + +Module Name: + + sources. + +Abstract: + + This file specifies the target component being built and the list of + sources files needed to build that component. Also specifies optional + compiler switches and libraries that are unique for the component being + built. + + +Author: + + Steve Wood (stevewo) 12-Apr-1990 + +NOTE: Commented description of this file is in \nt\bak\bin\sources.tpl + +!ENDIF + +TARGETNAME=addusrw +TARGETPATH=obj +TARGETTYPE=PROGRAM + +USE_MFCUNICODE=1 + +PRECOMPILED_INCLUDE=stdafx.h +PRECOMPILED_CXX=1 + +INCLUDES=$(BASEDIR)\private\net\inc; $(BASEDIR)\private\net\svcdlls\fpnw\inc + +SOURCES= \ + accexp.cpp \ + finish.cpp \ + fpinfo.cpp \ + ginfo.cpp \ + hours.cpp \ + hours1.cpp \ + limit.cpp \ + nwwks.cpp \ + optdlg.cpp \ + profile.cpp \ + prsinfo.cpp \ + pwinfo.cpp \ + rasperm.cpp \ + speckle.cpp \ + timelist.cpp \ + transbmp.cpp \ + userlist.cpp \ + welcome.cpp \ + wizbased.cpp \ + exch.cpp \ + homedir.cpp \ + nwlim.cpp \ + restrct.cpp \ + lscript.cpp \ + speckle.rc \ + trstlist.cpp + +UMTYPE=windows +UMENTRY=wwinmain +TARGETLIBS= \ + $(BASEDIR)\public\sdk\lib\*\netapi32.lib \ + $(BASEDIR)\public\sdk\lib\*\mpr.lib \ + $(BASEDIR)\public\sdk\lib\*\comdlg32.lib \ + $(BASEDIR)\public\sdk\lib\*\comctl32.lib \ + $(BASEDIR)\public\sdk\lib\*\shell32.lib \ + $(BASEDIR)\public\sdk\lib\*\ntdll.lib \ + $(BASEDIR)\public\sdk\lib\*\oleaut32.lib \ + $(BASEDIR)\public\sdk\lib\*\kernel32.lib + diff --git a/private/utils/wizards/addusrw/speckle.cpp b/private/utils/wizards/addusrw/speckle.cpp new file mode 100644 index 000000000..351e30d0b --- /dev/null +++ b/private/utils/wizards/addusrw/speckle.cpp @@ -0,0 +1,262 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + Speckle.cpp : Defines the class behaviors for the application. + +File History: + + JonY Apr-96 created + +--*/ + +#include "stdafx.h" +#include "Speckle.h" + +#include "wizbased.h" +#include "welcome.h" +#include "prsinfo.h" +#include "pwinfo.h" +#include "userlist.h" +#include "ginfo.h" +#include "Profile.h" +#include "finish.h" +#include "RasPerm.h" +#include "FPInfo.h" +#include "Limit.h" +#include "Timelist.h" +#include "hours.h" +#include "AccExp.h" +#include "optdlg.h" +#include "Restrct.h" +#include "HomeDir.h" +#include "LScript.h" +#include "Exch.h" +#include "NWLim.h" + +#include + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +TCHAR pszTreeEvent[] = _T("TreeThread"); +///////////////////////////////////////////////////////////////////////////// +// CSpeckleApp + +BEGIN_MESSAGE_MAP(CSpeckleApp, CWinApp) + //{{AFX_MSG_MAP(CSpeckleApp) + //}}AFX_MSG +// ON_COMMAND(ID_HELP, CWinApp::OnHelp) +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CSpeckleApp construction + +CSpeckleApp::CSpeckleApp() +{ + m_bLocal = 0; // local or remote + m_dwExpirationDate = TIMEQ_FOREVER; + *m_pHours = NULL; + + m_sNWAllowedGraceLogins = 0x6; + m_sNWRemainingGraceLogins = 0xff; + m_sNWConcurrentConnections = NO_LIMIT; + m_csNWHomeDir = (TCHAR*)DEFAULT_NWHOMEDIR; + m_csAllowedLoginFrom = (TCHAR*)DEFAULT_NWLOGONFROM; + + m_bDisabled = FALSE; + m_bChange_Password = FALSE; + m_bMust_Change_PW = FALSE; + m_bPW_Never_Expires = FALSE; + + m_bExpiration = FALSE; + m_bHours = FALSE; + m_bNW = FALSE; + m_bProfile = FALSE; + m_bRAS = FALSE; + m_bWorkstation = FALSE; + m_bExchange = FALSE; + m_bHomeDir = FALSE; + m_bLoginScript = FALSE; + m_bDisabled = FALSE; + m_bEnableRestrictions = FALSE; + + m_sCallBackType = 0; + + m_bPRSReset = TRUE; + m_bPWReset = TRUE; + m_bGReset = TRUE; +} + +CSpeckleApp::~CSpeckleApp() +{ +// zero out the password before we leave. + m_csPassword1 = L""; + +} + +///////////////////////////////////////////////////////////////////////////// +// The one and only CSpeckleApp object + +CSpeckleApp theApp; + +///////////////////////////////////////////////////////////////////////////// +// CSpeckleApp initialization +BOOL CSpeckleApp::IsSecondInstance() +{ + HANDLE hSem; + + //create a semaphore object with max count of 1 + hSem = CreateSemaphore(NULL, 0, 1, L"Adduser Wizard Semaphore"); + if (hSem!=NULL && GetLastError() == ERROR_ALREADY_EXISTS) { + CloseHandle(hSem); + CString csAppName; + csAppName.LoadString(AFX_IDS_APP_TITLE); + CWnd* pWnd = CWnd::FindWindow(NULL, (LPCTSTR)csAppName); + + if (pWnd) + pWnd->SetForegroundWindow(); + return TRUE; + } + + return FALSE; +} + +BOOL CSpeckleApp::InitInstance() +{ +// check for OS version + OSVERSIONINFO os; + os.dwOSVersionInfoSize = sizeof(os); + GetVersionEx(&os); + + if (os.dwMajorVersion < 4) + { + AfxMessageBox(IDS_BAD_VERSION, MB_ICONSTOP); + ExitProcess(0); + } + if (IsSecondInstance()) + return FALSE; + + AfxEnableControlContainer(); + + // Standard initialization + +#ifdef _AFXDLL + Enable3dControls(); // Call this when using MFC in a shared DLL +#else + Enable3dControlsStatic(); // Call this when linking to MFC statically +#endif + +// create the dialogs + CWelcomeDlg* pWelcome = new CWelcomeDlg; + CPersonalInfo* pInfo = new CPersonalInfo; + CPasswordInfo* pPassword = new CPasswordInfo; + CGroupInfo* pGroup = new CGroupInfo; + CProfile* pProfile = new CProfile; + CFinish* pFinish = new CFinish; + CRasPerm* pRasP = new CRasPerm; + CFPInfo* pFP = new CFPInfo; + CLimitLogon* pLim = new CLimitLogon; + CHoursDlg* pHours = new CHoursDlg; + CAccExp* pExp = new CAccExp; + COptionsDlg* pOpt = new COptionsDlg; + CRestrictions* pRestrictions = new CRestrictions; + CHomeDir* pHomeDir = new CHomeDir; + CLoginScript* pLScript = new CLoginScript; + CExch* pExch = new CExch; + CNWLimitLogon* pNWLim = new CNWLimitLogon; + +// create the property sheet and set 'wizmode' + m_cps1.SetWizardMode(); + +// Add the dialogs + m_cps1.AddPage(pWelcome); + m_cps1.AddPage(pInfo); + m_cps1.AddPage(pPassword); + m_cps1.AddPage(pGroup); + + m_cps1.AddPage(pOpt); + m_cps1.AddPage(pProfile); + m_cps1.AddPage(pLScript); + m_cps1.AddPage(pHomeDir); + m_cps1.AddPage(pRasP); + m_cps1.AddPage(pFP); + + m_cps1.AddPage(pExch); + + m_cps1.AddPage(pRestrictions); + m_cps1.AddPage(pExp); + m_cps1.AddPage(pHours); + m_cps1.AddPage(pLim); + m_cps1.AddPage(pNWLim); + m_cps1.AddPage(pFinish); + +// start the wizard + m_cps1.DoModal(); + +// clean up + delete pWelcome; + delete pInfo; + delete pPassword; + delete pGroup; + delete pProfile; + delete pFinish; + delete pRasP; + delete pFP; + delete pLim; + delete pHours; + delete pExp; + delete pOpt; + delete pRestrictions; + delete pHomeDir; + delete pLScript; + delete pExch; + delete pNWLim; + + return FALSE; +} + +///////////////////////////////////////////////////////////////////////////// +// CMySheet + +IMPLEMENT_DYNAMIC(CMySheet, CPropertySheet) + +CMySheet::CMySheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage) + :CPropertySheet(nIDCaption, pParentWnd, iSelectPage) +{ +} + +CMySheet::CMySheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage) + :CPropertySheet(pszCaption, pParentWnd, iSelectPage) +{ +} + +CMySheet::CMySheet() : CPropertySheet() +{ +} + +CMySheet::~CMySheet() +{ +} + + +BEGIN_MESSAGE_MAP(CMySheet, CPropertySheet) + //{{AFX_MSG_MAP(CMySheet) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CMySheet message handlers + +BOOL CMySheet::OnInitDialog() +{ + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + HICON hIcon = LoadIcon(pApp->m_hInstance, MAKEINTRESOURCE(IDR_MAINFRAME)); + ::SetClassLong(m_hWnd, GCL_HICON, (long)hIcon); + + return CPropertySheet::OnInitDialog(); +} diff --git a/private/utils/wizards/addusrw/speckle.h b/private/utils/wizards/addusrw/speckle.h new file mode 100644 index 000000000..1f1b2628a --- /dev/null +++ b/private/utils/wizards/addusrw/speckle.h @@ -0,0 +1,176 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + Speckle.h : main header file for the SPECKLE application + +File History: + + JonY Apr-96 created + +--*/ + +#ifndef __AFXWIN_H__ + #error include 'stdafx.h' before including this file for PCH +#endif + +#include "resource.h" // main symbols + + +///////////////////////////////////////////////////////////////////////////// +// CMySheet + +class CMySheet : public CPropertySheet +{ + DECLARE_DYNAMIC(CMySheet) + +// Construction +public: + CMySheet(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0); + CMySheet(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT iSelectPage = 0); + CMySheet(); + +// Attributes +public: + +// Operations +public: +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CMySheet) + public: + virtual BOOL OnInitDialog(); + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CMySheet(); + + // Generated message map functions +protected: + //{{AFX_MSG(CMySheet) + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// +// CSpeckleApp: +// See Speckle.cpp for the implementation of this class +// + +typedef struct tagTREEINFO +{ + HTREEITEM hTreeItem; + DWORD dwBufSize; + CObject* pTree; + BOOL bExpand; +} +TREEINFO, *PTREEINFO; + +class CSpeckleApp : public CWinApp +{ +public: + CSpeckleApp(); + ~CSpeckleApp(); + + CMySheet m_cps1; + BOOL IsSecondInstance(); + + short m_bLocal; + +// remote server name + BOOL m_bDomain; + BOOL m_bServer; + CString m_csServer; + int m_nGroupType; + CString m_csCurrentDomain; + CString m_csCurrentMachine; + CString m_csDomain; + +// account information +// password info + BOOL m_bChange_Password; + BOOL m_bMust_Change_PW; + BOOL m_bPW_Never_Expires; + CString m_csPassword1; + +// personal info + CString m_csDescription; + CString m_csFullName; + CString m_csUserName; + +// profile info + CString m_csLogonScript; // usri3_script_path + CString m_csProfilePath; // usri3_profile + +// homedir info + CString m_csHomeDir; // usri3_home_dir + CString m_csHome_dir_drive; // usri3_home_dir_drive + +// group list + CStringArray m_csaSelectedLocalGroups; + CStringArray m_csaSelectedGlobalGroups; + +// permitted machine list + CString m_csAllowedMachines; + +// Account expiration date (seconds since 1/1/1970 00:00:00) + DWORD m_dwExpirationDate; + +// time of availability + BYTE m_pHours[21]; + +// NetWare params + USHORT m_sNWAllowedGraceLogins; + USHORT m_sNWConcurrentConnections; + USHORT m_sNWRemainingGraceLogins; + CString m_csNWHomeDir; + CString m_csAllowedLoginFrom; + +// RAS params; + CString m_csRasPhoneNumber; + USHORT m_sCallBackType; // 0- no call back 1- caller set 2-preset + +// primary group ID + DWORD m_dwPrimaryGroupID; + +// Which windows to use + BOOL m_bExpiration; + BOOL m_bHours; + BOOL m_bNW; + BOOL m_bProfile; + BOOL m_bRAS; + BOOL m_bWorkstation; + BOOL m_bExchange; + BOOL m_bHomeDir; + BOOL m_bLoginScript; + BOOL m_bDisabled; + + BOOL m_bEnableRestrictions; + +// restarting the app? + BOOL m_bPRSReset; + BOOL m_bPWReset; + BOOL m_bGReset; + +// Exchange server + CString m_csExchangeServer; + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CSpeckleApp) + public: + virtual BOOL InitInstance(); + //}}AFX_VIRTUAL + +// Implementation + + //{{AFX_MSG(CSpeckleApp) + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + + +///////////////////////////////////////////////////////////////////////////// diff --git a/private/utils/wizards/addusrw/speckle.rc b/private/utils/wizards/addusrw/speckle.rc new file mode 100644 index 000000000..868f5cb3d --- /dev/null +++ b/private/utils/wizards/addusrw/speckle.rc @@ -0,0 +1,766 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#define _AFX_NO_SPLITTER_RESOURCES\r\n" + "#define _AFX_NO_OLE_RESOURCES\r\n" + "#define _AFX_NO_TRACKER_RESOURCES\r\n" + "#define _AFX_NO_PROPERTY_RESOURCES\r\n" + "\r\n" + "#include ""res\\Speckle.rc2"" // non-Microsoft Visual C++ edited resources\r\n" + "#include ""afxres.rc"" // Standard components\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDR_MAINFRAME ICON DISCARDABLE "res\\Speckle.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_BASE_DIALOG DIALOG DISCARDABLE 0, 0, 276, 140 +STYLE WS_POPUP | WS_VISIBLE | WS_DISABLED | WS_BORDER +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "",IDC_PAINT_BOX,"Static",SS_BLACKFRAME,0,0,80,140 +END + +IDD_WELCOME_DIALOG DIALOG DISCARDABLE 0, 0, 276, 140 +STYLE WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_CAPTION +CAPTION "Add User Account Wizard" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "&Domain name:",IDC_STATIC,92,56,48,8 + COMBOBOX IDC_DOMAIN_LIST,147,54,123,51,CBS_DROPDOWNLIST | + CBS_SORT | WS_VSCROLL | WS_TABSTOP + CONTROL 130,IDC_PAINT_BOX,"Static",SS_BITMAP | SS_SUNKEN,0,0,80, + 140 + LTEXT "Welcome to the Add User Account wizard",IDC_STATIC1,91, + 7,184,8 + LTEXT "Use this wizard to create an account for a user on this domain:", + IDC_STATIC,91,27,179,18 +END + +IDD_USER_NAME DIALOG DISCARDABLE 0, 0, 276, 140 +STYLE WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_CAPTION +CAPTION "Add User Account Wizard" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "What is the user's &full name?",IDC_STATIC,93,9,155,8 + EDITTEXT IDC_FULLNAME,93,19,175,14,ES_AUTOHSCROLL + LTEXT "Type a &unique name to identify the user. This username will be used for logging on and using resources.", + IDC_STATIC,93,47,174,19 + EDITTEXT IDC_USERNAME,93,65,175,14,ES_AUTOHSCROLL + LTEXT "Type a &description for this user (optional).", + IDC_STATIC,93,93,174,8 + EDITTEXT IDC_DESCRIPTION,93,103,175,14,ES_AUTOHSCROLL + CONTROL 130,IDC_PAINT_BOX,"Static",SS_BITMAP | SS_SUNKEN,0,0,80, + 140 +END + +IDD_PASSWORD_INFO DIALOG DISCARDABLE 0, 0, 276, 140 +STYLE WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_CAPTION +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "&Password:",IDC_STATIC,91,25,32,8 + EDITTEXT IDC_PASSWORD1,157,22,112,13,ES_PASSWORD | ES_AUTOHSCROLL + LTEXT "&Confirm password:",IDC_STATIC,91,42,58,8 + EDITTEXT IDC_PASSWORD2,157,39,112,13,ES_PASSWORD | ES_AUTOHSCROLL + LTEXT "",IDC_STATIC1,91,6,184,8 + CONTROL 130,IDC_PAINT_BOX,"Static",SS_BITMAP | SS_SUNKEN,0,0,80, + 140 + CONTROL "The user &must change the password at the next ", + IDC_PWOPTIONS_RADIO,"Button",BS_AUTORADIOBUTTON | + WS_GROUP,91,64,178,10 + CONTROL "The user c&an change the password at any time.", + IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,91,89,164,10 + CONTROL "The user is n&ot allowed to change the password.", + IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,91,105,167,10 + CONTROL "This password never &expires",IDC_EXPIREPW_CHECK, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,91,126,105,10 + LTEXT "logon and can change it at any time.",IDC_STATIC,103,74, + 166,8 +END + +IDD_PROFILE DIALOG DISCARDABLE 0, 0, 276, 140 +STYLE WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_CAPTION +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "User profiles contain desktop settings, such as which applications appear and which network connections are restored when the user logs on. If the profile path is left blank, the wizard will use the default profile stored in the Default User folder.", + IDC_STATIC,9,5,264,28 + LTEXT "What is the user's &profile path?",IDC_STATIC,9,35,110, + 8 + EDITTEXT IDC_PROFILE_PATH,8,44,260,14,ES_AUTOHSCROLL +END + +IDD_FINISH DIALOG DISCARDABLE 0, 0, 276, 140 +STYLE WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_CAPTION +CAPTION "Add User Account Wizard" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "",IDC_STATIC1,93,7,172,34 + LTEXT "Click Finish to add the account, or click Cancel to cancel the wizard without adding the account.", + IDC_STATIC,93,51,159,18 +END + +IDD_RAS_PERM_DIALOG DIALOG DISCARDABLE 0, 0, 276, 140 +STYLE WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Add User Account Wizard" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "&No call back by the Remote Access server", + IDC_CALL_BACK_RADIO,"Button",BS_AUTORADIOBUTTON | + WS_GROUP,90,55,174,10 + CONTROL "User can call in from &any number",IDC_RADIO2,"Button", + BS_AUTORADIOBUTTON,90,71,176,10 + CONTROL "User can only call from &this number",IDC_RADIO3, + "Button",BS_AUTORADIOBUTTON,90,87,176,10 + EDITTEXT IDC_RASPHONE_EDIT,101,97,90,14,ES_AUTOHSCROLL | + WS_DISABLED + CONTROL 130,IDC_PAINT_BOX,"Static",SS_BITMAP | SS_SUNKEN,0,0,80, + 140 + LTEXT "What are the Dial-Up Networking options you want for %s?", + IDC_STATIC1,90,7,180,17 +END + +IDD_FPNW_DLG DIALOG DISCARDABLE 0, 0, 276, 140 +STYLE WS_POPUP | WS_CAPTION +CAPTION "Add User Account Wizard" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "&Yes",IDC_GRACE_LOGIN_RADIO,"Button",BS_AUTORADIOBUTTON | + WS_GROUP,22,38,36,10 + CONTROL "N&o, allow only",IDC_GRACE_LOGIN_RADIO2,"Button", + BS_AUTORADIOBUTTON | WS_TABSTOP,22,52,60,10 + EDITTEXT IDC_ALLOWED_GRACE_LOGINS_EDIT,83,50,40,14,ES_AUTOHSCROLL + CONTROL "Spin1",IDC_GRACE_LOGIN_SPIN,"msctls_updown32", + UDS_SETBUDDYINT | UDS_AUTOBUDDY | UDS_ARROWKEYS,122,50, + 11,14 + LTEXT "grace login(s)",IDC_STATIC2,137,53,55,8 + LTEXT "Do you want to allow unlimited logins after the password has expired?", + IDC_STATIC,9,24,218,8 + LTEXT "Do you want to allow an unlimited number of concurrent connections?", + IDC_STATIC,9,79,220,8 + CONTROL "Y&es",IDC_CONCURRENT_CONNECTIONS_RADIO1,"Button", + BS_AUTORADIOBUTTON | WS_GROUP,23,93,28,10 + CONTROL "No, &allow only",IDC_CONCURRENT_CONNECTIONS_RADIO2, + "Button",BS_AUTORADIOBUTTON,23,107,60,10 + EDITTEXT IDC_CONCURRENT_CONNECTIONS_EDIT,83,105,40,14, + ES_AUTOHSCROLL + CONTROL "Spin1",IDC_CONCURRENT_CONNECTIONS_SPIN, + "msctls_updown32",UDS_SETBUDDYINT | UDS_AUTOBUDDY | + UDS_ARROWKEYS,122,105,11,14 + LTEXT "concurrent connection(s)",IDC_STATIC,137,108,102,8 + LTEXT "",IDC_STATIC1,9,6,245,8 +END + +IDD_GROUP_INFO DIALOG DISCARDABLE 0, 0, 276, 140 +STYLE WS_POPUP | WS_CAPTION +CAPTION "Add User Account Wizard" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "A&vailable groups:",IDC_STATIC,1,21,75,8 + LISTBOX IDC_GROUP_AVAILABLE_LIST,0,31,105,108,LBS_SORT | + LBS_OWNERDRAWVARIABLE | LBS_HASSTRINGS | + LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + LTEXT "&Selected groups:",IDC_STATIC,171,21,62,8 + LISTBOX IDC_GROUP_MEMBER_LIST,170,31,105,108,LBS_SORT | + LBS_OWNERDRAWVARIABLE | LBS_HASSTRINGS | + LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "&Add >",IDC_ADD_BUTTON,112,56,50,14 + PUSHBUTTON "< &Remove",IDC_REMOVE_BUTTON,112,74,50,14 + LTEXT "",IDC_STATIC1,0,1,266,19 +END + +IDD_LOGONTO_DLG DIALOG DISCARDABLE 0, 0, 276, 140 +STYLE WS_POPUP | WS_CAPTION +CAPTION "Add User Account Wizard" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "A&ll workstations",IDC_WORKSTATION_RADIO,"Button", + BS_AUTORADIOBUTTON | WS_GROUP,6,15,109,10 + GROUPBOX "Static",IDC_STATIC,0,29,271,111 + CONTROL "User can only log on from &these workstations", + IDC_WORKSTATION_RADIO2,"Button",BS_AUTORADIOBUTTON,6,28, + 154,10 + LISTBOX IDC_LIST1,9,52,253,61,LBS_SORT | LBS_NOINTEGRALHEIGHT | + WS_DISABLED | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "&Add...",IDC_ADD_BUTTON,9,118,50,14,WS_DISABLED + PUSHBUTTON "&Remove",IDC_REMOVE_BUTTON,64,118,50,14,WS_DISABLED + LTEXT "Workstations:",IDC_STATIC1,10,42,44,8,WS_DISABLED + LTEXT "",IDC_STATIC2,7,2,268,8 +END + +IDD_HOURS_DLG DIALOG DISCARDABLE 0, 0, 276, 141 +STYLE WS_POPUP | WS_CAPTION +CAPTION "Add User Account Wizard" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "Select the times the user can logon. Click on a square to allow or disallow a time. Click on a day to allow or disallow a whole day.", + IDC_STATIC,0,0,275,16 + LTEXT "Allowed times - ",IDC_STATIC,56,131,50,8 + CONTROL "",IDC_STATIC_ALLOWEDTIMES,"Static",SS_BLACKFRAME,109, + 131,9,9 + LTEXT "Disallowed times - ",IDC_STATIC,143,131,59,8 + CONTROL "",IDC_STATIC_DISALLOWEDTIMES,"Static",SS_BLACKFRAME,204, + 131,9,9 + CONTROL "",IDC_HOURSCTRL1, + "{A44EA7AD-9D58-11CF-A35F-00AA00B6743B}",WS_TABSTOP,13, + 30,249,100 + LTEXT "Midnight",IDC_STATIC,54,19,27,8 + LTEXT "Noon",IDC_STATIC,155,18,18,8 + LTEXT "Midnight",IDC_STATIC,245,19,28,8 + CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME,84,27,1,3 + CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME,100,27,1,3 + CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME,116,27,1,3 + CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME,132,27,1,3 + CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME,148,27,1,3 + CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME,180,27,1,3 + CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME,196,27,1,3 + CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME,212,27,1,3 + CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME,228,27,1,3 + CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME,244,27,1,3 + CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME,68,27,1,3 + CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME,164,27,1,3 + CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME,260,27,1,3 +END + +IDD_ADD_NWWKS_DIALOG DIALOG DISCARDABLE 0, 0, 183, 92 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Add NetWare Compatible Workstation" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",IDOK,43,68,50,14 + PUSHBUTTON "Cancel",IDCANCEL,102,68,50,14 + LTEXT "&Network Address:",IDC_STATIC,7,19,59,8 + EDITTEXT IDC_NETWORK_ADDRESS_EDIT,74,16,102,14,ES_AUTOHSCROLL + LTEXT "N&ode Address:",IDC_STATIC,7,40,48,8 + EDITTEXT IDC_NODE_ADDRESS_EDIT,74,37,102,14,ES_AUTOHSCROLL +END + +IDD_ACCOUNT_EXP_DIALOG DIALOG DISCARDABLE 0, 0, 276, 140 +STYLE WS_POPUP | WS_CAPTION +CAPTION "Add User Account WIzard" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "",IDC_STATIC,"Static",SS_ETCHEDFRAME,106,23,93,17 + CONTROL "",IDC_STATIC_FRAME,"Static",SS_WHITERECT,108,24,90,14 + EDITTEXT IDC_DAY_EDIT,135,25,13,12,ES_AUTOHSCROLL | ES_NUMBER | + NOT WS_BORDER + EDITTEXT IDC_YEAR_EDIT,160,25,27,12,ES_AUTOHSCROLL | ES_NUMBER | + NOT WS_BORDER + CONTROL "Spin1",IDC_DATE_SPIN,"msctls_updown32",UDS_SETBUDDYINT | + UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,188,23, + 11,16 + CTEXT "/",IDC_STATIC1,125,25,8,8 + CTEXT "/",IDC_STATIC2,151,25,8,8 + EDITTEXT IDC_MONTH_EDIT,110,25,13,12,ES_AUTOHSCROLL | ES_NUMBER | + NOT WS_BORDER + LTEXT "When do you want this account to expire?",IDC_STATIC,92, + 8,172,8 + CONTROL 130,IDC_PAINT_BOX,"Static",SS_BITMAP | SS_SUNKEN,1,0,80, + 140 +END + +IDD_OPTIONS_DIALOG DIALOG DISCARDABLE 0, 0, 276, 140 +STYLE WS_POPUP | WS_CAPTION +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "&Profile",IDC_PROFILE_CHECK,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,91,40,39,10 + CONTROL "&Login script",IDC_LOGIN_SCRIPT_CHECK,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,91,55,52,10 + CONTROL "&Home Directory",IDC_HOMEDIR_CHECK,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,91,70,65,10 + CONTROL "&Dial-Up Networking",IDC_RAS_CHECK,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,91,85,130,10 + CONTROL "&File and Print Services for NetWare",IDC_NW_CHECK, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,91,100,131,10 + CONTROL "Microsoft &Exchange",IDC_EXCHANGE_CHECK,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,91,115,103,10 + CONTROL 130,IDC_PAINT_BOX,"Static",SS_BITMAP | SS_SUNKEN,0,0,80, + 140 + LTEXT "",IDC_STATIC1,89,6,177,28 +END + +IDD_HOMEDIR_DIALOG DIALOG DISCARDABLE 0, 0, 276, 140 +STYLE WS_POPUP | WS_CAPTION +CAPTION "Add User Account Wizard" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "Use the default home directory on the &user's computer", + IDC_LOCAL_PATH_BUTTON,"Button",BS_AUTORADIOBUTTON | + WS_GROUP,13,56,232,14 + GROUPBOX "",IDC_STATIC,7,74,262,57 + CONTROL "On &another computer",IDC_REMOTE_PATH_BUTTON,"Button", + BS_AUTORADIOBUTTON,14,74,80,10 + LTEXT "&Connect drive:",IDC_STATIC,16,91,48,8 + COMBOBOX IDC_DRIVE_LETTER,70,89,27,58,CBS_DROPDOWN | CBS_SORT | + WS_DISABLED | WS_VSCROLL | WS_TABSTOP + LTEXT "&To:",IDC_STATIC,16,110,10,10 + EDITTEXT IDC_REMOTE_PATH,33,107,227,14,ES_AUTOHSCROLL | + WS_DISABLED + LTEXT "",IDC_STATIC1,7,30,255,8 + LTEXT "Home directories are for users to have a default location to store files and folders. A home directory can be on a user's computer, or on another computer in the domain.", + IDC_STATIC,7,7,262,23 +END + +IDD_LOGON_SCRIPT_DIALOG DIALOG DISCARDABLE 0, 0, 272, 140 +STYLE WS_POPUP | WS_CAPTION +CAPTION "Add User Accont Wizard" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "What is the user's logon &script name?",IDC_STATIC,7,35, + 124,8 + EDITTEXT IDC_LOGON_SCRIPT,7,45,258,13,ES_AUTOHSCROLL + LTEXT "Logon scripts can be used to configure the user's work environment, such as starting applications, or creating new network connections. If you leave the logon scripts blank, no logon script will be used for the user account.", + IDC_STATIC,7,7,258,28 +END + +IDD_RESTRICTIONS_DIALOG DIALOG DISCARDABLE 0, 0, 272, 141 +STYLE WS_POPUP | WS_CAPTION +CAPTION "Add User Account Wizard" +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "Static",IDC_STATIC,93,48,178,80 + CONTROL "&No restrictions",IDC_RESTRICTIONS_RADIO,"Button", + BS_AUTORADIOBUTTON | WS_GROUP,99,32,61,10 + CONTROL "The following &restrictions",IDC_RESTRICTIONS_RADIO2, + "Button",BS_AUTORADIOBUTTON,99,47,90,10 + CONTROL "When the &account will expire",IDC_ACCOUNT_EXPIRE_CHECK, + "Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,103, + 63,107,10 + CONTROL "The × when the user can logon", + IDC_LOGIN_TIMES_CHECK,"Button",BS_AUTOCHECKBOX | + WS_DISABLED | WS_TABSTOP,103,78,140,10 + CONTROL "The &workstations from which the user can logon", + IDC_WORKSTATIONS_CHECK,"Button",BS_AUTOCHECKBOX | + WS_DISABLED | WS_TABSTOP,103,93,164,10 + CONTROL "The account is currently &disabled",IDC_DISABLED_CHECK, + "Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,103, + 108,120,10 + LTEXT "",IDC_STATIC1,93,7,177,17 + CONTROL 130,IDC_PAINT_BOX,"Static",SS_BITMAP | SS_SUNKEN,1,0,80, + 140 +END + +IDD_NWLOGON_DIALOG DIALOG DISCARDABLE 0, 0, 276, 140 +STYLE WS_POPUP | WS_CAPTION +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "A&ll NetWare compatible workstations", + IDC_WORKSTATION_RADIO,"Button",BS_AUTORADIOBUTTON | + WS_GROUP,6,15,132,10 + GROUPBOX "Static",IDC_STATIC,0,29,271,111 + CONTROL "User can only log on from &these workstations", + IDC_WORKSTATION_RADIO2,"Button",BS_AUTORADIOBUTTON,6,28, + 154,10 + LISTBOX IDC_NWLOGON_LIST,9,52,253,63,LBS_SORT | + LBS_OWNERDRAWFIXED | WS_DISABLED | WS_VSCROLL | + WS_TABSTOP + PUSHBUTTON "&Add...",IDC_ADD_BUTTON,9,118,50,14,WS_DISABLED + PUSHBUTTON "&Remove",IDC_REMOVE_BUTTON,64,118,50,14,WS_DISABLED + LTEXT "Network Address:",IDC_NWSTATIC1,10,42,70,8,WS_DISABLED + LTEXT "Node Address:",IDC_NWSTATIC2,120,42,70,8,WS_DISABLED + LTEXT "",IDC_STATIC1,7,2,263,8 +END + +IDD_EXCHANGE_DIALOG DIALOG DISCARDABLE 0, 0, 276, 140 +STYLE WS_POPUP | WS_CAPTION +FONT 8, "MS Sans Serif" +BEGIN + EDITTEXT IDC_SERVERNAME_EDIT,7,33,204,14,ES_AUTOHSCROLL + LTEXT "Please enter the name of a Microsoft Exchange server in the domain:", + IDC_STATIC,7,6,228,8 + LISTBOX IDC_SERVER_LIST,63,96,122,39,LBS_SORT | + LBS_NOINTEGRALHEIGHT | NOT WS_VISIBLE | WS_VSCROLL | + WS_TABSTOP + LTEXT "Static",IDC_STATIC_DOMAIN,7,19,82,8 +END + +IDD_ADD_WKS_DIALOG DIALOG DISCARDABLE 0, 0, 186, 95 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Workstations" +FONT 8, "MS Sans Serif" +BEGIN + EDITTEXT IDC_WORKSTATION_EDIT,6,22,172,14,ES_AUTOHSCROLL + DEFPUSHBUTTON "&Add",IDOK,40,74,50,14 + PUSHBUTTON "&Close",IDCANCEL,95,74,50,14 + LTEXT "&Please enter the name of a workstation:",IDC_STATIC,7, + 12,126,8 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_BASE_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 269 + TOPMARGIN, 7 + BOTTOMMARGIN, 133 + END + + IDD_WELCOME_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 5 + RIGHTMARGIN, 269 + TOPMARGIN, 5 + BOTTOMMARGIN, 135 + END + + IDD_USER_NAME, DIALOG + BEGIN + LEFTMARGIN, 5 + RIGHTMARGIN, 269 + TOPMARGIN, 5 + BOTTOMMARGIN, 135 + END + + IDD_PASSWORD_INFO, DIALOG + BEGIN + LEFTMARGIN, 5 + RIGHTMARGIN, 269 + TOPMARGIN, 5 + BOTTOMMARGIN, 135 + END + + IDD_PROFILE, DIALOG + BEGIN + LEFTMARGIN, 5 + RIGHTMARGIN, 269 + TOPMARGIN, 5 + BOTTOMMARGIN, 135 + END + + IDD_FINISH, DIALOG + BEGIN + LEFTMARGIN, 5 + RIGHTMARGIN, 269 + TOPMARGIN, 5 + BOTTOMMARGIN, 135 + END + + IDD_RAS_PERM_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 269 + TOPMARGIN, 7 + BOTTOMMARGIN, 133 + END + + IDD_FPNW_DLG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 269 + TOPMARGIN, 7 + BOTTOMMARGIN, 133 + END + + IDD_GROUP_INFO, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 269 + TOPMARGIN, 7 + BOTTOMMARGIN, 133 + END + + IDD_LOGONTO_DLG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 269 + TOPMARGIN, 7 + BOTTOMMARGIN, 133 + END + + IDD_HOURS_DLG, DIALOG + BEGIN + RIGHTMARGIN, 269 + TOPMARGIN, 7 + BOTTOMMARGIN, 134 + END + + IDD_ADD_NWWKS_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 176 + TOPMARGIN, 7 + BOTTOMMARGIN, 85 + END + + IDD_ACCOUNT_EXP_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 269 + TOPMARGIN, 7 + BOTTOMMARGIN, 133 + END + + IDD_OPTIONS_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 269 + TOPMARGIN, 7 + BOTTOMMARGIN, 133 + END + + IDD_HOMEDIR_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 269 + TOPMARGIN, 7 + BOTTOMMARGIN, 133 + END + + IDD_LOGON_SCRIPT_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 265 + TOPMARGIN, 7 + BOTTOMMARGIN, 133 + END + + IDD_RESTRICTIONS_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 265 + TOPMARGIN, 7 + BOTTOMMARGIN, 134 + END + + IDD_NWLOGON_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 269 + TOPMARGIN, 7 + BOTTOMMARGIN, 133 + END + + IDD_EXCHANGE_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 269 + TOPMARGIN, 7 + BOTTOMMARGIN, 133 + END + + IDD_ADD_WKS_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 179 + TOPMARGIN, 7 + BOTTOMMARGIN, 88 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_BITMAP1 BITMAP DISCARDABLE "res\\bitmap1.bmp" +IDB_NET_TREE BITMAP DISCARDABLE "res\\net_tree.bmp" +IDB_USER_BITMAP BITMAP DISCARDABLE "res\\user.bmp" +IDB_USER_BITMAP1 BITMAP DISCARDABLE "res\\user_bit.bmp" +IDB_GLOBAL_GROUP_BITMAP BITMAP DISCARDABLE "res\\global.bmp" +IDB_LOCAL_GROUP_BITMAP BITMAP DISCARDABLE "res\\group.bmp" +IDB_WORLD BITMAP DISCARDABLE "res\\world.bmp" +IDB_ENDFLAG BITMAP DISCARDABLE "res\\endflag.BMP" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog Info +// + +IDD_HOURS_DLG DLGINIT +BEGIN + IDC_HOURSCTRL1, 0x376, 20, 0 +0x0000, 0x0000, 0x0000, 0x0001, 0x26a7, 0x0000, 0x10d9, 0x0000, 0x0000, +0x0000, + 0 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_NO_MACHINE_NAME "Please enter the name of a computer or domain." + IDS_NO_VALID_WORKSTATIONS + "You did not specify any valid logon workstations. You must select that all workstations are permissible, or specify one or more workstations in the spaces provided." + IDS_NO_NEW_USER "An error occurred while adding the user account for %s with the username %s. The user account was not created. Do you want to restart the wizard?" + IDS_BAD_USER_DATA "An error occurred while parameters were being set for %s with the username %s. Not all parameters were set. Would you like to restart the wizard?" + IDS_NO_LOCAL_GROUP "An error occurred while adding this user to some local groups." + IDS_NO_GLOBAL_GROUP "An error occurred while adding this user to some global groups." +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_GENERIC_NO_HEAP "There is insufficient memory to continue. This program will stop." + IDS_GENERIC_NO_PDC "Unable to contact a domain controller for this domain. Group and user lists are unavailable." + IDS_GENERIC_BAD_MACHINE "Unable to locate computer. The selected computer is not available or is not running Windows NT Workstation or Windows NT Server." + IDS_NO_GROUP_NAME "Please enter a group name." + IDS_GROUP_INVALID_NAME "Please enter a group name with 20 characters or less. The name can contain any character except: ""\\/[];:|=,+*?<>" + IDS_DOMAIN_SET "The selected computer is a domain controller. Focus will be set to its affiliated primary domain." + IDS_NET_ERROR "IDS_NET_ERROR" + IDS_NET_NO_SERVERS "No servers were found in the selected domain." + IDS_ERROR "IDS_ERROR" +END + +STRINGTABLE DISCARDABLE +BEGIN + AFX_IDS_APP_TITLE "Add User Account Wizard" + IDS_BAD_VERSION "You must be running Windows NT version 4.0 in order to use this application." + IDS_WELCOME_STRING "Welcome to the Add User Account wizard" + IDS_PASSWORD_CAPTION "Type a password for %s." + IDS_FINISH_CAPTION "You have entered all the information to add a user account for %s. To make changes to existing user accounts, use User Manager for Domains in the Administrative Tools group." + IDS_OPTION_CAPTION "Which of the following options do you want to configure for %s? If any of these options are not available, you will not be able to select it." + IDS_FPNW_CAPTION "Select the File and Print Services for NetWare settings for %s:" + IDS_GROUP_CAPTION "By default, all users are members of the Domain Users group. What other groups do you want %s to be a member of?" + IDS_RAS_CAPTION "What are the calling options you want for %s?" + IDS_WORKSTATION_CAPTION "Which workstations running Microsoft Windows NT can %s log on from?" + IDS_HOMEDIR_CAPTION "Where do you want the home directory for %s?" + IDS_RESTRICTION_CAPTION "What restrictions do you want %s to have?" + IDS_NWLOGON_CAPTION "Which NetWare compatible workstations can %s log on from?" + IDS_SUCCESS "The new user account was created for %s with the username %s. Do you want to restart the wizard?" + IDS_NW_PW_ERROR "An error occurred during encryption of the NetWare password." + IDS_NW_GRACELOGIN_ERROR "Error setting NetWare grace login limit." +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_NW_CONCON_ERROR "Error setting NetWare concurrent connection limit." + IDS_RAS_ERROR "Error setting RAS account information." + IDS_NEEDA_WORKSTATION "Please provide a valid workstation from which the user can log on." + IDS_NEED_ADDRESS "Please provide the network address." + IDS_UNKNOWN_COMPONENTS "Unable to determine which optional components are installed." + IDS_BAD_WS_NAME "Invalid characters in workstation name." + IDS_BAD_USERNAME "Username contains illegal characters." + IDS_DUPLICATE_NAME "You can not create an account called %s because username %s already exists in %s. Please type a different username." + IDS_PW_NOMATCH "The passwords you entered are not identical. You need to type and confirm the password for %s." + IDS_PW_TOOLONG "The selected password is too long. Please select another password that is 14 characters or less." + IDS_BAD_GETMODALS "Error with NetUserGetModals." + IDS_PW_TOOSHORT "The selected password is too short. Please select another password that is at least %d characters long." + IDS_NODC "Unable to find a domain controller for this domain." + IDS_NO_USERNAME "Please type a username for this user." + IDS_USERNAME_TOOLONG "The username must be 20 characters or less." + IDS_NOFP_WS "Error setting the allowed NetWare compatible workstations." +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_ALL_NODES "Do you want to include all nodes?" + IDS_NOT_ADMIN "You are not a member of the Administrators group on the selected domain." + IDS_WSNAME_TOOLONG "The workstation name must be 15 characters or less." + IDS_INVALID_DAY "The selected month does not contain that many days." + IDS_INVALID_MONTH "The value for month must be between 1 and 12." + IDS_INVALID_YEAR "The value for year must be between 1996 and 2030." + IDS_BAD_NWADDRESS "The specified NetWare address contains invalid characters." + IDS_BAD_NWNODE "The specified NetWare node contains invalid characters." + IDS_TOOLONG_NWADDRESS "The specified NetWare address must be 8 characters or less." + IDS_TOOLONG_NWNODE "The specified NetWare node must be 12 characters or less." + IDS_ALREADY_EXPIRED "The selected date will create an account that has already expired. Do you want to continue creating this account with this expiration date?" + IDS_INVALID_DIRECTORY_NAME + "The folder %1 does not exist. Would you like to create it?" + IDS_NO_DIR_PERMISSION "You do not have permission to access the specifed folder." + IDS_CANT_CREATE_DIRECTORY + "Unable to create the specified directory. Would you like to continue creating this new account with this home directory?" + IDS_INVALID_PATH "The specified path is invalid." +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_NEW_DIR_CREATED "The folder %s has been created." + IDS_SUCCESS2 "The new user account was created with the username %s. Do you want to restart the wizard?" + IDS_WONT_REQUIRE "You have selected no password expiration. The user will not be required to change passwords at next logon." + IDS_BAD_USER_DATA2 "An error occurred while parameters were being set for the username %s. Not all parameters were set. Would you like to restart the wizard?" + IDC_NO_WKSALLOWED "You are currently logged in with a user account valid only for the computer. You must be logged on with a user account valid for a domain to run this wizard. Please log on with a valid domain user account." + IDS_NO_HOMEDIR_DRIVE_LETTER + "You must select a drive letter that will be used to connect to another computer." + IDS_NO_RAS_NUMBER "Please provide a callback number." + IDS_NO_EXCH_SERVER "Please enter the name of an Exchange server." + IDS_BAD_RAS_NUMBER "Phone number contains invalid characters." + IDS_RAS_NUMBER_TOO_LONG "The phone number is too long." +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#define _AFX_NO_SPLITTER_RESOURCES +#define _AFX_NO_OLE_RESOURCES +#define _AFX_NO_TRACKER_RESOURCES +#define _AFX_NO_PROPERTY_RESOURCES + +#include "res\Speckle.rc2" // non-Microsoft Visual C++ edited resources +#include "afxres.rc" // Standard components + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/private/utils/wizards/addusrw/stdafx.cpp b/private/utils/wizards/addusrw/stdafx.cpp new file mode 100644 index 000000000..22a4fceb6 --- /dev/null +++ b/private/utils/wizards/addusrw/stdafx.cpp @@ -0,0 +1,6 @@ +// stdafx.cpp : source file that includes just the standard includes +// Speckle.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + diff --git a/private/utils/wizards/addusrw/stdafx.h b/private/utils/wizards/addusrw/stdafx.h new file mode 100644 index 000000000..86bc34ada --- /dev/null +++ b/private/utils/wizards/addusrw/stdafx.h @@ -0,0 +1,32 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + stdafx.h : header file + + stdafx.h : include file for standard system include files, + or project specific include files that are used frequently, but + are changed infrequently + + +File History: + + JonY Apr-96 created + +--*/ + +#include // MFC core and standard components +#include // MFC extensions + +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include // MFC support for Windows 95 Common Controls +#endif // _AFX_NO_AFXCMN_SUPPORT + +//#include // MFC OLE automation classes +#include +#include // MFC template classes +#include // MFC synchronization classes +#include + diff --git a/private/utils/wizards/addusrw/timelist.cpp b/private/utils/wizards/addusrw/timelist.cpp new file mode 100644 index 000000000..6eb91c1af --- /dev/null +++ b/private/utils/wizards/addusrw/timelist.cpp @@ -0,0 +1,92 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + TimesList.cpp : implementation file + +File History: + + JonY Apr-96 created + +--*/ + + +#include "stdafx.h" +#include "Speckle.h" +#include "TimeList.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CTimesList + +CTimesList::CTimesList() +{ + +} + +CTimesList::~CTimesList() +{ +} + + +BEGIN_MESSAGE_MAP(CTimesList, CListBox) + //{{AFX_MSG_MAP(CTimesList) + // NOTE - the ClassWizard will add and remove mapping macros here. + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CTimesList message handlers + +void CTimesList::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) +{ + CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC); + + USHORT dwValue = (USHORT)GetItemData(lpDrawItemStruct->itemID); + + switch (lpDrawItemStruct->itemAction) + { + case ODA_SELECT: + { + if (dwValue == 1) + { + SetItemData(lpDrawItemStruct->itemID, 0); + InvalidateRect(&lpDrawItemStruct->rcItem); + } + else + { + SetItemData(lpDrawItemStruct->itemID, 1); + InvalidateRect(&lpDrawItemStruct->rcItem); + } + } + break; + + case ODA_DRAWENTIRE: + if (dwValue == 0) + { + pDC->FillRect(&(lpDrawItemStruct->rcItem), + CBrush::FromHandle(CreateSolidBrush(GetSysColor(COLOR_CAPTIONTEXT)))); + + pDC->DrawEdge(&lpDrawItemStruct->rcItem, + BDR_RAISEDOUTER | BDR_SUNKENINNER, + BF_BOTTOM | BF_BOTTOMRIGHT); + } + else + { + pDC->FillRect(&(lpDrawItemStruct->rcItem), + CBrush::FromHandle(CreateSolidBrush(GetSysColor(COLOR_ACTIVECAPTION)))); + + pDC->DrawEdge(&lpDrawItemStruct->rcItem, + BDR_RAISEDINNER | BDR_SUNKENOUTER, + BF_BOTTOM | BF_BOTTOMRIGHT); + } + break; + } +} diff --git a/private/utils/wizards/addusrw/timelist.h b/private/utils/wizards/addusrw/timelist.h new file mode 100644 index 000000000..f920ad15c --- /dev/null +++ b/private/utils/wizards/addusrw/timelist.h @@ -0,0 +1,53 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + TimesList.h : header file + + CPropertyPage support for User mgmt wizard + +File History: + + JonY Apr-96 created + +--*/ + + +///////////////////////////////////////////////////////////////////////////// +// CTimesList window + +class CTimesList : public CListBox +{ +// Construction +public: + CTimesList(); + +// Attributes +public: + +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CTimesList) + public: + virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CTimesList(); + + // Generated message map functions +protected: + //{{AFX_MSG(CTimesList) + // NOTE - the ClassWizard will add and remove member functions here. + //}}AFX_MSG + + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// diff --git a/private/utils/wizards/addusrw/transbmp.cpp b/private/utils/wizards/addusrw/transbmp.cpp new file mode 100644 index 000000000..7b5d7fec5 --- /dev/null +++ b/private/utils/wizards/addusrw/transbmp.cpp @@ -0,0 +1,175 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + // transbmp.cpp : implementation of the CTransBmp class +// +// support for transparent CBitmap objects. Used in the CUserList class. +// Based on a class from MSDN 7/95 + + File History: + + JonY Apr-96 created + +--*/ + +#include "stdafx.h" +#include "transbmp.h" + +#ifdef _DEBUG +#undef THIS_FILE +static char BASED_CODE THIS_FILE[] = __FILE__; +#endif + +// Colors +#define rgbWhite RGB(255,255,255) +// Raster op codes +#define DSa 0x008800C6L +#define DSx 0x00660046L + + +///////////////////////////////////////////////////////////////////////////// +// CTransBmp construction/destruction + +CTransBmp::CTransBmp() +{ + m_iWidth = 0; + m_iHeight = 0; + m_hbmMask = NULL; +} + +CTransBmp::~CTransBmp() +{ + if (m_hbmMask != NULL) delete m_hbmMask; +} + +void CTransBmp::GetMetrics() +{ + // Get the width and height + BITMAP bm; + GetObject(sizeof(bm), &bm); + m_iWidth = bm.bmWidth; + m_iHeight = bm.bmHeight; +} + + +int CTransBmp::GetWidth() +{ + if ((m_iWidth == 0) || (m_iHeight == 0)){ + GetMetrics(); + } + return m_iWidth; +} + +int CTransBmp::GetHeight() +{ + if ((m_iWidth == 0) || (m_iHeight == 0)){ + GetMetrics(); + } + return m_iHeight; +} + + +void CTransBmp::CreateMask(CDC* pDC) +{ + m_hbmMask = new CBitmap; +// Nuke any existing mask + if (m_hbmMask) m_hbmMask->DeleteObject(); + +// Create memory DCs to work with + CDC* hdcMask = new CDC; + CDC* hdcImage = new CDC; + + hdcMask->CreateCompatibleDC(pDC); + hdcImage->CreateCompatibleDC(pDC); + +// Create a monochrome bitmap for the mask + m_hbmMask->CreateBitmap(GetWidth(), + GetHeight(), + 1, + 1, + NULL); + CBitmap* pTempBmp; +// Select the mono bitmap into its DC + CBitmap* hbmOldMask = hdcMask->SelectObject(m_hbmMask); +// Select the image bitmap into its DC + CBitmap* hbmOldImage = hdcImage->SelectObject(pTempBmp->FromHandle((HBITMAP)m_hObject)); + +// Set the transparency color to be the top-left pixel + hdcImage->SetBkColor(hdcImage->GetPixel(0, 0)); +// Make the mask + hdcMask->BitBlt(0, 0, + GetWidth(), GetHeight(), + hdcImage, + 0, 0, + SRCCOPY); +// clean up + hdcMask->SelectObject(hbmOldMask); + hdcImage->SelectObject(hbmOldImage); + delete hdcMask; + delete hdcImage; +} + +// draw the transparent bitmap using the created mask +void CTransBmp::DrawTrans(CDC* pDC, int x, int y) +{ + if (m_hbmMask == NULL) CreateMask(pDC); + + int dx = GetWidth(); + int dy = GetHeight(); + +// Create a memory DC to do the drawing to + CDC* hdcOffScr = new CDC; + hdcOffScr->CreateCompatibleDC(pDC); + +// Create a bitmap for the off-screen DC that is really +// color compatible with the destination DC. + CBitmap hbmOffScr; + hbmOffScr.CreateBitmap(dx, dy, + pDC->GetDeviceCaps(PLANES), + pDC->GetDeviceCaps(BITSPIXEL), + NULL); + +// Select the buffer bitmap into the off-screen DC + HBITMAP hbmOldOffScr = (HBITMAP)hdcOffScr->SelectObject(hbmOffScr); + +// Copy the image of the destination rectangle to the +// off-screen buffer DC so we can play with it + hdcOffScr->BitBlt(0, 0, dx, dy, pDC, x, y, SRCCOPY); + +// Create a memory DC for the source image + CDC* hdcImage = new CDC; + hdcImage->CreateCompatibleDC(pDC); + + CBitmap* hbmOldImage = hdcImage->SelectObject(CBitmap::FromHandle((HBITMAP)m_hObject)); + + // Create a memory DC for the mask + CDC* hdcMask = new CDC; + hdcMask->CreateCompatibleDC(pDC); + + CBitmap* hbmOldMask = hdcMask->SelectObject(m_hbmMask); + + // XOR the image with the destination + hdcOffScr->SetBkColor(rgbWhite); + hdcOffScr->BitBlt(0, 0, dx, dy ,hdcImage, 0, 0, DSx); + // AND the destination with the mask + hdcOffScr->BitBlt(0, 0, dx, dy, hdcMask, 0,0, DSa); + // XOR the destination with the image again + hdcOffScr->BitBlt(0, 0, dx, dy, hdcImage, 0, 0, DSx); + + // Copy the resultant image back to the screen DC + pDC->BitBlt(x, y, dx, dy, hdcOffScr, 0, 0, SRCCOPY); + + // Tidy up + hdcOffScr->SelectObject(hbmOldOffScr); + hdcImage->SelectObject(hbmOldImage); + hdcMask->SelectObject(hbmOldMask); + + delete hdcOffScr; + delete hdcImage; + delete hdcMask; +} + + diff --git a/private/utils/wizards/addusrw/transbmp.h b/private/utils/wizards/addusrw/transbmp.h new file mode 100644 index 000000000..5694b66f1 --- /dev/null +++ b/private/utils/wizards/addusrw/transbmp.h @@ -0,0 +1,42 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + transbmp.h : header file + + CPropertyPage support for User mgmt wizard + +File History: + + JonY Apr-96 created + +--*/ + +///////////////////////////////////////////////////////////////////////////// + +class CTransBmp : public CBitmap +{ +public: + CTransBmp(); + ~CTransBmp(); + void Draw(HDC hDC, int x, int y); + void Draw(CDC* pDC, int x, int y); + void DrawTrans(HDC hDC, int x, int y); + void DrawTrans(CDC* pDC, int x, int y); + int GetWidth(); + int GetHeight(); + +private: + int m_iWidth; + int m_iHeight; + CBitmap* m_hbmMask; // handle to mask bitmap + + void GetMetrics(); + void CreateMask(HDC hDC); + void CreateMask(CDC* pDC); + +}; + +///////////////////////////////////////////////////////////////////////////// diff --git a/private/utils/wizards/addusrw/trstlist.cpp b/private/utils/wizards/addusrw/trstlist.cpp new file mode 100644 index 000000000..77e44a7b1 --- /dev/null +++ b/private/utils/wizards/addusrw/trstlist.cpp @@ -0,0 +1,414 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + disptrus.c(pp) + +Author: + + Scott Field (sfield) 16-Mar-96 + +Revision: + JonY 16-Apr-96 Modified to .cpp + +--*/ + +#include "stdafx.h" +#include "trstlist.h" + + +#define RTN_OK 0 +#define RTN_ERROR 13 + +// +// if you have the ddk, include ntstatus.h +// +#ifndef STATUS_SUCCESS +#define STATUS_SUCCESS ((NTSTATUS)0x00000000L) +#define STATUS_MORE_ENTRIES ((NTSTATUS)0x00000105L) +#define STATUS_NO_MORE_ENTRIES ((NTSTATUS)0x8000001AL) +#endif + + +#define ELEMENT_COUNT 64 // number of array elements to allocate + +CTrustList::CTrustList() +{ + m_dwTrustCount = 0; + m_ppszTrustList = (LPWSTR *)HeapAlloc( + GetProcessHeap(), HEAP_ZERO_MEMORY, + ELEMENT_COUNT * sizeof(LPWSTR) + ); +} + +CTrustList::~CTrustList() +{ + // + // free trust list + // + unsigned int i; + for(i = 0 ; i < m_dwTrustCount ; i++) { + if(m_ppszTrustList[i] != NULL) + HeapFree(GetProcessHeap(), 0, m_ppszTrustList[i]); + } + + HeapFree(GetProcessHeap(), 0, m_ppszTrustList); + +} + +BOOL +CTrustList::BuildTrustList( + LPTSTR Target + ) +{ + LSA_HANDLE PolicyHandle; + NTSTATUS Status; + + PPOLICY_ACCOUNT_DOMAIN_INFO AccountDomain; + BOOL bDC; + NET_API_STATUS nas = NERR_Success; // assume success + + BOOL bSuccess = FALSE; // assume this function will fail + + // + // open the policy on the specified machine + // + Status = OpenPolicy( + Target, + POLICY_VIEW_LOCAL_INFORMATION, + &PolicyHandle + ); + + if(Status != STATUS_SUCCESS) { + SetLastError( LsaNtStatusToWinError(Status) ); + return FALSE; + } + + // + // obtain the AccountDomain, which is common to all three cases + // + Status = LsaQueryInformationPolicy( + PolicyHandle, + PolicyAccountDomainInformation, + (LPVOID*)&AccountDomain + ); + + if(Status != STATUS_SUCCESS) + goto cleanup; + + // + // Note: AccountDomain->DomainSid will contain binary Sid + // + AddTrustToList(&AccountDomain->DomainName); + + // + // free memory allocated for account domain + // + LsaFreeMemory(AccountDomain); + + // + // find out if the target machine is a domain controller + // + if(!IsDomainController(Target, &bDC)) { + //// + goto cleanup; + } + + if(!bDC) { + PPOLICY_PRIMARY_DOMAIN_INFO PrimaryDomain; + TCHAR* szPrimaryDomainName = NULL; + TCHAR* DomainController = NULL; + + // + // get the primary domain + // + Status = LsaQueryInformationPolicy( + PolicyHandle, + PolicyPrimaryDomainInformation, + (LPVOID*)&PrimaryDomain + ); + + if(Status != STATUS_SUCCESS) + goto cleanup; + + // + // if the primary domain Sid is NULL, we are a non-member, and + // our work is done. + // + if(PrimaryDomain->Sid == NULL) { + LsaFreeMemory(PrimaryDomain); + bSuccess = TRUE; + goto cleanup; + } + + AddTrustToList(&PrimaryDomain->Name); + + // + // build a copy of what we just added. This is necessary in order + // to lookup the domain controller for the specified domain. + // the Domain name must be NULL terminated for NetGetDCName(), + // and the LSA_UNICODE_STRING buffer is not necessarilly NULL + // terminated. Note that in a practical implementation, we + // could just extract the element we added, since it ends up + // NULL terminated. + // + + szPrimaryDomainName = (LPTSTR)HeapAlloc( + GetProcessHeap(), 0, + PrimaryDomain->Name.Length + sizeof(WCHAR) // existing length + NULL + ); + + if(szPrimaryDomainName != NULL) { + // + // copy the existing buffer to the new storage, appending a NULL + // + _tcsncpy( + szPrimaryDomainName, + PrimaryDomain->Name.Buffer, + (PrimaryDomain->Name.Length / 2) + 1 + ); + } + + LsaFreeMemory(PrimaryDomain); + + if(szPrimaryDomainName == NULL) goto cleanup; + + // + // get the primary domain controller computer name + // + nas = NetGetDCName( + NULL, + szPrimaryDomainName, + (LPBYTE *)&DomainController + ); + + HeapFree(GetProcessHeap(), 0, szPrimaryDomainName); + + if(nas != NERR_Success) + goto cleanup; + + // + // close the policy handle, because we don't need it anymore + // for the workstation case, as we open a handle to a DC + // policy below + // + LsaClose(PolicyHandle); + PolicyHandle = INVALID_HANDLE_VALUE; // invalidate handle value + + // + // open the policy on the domain controller + // + Status = OpenPolicy( + DomainController, + POLICY_VIEW_LOCAL_INFORMATION, + &PolicyHandle + ); + + // + // free the domaincontroller buffer + // + NetApiBufferFree(DomainController); + + if(Status != STATUS_SUCCESS) + goto cleanup; + } + + // + // build additional trusted domain(s) list and indicate if successful + // + bSuccess = EnumTrustedDomains(PolicyHandle); + +cleanup: + + // + // close the policy handle + // + if(PolicyHandle != INVALID_HANDLE_VALUE) + LsaClose(PolicyHandle); + + if(!bSuccess) { + if(Status != STATUS_SUCCESS) + SetLastError( LsaNtStatusToWinError(Status) ); + else if(nas != NERR_Success) + SetLastError( nas ); + } + + return bSuccess; +} + +BOOL +CTrustList::EnumTrustedDomains( + LSA_HANDLE PolicyHandle + ) +{ + LSA_ENUMERATION_HANDLE lsaEnumHandle=0; // start an enum + PLSA_TRUST_INFORMATION TrustInfo; + ULONG ulReturned; // number of items returned + ULONG ulCounter; // counter for items returned + NTSTATUS Status; + + do { + Status = LsaEnumerateTrustedDomains( + PolicyHandle, // open policy handle + &lsaEnumHandle, // enumeration tracker + (LPVOID*)&TrustInfo, // buffer to receive data + 32000, // recommended buffer size + &ulReturned // number of items returned + ); + // + // get out if an error occurred + // + if( (Status != STATUS_SUCCESS) && + (Status != STATUS_MORE_ENTRIES) && + (Status != STATUS_NO_MORE_ENTRIES) + ) { + SetLastError( LsaNtStatusToWinError(Status) ); + return FALSE; + } + + // + // Display results + // Note: Sids are in TrustInfo[ulCounter].Sid + // + for(ulCounter = 0 ; ulCounter < ulReturned ; ulCounter++) + AddTrustToList(&TrustInfo[ulCounter].Name); + + // + // free the buffer + // + LsaFreeMemory(TrustInfo); + + } while (Status != STATUS_NO_MORE_ENTRIES); + + return TRUE; +} + +BOOL +CTrustList::IsDomainController( + LPTSTR Server, + LPBOOL bDomainController + ) +{ + PSERVER_INFO_101 si101; + NET_API_STATUS nas; + + nas = NetServerGetInfo( + Server, + 101, // info-level + (LPBYTE *)&si101 + ); + + if(nas != NERR_Success) { + SetLastError(nas); + return FALSE; + } + + if( (si101->sv101_type & SV_TYPE_DOMAIN_CTRL) || + (si101->sv101_type & SV_TYPE_DOMAIN_BAKCTRL) ) { + // + // we are dealing with a DC + // + *bDomainController = TRUE; + } else { + *bDomainController = FALSE; + } + + NetApiBufferFree(si101); + + return TRUE; +} + +BOOL +CTrustList::AddTrustToList( + PLSA_UNICODE_STRING UnicodeString + ) +{ + if(m_dwTrustCount > ELEMENT_COUNT) return FALSE; + + // + // allocate storage for array element + // + m_ppszTrustList[m_dwTrustCount] = (LPWSTR)HeapAlloc( + GetProcessHeap(), 0, + UnicodeString->Length + sizeof(WCHAR) // existing length + NULL + ); + + if(m_ppszTrustList[m_dwTrustCount] == NULL) return FALSE; + + // + // copy the existing buffer to the new storage, appending a NULL + // + lstrcpynW( + m_ppszTrustList[m_dwTrustCount], + UnicodeString->Buffer, + (UnicodeString->Length / 2) + 1 + ); + + m_dwTrustCount++; // increment the trust count + + return TRUE; +} + +void +CTrustList::InitLsaString( + PLSA_UNICODE_STRING LsaString, + LPTSTR String + ) +{ + DWORD StringLength; + + if (String == NULL) { + LsaString->Buffer = NULL; + LsaString->Length = 0; + LsaString->MaximumLength = 0; + + return; + } + + StringLength = _tcslen(String); + LsaString->Buffer = String; + LsaString->Length = (USHORT) StringLength * sizeof(WCHAR); + LsaString->MaximumLength = (USHORT) (StringLength + 1) * sizeof(WCHAR); +} + +NTSTATUS +CTrustList::OpenPolicy( + LPTSTR ServerName, + DWORD DesiredAccess, + PLSA_HANDLE PolicyHandle + ) +{ + LSA_OBJECT_ATTRIBUTES ObjectAttributes; + LSA_UNICODE_STRING ServerString; + PLSA_UNICODE_STRING Server; + + // + // Always initialize the object attributes to all zeroes + // + ZeroMemory(&ObjectAttributes, sizeof(ObjectAttributes)); + + if(ServerName != NULL) { + // + // Make a LSA_UNICODE_STRING out of the LPWSTR passed in + // + InitLsaString(&ServerString, ServerName); + + Server = &ServerString; + } else { + Server = NULL; + } + + // + // Attempt to open the policy + // + return LsaOpenPolicy( + Server, + &ObjectAttributes, + DesiredAccess, + PolicyHandle + ); +} + + diff --git a/private/utils/wizards/addusrw/trstlist.h b/private/utils/wizards/addusrw/trstlist.h new file mode 100644 index 000000000..dc60275a3 --- /dev/null +++ b/private/utils/wizards/addusrw/trstlist.h @@ -0,0 +1,56 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + Trstlist.h : header file + + CPropertyPage support for User mgmt wizard + +File History: + + JonY Apr-96 created + +--*/ + + + +#include +#include +#include // \mstools\security\ntsecapi.h +#include + +class CTrustList +{ + public: + TCHAR** m_ppszTrustList; // array of trust elements + DWORD m_dwTrustCount; // number of elements in m_ppszTrustList + + CTrustList(); + ~CTrustList(); + + BOOL BuildTrustList(LPTSTR Target); + + private: + BOOL IsDomainController(LPTSTR Server, + LPBOOL bDomainController); + + BOOL EnumTrustedDomains(LSA_HANDLE PolicyHandle); + + BOOL AddTrustToList(PLSA_UNICODE_STRING UnicodeString); + + // + // helper functions + // + + void InitLsaString(PLSA_UNICODE_STRING LsaString, + LPTSTR String); + + NTSTATUS OpenPolicy(LPTSTR ServerName, + DWORD DesiredAccess, + PLSA_HANDLE PolicyHandle); + + +}; + diff --git a/private/utils/wizards/addusrw/userlist.cpp b/private/utils/wizards/addusrw/userlist.cpp new file mode 100644 index 000000000..31ffcd973 --- /dev/null +++ b/private/utils/wizards/addusrw/userlist.cpp @@ -0,0 +1,216 @@ +/**********************************************************************/ +/** Microsoft Windows NT **/ +/** Copyright(c) Microsoft Corp., 1991-1996 **/ +/**********************************************************************/ + +/* + UserList.cpp + + CListBox class for owner draw list that displays users and groups + + FILE HISTORY: + jony Apr-1996 created +*/ + +#include "stdafx.h" +#include "resource.h" +#include "UserList.h" + +const unsigned short BITMAP_HEIGHT = 18; +const unsigned short BITMAP_WIDTH = 18; + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CUserList + +CUserList::CUserList() +{ + m_pBitmap[0] = new CTransBmp; + m_pBitmap[0]->LoadBitmap(IDB_USER_BITMAP); + + m_pBitmap[1] = new CTransBmp; + m_pBitmap[1]->LoadBitmap(IDB_GLOBAL_GROUP_BITMAP); + + m_pBitmap[2] = new CTransBmp; + m_pBitmap[2]->LoadBitmap(IDB_WORLD); + + m_pBitmap[3] = new CTransBmp; + m_pBitmap[3]->LoadBitmap(IDB_LOCAL_GROUP_BITMAP); + + m_sHScrollWidth = 0; +} + +CUserList::~CUserList() +{ + delete m_pBitmap[0]; + delete m_pBitmap[1]; + delete m_pBitmap[2]; + delete m_pBitmap[3]; + +} + + +BEGIN_MESSAGE_MAP(CUserList, CListBox) + //{{AFX_MSG_MAP(CUserList) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CUserList message handlers +void CUserList::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) +{ +// is this a valid item? + if ((GetCount() == LB_ERR) || (lpDrawItemStruct->itemID > (UINT)GetCount())) return; + + COLORREF crefOldText; + COLORREF crefOldBk; + + CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC); + pDC->SetBkMode(TRANSPARENT); + + HBRUSH hBrush; + CTransBmp* pTempBmp = (CTransBmp*)lpDrawItemStruct->itemData; + + switch (lpDrawItemStruct->itemAction) + { + case ODA_SELECT: + case ODA_DRAWENTIRE: +// Display the text associated with the item. + HBITMAP hBitmapOld; + +// Is the item selected? + if (lpDrawItemStruct->itemState & ODS_SELECTED) + { + hBrush = CreateSolidBrush( GetSysColor(COLOR_HIGHLIGHT)); + hBitmapOld = (HBITMAP)pDC->SelectObject(pTempBmp); + + crefOldText = pDC->SetTextColor(GetSysColor(COLOR_HIGHLIGHTTEXT) ); + crefOldBk = pDC->SetBkColor(GetSysColor(COLOR_HIGHLIGHT) ); + } + else + { + hBrush = (HBRUSH)GetStockObject( GetSysColor(COLOR_WINDOW)); + hBitmapOld = (HBITMAP)pDC->SelectObject(pTempBmp); + + crefOldText = pDC->SetTextColor(GetSysColor(COLOR_WINDOWTEXT)); + crefOldBk = pDC->SetBkColor(GetSysColor(COLOR_WINDOW)); + + } + + pDC->FillRect(&(lpDrawItemStruct->rcItem), CBrush::FromHandle(hBrush)); + +// display text + TCHAR* pName = (TCHAR*)malloc(255 * sizeof(TCHAR)); + if (pName == NULL) + { + AfxMessageBox(IDS_GENERIC_NO_HEAP, MB_ICONEXCLAMATION); + exit(1); + } + + GetText(lpDrawItemStruct->itemID, pName); + TCHAR* pName2; + pName = _tcstok(pName, _T(";")); // gets the name + pName2 = _tcstok(NULL, _T(";")); // gets the comment + +// format the name + comment + int nTop = (lpDrawItemStruct->rcItem.bottom + lpDrawItemStruct->rcItem.top) / 2; + pDC->TextOut(BITMAP_WIDTH + 6, + (nTop - 8), + pName); + + pDC->TextOut(130, + (nTop - 8), + pName2); + + free(pName); + +// Display bitmap + nTop = (lpDrawItemStruct->rcItem.bottom + lpDrawItemStruct->rcItem.top - BITMAP_HEIGHT) / 2; + + pTempBmp->DrawTrans(pDC, lpDrawItemStruct->rcItem.left, nTop); + + pDC->SetBkColor(crefOldBk ); + pDC->SetTextColor(crefOldText ); + pDC->SelectObject(hBitmapOld); + + break; + } + +} +int CUserList::AddString(LPCTSTR lpItem) +{ + int nPos = CListBox::AddString((const TCHAR*) lpItem); + if (nPos == LB_ERR) return LB_ERR; + SetItemData(nPos, (unsigned long)m_pBitmap[1]); + + return nPos; +} + +int CUserList::AddString(LPCTSTR lpItem, USHORT usBitmapID) +{ + int nPos = CListBox::AddString((const TCHAR*) lpItem); + if (nPos == LB_ERR) return LB_ERR; + SetItemData(nPos, (DWORD)m_pBitmap[usBitmapID]); + + return nPos; +} + + +void CUserList::MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct) +{ + lpMeasureItemStruct->itemHeight = 20; +} + + +int CUserList::VKeyToItem(UINT nKey, UINT nIndex) +{ + // TODO: Add your code to handle a particular virtual key + // return -1 = default action + // return -2 = no further action + // return index = perform default action for keystroke on + // item specified by index + + if (nKey == 46) DeleteString(GetCurSel()); + return -1; +} + +int CUserList::AddString(short nType, LPCTSTR lpItem) +{ + int nPos = CListBox::AddString((const TCHAR*) lpItem); + if (nPos == LB_ERR) return LB_ERR; + SetItemData(nPos, (DWORD)m_pBitmap[nType]); + + return nPos; +} + +short CUserList::GetBitmapID() +{ + USHORT sSel = GetCurSel(); + if (sSel == LB_ERR) return -1; + USHORT sCount = 0; + + while ((sCount < 4) && ((CBitmap*)GetItemData(sSel) != m_pBitmap[sCount])) sCount++; + return sCount; + +} + +short CUserList::GetBitmapID(USHORT sSel) +{ + USHORT sCount = 0; + + DWORD dwData = GetItemData(sSel); + DWORD dwBmp = (DWORD)m_pBitmap[0]; + while ((sCount < 4) && (dwData != dwBmp)) + { + sCount++; + dwBmp = (DWORD)m_pBitmap[sCount]; + } + + return sCount; + +} diff --git a/private/utils/wizards/addusrw/userlist.h b/private/utils/wizards/addusrw/userlist.h new file mode 100644 index 000000000..ed4fc5e69 --- /dev/null +++ b/private/utils/wizards/addusrw/userlist.h @@ -0,0 +1,61 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + UserList.h : header file + + CPropertyPage support for User mgmt wizard + +File History: + + JonY Apr-96 created + +--*/ + +#include "transbmp.h" +///////////////////////////////////////////////////////////////////////////// +// CUserList window + +class CUserList : public CListBox +{ +// Construction +public: + CUserList(); + +// Attributes +public: +private: + CTransBmp* m_pBitmap[4]; + unsigned short m_sHScrollWidth; +// Operations +public: + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CUserList) + public: + virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct); + virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMeasureItemStruct); + virtual int VKeyToItem(UINT nKey, UINT nIndex); + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CUserList(); + int AddString(LPCTSTR lpItem); + int AddString(short nType, LPCTSTR lpItem); + int AddString(LPCTSTR lpItem, USHORT dwBitmap); + short GetBitmapID(); + short GetBitmapID(USHORT sSel); + + // Generated message map functions +protected: + //{{AFX_MSG(CUserList) + //}}AFX_MSG + + DECLARE_MESSAGE_MAP() +}; + +///////////////////////////////////////////////////////////////////////////// diff --git a/private/utils/wizards/addusrw/welcome.cpp b/private/utils/wizards/addusrw/welcome.cpp new file mode 100644 index 000000000..320243514 --- /dev/null +++ b/private/utils/wizards/addusrw/welcome.cpp @@ -0,0 +1,576 @@ +/**********************************************************************/ +/** Microsoft Windows NT **/ +/** Copyright(c) Microsoft Corp., 1991-1996 **/ +/**********************************************************************/ + +/* + WelcomeDlg.cpp + + CPropertyPage support for User management wizard + + FILE HISTORY: + jony Apr-1996 created +*/ + +#include "stdafx.h" +#include "Speckle.h" +#include "wizbased.h" +#include "Welcome.h" +#include "trstlist.h" + +#include +#include +#include + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CWelcomeDlg property page + +IMPLEMENT_DYNCREATE(CWelcomeDlg, CWizBaseDlg) + +CWelcomeDlg::CWelcomeDlg() : CWizBaseDlg(CWelcomeDlg::IDD) +{ + //{{AFX_DATA_INIT(CWelcomeDlg) + //}}AFX_DATA_INIT + + m_pFont = NULL; +} + +CWelcomeDlg::~CWelcomeDlg() +{ + if (m_pFont != NULL) delete m_pFont; +} + +void CWelcomeDlg::DoDataExchange(CDataExchange* pDX) +{ + CPropertyPage::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CWelcomeDlg) + DDX_Control(pDX, IDC_DOMAIN_LIST, m_cbDomainList); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CWelcomeDlg, CPropertyPage) + //{{AFX_MSG_MAP(CWelcomeDlg) + ON_WM_SHOWWINDOW() + //}}AFX_MSG_MAP + +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CWelcomeDlg message handlers +BOOL CWelcomeDlg::OnInitDialog() +{ + CPropertyPage::OnInitDialog(); + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); +// read cached domain list from registry + DWORD dwRet; + HKEY hKey; + DWORD cbProv = 0; + TCHAR* lpProv = NULL; + + BOOL bFoundOne = FALSE; + + long lRet = RegConnectRegistry( + (LPTSTR)pApp->m_csServer.GetBuffer(pApp->m_csServer.GetLength()), + HKEY_LOCAL_MACHINE, + &hKey); + + dwRet = RegOpenKey(hKey, + TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon"), &hKey ); + + TCHAR* lpPrimaryDomain = NULL; + if ((dwRet = RegQueryValueEx( hKey, TEXT(/*"CachePrimaryDomain"*/"DefaultDomainName"), NULL, NULL, NULL, &cbProv )) == ERROR_SUCCESS) + { + lpPrimaryDomain = (TCHAR*)malloc(cbProv); + if (lpPrimaryDomain == NULL) + { + AfxMessageBox(IDS_GENERIC_NO_HEAP, MB_ICONEXCLAMATION); + ExitProcess(1); + } + dwRet = RegQueryValueEx( hKey, TEXT(/*"CachePrimaryDomain"*/"DefaultDomainName"), NULL, NULL, (LPBYTE) lpPrimaryDomain, &cbProv ); + bFoundOne = TRUE; + } + + m_csPrimaryDomain = lpPrimaryDomain; + free(lpPrimaryDomain); + RegCloseKey(hKey); + + CString csMachineName; + DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1; + GetComputerName(csMachineName.GetBufferSetLength(MAX_COMPUTERNAME_LENGTH + 1), &dwSize); + + pApp->m_csCurrentMachine = csMachineName; + +// read the list of trusted domains + CTrustList pList; + if (!pList.BuildTrustList((LPTSTR)pApp->m_csServer.GetBuffer(pApp->m_csServer.GetLength()))) + { +/* if this fails its probably because they are running the wizard + from a machine account that doesn't exist on the domain level. + Add only the local machine and select it.*/ + m_cbDomainList.AddString(pApp->m_csCurrentMachine); + m_cbDomainList.SelectString(-1, pApp->m_csCurrentMachine); + } + + else + { + UINT i; + for(i = 0 ; i < pList.m_dwTrustCount ; i++) + m_cbDomainList.AddString(pList.m_ppszTrustList[i]); + +// remove the current machine from the list +// if ((i = m_cbDomainList.FindStringExact(-1, pApp->m_csCurrentMachine)) != LB_ERR) +// m_cbDomainList.DeleteString(i); + +// now select the default domain into view + int nSel = m_cbDomainList.SelectString(-1, m_csPrimaryDomain); + m_cbDomainList.GetWindowText(m_csDomain); + UpdateData(FALSE); + } + +// welcome text + m_pFont = new CFont; + LOGFONT lf; + + memset(&lf, 0, sizeof(LOGFONT)); // Clear out structure. + lf.lfHeight = 15; + _tcscpy(lf.lfFaceName, L"MS Sans Serif"); + lf.lfWeight = 700; + m_pFont->CreateFontIndirect(&lf); // Create the font. + + CString cs; + cs.LoadString(IDS_WELCOME_STRING); + CWnd* pWnd = GetDlgItem(IDC_STATIC1); + pWnd->SetWindowText(cs); + pWnd->SetFont(m_pFont); + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +LRESULT CWelcomeDlg::OnWizardNext() +{ + UpdateData(TRUE); + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + +// get the DC of the selected domain + m_cbDomainList.GetWindowText(m_csDomain); + +// same as last time? no need to check again. + if (m_csLastDomain == m_csDomain) return CPropertyPage::OnWizardNext(); + + CWaitCursor wait; + + pApp->m_csDomain = m_csDomain; + pApp->m_bDomain = FALSE; + TCHAR* pDomain = m_csDomain.GetBuffer(m_csDomain.GetLength()); + m_csDomain.ReleaseBuffer(); + + TCHAR* pDC; + NET_API_STATUS nApi; + +// local machine? + if (m_csDomain == pApp->m_csCurrentMachine) + { + pApp->m_csServer = CString(L"\\\\") + pApp->m_csCurrentMachine; + pDC = pApp->m_csServer.GetBuffer(pApp->m_csServer.GetLength()); + } + + else + { + nApi = NetGetDCName(NULL, + pDomain, + (LPBYTE*)&pDC); + + if (nApi != NERR_Success) + { + AfxMessageBox(IDS_NODC, MB_ICONSTOP); + return -1; + } + pApp->m_csServer = pDC; + pApp->m_bDomain = TRUE; + } + +// we really shouldn't proceed until we know we are an admin on the remote machine + BYTE sidBuffer[100]; + PSID pSID = (PSID)&sidBuffer; + BOOL bRet; + +// create a SID for the Administrators group + SID_IDENTIFIER_AUTHORITY SIDAuth = SECURITY_NT_AUTHORITY; + bRet = AllocateAndInitializeSid(&SIDAuth, + 2, + SECURITY_BUILTIN_DOMAIN_RID, + DOMAIN_ALIAS_RID_ADMINS, + 0, + 0, + 0, + 0, + 0, + 0, + &pSID); + + if (!bRet) + { + DWORD dw = GetLastError(); + ASSERT(0); + } + + TCHAR pName[256]; + DWORD dwNameLen = 256; + TCHAR pDomainName[256]; + DWORD dwDomainNameLen = 256; + SID_NAME_USE SNU; + + bRet = LookupAccountSid(pDC, + pSID, + pName, + &dwNameLen, + pDomainName, + &dwDomainNameLen, + &SNU); + +// get the users name and domain from the reg for comparison + DWORD dwRet; + HKEY hKey; + DWORD cbProv = 0; + + CString csUsername; + CString csDomainName; + dwRet = RegOpenKey(HKEY_LOCAL_MACHINE, + TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon"), &hKey ); + + if ((dwRet = RegQueryValueEx( hKey, TEXT("DefaultDomainName"), NULL, NULL, NULL, &cbProv )) == ERROR_SUCCESS) + { + dwRet = RegQueryValueEx( hKey, TEXT("DefaultDomainName"), + NULL, + NULL, + (LPBYTE)csDomainName.GetBufferSetLength(cbProv), + &cbProv ); + } + + TCHAR* lpDefaultUserName = NULL; + if ((dwRet = RegQueryValueEx( hKey, TEXT("DefaultUserName"), NULL, NULL, NULL, &cbProv )) == ERROR_SUCCESS) + { + dwRet = RegQueryValueEx( hKey, TEXT("DefaultUserName"), + NULL, + NULL, + (LPBYTE)csUsername.GetBufferSetLength(cbProv), + &cbProv ); + } + + RegCloseKey(hKey); + +// now enumerate the members of the admin group to see if we are a member + BOOL bAdmin = FALSE; + PLOCALGROUP_MEMBERS_INFO_1 pMembers; + DWORD dwEntriesRead, dwTotalEntries; + DWORD dwResumeHandle = 0; + nApi = NetLocalGroupGetMembers(pDC, + pName, + 1, + (LPBYTE*)&pMembers, + 5000, + &dwEntriesRead, + &dwTotalEntries, + &dwResumeHandle); + + if (nApi == NERR_Success) + { + USHORT sIndex = 0; + while (sIndex < dwEntriesRead) + { + TCHAR pName[50]; + DWORD dwNameSize = 50; + TCHAR pDomain[50]; + DWORD dwDomainNameSize = 50; + SID_NAME_USE pUse; + LookupAccountSid(pDC, pMembers[sIndex].lgrmi1_sid, + pName, &dwNameSize, + pDomain, &dwDomainNameSize, + &pUse); + + if (((pUse == SidTypeGroup) && (bParseGlobalGroup(pName, csUsername, csDomainName))) || + ((!csUsername.CompareNoCase(pName)) && (!csDomainName.CompareNoCase(pDomain)))) + { + bAdmin = TRUE; + break; + } + + sIndex++; + } + + NetApiBufferFree(pMembers); + + while ((dwResumeHandle != 0) && (!bAdmin)) + { + nApi = NetLocalGroupGetMembers(pDC, + pName, + 1, + (LPBYTE*)&pMembers, + 5000, + &dwEntriesRead, + &dwTotalEntries, + &dwResumeHandle); + + if (nApi == NERR_Success) + { + USHORT sIndex = 0; + while (sIndex < dwEntriesRead) + { + TCHAR pName[50]; + DWORD dwNameSize = 50; + TCHAR pDomain[50]; + DWORD dwDomainNameSize = 50; + SID_NAME_USE pUse; + LookupAccountSid(pDC, pMembers[sIndex].lgrmi1_sid, + pName, &dwNameSize, + pDomain, &dwDomainNameSize, + &pUse); + + if (((pUse == SidTypeGroup) && (bParseGlobalGroup(pName, csUsername, csDomainName))) || + ((!csUsername.CompareNoCase(pName)) && (!csDomainName.CompareNoCase(pDomain)))) + { + bAdmin = TRUE; + break; + } + + sIndex++; + } + } + NetApiBufferFree(pMembers); + } + } + + if (!bAdmin) // not in the administrators group - check the account ops group + { + BYTE sidBuffer[100]; + PSID pSID = (PSID)&sidBuffer; + BOOL bRet; + +// create a SID for the Account Operators group + SID_IDENTIFIER_AUTHORITY SIDAuth = SECURITY_NT_AUTHORITY; + bRet = AllocateAndInitializeSid(&SIDAuth, + 2, + SECURITY_BUILTIN_DOMAIN_RID, + DOMAIN_ALIAS_RID_ACCOUNT_OPS, + 0, + 0, + 0, + 0, + 0, + 0, + &pSID); + + if (!bRet) + { + DWORD dw = GetLastError(); + ASSERT(0); + } + + TCHAR pName[256]; + DWORD dwNameLen = 256; + TCHAR pDomainName[256]; + DWORD dwDomainNameLen = 256; + SID_NAME_USE SNU; + + bRet = LookupAccountSid(pDC, + pSID, + pName, + &dwNameLen, + pDomainName, + &dwDomainNameLen, + &SNU); + +// now enumerate the members of the group to see if we are a member + PLOCALGROUP_MEMBERS_INFO_1 pMembers; + DWORD dwEntriesRead, dwTotalEntries; + DWORD dwResumeHandle = 0; + nApi = NetLocalGroupGetMembers(pDC, + pName, + 1, + (LPBYTE*)&pMembers, + 5000, + &dwEntriesRead, + &dwTotalEntries, + &dwResumeHandle); + + if (nApi == NERR_Success) + { + USHORT sIndex = 0; + while (sIndex < dwEntriesRead) + { + TCHAR pName[50]; + DWORD dwNameSize = 50; + TCHAR pDomain[50]; + DWORD dwDomainNameSize = 50; + SID_NAME_USE pUse; + LookupAccountSid(pDC, pMembers[sIndex].lgrmi1_sid, + pName, &dwNameSize, + pDomain, &dwDomainNameSize, + &pUse); + + if (((pUse == SidTypeGroup) && (bParseGlobalGroup(pName, csUsername, csDomainName))) || + ((!csUsername.CompareNoCase(pName)) && (!csDomainName.CompareNoCase(pDomain)))) + { + bAdmin = TRUE; + break; + } + + sIndex++; + } + + NetApiBufferFree(pMembers); + + while ((dwResumeHandle != 0) && (!bAdmin)) + { + nApi = NetLocalGroupGetMembers(pDC, + pName, + 1, + (LPBYTE*)&pMembers, + 5000, + &dwEntriesRead, + &dwTotalEntries, + &dwResumeHandle); + + if (nApi == NERR_Success) + { + USHORT sIndex = 0; + while (sIndex < dwEntriesRead) + { + TCHAR pName[50]; + DWORD dwNameSize = 50; + TCHAR pDomain[50]; + DWORD dwDomainNameSize = 50; + SID_NAME_USE pUse; + LookupAccountSid(pDC, pMembers[sIndex].lgrmi1_sid, + pName, &dwNameSize, + pDomain, &dwDomainNameSize, + &pUse); + + if (((pUse == SidTypeGroup) && (bParseGlobalGroup(pName, csUsername, csDomainName))) || + ((!csUsername.CompareNoCase(pName)) && (!csDomainName.CompareNoCase(pDomain)))) + { + bAdmin = TRUE; + break; + } + + sIndex++; + } + } + NetApiBufferFree(pMembers); + } + } + + } + +// not an admin? don't continue + if (!bAdmin) + { + AfxMessageBox(IDS_NOT_ADMIN); + return -1; + } + +// store the domain name for a possible rerun. + m_csLastDomain = m_csDomain; + + return CPropertyPage::OnWizardNext(); + +} + +// this gets called to look into a global group which is included in the admin or account ops local group. +// these groups live on the DC of the domain passed in. +BOOL CWelcomeDlg::bParseGlobalGroup(LPTSTR lpGroupName, CString& lpName, CString& lpDomain) +{ + DWORD dwEntriesRead; + DWORD dwTotalEntries; + DWORD dwResumeHandle = 0; + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + + TCHAR* pDomain = lpDomain.GetBuffer(lpDomain.GetLength()); + lpDomain.ReleaseBuffer(); + + TCHAR* pServer; + NET_API_STATUS nApi = NetGetDCName(NULL, + pDomain, + (LPBYTE*)&pServer); + + if (nApi != NERR_Success) + { + AfxMessageBox(IDS_NODC, MB_ICONSTOP); + return FALSE; + } + + PGROUP_USERS_INFO_1 pMembers; + nApi = NetGroupGetUsers(pServer, + lpGroupName, + 1, + (LPBYTE*)&pMembers, + 5000, + &dwEntriesRead, + &dwTotalEntries, + &dwResumeHandle); + + if (nApi != ERROR_SUCCESS) + { + NetApiBufferFree(pServer); + return FALSE; + } + + USHORT sIndex; + for (sIndex = 0; sIndex < dwEntriesRead; sIndex++) + { + if (!lpName.CompareNoCase(pMembers[sIndex].grui1_name)) + { + NetApiBufferFree(pServer); + return TRUE; + } + } + + while (dwResumeHandle != 0) + { + nApi = NetGroupGetUsers(pServer, + lpGroupName, + 1, + (LPBYTE*)&pMembers, + 5000, + &dwEntriesRead, + &dwTotalEntries, + &dwResumeHandle); + + if (nApi != ERROR_SUCCESS) + { + NetApiBufferFree(pServer); + return FALSE; + } + + for (sIndex = 0; sIndex < dwEntriesRead; sIndex++) + { + if (!lpName.CompareNoCase(pMembers[sIndex].grui1_name)) + { + NetApiBufferFree(pServer); + return TRUE; + } + } + } + + NetApiBufferFree(pServer); + return FALSE; +} + + +void CWelcomeDlg::OnShowWindow(BOOL bShow, UINT nStatus) +{ + CPropertyPage::OnShowWindow(bShow, nStatus); + + CSpeckleApp* pApp = (CSpeckleApp*)AfxGetApp(); + + if (bShow) pApp->m_cps1.SetWizardButtons(PSWIZB_NEXT); + else pApp->m_cps1.SetWizardButtons(PSWIZB_BACK | PSWIZB_NEXT); + +} diff --git a/private/utils/wizards/addusrw/welcome.h b/private/utils/wizards/addusrw/welcome.h new file mode 100644 index 000000000..f77d2973a --- /dev/null +++ b/private/utils/wizards/addusrw/welcome.h @@ -0,0 +1,62 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + WelcomeDlg.h : header file + + CPropertyPage support for User mgmt wizard + +File History: + + JonY Apr-96 created + +--*/ + + + +///////////////////////////////////////////////////////////////////////////// +// CWelcomeDlg dialog + +class CWelcomeDlg : public CWizBaseDlg +{ + DECLARE_DYNCREATE(CWelcomeDlg) + +// Construction +public: + CWelcomeDlg(); + ~CWelcomeDlg(); + +// Dialog Data + //{{AFX_DATA(CWelcomeDlg) + enum { IDD = IDD_WELCOME_DIALOG }; + CComboBox m_cbDomainList; + //}}AFX_DATA + virtual LRESULT OnWizardNext(); + +// Overrides + // ClassWizard generate virtual function overrides + //{{AFX_VIRTUAL(CWelcomeDlg) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + // Generated message map functions + //{{AFX_MSG(CWelcomeDlg) + virtual BOOL OnInitDialog(); + afx_msg void OnShowWindow(BOOL bShow, UINT nStatus); + //}}AFX_MSG + + DECLARE_MESSAGE_MAP() + +private: + CString m_csPrimaryDomain; + CString m_csDomain; + CFont* m_pFont; + CString m_csLastDomain; + BOOL bParseGlobalGroup(LPTSTR lpGroupName, CString& lpName, CString& lpDomain); + +}; diff --git a/private/utils/wizards/addusrw/wizbased.cpp b/private/utils/wizards/addusrw/wizbased.cpp new file mode 100644 index 000000000..da5a407c2 --- /dev/null +++ b/private/utils/wizards/addusrw/wizbased.cpp @@ -0,0 +1,68 @@ +/**********************************************************************/ +/** Microsoft Windows NT **/ +/** Copyright(c) Microsoft Corp., 1991-1996 **/ +/**********************************************************************/ + +/* + WizBaseD.cpp + + CPropertyPage support for User management wizard + + FILE HISTORY: + jony Apr-1996 created +*/ + + +#include "stdafx.h" +#include "Speckle.h" +#include "WizBaseD.h" + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CWizBaseDlg property page + +IMPLEMENT_DYNCREATE(CWizBaseDlg, CPropertyPage) + +CWizBaseDlg::CWizBaseDlg() : CPropertyPage(CWizBaseDlg::IDD) +{ + //{{AFX_DATA_INIT(CWizBaseDlg) + // NOTE: the ClassWizard will add member initialization here + //}}AFX_DATA_INIT +} + +CWizBaseDlg::~CWizBaseDlg() +{ +} + +CWizBaseDlg::CWizBaseDlg(short sIDD) : CPropertyPage(sIDD) +{ + +} + +void CWizBaseDlg::DoDataExchange(CDataExchange* pDX) +{ + CPropertyPage::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CWizBaseDlg) + // NOTE: the ClassWizard will add DDX and DDV calls here + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CWizBaseDlg, CPropertyPage) + //{{AFX_MSG_MAP(CWizBaseDlg) + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CWizBaseDlg message handlers +void CWizBaseDlg::SetButtonAccess(short sFlags) +{ + CPropertySheet* cp = (CPropertySheet*)GetParent(); + cp->SetWizardButtons(sFlags); + +} + diff --git a/private/utils/wizards/addusrw/wizbased.h b/private/utils/wizards/addusrw/wizbased.h new file mode 100644 index 000000000..9178a15fb --- /dev/null +++ b/private/utils/wizards/addusrw/wizbased.h @@ -0,0 +1,57 @@ +/*++ + +Copyright (c) 1996 Microsoft Corporation + +Module Name: + + WizBaseD.h : header file + + CPropertyPage support for User mgmt wizard + +File History: + + JonY Apr-96 created + +--*/ + + +///////////////////////////////////////////////////////////////////////////// +// CWizBaseDlg dialog + +class CWizBaseDlg : public CPropertyPage +{ + DECLARE_DYNCREATE(CWizBaseDlg) + +// Construction +public: + CWizBaseDlg(); + CWizBaseDlg(short sIDD); + ~CWizBaseDlg(); + +public: +// base class paint fn for space on left side of dialog + void SetButtonAccess(short sFlags); + +// Dialog Data + //{{AFX_DATA(CWizBaseDlg) + enum { IDD = IDD_BASE_DIALOG }; + // NOTE - ClassWizard will add data members here. + // DO NOT EDIT what you see in these blocks of generated code ! + //}}AFX_DATA + + +// Overrides + // ClassWizard generate virtual function overrides + //{{AFX_VIRTUAL(CWizBaseDlg) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + // Generated message map functions + //{{AFX_MSG(CWizBaseDlg) + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + +}; -- cgit v1.2.3