Skip to content

Commit 2d8a294

Browse files
committed
[SYSSETUP] Add the type library registration to the Register Components task on the process page
1 parent d969be0 commit 2d8a294

File tree

3 files changed

+102
-36
lines changed

3 files changed

+102
-36
lines changed

dll/win32/syssetup/globals.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,15 @@ extern HINSTANCE hDllInstance;
6868
extern HINF hSysSetupInf;
6969
extern ADMIN_INFO AdminInfo;
7070

71-
BOOL RegisterTypeLibraries (HINF hinf, LPCWSTR szSection);
72-
7371
/* install */
7472

73+
BOOL
74+
RegisterTypeLibraries(
75+
_In_ PITEMSDATA pItemsData,
76+
_In_ PREGISTRATIONNOTIFY pNotify,
77+
_In_ HINF hinf,
78+
_In_ LPCWSTR szSection);
79+
7580
VOID
7681
InstallStartMenuItems(
7782
_In_ PITEMSDATA pItemsData);

dll/win32/syssetup/install.c

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,9 @@ InstallStartMenuItems(
336336
INF_STYLE_WIN4,
337337
NULL);
338338

339-
// Steps = SetupGetLineCountW(hShortcutsInf1, L"ShortcutFolders");
340339
Steps = CountShortcuts(hShortcutsInf1, L"ShortcutFolders");
341340
if (hShortcutsInf2 != INVALID_HANDLE_VALUE)
342341
Steps += CountShortcuts(hShortcutsInf2, L"ShortcutFolders");
343-
// Steps += SetupGetLineCountW(hShortcutsInf2, L"ShortcutFolders");
344342

345343
SendMessage(pItemsData->hwndDlg, PM_ITEM_START, 1, (LPARAM)Steps);
346344

@@ -538,7 +536,11 @@ InstallSysSetupInfComponents(VOID)
538536

539537

540538
BOOL
541-
RegisterTypeLibraries(HINF hinf, LPCWSTR szSection)
539+
RegisterTypeLibraries(
540+
_In_ PITEMSDATA pItemsData,
541+
_In_ PREGISTRATIONNOTIFY pNotify,
542+
_In_ HINF hinf,
543+
_In_ LPCWSTR szSection)
542544
{
543545
INFCONTEXT InfContext;
544546
BOOL res;
@@ -575,6 +577,15 @@ RegisterTypeLibraries(HINF hinf, LPCWSTR szSection)
575577
p = PathAddBackslash(szPath);
576578
wcscpy(p, szName);
577579

580+
if (pItemsData && pNotify)
581+
{
582+
pNotify->Progress++;
583+
pNotify->CurrentItem = szName;
584+
585+
DPRINT("RegisterTypeLibraries: Start step %ld\n", pNotify->Progress);
586+
SendMessage(pItemsData->hwndDlg, PM_STEP_START, 0, (LPARAM)pNotify);
587+
}
588+
578589
hmod = LoadLibraryW(szPath);
579590
if (hmod == NULL)
580591
{
@@ -584,6 +595,12 @@ RegisterTypeLibraries(HINF hinf, LPCWSTR szSection)
584595

585596
__wine_register_resources(hmod);
586597

598+
if (pItemsData && pNotify)
599+
{
600+
DPRINT("RegisterTypeLibraries: End step %ld\n", pNotify->Progress);
601+
SendMessage(pItemsData->hwndDlg, PM_STEP_END, 0, (LPARAM)pNotify);
602+
}
603+
587604
} while (SetupFindNextLine(&InfContext, &InfContext));
588605

589606
return TRUE;
@@ -1073,7 +1090,7 @@ InstallLiveCD(VOID)
10731090
DPRINT1("SetupInstallFromInfSectionW failed!\n");
10741091
}
10751092

1076-
RegisterTypeLibraries(hSysSetupInf, L"TypeLibraries");
1093+
RegisterTypeLibraries(NULL, NULL, hSysSetupInf, L"TypeLibraries");
10771094
}
10781095
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
10791096
{

dll/win32/syssetup/wizard.c

Lines changed: 74 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ typedef struct _REGISTRATIONDATA
3333
ULONG DllCount;
3434
ULONG Registered;
3535
PVOID DefaultContext;
36+
PREGISTRATIONNOTIFY pNotify;
3637
} REGISTRATIONDATA, *PREGISTRATIONDATA;
3738

3839
typedef 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,
20812083
static
20822084
DWORD
20832085
RegisterDlls(
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

Comments
 (0)