Author: hbelusca
Date: Wed Jul 27 00:10:14 2016
New Revision: 72008
URL:
http://svn.reactos.org/svn/reactos?rev=72008&view=rev
Log:
[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).
Modified:
trunk/reactos/dll/win32/setupapi/devinst.c
trunk/reactos/dll/win32/setupapi/install.c
trunk/reactos/dll/win32/setupapi/misc.c
trunk/reactos/dll/win32/setupapi/parser.c
trunk/reactos/dll/win32/setupapi/setupapi.spec
trunk/reactos/dll/win32/setupapi/setupapi_private.h
trunk/reactos/dll/win32/setupapi/setupcab.c
Modified: trunk/reactos/dll/win32/setupapi/devinst.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/devinst…
==============================================================================
--- trunk/reactos/dll/win32/setupapi/devinst.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/setupapi/devinst.c [iso-8859-1] Wed Jul 27 00:10:14 2016
@@ -23,8 +23,6 @@
/* Unicode constants */
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 DotCoInstallers[] =
{'.','C','o','I','n','s','t','a','l','l','e','r','s',0};
static const WCHAR DotHW[] = {'.','H','W',0};
@@ -459,21 +457,16 @@
if (CurrentPlatform.cbSize != sizeof(SP_ALTPLATFORM_INFO))
{
/* That's the first time we go here. We need to fill in the structure
*/
- OSVERSIONINFOEX VersionInfo;
SYSTEM_INFO SystemInfo;
- VersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
- ret = GetVersionExW((OSVERSIONINFO*)&VersionInfo);
- if (!ret)
- goto done;
GetSystemInfo(&SystemInfo);
CurrentPlatform.cbSize = sizeof(SP_ALTPLATFORM_INFO);
- CurrentPlatform.Platform = VersionInfo.dwPlatformId;
- CurrentPlatform.MajorVersion = VersionInfo.dwMajorVersion;
- CurrentPlatform.MinorVersion = VersionInfo.dwMinorVersion;
+ CurrentPlatform.Platform = OsVersionInfo.dwPlatformId;
+ CurrentPlatform.MajorVersion = OsVersionInfo.dwMajorVersion;
+ CurrentPlatform.MinorVersion = OsVersionInfo.dwMinorVersion;
CurrentPlatform.ProcessorArchitecture =
SystemInfo.wProcessorArchitecture;
CurrentPlatform.Reserved = 0;
- CurrentProductType = VersionInfo.wProductType;
- CurrentSuiteMask = VersionInfo.wSuiteMask;
+ CurrentProductType = OsVersionInfo.wProductType;
+ CurrentSuiteMask = OsVersionInfo.wSuiteMask;
}
ProductType = CurrentProductType;
SuiteMask = CurrentSuiteMask;
@@ -489,6 +482,7 @@
CallbackInfo.BestScore4 = ULONG_MAX;
CallbackInfo.BestScore5 = ULONG_MAX;
strcpyW(CallbackInfo.BestSection, InfSectionName);
+ TRACE("EnumerateSectionsStartingWith(InfSectionName = %S)\n",
InfSectionName);
if (!EnumerateSectionsStartingWith(
InfHandle,
InfSectionName,
@@ -498,6 +492,7 @@
SetLastError(ERROR_GEN_FAILURE);
goto done;
}
+ TRACE("CallbackInfo.BestSection = %S\n", CallbackInfo.BestSection);
dwFullLength = lstrlenW(CallbackInfo.BestSection);
if (RequiredSize != NULL)
@@ -1011,7 +1006,7 @@
dwLength = MAX_CLASS_NAME_LEN * sizeof(WCHAR);
if (!RegQueryValueExW(hClassKey,
- Class,
+ REGSTR_VAL_CLASS,
NULL,
NULL,
(LPBYTE)szClassName,
@@ -1163,7 +1158,7 @@
return FALSE;
/* 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);
/* Make sure we got the data */
@@ -3613,7 +3608,7 @@
if (!SetupGetLineTextW(NULL,
hInf,
Version,
- ClassGUID,
+ REGSTR_VAL_CLASSGUID,
Buffer,
MAX_PATH,
&RequiredSize))
@@ -3634,7 +3629,7 @@
if (!SetupGetLineTextW(NULL,
hInf,
Version,
- Class,
+ REGSTR_VAL_CLASS,
Buffer,
MAX_PATH,
&RequiredSize))
@@ -3657,7 +3652,7 @@
}
if (RegSetValueExW(hClassKey,
- Class,
+ REGSTR_VAL_CLASS,
0,
REG_SZ,
(LPBYTE)Buffer,
Modified: trunk/reactos/dll/win32/setupapi/install.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/install…
==============================================================================
--- trunk/reactos/dll/win32/setupapi/install.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/setupapi/install.c [iso-8859-1] Wed Jul 27 00:10:14 2016
@@ -1459,25 +1459,25 @@
*/
void WINAPI InstallHinfSectionW( HWND hwnd, HINSTANCE handle, LPCWSTR cmdline, INT show
)
{
+ BOOL ret = FALSE;
WCHAR *s, *path, section[MAX_PATH];
void *callback_context = NULL;
DWORD SectionNameLength;
UINT mode;
HINF hinf = INVALID_HANDLE_VALUE;
BOOL bRebootRequired = FALSE;
- BOOL ret;
TRACE("hwnd %p, handle %p, cmdline %s\n", hwnd, handle,
debugstr_w(cmdline));
lstrcpynW( section, cmdline, MAX_PATH );
- if (!(s = strchrW( section, ' ' ))) return;
+ if (!(s = strchrW( section, ' ' ))) goto cleanup;
*s++ = 0;
while (*s == ' ') s++;
mode = atoiW( s );
/* 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++;
path = s;
@@ -1576,6 +1576,12 @@
SetupTermDefaultQueueCallback( callback_context );
if ( hinf != INVALID_HANDLE_VALUE )
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);
+ }
}
Modified: trunk/reactos/dll/win32/setupapi/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/misc.c?…
==============================================================================
--- trunk/reactos/dll/win32/setupapi/misc.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/setupapi/misc.c [iso-8859-1] Wed Jul 27 00:10:14 2016
@@ -838,25 +838,37 @@
}
-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.@)
*/
DWORD WINAPI pSetupGetGlobalFlags(void)
{
+ return GlobalSetupFlags;
+}
+
+/***********************************************************************
+ * pSetupModifyGlobalFlags (SETUPAPI.@)
+ */
+void WINAPI pSetupModifyGlobalFlags( DWORD mask, DWORD flags )
+{
FIXME( "stub\n" );
- return global_flags;
-}
-
+ GlobalSetupFlags = (GlobalSetupFlags & ~mask) | (flags & mask);
+}
/***********************************************************************
* pSetupSetGlobalFlags (SETUPAPI.@)
*/
void WINAPI pSetupSetGlobalFlags( DWORD flags )
{
- global_flags = flags;
-}
+ pSetupModifyGlobalFlags(0xFFFFFFFF, flags);
+}
+
/***********************************************************************
* AssertFail (SETUPAPI.@)
Modified: trunk/reactos/dll/win32/setupapi/parser.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/parser.…
==============================================================================
--- trunk/reactos/dll/win32/setupapi/parser.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/setupapi/parser.c [iso-8859-1] Wed Jul 27 00:10:14 2016
@@ -2383,10 +2383,12 @@
unsigned int i;
for (i = 0; i < file->nb_sections; i++)
+ {
if (strncmpiW(pStr, file->sections[i]->name, len) == 0)
{
if (!Callback(file->sections[i]->name, Context))
return FALSE;
}
+ }
return TRUE;
}
Modified: trunk/reactos/dll/win32/setupapi/setupapi.spec
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/setupap…
==============================================================================
--- trunk/reactos/dll/win32/setupapi/setupapi.spec [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/setupapi/setupapi.spec [iso-8859-1] Wed Jul 27 00:10:14 2016
@@ -569,7 +569,7 @@
@ stdcall pSetupIsUserAdmin()
@ stub pSetupMakeSurePathExists
@ stub pSetupMalloc
-@ stub pSetupModifyGlobalFlags
+@ stdcall pSetupModifyGlobalFlags(long long)
@ stdcall pSetupMultiByteToUnicode(str long)
@ stdcall pSetupOpenAndMapFileForRead(wstr ptr ptr ptr ptr)
@ stub pSetupOutOfMemory
Modified: trunk/reactos/dll/win32/setupapi/setupapi_private.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/setupap…
==============================================================================
--- trunk/reactos/dll/win32/setupapi/setupapi_private.h [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/setupapi/setupapi_private.h [iso-8859-1] Wed Jul 27 00:10:14
2016
@@ -281,7 +281,15 @@
#define _S_IREAD 0x0100
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 */
Modified: trunk/reactos/dll/win32/setupapi/setupcab.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/setupapi/setupca…
==============================================================================
--- trunk/reactos/dll/win32/setupapi/setupcab.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/setupapi/setupcab.c [iso-8859-1] Wed Jul 27 00:10:14 2016
@@ -29,10 +29,10 @@
#include <share.h>
#include <fdi.h>
-HINSTANCE hInstance = 0;
-OSVERSIONINFOW OsVersionInfo;
-
-static HINSTANCE CABINET_hInstance = 0;
+HINSTANCE hInstance = NULL;
+OSVERSIONINFOEXW OsVersionInfo;
+
+static HINSTANCE CABINET_hInstance = NULL;
static HFDI (__cdecl *sc_FDICreate)(PFNALLOC, PFNFREE, PFNOPEN,
PFNREAD, PFNWRITE, PFNCLOSE, PFNSEEK, int, PERF);
@@ -652,8 +652,8 @@
switch (fdwReason) {
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hinstDLL);
- OsVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
- if (!GetVersionExW(&OsVersionInfo))
+ OsVersionInfo.dwOSVersionInfoSize = sizeof(OsVersionInfo);
+ if (!GetVersionExW((POSVERSIONINFOW)&OsVersionInfo))
return FALSE;
hInstance = (HINSTANCE)hinstDLL;
break;