@@ -33,6 +33,7 @@ typedef struct _REGISTRATIONDATA
3333 ULONG DllCount ;
3434 ULONG Registered ;
3535 PVOID DefaultContext ;
36+ PREGISTRATIONNOTIFY pNotify ;
3637} REGISTRATIONDATA , * PREGISTRATIONDATA ;
3738
3839typedef struct _TIMEZONE_ENTRY
@@ -1991,7 +1992,6 @@ RegistrationNotificationProc(PVOID Context,
19911992 UINT_PTR Param2 )
19921993{
19931994 PREGISTRATIONDATA RegistrationData ;
1994- REGISTRATIONNOTIFY RegistrationNotify ;
19951995 PSP_REGISTER_CONTROL_STATUSW StatusInfo ;
19961996 UINT MessageID ;
19971997
@@ -2001,23 +2001,24 @@ RegistrationNotificationProc(PVOID Context,
20012001 Notification == SPFILENOTIFY_ENDREGISTRATION )
20022002 {
20032003 StatusInfo = (PSP_REGISTER_CONTROL_STATUSW ) Param1 ;
2004- RegistrationNotify . CurrentItem = wcsrchr (StatusInfo -> FileName , L'\\' );
2005- if (RegistrationNotify . CurrentItem == NULL )
2004+ RegistrationData -> pNotify -> CurrentItem = wcsrchr (StatusInfo -> FileName , L'\\' );
2005+ if (RegistrationData -> pNotify -> CurrentItem == NULL )
20062006 {
2007- RegistrationNotify . CurrentItem = StatusInfo -> FileName ;
2007+ RegistrationData -> pNotify -> CurrentItem = StatusInfo -> FileName ;
20082008 }
20092009 else
20102010 {
2011- RegistrationNotify . CurrentItem ++ ;
2011+ RegistrationData -> pNotify -> CurrentItem ++ ;
20122012 }
20132013
20142014 if (Notification == SPFILENOTIFY_STARTREGISTRATION )
20152015 {
20162016 DPRINT ("Received SPFILENOTIFY_STARTREGISTRATION notification for %S\n" ,
20172017 StatusInfo -> FileName );
2018- // RegistrationNotify.ErrorMessage = NULL;
2019- RegistrationNotify .Progress = RegistrationData -> Registered ;
2020- SendMessage (RegistrationData -> hwndDlg , PM_STEP_START , 0 , (LPARAM )& RegistrationNotify );
2018+ RegistrationData -> pNotify -> Progress = RegistrationData -> Registered ;
2019+
2020+ DPRINT ("RegisterDll: Start step %ld\n" , RegistrationData -> pNotify -> Progress );
2021+ SendMessage (RegistrationData -> hwndDlg , PM_STEP_START , 0 , (LPARAM )RegistrationData -> pNotify );
20212022 }
20222023 else
20232024 {
@@ -2049,22 +2050,23 @@ RegistrationNotificationProc(PVOID Context,
20492050 break ;
20502051 }
20512052
2052- RegistrationNotify . MessageID = MessageID ;
2053- RegistrationNotify . LastError = StatusInfo -> Win32Error ;
2053+ RegistrationData -> pNotify -> MessageID = MessageID ;
2054+ RegistrationData -> pNotify -> LastError = StatusInfo -> Win32Error ;
20542055 }
20552056 else
20562057 {
2057- RegistrationNotify . MessageID = 0 ;
2058- RegistrationNotify . LastError = ERROR_SUCCESS ;
2058+ RegistrationData -> pNotify -> MessageID = 0 ;
2059+ RegistrationData -> pNotify -> LastError = ERROR_SUCCESS ;
20592060 }
20602061
20612062 if (RegistrationData -> Registered < RegistrationData -> DllCount )
20622063 {
20632064 RegistrationData -> Registered ++ ;
20642065 }
20652066
2066- RegistrationNotify .Progress = RegistrationData -> Registered ;
2067- SendMessage (RegistrationData -> hwndDlg , PM_STEP_END , 0 , (LPARAM )& RegistrationNotify );
2067+ RegistrationData -> pNotify -> Progress = RegistrationData -> Registered ;
2068+ DPRINT ("RegisterDll: End step %ld\n" , RegistrationData -> pNotify -> Progress );
2069+ SendMessage (RegistrationData -> hwndDlg , PM_STEP_END , 0 , (LPARAM )RegistrationData -> pNotify );
20682070 }
20692071
20702072 return FILEOP_DOIT ;
@@ -2081,13 +2083,14 @@ RegistrationNotificationProc(PVOID Context,
20812083static
20822084DWORD
20832085RegisterDlls (
2084- PITEMSDATA pItemsData )
2086+ _In_ PITEMSDATA pItemsData ,
2087+ _In_ PREGISTRATIONNOTIFY pNotify )
20852088{
20862089 REGISTRATIONDATA RegistrationData ;
20872090 WCHAR SectionName [512 ];
20882091 INFCONTEXT Context ;
20892092 LONG DllCount = 0 ;
2090- DWORD LastError = NO_ERROR ;
2093+ DWORD Error = NO_ERROR ;
20912094
20922095 ZeroMemory (& RegistrationData , sizeof (REGISTRATIONDATA ));
20932096 RegistrationData .hwndDlg = pItemsData -> hwndDlg ;
@@ -2097,29 +2100,27 @@ RegisterDlls(
20972100 L"RegisterDlls" , & Context ))
20982101 {
20992102 DPRINT1 ("No RegistrationPhase2 section found\n" );
2100- return FALSE ;
2103+ return GetLastError () ;
21012104 }
21022105
21032106 if (!SetupGetStringFieldW (& Context , 1 , SectionName ,
21042107 ARRAYSIZE (SectionName ),
21052108 NULL ))
21062109 {
21072110 DPRINT1 ("Unable to retrieve section name\n" );
2108- return FALSE ;
2111+ return GetLastError () ;
21092112 }
21102113
21112114 DllCount = SetupGetLineCountW (hSysSetupInf , SectionName );
2112- DPRINT1 ("SectionName %S DllCount %ld\n" , SectionName , DllCount );
2115+ DPRINT ("SectionName %S DllCount %ld\n" , SectionName , DllCount );
21132116 if (DllCount < 0 )
21142117 {
2115- SetLastError (STATUS_NOT_FOUND );
2116- return FALSE;
2118+ return STATUS_NOT_FOUND ;
21172119 }
21182120
21192121 RegistrationData .DllCount = (ULONG )DllCount ;
21202122 RegistrationData .DefaultContext = SetupInitDefaultQueueCallback (RegistrationData .hwndDlg );
2121-
2122- SendMessage (pItemsData -> hwndDlg , PM_ITEM_START , 0 , (LPARAM )RegistrationData .DllCount );
2123+ RegistrationData .pNotify = pNotify ;
21232124
21242125 _SEH2_TRY
21252126 {
@@ -2135,21 +2136,66 @@ RegisterDlls(
21352136 NULL ,
21362137 NULL ))
21372138 {
2138- LastError = GetLastError ();
2139+ Error = GetLastError ();
21392140 }
21402141 }
21412142 _SEH2_EXCEPT (EXCEPTION_EXECUTE_HANDLER )
21422143 {
21432144 DPRINT ("Catching exception\n" );
2144- LastError = RtlNtStatusToDosError (_SEH2_GetExceptionCode ());
2145+ Error = RtlNtStatusToDosError (_SEH2_GetExceptionCode ());
21452146 }
21462147 _SEH2_END ;
21472148
21482149 SetupTermDefaultQueueCallback (RegistrationData .DefaultContext );
21492150
2150- SendMessage (pItemsData -> hwndDlg , PM_ITEM_END , 0 , LastError );
2151+ return Error ;
2152+ }
21512153
2152- return 0 ;
2154+ static
2155+ VOID
2156+ RegisterComponents (
2157+ PITEMSDATA pItemsData )
2158+ {
2159+ WCHAR SectionName [512 ];
2160+ INFCONTEXT Context ;
2161+ LONG Steps = 0 ;
2162+ DWORD Error = NO_ERROR ;
2163+ REGISTRATIONNOTIFY Notify ;
2164+
2165+ ZeroMemory (& Notify , sizeof (Notify ));
2166+
2167+ /* Count the 'RegisterDlls' steps */
2168+ if (!SetupFindFirstLineW (hSysSetupInf , L"RegistrationPhase2" ,
2169+ L"RegisterDlls" , & Context ))
2170+ {
2171+ DPRINT1 ("No RegistrationPhase2 section found\n" );
2172+ return ;
2173+ }
2174+
2175+ if (!SetupGetStringFieldW (& Context , 1 , SectionName ,
2176+ ARRAYSIZE (SectionName ),
2177+ NULL ))
2178+ {
2179+ DPRINT1 ("Unable to retrieve section name\n" );
2180+ return ;
2181+ }
2182+
2183+ Steps += SetupGetLineCountW (hSysSetupInf , SectionName );
2184+
2185+ /* Count the 'TypeLibratries' steps */
2186+ Steps += SetupGetLineCountW (hSysSetupInf , L"TypeLibraries" );
2187+
2188+ /* Start the item */
2189+ DPRINT ("Register Components: %ld Steps\n" , Steps );
2190+ SendMessage (pItemsData -> hwndDlg , PM_ITEM_START , 0 , (LPARAM )Steps );
2191+
2192+ Error = RegisterDlls (pItemsData , & Notify );
2193+ if (Error == ERROR_SUCCESS )
2194+ RegisterTypeLibraries (pItemsData , & Notify , hSysSetupInf , L"TypeLibraries" );
2195+
2196+ /* End the item */
2197+ DPRINT ("Register Components: done\n" );
2198+ SendMessage (pItemsData -> hwndDlg , PM_ITEM_END , 0 , Error );
21532199}
21542200
21552201
@@ -2166,9 +2212,7 @@ ItemCompletionThread(
21662212 hwndDlg = pItemsData -> hwndDlg ;
21672213
21682214 /* Step 0 - Registering components */
2169- RegisterDlls (pItemsData );
2170-
2171- RegisterTypeLibraries (hSysSetupInf , L"TypeLibraries" );
2215+ RegisterComponents (pItemsData );
21722216
21732217 /* Step 1 - Installing start menu items */
21742218 InstallStartMenuItems (pItemsData );
0 commit comments