if (RegQueryValueExW( hkey, value, NULL, &type, NULL, &size )) return;
if (type != REG_MULTI_SZ) return;
- if (!(buffer = HeapAlloc( GetProcessHeap(), 0, (size + str_size) * sizeof(WCHAR) ))) return;
+ size = size + str_size * sizeof(WCHAR) ;
+ if (!(buffer = HeapAlloc( GetProcessHeap(), 0, size))) return;
if (RegQueryValueExW( hkey, value, NULL, NULL, (BYTE *)buffer, &size )) goto done;
/* compare each string against all the existing ones */
if (RegQueryValueExW( hkey, value, NULL, &type, NULL, &size )) return;
if (type != REG_MULTI_SZ) return;
/* allocate double the size, one for value before and one for after */
- if (!(buffer = HeapAlloc( GetProcessHeap(), 0, size * 2 * sizeof(WCHAR) ))) return;
+ if (!(buffer = HeapAlloc( GetProcessHeap(), 0, size * 2))) return;
if (RegQueryValueExW( hkey, value, NULL, NULL, (BYTE *)buffer, &size )) goto done;
src = buffer;
dst = buffer + size;
*/
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 );
+
+#ifdef CORE_11689_IS_FIXED
+ // TODO: Localize the error string.
+ if (!ret && !(GlobalSetupFlags & PSPGF_NONINTERACTIVE))
+ {
+ MessageBoxW(hwnd, section, L"setupapi.dll: An error happened...", MB_ICONERROR | MB_OK);
+ }
+#endif
}
/* Handle Win32-services differently */
if (ServiceType & SERVICE_WIN32)
{
- Win32Length = (ServiceLength -
- RosDirLength - 1 + 13) * sizeof(WCHAR);
- /* -1 to not count the separator after C:\ReactOS
- wcslen(L"%SystemRoot%\\") = 13*sizeof(wchar_t) */
+ Win32Length = (ServiceLength - RosDirLength) * sizeof(WCHAR)
+ - sizeof(L'\\') + sizeof(L"%SystemRoot%\\");
Buffer = MyMalloc(Win32Length);
wcscpy(Buffer, L"%SystemRoot%\\");