/* 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};
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;
CallbackInfo.BestScore4 = ULONG_MAX;
CallbackInfo.BestScore5 = ULONG_MAX;
strcpyW(CallbackInfo.BestSection, InfSectionName);
+ TRACE("EnumerateSectionsStartingWith(InfSectionName = %S)\n", InfSectionName);
if (!EnumerateSectionsStartingWith(
InfHandle,
InfSectionName,
SetLastError(ERROR_GEN_FAILURE);
goto done;
}
+ TRACE("CallbackInfo.BestSection = %S\n", CallbackInfo.BestSection);
dwFullLength = lstrlenW(CallbackInfo.BestSection);
if (RequiredSize != NULL)
dwLength = MAX_CLASS_NAME_LEN * sizeof(WCHAR);
if (!RegQueryValueExW(hClassKey,
- Class,
+ REGSTR_VAL_CLASS,
NULL,
NULL,
(LPBYTE)szClassName,
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 */
if (!SetupGetLineTextW(NULL,
hInf,
Version,
- ClassGUID,
+ REGSTR_VAL_CLASSGUID,
Buffer,
MAX_PATH,
&RequiredSize))
if (!SetupGetLineTextW(NULL,
hInf,
Version,
- Class,
+ REGSTR_VAL_CLASS,
Buffer,
MAX_PATH,
&RequiredSize))
}
if (RegSetValueExW(hClassKey,
- Class,
+ REGSTR_VAL_CLASS,
0,
REG_SZ,
(LPBYTE)Buffer,
*/
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;
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);
+ }
}
}
-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)
{
- FIXME( "stub\n" );
- return global_flags;
+ return GlobalSetupFlags;
}
+/***********************************************************************
+ * pSetupModifyGlobalFlags (SETUPAPI.@)
+ */
+void WINAPI pSetupModifyGlobalFlags( DWORD mask, DWORD flags )
+{
+ FIXME( "stub\n" );
+ GlobalSetupFlags = (GlobalSetupFlags & ~mask) | (flags & mask);
+}
/***********************************************************************
* pSetupSetGlobalFlags (SETUPAPI.@)
*/
void WINAPI pSetupSetGlobalFlags( DWORD flags )
{
- global_flags = flags;
+ pSetupModifyGlobalFlags(0xFFFFFFFF, flags);
}
+
/***********************************************************************
* AssertFail (SETUPAPI.@)
*
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;
}
@ 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
#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 */
#include <share.h>
#include <fdi.h>
-HINSTANCE hInstance = 0;
-OSVERSIONINFOW OsVersionInfo;
+HINSTANCE hInstance = NULL;
+OSVERSIONINFOEXW OsVersionInfo;
-static HINSTANCE CABINET_hInstance = 0;
+static HINSTANCE CABINET_hInstance = NULL;
static HFDI (__cdecl *sc_FDICreate)(PFNALLOC, PFNFREE, PFNOPEN,
PFNREAD, PFNWRITE, PFNCLOSE, PFNSEEK, int, PERF);
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;