mirror of
https://github.com/reactos/reactos.git
synced 2025-04-20 12:29:56 +00:00
[SYSSETUP]
- Fix GetRosInstallCD - GetLogicalDriveStringsW returns drive paths, not letters. - When building intl.cpl command line for unattended setup don't use %S - swprint interprets it as multi-byte string. Use "%s" instead. This bug caused yesterdays KVM problems. svn path=/trunk/; revision=54971
This commit is contained in:
parent
e94b30cdf1
commit
cb74343620
1 changed files with 24 additions and 38 deletions
|
@ -46,7 +46,7 @@ SETUPDATA SetupData;
|
|||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
BOOL
|
||||
GetRosInstallCD(WCHAR * szPath, DWORD dwPathLength);
|
||||
GetRosInstallCD(WCHAR *pwszPath, DWORD cchPathMax);
|
||||
|
||||
#ifdef VMWINST
|
||||
static BOOL
|
||||
|
@ -883,7 +883,6 @@ LocalePageDlgProc(HWND hwndDlg,
|
|||
LPARAM lParam)
|
||||
{
|
||||
PSETUPDATA SetupData;
|
||||
WCHAR szBuffer[1024];
|
||||
|
||||
/* Retrieve pointer to the global setup data */
|
||||
SetupData = (PSETUPDATA)GetWindowLongPtr (hwndDlg, GWL_USERDATA);
|
||||
|
@ -907,18 +906,12 @@ LocalePageDlgProc(HWND hwndDlg,
|
|||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDC_CUSTOMLOCALE:
|
||||
{
|
||||
wcscpy(szBuffer, L"rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,5");
|
||||
RunControlPanelApplet(hwndDlg, szBuffer);
|
||||
RunControlPanelApplet(hwndDlg, L"rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,5");
|
||||
/* FIXME: Update input locale name */
|
||||
}
|
||||
break;
|
||||
|
||||
case IDC_CUSTOMLAYOUT:
|
||||
{
|
||||
wcscpy(szBuffer, L"rundll32.exe shell32.dll,Control_RunDLL input.dll,@1");
|
||||
RunControlPanelApplet(hwndDlg, szBuffer);
|
||||
}
|
||||
RunControlPanelApplet(hwndDlg, L"rundll32.exe shell32.dll,Control_RunDLL input.dll,@1");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -935,17 +928,13 @@ LocalePageDlgProc(HWND hwndDlg,
|
|||
PropSheet_SetWizButtons(GetParent(hwndDlg), PSWIZB_BACK | PSWIZB_NEXT);
|
||||
if (SetupData->UnattendSetup)
|
||||
{
|
||||
WCHAR szPath[MAX_PATH];
|
||||
if (GetRosInstallCD(szPath, MAX_PATH))
|
||||
{
|
||||
swprintf(szBuffer, L"rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,/f:\"%S\\reactos\\unattend.inf\"", szPath);
|
||||
}
|
||||
WCHAR wszPath[MAX_PATH], wszBuf[1024];
|
||||
if (GetRosInstallCD(wszPath, _countof(wszPath)))
|
||||
swprintf(wszBuf, L"rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,/f:\"%sreactos\\unattend.inf\"", wszPath);
|
||||
else
|
||||
{
|
||||
wcscpy(szBuffer, L"rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,/f:\"unattend.inf\"");
|
||||
}
|
||||
wcscpy(wszBuf, L"rundll32.exe shell32.dll,Control_RunDLL intl.cpl,,/f:\"unattend.inf\"");
|
||||
|
||||
RunControlPanelApplet(hwndDlg, szBuffer);
|
||||
RunControlPanelApplet(hwndDlg, wszBuf);
|
||||
SetWindowLongPtr(hwndDlg, DWL_MSGRESULT, IDD_DATETIMEPAGE);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -2238,35 +2227,32 @@ ProcessUnattendInf(HINF hUnattendedInf)
|
|||
*/
|
||||
|
||||
BOOL
|
||||
GetRosInstallCD(WCHAR * szPath, DWORD dwPathLength)
|
||||
GetRosInstallCD(WCHAR *pwszPath, DWORD cchPathMax)
|
||||
{
|
||||
WCHAR szDrives[512];
|
||||
WCHAR szDrive[] = L"D:\\";
|
||||
DWORD dwLength, dwIndex;
|
||||
WCHAR * pDrive;
|
||||
dwLength = GetLogicalDriveStringsW(sizeof(szDrives) / sizeof(WCHAR), szDrives);
|
||||
WCHAR wszDrives[512];
|
||||
DWORD cchDrives;
|
||||
WCHAR *pwszDrive;
|
||||
|
||||
if (dwLength > (sizeof(szDrives) / sizeof(WCHAR)) || dwLength == 0)
|
||||
cchDrives = GetLogicalDriveStringsW(_countof(wszDrives) - 1, wszDrives);
|
||||
if (cchDrives == 0 || cchDrives >= _countof(wszDrives))
|
||||
{
|
||||
/* buffer too small or failure */
|
||||
LogItem(SYSSETUP_SEVERITY_INFORMATION, L"GetLogicalDriveStringsW failed");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
pDrive = szDrives;
|
||||
for (dwIndex = 0; dwIndex < dwLength; dwIndex++)
|
||||
for (pwszDrive = wszDrives; pwszDrive[0]; pwszDrive += wcslen(pwszDrive) + 1)
|
||||
{
|
||||
szDrive[0] = pDrive[dwIndex];
|
||||
if (GetDriveTypeW(szDrive) == DRIVE_CDROM)
|
||||
if (GetDriveTypeW(pwszDrive) == DRIVE_CDROM)
|
||||
{
|
||||
WCHAR szBuffer[MAX_PATH];
|
||||
wcscpy(szBuffer, szDrive);
|
||||
wcscat(szBuffer, L"reactos\\system32\\ntoskrnl.exe");
|
||||
LogItem(SYSSETUP_SEVERITY_INFORMATION, szBuffer);
|
||||
if (GetFileAttributesW(szBuffer) != INVALID_FILE_ATTRIBUTES)
|
||||
WCHAR wszBuf[MAX_PATH];
|
||||
wsprintf(wszBuf, L"%sreactos\\system32\\ntoskrnl.exe", pwszDrive);
|
||||
LogItem(SYSSETUP_SEVERITY_INFORMATION, wszBuf);
|
||||
if (GetFileAttributesW(wszBuf) != INVALID_FILE_ATTRIBUTES)
|
||||
{
|
||||
/* the file exists, so this is the right drive */
|
||||
wcsncpy(szPath, szDrive, dwPathLength);
|
||||
wcsncpy(pwszPath, pwszDrive, cchPathMax);
|
||||
OutputDebugStringW(L"GetRosInstallCD: ");OutputDebugStringW(pwszPath);OutputDebugStringW(L"\n");
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue