#include "setupp.h" #pragma hdrstop //////////////////////////////////////////// // // Action item list control // //////////////////////////////////////////// // // Define locations in extra window storage // #define AIL_FONT (0) #define AIL_BOLDFONT (AIL_FONT + sizeof(PVOID)) #define AIL_TEXT (AIL_BOLDFONT + sizeof(PVOID)) #define AIL_BOLDITEM (AIL_TEXT + sizeof(PVOID)) #define AIL_LINECOUNT (AIL_BOLDITEM + sizeof(LONG)) #define AIL_FREEFONTS (AIL_LINECOUNT + sizeof(LONG)) #define AIL_EXTRA ((3 * sizeof(PVOID)) + (3 * sizeof(LONG))) PCWSTR szActionItemListClassName = L"$$$ActionItemList"; VOID ActionItemListPaint( IN HWND hwnd ) { PAINTSTRUCT PaintStruct; PWSTR p,Text; UINT LineCount; HFONT OldFont,Font,BoldFont; UINT HighlightedItem; UINT i; int Length; int y; int yDelta; HBITMAP Bitmap,OldBitmap; BITMAP bitmap; HDC MemoryDC; SIZE Size; RECT rect; int Spacing; int oldmode; #define BORDER 3 if(!BeginPaint(hwnd,&PaintStruct)) { return; } // // If no text, nothing to do. // if(Text = (PWSTR)GetWindowLongPtr(hwnd,AIL_TEXT)) { LineCount = (UINT)GetWindowLong(hwnd,AIL_LINECOUNT); } if(!Text || !LineCount) { return; } // // Get value indicating which item is to be bolded. // HighlightedItem = (UINT)GetWindowLong(hwnd,AIL_BOLDITEM); // // Get font handles. // Font = (HFONT)GetWindowLongPtr(hwnd,AIL_FONT); BoldFont = (HFONT)GetWindowLongPtr(hwnd,AIL_BOLDFONT); // // Select the non-boldface font to get the handle of // the currently selected font. // OldFont = SelectObject(PaintStruct.hdc,Font); oldmode = SetBkMode(PaintStruct.hdc,TRANSPARENT); // // Load the little triangle bitmap and create a compatible DC for it. // Bitmap = LoadBitmap(NULL,MAKEINTRESOURCE(OBM_MNARROW)); if(MemoryDC = CreateCompatibleDC(PaintStruct.hdc)) { OldBitmap = SelectObject(MemoryDC,Bitmap); GetObject(Bitmap,sizeof(BITMAP),&bitmap); } Spacing = GetSystemMetrics(SM_CXICON) / 2; // // Treat the text as a series of lines and draw each one. // p = Text; y = 0; for(i=0; iFileName); if (RegistrationContext->hWndProgress) { SendMessage( RegistrationContext->hWndProgress, PBM_STEPIT, 0, 0 ); } return FILEOP_DOIT; } if (Notification == SPFILENOTIFY_ENDREGISTRATION) { // // the file has been registered, so log failure if necessary // Note that we have a special code for timeouts // switch(Status->FailureCode) { case SPREG_SUCCESS: SetupDebugPrint1( L"SETUP: %s registered successfully", Status->FileName); break; case SPREG_TIMEOUT: SetuplogError( LogSevError, SETUPLOG_USE_MESSAGEID, MSG_OLE_REGISTRATION_HUNG, Status->FileName, NULL,NULL); SetupDebugPrint1( L"SETUP: %s timed out during registration", Status->FileName); break; default: // // log an error // for (i = 0;RegErrorToText[i].FailureText != NULL;i++) { if (RegErrorToText[i].FailureCode == Status->FailureCode) { p = RegErrorToText[i].FailureText; if ((Status->FailureCode == SPREG_LOADLIBRARY) && (Status->Win32Error == ERROR_MOD_NOT_FOUND)) ErrorMessageId = MSG_LOG_X_MOD_NOT_FOUND; else if ((Status->FailureCode == SPREG_GETPROCADDR) && (Status->Win32Error == ERROR_PROC_NOT_FOUND)) ErrorMessageId = MSG_LOG_X_PROC_NOT_FOUND; else ErrorMessageId = MSG_LOG_X_RETURNED_WINERR; break; } } if (!p) { p = L"Unknown"; ErrorMessageId = MSG_LOG_X_RETURNED_WINERR; } SetuplogError( LogSevError, SETUPLOG_USE_MESSAGEID, MSG_LOG_OLE_CONTROL_NOT_REGISTERED, Status->FileName, NULL, SETUPLOG_USE_MESSAGEID, ErrorMessageId, p, Status->Win32Error, NULL, NULL ); SetupDebugPrint1( L"SETUP: %s did not register successfully", Status->FileName); } // // Verify that the DLL didn't change our unhandled exception filter. // if( MyUnhandledExceptionFilter != SetUnhandledExceptionFilter(MyUnhandledExceptionFilter)) { SetupDebugPrint1( L"SETUP: %ws broke the exception handler.", Status->FileName ); #if 0 // // We'll put this in after all the currently broken DLLs are fixed. // MessageBoxFromMessage( RegistrationContext->hwndParent, MSG_EXCEPTION_FILTER_CHANGED, NULL, IDS_WINNT_SETUP, MB_OK | MB_ICONWARNING, Status->FileName ); #endif } return FILEOP_DOIT; } MYASSERT(FALSE); return(FILEOP_DOIT); } BOOL RegisterOleControls( IN HWND hwndParent, IN HINF hInf, IN HWND hProgress, IN ULONG StartAtPercent, IN ULONG StopAtPercent, IN PWSTR SectionName ) /*++ Routine Description: This routine runs down the entries in the specified INF section, and self-registers each file. Arguments: hwndParent - supplies the window handle used for the PRERELEASE message box that indicates an OLE registration has hung. InfHandle - supplies handle to inf containing the specified SectionName. hProgress - handle to progress gauge that gets ticked every time we process a file. StartAtPercent - Position where the progress window should start (0% to 100%). StopAtPercent - Maximum position where the progress window can be moved to (0% to 100%). SectionName - Supplies the name of the section contained in the INF specified by InfHandle that lists OLE control DLLs to be registered/installed. Return Value: Boolean value indicating outcome. If a file to be registered is not present, that is NOT reason for returning false. --*/ { UINT GaugeRange; DWORD SectionCount,LineCount, i; INFCONTEXT InfContext; BOOL RetVal = TRUE; REGISTRATION_CONTEXT RegistrationContext; RegistrationContext.hWndParent = hwndParent; RegistrationContext.hWndProgress = hProgress; LineCount = 0; // // Initialize the progress indicator control. // if (hProgress) { // // find out how many files we have to register // if (SetupFindFirstLine(hInf, SectionName, TEXT("RegisterDlls"), &InfContext)) { do { SectionCount = SetupGetFieldCount(&InfContext); for (i = 1; i<=SectionCount; i++) { PCWSTR IndividualSectionName = pSetupGetField(&InfContext,i); if (IndividualSectionName) { LineCount += SetupGetLineCount(hInf, IndividualSectionName); } } } while(SetupFindNextMatchLine( &InfContext, TEXT("RegisterDlls"), &InfContext)); } MYASSERT((StopAtPercent-StartAtPercent) != 0); GaugeRange = (LineCount*100/(StopAtPercent-StartAtPercent)); SendMessage(hProgress, WMX_PROGRESSTICKS, LineCount, 0); SendMessage(hProgress,PBM_SETRANGE,0,MAKELPARAM(0,GaugeRange)); SendMessage(hProgress,PBM_SETPOS,GaugeRange*StartAtPercent/100,0); SendMessage(hProgress,PBM_SETSTEP,1,0); } // // now allow Setup API to register the files, using our callback to log // errors if and when they occur. // if (!SetupInstallFromInfSection( hwndParent, hInf, SectionName, SPINST_REGSVR| SPINST_REGISTERCALLBACKAWARE, NULL, NULL, 0, RegistrationQueueCallback, (PVOID)&RegistrationContext, NULL, NULL )) { DWORD d; RetVal = FALSE; d = GetLastError(); SetuplogError( LogSevError, SETUPLOG_USE_MESSAGEID, MSG_OLE_REGISTRATION_SECTION_FAILURE, SectionName, L"syssetup.inf", d, NULL, SETUPLOG_USE_MESSAGEID, MSG_LOG_X_RETURNED_WINERR, szSetupInstallFromInfSection, d, NULL, NULL ); } return(RetVal); }