mirror of
https://github.com/reactos/reactos.git
synced 2025-06-17 00:08:32 +00:00
[SETUPAPI]
- Transform the cached OsVersionInfo structure into a OSVERSIONINFOEXW that is then reused in SetupDiGetActualSectionToInstallExW. - Remove few unused hardcoded strings. - Add two TRACEs in SetupDiGetActualSectionToInstallExW to debug diverse INF file installation problems. - parser.c: enclose the contents of the for-loop inside braces. - Implement pSetupSetGlobalFlags and pSetupModifyGlobalFlags, see https://msdn.microsoft.com/en-us/library/bb432397(v=vs.85).aspx - Popup an error message box in InstallHinfSectionW if an error happened and if interactive setup is allowed (through the global setup flags). svn path=/trunk/; revision=72008
This commit is contained in:
parent
79ce70c1dd
commit
86ff038c51
7 changed files with 54 additions and 31 deletions
|
@ -23,8 +23,6 @@
|
||||||
|
|
||||||
/* Unicode constants */
|
/* Unicode constants */
|
||||||
static const WCHAR BackSlash[] = {'\\',0};
|
static const WCHAR BackSlash[] = {'\\',0};
|
||||||
static const WCHAR ClassGUID[] = {'C','l','a','s','s','G','U','I','D',0};
|
|
||||||
static const WCHAR Class[] = {'C','l','a','s','s',0};
|
|
||||||
static const WCHAR DateFormat[] = {'%','u','-','%','u','-','%','u',0};
|
static const WCHAR DateFormat[] = {'%','u','-','%','u','-','%','u',0};
|
||||||
static const WCHAR DotCoInstallers[] = {'.','C','o','I','n','s','t','a','l','l','e','r','s',0};
|
static const WCHAR DotCoInstallers[] = {'.','C','o','I','n','s','t','a','l','l','e','r','s',0};
|
||||||
static const WCHAR DotHW[] = {'.','H','W',0};
|
static const WCHAR DotHW[] = {'.','H','W',0};
|
||||||
|
@ -459,21 +457,16 @@ SetupDiGetActualSectionToInstallExW(
|
||||||
if (CurrentPlatform.cbSize != sizeof(SP_ALTPLATFORM_INFO))
|
if (CurrentPlatform.cbSize != sizeof(SP_ALTPLATFORM_INFO))
|
||||||
{
|
{
|
||||||
/* That's the first time we go here. We need to fill in the structure */
|
/* That's the first time we go here. We need to fill in the structure */
|
||||||
OSVERSIONINFOEX VersionInfo;
|
|
||||||
SYSTEM_INFO SystemInfo;
|
SYSTEM_INFO SystemInfo;
|
||||||
VersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
|
|
||||||
ret = GetVersionExW((OSVERSIONINFO*)&VersionInfo);
|
|
||||||
if (!ret)
|
|
||||||
goto done;
|
|
||||||
GetSystemInfo(&SystemInfo);
|
GetSystemInfo(&SystemInfo);
|
||||||
CurrentPlatform.cbSize = sizeof(SP_ALTPLATFORM_INFO);
|
CurrentPlatform.cbSize = sizeof(SP_ALTPLATFORM_INFO);
|
||||||
CurrentPlatform.Platform = VersionInfo.dwPlatformId;
|
CurrentPlatform.Platform = OsVersionInfo.dwPlatformId;
|
||||||
CurrentPlatform.MajorVersion = VersionInfo.dwMajorVersion;
|
CurrentPlatform.MajorVersion = OsVersionInfo.dwMajorVersion;
|
||||||
CurrentPlatform.MinorVersion = VersionInfo.dwMinorVersion;
|
CurrentPlatform.MinorVersion = OsVersionInfo.dwMinorVersion;
|
||||||
CurrentPlatform.ProcessorArchitecture = SystemInfo.wProcessorArchitecture;
|
CurrentPlatform.ProcessorArchitecture = SystemInfo.wProcessorArchitecture;
|
||||||
CurrentPlatform.Reserved = 0;
|
CurrentPlatform.Reserved = 0;
|
||||||
CurrentProductType = VersionInfo.wProductType;
|
CurrentProductType = OsVersionInfo.wProductType;
|
||||||
CurrentSuiteMask = VersionInfo.wSuiteMask;
|
CurrentSuiteMask = OsVersionInfo.wSuiteMask;
|
||||||
}
|
}
|
||||||
ProductType = CurrentProductType;
|
ProductType = CurrentProductType;
|
||||||
SuiteMask = CurrentSuiteMask;
|
SuiteMask = CurrentSuiteMask;
|
||||||
|
@ -489,6 +482,7 @@ SetupDiGetActualSectionToInstallExW(
|
||||||
CallbackInfo.BestScore4 = ULONG_MAX;
|
CallbackInfo.BestScore4 = ULONG_MAX;
|
||||||
CallbackInfo.BestScore5 = ULONG_MAX;
|
CallbackInfo.BestScore5 = ULONG_MAX;
|
||||||
strcpyW(CallbackInfo.BestSection, InfSectionName);
|
strcpyW(CallbackInfo.BestSection, InfSectionName);
|
||||||
|
TRACE("EnumerateSectionsStartingWith(InfSectionName = %S)\n", InfSectionName);
|
||||||
if (!EnumerateSectionsStartingWith(
|
if (!EnumerateSectionsStartingWith(
|
||||||
InfHandle,
|
InfHandle,
|
||||||
InfSectionName,
|
InfSectionName,
|
||||||
|
@ -498,6 +492,7 @@ SetupDiGetActualSectionToInstallExW(
|
||||||
SetLastError(ERROR_GEN_FAILURE);
|
SetLastError(ERROR_GEN_FAILURE);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
TRACE("CallbackInfo.BestSection = %S\n", CallbackInfo.BestSection);
|
||||||
|
|
||||||
dwFullLength = lstrlenW(CallbackInfo.BestSection);
|
dwFullLength = lstrlenW(CallbackInfo.BestSection);
|
||||||
if (RequiredSize != NULL)
|
if (RequiredSize != NULL)
|
||||||
|
@ -1011,7 +1006,7 @@ BOOL WINAPI SetupDiClassGuidsFromNameExW(
|
||||||
|
|
||||||
dwLength = MAX_CLASS_NAME_LEN * sizeof(WCHAR);
|
dwLength = MAX_CLASS_NAME_LEN * sizeof(WCHAR);
|
||||||
if (!RegQueryValueExW(hClassKey,
|
if (!RegQueryValueExW(hClassKey,
|
||||||
Class,
|
REGSTR_VAL_CLASS,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
(LPBYTE)szClassName,
|
(LPBYTE)szClassName,
|
||||||
|
@ -1163,7 +1158,7 @@ BOOL WINAPI SetupDiClassNameFromGuidExW(
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* Retrieve the class name data and close the key */
|
/* Retrieve the class name data and close the key */
|
||||||
rc = QueryRegistryValue(hKey, Class, (LPBYTE *) &Buffer, &dwRegType, &dwLength);
|
rc = QueryRegistryValue(hKey, REGSTR_VAL_CLASS, (LPBYTE *) &Buffer, &dwRegType, &dwLength);
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
|
|
||||||
/* Make sure we got the data */
|
/* Make sure we got the data */
|
||||||
|
@ -3613,7 +3608,7 @@ HKEY SETUP_CreateClassKey(HINF hInf)
|
||||||
if (!SetupGetLineTextW(NULL,
|
if (!SetupGetLineTextW(NULL,
|
||||||
hInf,
|
hInf,
|
||||||
Version,
|
Version,
|
||||||
ClassGUID,
|
REGSTR_VAL_CLASSGUID,
|
||||||
Buffer,
|
Buffer,
|
||||||
MAX_PATH,
|
MAX_PATH,
|
||||||
&RequiredSize))
|
&RequiredSize))
|
||||||
|
@ -3634,7 +3629,7 @@ HKEY SETUP_CreateClassKey(HINF hInf)
|
||||||
if (!SetupGetLineTextW(NULL,
|
if (!SetupGetLineTextW(NULL,
|
||||||
hInf,
|
hInf,
|
||||||
Version,
|
Version,
|
||||||
Class,
|
REGSTR_VAL_CLASS,
|
||||||
Buffer,
|
Buffer,
|
||||||
MAX_PATH,
|
MAX_PATH,
|
||||||
&RequiredSize))
|
&RequiredSize))
|
||||||
|
@ -3657,7 +3652,7 @@ HKEY SETUP_CreateClassKey(HINF hInf)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RegSetValueExW(hClassKey,
|
if (RegSetValueExW(hClassKey,
|
||||||
Class,
|
REGSTR_VAL_CLASS,
|
||||||
0,
|
0,
|
||||||
REG_SZ,
|
REG_SZ,
|
||||||
(LPBYTE)Buffer,
|
(LPBYTE)Buffer,
|
||||||
|
|
|
@ -1459,25 +1459,25 @@ BOOL WINAPI SetupInstallFromInfSectionW( HWND owner, HINF hinf, PCWSTR section,
|
||||||
*/
|
*/
|
||||||
void WINAPI InstallHinfSectionW( HWND hwnd, HINSTANCE handle, LPCWSTR cmdline, INT show )
|
void WINAPI InstallHinfSectionW( HWND hwnd, HINSTANCE handle, LPCWSTR cmdline, INT show )
|
||||||
{
|
{
|
||||||
|
BOOL ret = FALSE;
|
||||||
WCHAR *s, *path, section[MAX_PATH];
|
WCHAR *s, *path, section[MAX_PATH];
|
||||||
void *callback_context = NULL;
|
void *callback_context = NULL;
|
||||||
DWORD SectionNameLength;
|
DWORD SectionNameLength;
|
||||||
UINT mode;
|
UINT mode;
|
||||||
HINF hinf = INVALID_HANDLE_VALUE;
|
HINF hinf = INVALID_HANDLE_VALUE;
|
||||||
BOOL bRebootRequired = FALSE;
|
BOOL bRebootRequired = FALSE;
|
||||||
BOOL ret;
|
|
||||||
|
|
||||||
TRACE("hwnd %p, handle %p, cmdline %s\n", hwnd, handle, debugstr_w(cmdline));
|
TRACE("hwnd %p, handle %p, cmdline %s\n", hwnd, handle, debugstr_w(cmdline));
|
||||||
|
|
||||||
lstrcpynW( section, cmdline, MAX_PATH );
|
lstrcpynW( section, cmdline, MAX_PATH );
|
||||||
|
|
||||||
if (!(s = strchrW( section, ' ' ))) return;
|
if (!(s = strchrW( section, ' ' ))) goto cleanup;
|
||||||
*s++ = 0;
|
*s++ = 0;
|
||||||
while (*s == ' ') s++;
|
while (*s == ' ') s++;
|
||||||
mode = atoiW( s );
|
mode = atoiW( s );
|
||||||
|
|
||||||
/* quoted paths are not allowed on native, the rest of the command line is taken as the path */
|
/* quoted paths are not allowed on native, the rest of the command line is taken as the path */
|
||||||
if (!(s = strchrW( s, ' ' ))) return;
|
if (!(s = strchrW( s, ' ' ))) goto cleanup;
|
||||||
while (*s == ' ') s++;
|
while (*s == ' ') s++;
|
||||||
path = s;
|
path = s;
|
||||||
|
|
||||||
|
@ -1576,6 +1576,12 @@ cleanup:
|
||||||
SetupTermDefaultQueueCallback( callback_context );
|
SetupTermDefaultQueueCallback( callback_context );
|
||||||
if ( hinf != INVALID_HANDLE_VALUE )
|
if ( hinf != INVALID_HANDLE_VALUE )
|
||||||
SetupCloseInfFile( hinf );
|
SetupCloseInfFile( hinf );
|
||||||
|
|
||||||
|
// TODO: Localize the error string.
|
||||||
|
if (!ret && !(GlobalSetupFlags & PSPGF_NONINTERACTIVE))
|
||||||
|
{
|
||||||
|
MessageBoxW(hwnd, section, L"setupapi.dll: An error happened...", MB_ICONERROR | MB_OK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -838,26 +838,38 @@ DWORD WINAPI RetreiveFileSecurity(LPCWSTR lpFileName,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static DWORD global_flags = 0; /* FIXME: what should be in here? */
|
/*
|
||||||
|
* See: https://msdn.microsoft.com/en-us/library/bb432397(v=vs.85).aspx
|
||||||
|
* for more information.
|
||||||
|
*/
|
||||||
|
DWORD GlobalSetupFlags = 0;
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* pSetupGetGlobalFlags (SETUPAPI.@)
|
* pSetupGetGlobalFlags (SETUPAPI.@)
|
||||||
*/
|
*/
|
||||||
DWORD WINAPI pSetupGetGlobalFlags(void)
|
DWORD WINAPI pSetupGetGlobalFlags(void)
|
||||||
{
|
{
|
||||||
FIXME( "stub\n" );
|
return GlobalSetupFlags;
|
||||||
return global_flags;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* pSetupModifyGlobalFlags (SETUPAPI.@)
|
||||||
|
*/
|
||||||
|
void WINAPI pSetupModifyGlobalFlags( DWORD mask, DWORD flags )
|
||||||
|
{
|
||||||
|
FIXME( "stub\n" );
|
||||||
|
GlobalSetupFlags = (GlobalSetupFlags & ~mask) | (flags & mask);
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* pSetupSetGlobalFlags (SETUPAPI.@)
|
* pSetupSetGlobalFlags (SETUPAPI.@)
|
||||||
*/
|
*/
|
||||||
void WINAPI pSetupSetGlobalFlags( DWORD flags )
|
void WINAPI pSetupSetGlobalFlags( DWORD flags )
|
||||||
{
|
{
|
||||||
global_flags = flags;
|
pSetupModifyGlobalFlags(0xFFFFFFFF, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* AssertFail (SETUPAPI.@)
|
* AssertFail (SETUPAPI.@)
|
||||||
*
|
*
|
||||||
|
|
|
@ -2383,10 +2383,12 @@ BOOL EnumerateSectionsStartingWith(
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i = 0; i < file->nb_sections; i++)
|
for (i = 0; i < file->nb_sections; i++)
|
||||||
|
{
|
||||||
if (strncmpiW(pStr, file->sections[i]->name, len) == 0)
|
if (strncmpiW(pStr, file->sections[i]->name, len) == 0)
|
||||||
{
|
{
|
||||||
if (!Callback(file->sections[i]->name, Context))
|
if (!Callback(file->sections[i]->name, Context))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -569,7 +569,7 @@
|
||||||
@ stdcall pSetupIsUserAdmin()
|
@ stdcall pSetupIsUserAdmin()
|
||||||
@ stub pSetupMakeSurePathExists
|
@ stub pSetupMakeSurePathExists
|
||||||
@ stub pSetupMalloc
|
@ stub pSetupMalloc
|
||||||
@ stub pSetupModifyGlobalFlags
|
@ stdcall pSetupModifyGlobalFlags(long long)
|
||||||
@ stdcall pSetupMultiByteToUnicode(str long)
|
@ stdcall pSetupMultiByteToUnicode(str long)
|
||||||
@ stdcall pSetupOpenAndMapFileForRead(wstr ptr ptr ptr ptr)
|
@ stdcall pSetupOpenAndMapFileForRead(wstr ptr ptr ptr ptr)
|
||||||
@ stub pSetupOutOfMemory
|
@ stub pSetupOutOfMemory
|
||||||
|
|
|
@ -281,7 +281,15 @@ UINT CALLBACK QUEUE_callback_WtoA( void *context, UINT notification, UINT_PTR, U
|
||||||
#define _S_IREAD 0x0100
|
#define _S_IREAD 0x0100
|
||||||
|
|
||||||
extern HINSTANCE hInstance;
|
extern HINSTANCE hInstance;
|
||||||
extern OSVERSIONINFOW OsVersionInfo;
|
extern OSVERSIONINFOEXW OsVersionInfo;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* See: https://msdn.microsoft.com/en-us/library/bb432397(v=vs.85).aspx
|
||||||
|
* for more information.
|
||||||
|
*/
|
||||||
|
extern DWORD GlobalSetupFlags;
|
||||||
|
#define PSPGF_NO_BACKUP 0x0002
|
||||||
|
#define PSPGF_NONINTERACTIVE 0x0004
|
||||||
|
|
||||||
/* devinst.c */
|
/* devinst.c */
|
||||||
|
|
||||||
|
|
|
@ -29,10 +29,10 @@
|
||||||
#include <share.h>
|
#include <share.h>
|
||||||
#include <fdi.h>
|
#include <fdi.h>
|
||||||
|
|
||||||
HINSTANCE hInstance = 0;
|
HINSTANCE hInstance = NULL;
|
||||||
OSVERSIONINFOW OsVersionInfo;
|
OSVERSIONINFOEXW OsVersionInfo;
|
||||||
|
|
||||||
static HINSTANCE CABINET_hInstance = 0;
|
static HINSTANCE CABINET_hInstance = NULL;
|
||||||
|
|
||||||
static HFDI (__cdecl *sc_FDICreate)(PFNALLOC, PFNFREE, PFNOPEN,
|
static HFDI (__cdecl *sc_FDICreate)(PFNALLOC, PFNFREE, PFNOPEN,
|
||||||
PFNREAD, PFNWRITE, PFNCLOSE, PFNSEEK, int, PERF);
|
PFNREAD, PFNWRITE, PFNCLOSE, PFNSEEK, int, PERF);
|
||||||
|
@ -652,8 +652,8 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||||
switch (fdwReason) {
|
switch (fdwReason) {
|
||||||
case DLL_PROCESS_ATTACH:
|
case DLL_PROCESS_ATTACH:
|
||||||
DisableThreadLibraryCalls(hinstDLL);
|
DisableThreadLibraryCalls(hinstDLL);
|
||||||
OsVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
|
OsVersionInfo.dwOSVersionInfoSize = sizeof(OsVersionInfo);
|
||||||
if (!GetVersionExW(&OsVersionInfo))
|
if (!GetVersionExW((POSVERSIONINFOW)&OsVersionInfo))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
hInstance = (HINSTANCE)hinstDLL;
|
hInstance = (HINSTANCE)hinstDLL;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue