https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2d8a2944baad1078aa98097b38d86fb3b72dee01
commit 2d8a2944baad1078aa98097b38d86fb3b72dee01 Author: Eric Kohl <eric.k...@reactos.org> AuthorDate: Thu Feb 6 23:14:28 2025 +0100 Commit: Eric Kohl <eric.k...@reactos.org> CommitDate: Thu Feb 6 23:14:28 2025 +0100 [SYSSETUP] Add the type library registration to the Register Components task on the process page --- dll/win32/syssetup/globals.h | 9 +++- dll/win32/syssetup/install.c | 25 +++++++++-- dll/win32/syssetup/wizard.c | 104 ++++++++++++++++++++++++++++++------------- 3 files changed, 102 insertions(+), 36 deletions(-) diff --git a/dll/win32/syssetup/globals.h b/dll/win32/syssetup/globals.h index 85b3f8dea3a..8112102a0b7 100644 --- a/dll/win32/syssetup/globals.h +++ b/dll/win32/syssetup/globals.h @@ -68,10 +68,15 @@ extern HINSTANCE hDllInstance; extern HINF hSysSetupInf; extern ADMIN_INFO AdminInfo; -BOOL RegisterTypeLibraries (HINF hinf, LPCWSTR szSection); - /* install */ +BOOL +RegisterTypeLibraries( + _In_ PITEMSDATA pItemsData, + _In_ PREGISTRATIONNOTIFY pNotify, + _In_ HINF hinf, + _In_ LPCWSTR szSection); + VOID InstallStartMenuItems( _In_ PITEMSDATA pItemsData); diff --git a/dll/win32/syssetup/install.c b/dll/win32/syssetup/install.c index 61d5da1bc33..4d964fab68c 100644 --- a/dll/win32/syssetup/install.c +++ b/dll/win32/syssetup/install.c @@ -336,11 +336,9 @@ InstallStartMenuItems( INF_STYLE_WIN4, NULL); -// Steps = SetupGetLineCountW(hShortcutsInf1, L"ShortcutFolders"); Steps = CountShortcuts(hShortcutsInf1, L"ShortcutFolders"); if (hShortcutsInf2 != INVALID_HANDLE_VALUE) Steps += CountShortcuts(hShortcutsInf2, L"ShortcutFolders"); -// Steps += SetupGetLineCountW(hShortcutsInf2, L"ShortcutFolders"); SendMessage(pItemsData->hwndDlg, PM_ITEM_START, 1, (LPARAM)Steps); @@ -538,7 +536,11 @@ InstallSysSetupInfComponents(VOID) BOOL -RegisterTypeLibraries(HINF hinf, LPCWSTR szSection) +RegisterTypeLibraries( + _In_ PITEMSDATA pItemsData, + _In_ PREGISTRATIONNOTIFY pNotify, + _In_ HINF hinf, + _In_ LPCWSTR szSection) { INFCONTEXT InfContext; BOOL res; @@ -575,6 +577,15 @@ RegisterTypeLibraries(HINF hinf, LPCWSTR szSection) p = PathAddBackslash(szPath); wcscpy(p, szName); + if (pItemsData && pNotify) + { + pNotify->Progress++; + pNotify->CurrentItem = szName; + + DPRINT("RegisterTypeLibraries: Start step %ld\n", pNotify->Progress); + SendMessage(pItemsData->hwndDlg, PM_STEP_START, 0, (LPARAM)pNotify); + } + hmod = LoadLibraryW(szPath); if (hmod == NULL) { @@ -584,6 +595,12 @@ RegisterTypeLibraries(HINF hinf, LPCWSTR szSection) __wine_register_resources(hmod); + if (pItemsData && pNotify) + { + DPRINT("RegisterTypeLibraries: End step %ld\n", pNotify->Progress); + SendMessage(pItemsData->hwndDlg, PM_STEP_END, 0, (LPARAM)pNotify); + } + } while (SetupFindNextLine(&InfContext, &InfContext)); return TRUE; @@ -1073,7 +1090,7 @@ InstallLiveCD(VOID) DPRINT1("SetupInstallFromInfSectionW failed!\n"); } - RegisterTypeLibraries(hSysSetupInf, L"TypeLibraries"); + RegisterTypeLibraries(NULL, NULL, hSysSetupInf, L"TypeLibraries"); } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { diff --git a/dll/win32/syssetup/wizard.c b/dll/win32/syssetup/wizard.c index 4675ff904a9..0345ed14f40 100644 --- a/dll/win32/syssetup/wizard.c +++ b/dll/win32/syssetup/wizard.c @@ -33,6 +33,7 @@ typedef struct _REGISTRATIONDATA ULONG DllCount; ULONG Registered; PVOID DefaultContext; + PREGISTRATIONNOTIFY pNotify; } REGISTRATIONDATA, *PREGISTRATIONDATA; typedef struct _TIMEZONE_ENTRY @@ -1991,7 +1992,6 @@ RegistrationNotificationProc(PVOID Context, UINT_PTR Param2) { PREGISTRATIONDATA RegistrationData; - REGISTRATIONNOTIFY RegistrationNotify; PSP_REGISTER_CONTROL_STATUSW StatusInfo; UINT MessageID; @@ -2001,23 +2001,24 @@ RegistrationNotificationProc(PVOID Context, Notification == SPFILENOTIFY_ENDREGISTRATION) { StatusInfo = (PSP_REGISTER_CONTROL_STATUSW) Param1; - RegistrationNotify.CurrentItem = wcsrchr(StatusInfo->FileName, L'\\'); - if (RegistrationNotify.CurrentItem == NULL) + RegistrationData->pNotify->CurrentItem = wcsrchr(StatusInfo->FileName, L'\\'); + if (RegistrationData->pNotify->CurrentItem == NULL) { - RegistrationNotify.CurrentItem = StatusInfo->FileName; + RegistrationData->pNotify->CurrentItem = StatusInfo->FileName; } else { - RegistrationNotify.CurrentItem++; + RegistrationData->pNotify->CurrentItem++; } if (Notification == SPFILENOTIFY_STARTREGISTRATION) { DPRINT("Received SPFILENOTIFY_STARTREGISTRATION notification for %S\n", StatusInfo->FileName); -// RegistrationNotify.ErrorMessage = NULL; - RegistrationNotify.Progress = RegistrationData->Registered; - SendMessage(RegistrationData->hwndDlg, PM_STEP_START, 0, (LPARAM)&RegistrationNotify); + RegistrationData->pNotify->Progress = RegistrationData->Registered; + + DPRINT("RegisterDll: Start step %ld\n", RegistrationData->pNotify->Progress); + SendMessage(RegistrationData->hwndDlg, PM_STEP_START, 0, (LPARAM)RegistrationData->pNotify); } else { @@ -2049,13 +2050,13 @@ RegistrationNotificationProc(PVOID Context, break; } - RegistrationNotify.MessageID = MessageID; - RegistrationNotify.LastError = StatusInfo->Win32Error; + RegistrationData->pNotify->MessageID = MessageID; + RegistrationData->pNotify->LastError = StatusInfo->Win32Error; } else { - RegistrationNotify.MessageID = 0; - RegistrationNotify.LastError = ERROR_SUCCESS; + RegistrationData->pNotify->MessageID = 0; + RegistrationData->pNotify->LastError = ERROR_SUCCESS; } if (RegistrationData->Registered < RegistrationData->DllCount) @@ -2063,8 +2064,9 @@ RegistrationNotificationProc(PVOID Context, RegistrationData->Registered++; } - RegistrationNotify.Progress = RegistrationData->Registered; - SendMessage(RegistrationData->hwndDlg, PM_STEP_END, 0, (LPARAM)&RegistrationNotify); + RegistrationData->pNotify->Progress = RegistrationData->Registered; + DPRINT("RegisterDll: End step %ld\n", RegistrationData->pNotify->Progress); + SendMessage(RegistrationData->hwndDlg, PM_STEP_END, 0, (LPARAM)RegistrationData->pNotify); } return FILEOP_DOIT; @@ -2081,13 +2083,14 @@ RegistrationNotificationProc(PVOID Context, static DWORD RegisterDlls( - PITEMSDATA pItemsData) + _In_ PITEMSDATA pItemsData, + _In_ PREGISTRATIONNOTIFY pNotify) { REGISTRATIONDATA RegistrationData; WCHAR SectionName[512]; INFCONTEXT Context; LONG DllCount = 0; - DWORD LastError = NO_ERROR; + DWORD Error = NO_ERROR; ZeroMemory(&RegistrationData, sizeof(REGISTRATIONDATA)); RegistrationData.hwndDlg = pItemsData->hwndDlg; @@ -2097,7 +2100,7 @@ RegisterDlls( L"RegisterDlls", &Context)) { DPRINT1("No RegistrationPhase2 section found\n"); - return FALSE; + return GetLastError(); } if (!SetupGetStringFieldW(&Context, 1, SectionName, @@ -2105,21 +2108,19 @@ RegisterDlls( NULL)) { DPRINT1("Unable to retrieve section name\n"); - return FALSE; + return GetLastError(); } DllCount = SetupGetLineCountW(hSysSetupInf, SectionName); - DPRINT1("SectionName %S DllCount %ld\n", SectionName, DllCount); + DPRINT("SectionName %S DllCount %ld\n", SectionName, DllCount); if (DllCount < 0) { - SetLastError(STATUS_NOT_FOUND); - return FALSE; + return STATUS_NOT_FOUND; } RegistrationData.DllCount = (ULONG)DllCount; RegistrationData.DefaultContext = SetupInitDefaultQueueCallback(RegistrationData.hwndDlg); - - SendMessage(pItemsData->hwndDlg, PM_ITEM_START, 0, (LPARAM)RegistrationData.DllCount); + RegistrationData.pNotify = pNotify; _SEH2_TRY { @@ -2135,21 +2136,66 @@ RegisterDlls( NULL, NULL)) { - LastError = GetLastError(); + Error = GetLastError(); } } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { DPRINT("Catching exception\n"); - LastError = RtlNtStatusToDosError(_SEH2_GetExceptionCode()); + Error = RtlNtStatusToDosError(_SEH2_GetExceptionCode()); } _SEH2_END; SetupTermDefaultQueueCallback(RegistrationData.DefaultContext); - SendMessage(pItemsData->hwndDlg, PM_ITEM_END, 0, LastError); + return Error; +} - return 0; +static +VOID +RegisterComponents( + PITEMSDATA pItemsData) +{ + WCHAR SectionName[512]; + INFCONTEXT Context; + LONG Steps = 0; + DWORD Error = NO_ERROR; + REGISTRATIONNOTIFY Notify; + + ZeroMemory(&Notify, sizeof(Notify)); + + /* Count the 'RegisterDlls' steps */ + if (!SetupFindFirstLineW(hSysSetupInf, L"RegistrationPhase2", + L"RegisterDlls", &Context)) + { + DPRINT1("No RegistrationPhase2 section found\n"); + return; + } + + if (!SetupGetStringFieldW(&Context, 1, SectionName, + ARRAYSIZE(SectionName), + NULL)) + { + DPRINT1("Unable to retrieve section name\n"); + return; + } + + Steps += SetupGetLineCountW(hSysSetupInf, SectionName); + + /* Count the 'TypeLibratries' steps */ + Steps += SetupGetLineCountW(hSysSetupInf, L"TypeLibraries"); + + /* Start the item */ + DPRINT("Register Components: %ld Steps\n", Steps); + SendMessage(pItemsData->hwndDlg, PM_ITEM_START, 0, (LPARAM)Steps); + + Error = RegisterDlls(pItemsData, &Notify); + if (Error == ERROR_SUCCESS) + RegisterTypeLibraries(pItemsData, &Notify, hSysSetupInf, L"TypeLibraries"); + + /* End the item */ + DPRINT("Register Components: done\n"); + SendMessage(pItemsData->hwndDlg, PM_ITEM_END, 0, Error); } @@ -2166,9 +2212,7 @@ ItemCompletionThread( hwndDlg = pItemsData->hwndDlg; /* Step 0 - Registering components */ - RegisterDlls(pItemsData); - - RegisterTypeLibraries(hSysSetupInf, L"TypeLibraries"); + RegisterComponents(pItemsData); /* Step 1 - Installing start menu items */ InstallStartMenuItems(pItemsData);