+
+ if (SystemInfo.wProcessorArchitecture != PROCESSOR_ARCHITECTURE_UNKNOWN)
+ StringCchCatW(Installer, ARRAYSIZE(Installer), L"\\");
+ StringCchCatW(Installer, ARRAYSIZE(Installer), lpInstallerName);
+
+ dwAttribs = GetFileAttributesW(Installer);
+ if ((dwAttribs != INVALID_FILE_ATTRIBUTES) &&
+ !(dwAttribs & FILE_ATTRIBUTE_DIRECTORY))
+ {
+ /* We have found the installer */
+ if (StartProcess(Installer))
+ return TRUE;
+ }
+
+ ERR("Failed to start the installer '%s', trying alternative.\n", debugstr_w(Installer));
+
+ /*
+ * We failed. Try to find the installer from either the current
+ * ReactOS installation directory, or from our current directory.
+ */
+ *Installer = UNICODE_NULL;
+ /* Alternatively one can use SharedUserData->NtSystemRoot */
+ if (GetSystemWindowsDirectoryW(Installer, ARRAYSIZE(Installer) - cchInstallerNameLen - 1))
+ StringCchCatW(Installer, ARRAYSIZE(Installer), L"\\");
+ StringCchCatW(Installer, ARRAYSIZE(Installer), lpInstallerName);
+
+ dwAttribs = GetFileAttributesW(Installer);
+ if ((dwAttribs != INVALID_FILE_ATTRIBUTES) &&
+ !(dwAttribs & FILE_ATTRIBUTE_DIRECTORY))
+ {
+ /* We have found the installer */
+ if (StartProcess(Installer))
+ return TRUE;
+ }
+
+ /* We failed. Display an error message and quit. */
+ ERR("Failed to start the installer '%s'.\n", debugstr_w(Installer));
+ LoadStringW(GetModuleHandle(NULL), IDS_INSTALLER_FAIL, szMsg, ARRAYSIZE(szMsg));
+ MessageBoxW(NULL, szMsg, NULL, MB_OK);
+ return FALSE;