/*++ Copyright (c) 1997 Microsoft Corporation Module Name: ntoc.cpp Abstract: This file implements the NT OC Manager DLL. Environment: WIN32 User Mode Author: Wesley Witt (wesw) 7-Aug-1997 --*/ #include "ntoc.h" #pragma hdrstop // // types // typedef void (*PWIZINIT)(void); typedef void (*PWIZCOMMIT)(void); // // structures // typedef struct _WIZPAGE { DWORD ButtonState; DWORD PageId; DWORD DlgId; DLGPROC DlgProc; DWORD Title; DWORD SubTitle; DWORD WizPageType; PWIZINIT WizInit; PWIZCOMMIT WizCommit; DWORDLONG Modes; } WIZPAGE, *PWIZPAGE; // // globals // WIZPAGE SetupWizardPages[WizPageMaximum] = { { PSWIZB_NEXT, WizPageTapiLoc, IDD_TAPI_LOCATIONS, TapiLocDlgProc, IDS_TAPILOC_TITLE, IDS_TAPILOC_SUBTITLE, WizPagesEarly, TapiInit, TapiCommitChanges, -1 }, /* { PSWIZB_NEXT, WizPageDisplay, IDD_DISPLAY, DisplayDlgProc, IDS_DISPLAY_TITLE, IDS_DISPLAY_SUBTITLE, WizPagesEarly, DisplayInit, DisplayCommitChanges, -1 }, */ { PSWIZB_NEXT, WizPageDateTime, IDD_DATETIME, DateTimeDlgProc, IDS_DATETIME_TITLE, IDS_DATETIME_SUBTITLE, WizPagesEarly, DateTimeInit, DateTimeCommitChanges, -1 }, { PSWIZB_NEXT, WizPageWelcome, IDD_NTOC_WELCOME, WelcomeDlgProc, 0, 0, WizPagesWelcome, WelcomeInit, WelcomeCommit, SETUPOP_STANDALONE }, /* { PSWIZB_NEXT, WizPageReinstall, IDD_REINSTALL, ReinstallDlgProc, 0, 0, WizPagesEarly, ReinstallInit, ReinstallCommit, SETUPOP_STANDALONE }, */ { PSWIZB_FINISH, WizPageFinal, IDD_NTOC_FINISH, FinishDlgProc, 0, 0, WizPagesFinal, FinishInit, FinishCommit, SETUPOP_STANDALONE } }; DWORD NtOcWizardPages[] = { WizPageTapiLoc, // WizPageDisplay, WizPageDateTime, WizPageWelcome, //WizPageReinstall, WizPageFinal }; //DWORD NtOcWrapPages[] = //{ //} #define MAX_NTOC_PAGES (sizeof(NtOcWizardPages)/sizeof(NtOcWizardPages[0])) //#define MAX_NTOC_WRAP_PAGES (sizeof(NtOcWrapPages)/sizeof(NtOcWrapPages[0])) HINSTANCE hInstance; HPROPSHEETPAGE WizardPageHandles[WizPageMaximum]; PROPSHEETPAGE WizardPages[WizPageMaximum]; //HPROPSHEETPAGE WrapPageHandles[WizPageMaximum]; //PROPSHEETPAGE WizardPages[WizPageMaximum]; SETUP_INIT_COMPONENT SetupInitComponent; extern "C" DWORD NtOcDllInit( HINSTANCE hInst, DWORD Reason, LPVOID Context ) { if (Reason == DLL_PROCESS_ATTACH) { hInstance = hInst; DisableThreadLibraryCalls( hInstance ); InitCommonControls(); } return TRUE; } DWORD NtOcSetupProc( IN LPCVOID ComponentId, IN LPCVOID SubcomponentId, IN UINT Function, IN UINT Param1, IN OUT PVOID Param2 ) { DWORD i; DWORD cnt; DWORD WizPageCount = 0; WCHAR TitleBuffer[256]; PSETUP_REQUEST_PAGES SetupRequestPages; switch( Function ) { case OC_PREINITIALIZE: return OCFLAG_UNICODE; case OC_INIT_COMPONENT: if (OCMANAGER_VERSION <= ((PSETUP_INIT_COMPONENT)Param2)->OCManagerVersion) { ((PSETUP_INIT_COMPONENT)Param2)->ComponentVersion = OCMANAGER_VERSION; } else { return ERROR_CALL_NOT_IMPLEMENTED; } CopyMemory( &SetupInitComponent, (LPVOID)Param2, sizeof(SETUP_INIT_COMPONENT) ); for (i=0; i SetupRequestPages->MaxPages) { return cnt; } if (cnt == 0) { goto getallpages; } WizardPages[WizPageCount].dwSize = sizeof(PROPSHEETPAGE); // if (i == WizPageReinstall) { // WizardPages[WizPageCount].dwFlags = PSP_DEFAULT | PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE; // } else { WizardPages[WizPageCount].dwFlags = PSP_DEFAULT | PSP_HIDEHEADER; // } WizardPages[WizPageCount].hInstance = hInstance; WizardPages[WizPageCount].pszTemplate = MAKEINTRESOURCE(SetupWizardPages[NtOcWizardPages[i]].DlgId); WizardPages[WizPageCount].pszIcon = NULL; WizardPages[WizPageCount].pszTitle = NULL; WizardPages[WizPageCount].pfnDlgProc = SetupWizardPages[NtOcWizardPages[i]].DlgProc; WizardPages[WizPageCount].lParam = 0; WizardPages[WizPageCount].pfnCallback = NULL; WizardPages[WizPageCount].pcRefParent = NULL; WizardPages[WizPageCount].pszHeaderTitle = NULL; WizardPages[WizPageCount].pszHeaderSubTitle = NULL; if (SetupWizardPages[NtOcWizardPages[i]].Title) { if (LoadString( hInstance, SetupWizardPages[NtOcWizardPages[i]].Title, TitleBuffer, sizeof(TitleBuffer)/sizeof(WCHAR) )) { WizardPages[WizPageCount].pszHeaderTitle = _wcsdup( TitleBuffer ); } } if (SetupWizardPages[NtOcWizardPages[i]].SubTitle) { if (LoadString( hInstance, SetupWizardPages[NtOcWizardPages[i]].SubTitle, TitleBuffer, sizeof(TitleBuffer)/sizeof(WCHAR) )) { WizardPages[WizPageCount].pszHeaderSubTitle = _wcsdup( TitleBuffer ); } } WizardPageHandles[WizPageCount] = CreatePropertySheetPage( &WizardPages[WizPageCount] ); if (WizardPageHandles[WizPageCount]) { SetupRequestPages->Pages[WizPageCount] = WizardPageHandles[WizPageCount]; WizPageCount += 1; } return WizPageCount; } getallpages: for (i=0,cnt=0; i SetupRequestPages->MaxPages) { return cnt; } for (i=0; iPages[WizPageCount] = WizardPageHandles[WizPageCount]; WizPageCount += 1; } } return WizPageCount; case OC_QUERY_SKIP_PAGE: // if this is gui mode setup and the system is NT Workstation, // skip the select components page // remove workstation check to make this change effective on servers as well // if (SetupInitComponent.SetupData.ProductType == PRODUCT_WORKSTATION) { if (!(SetupInitComponent.SetupData.OperationFlags & SETUPOP_STANDALONE)) { return TRUE; } // } return FALSE; case OC_COMPLETE_INSTALLATION: // if this is not gui mode setup, do nothing, else commit the pages if ((SetupInitComponent.SetupData.OperationFlags & SETUPOP_STANDALONE)) { break; } for (i=0; iGroupCount; dwGroup++) { if ( EqualSid ( ptg->Groups[dwGroup].Sid, psidAdmin)) { fAdmin = TRUE; break; } } // Before we exit we must explicity deallocate the SID we created. FreeSid ( psidAdmin); free(ptg); return ( fAdmin); #endif //_CHICAGO_ } LRESULT CommonWizardProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam, DWORD WizardId ) /*++ Routine Description: Common procedure for handling wizard pages: Arguments: hDlg - Identifies the wizard page message - Specifies the message wParam - Specifies additional message-specific information lParam - Specifies additional message-specific information WizardId - Indicate which wizard page this is for Return Value: NULL - Message is processed and the dialog procedure should return FALSE Otherwise - Message is not completely processed and The return value is a pointer to the user mode memory structure --*/ { switch (message) { case WM_NOTIFY: switch (((NMHDR *) lParam)->code) { case PSN_SETACTIVE: PropSheet_SetWizButtons( GetParent(hDlg), SetupWizardPages[WizardId].ButtonState ); break; default: ; } break; default: ; } return FALSE; }