mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[SHELL32] ShellExecute: Re-work Part 2 (#6882)
Follow-up to #6871. Reduce indentation level. JIRA issue: CORE-17482 In ShellExecuteExW, early check the structure size and return on failure before SHCoInitializeAnyApartment call.
This commit is contained in:
parent
a0776922f4
commit
3e97f76a33
1 changed files with 29 additions and 30 deletions
|
@ -2431,44 +2431,43 @@ ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
|
|||
DWORD dwError;
|
||||
ULONG fOldMask;
|
||||
|
||||
hrCoInit = SHCoInitializeAnyApartment();
|
||||
|
||||
if (sei->cbSize != sizeof(SHELLEXECUTEINFOW))
|
||||
{
|
||||
dwError = ERROR_ACCESS_DENIED;
|
||||
sei->hInstApp = (HINSTANCE)ERROR_ACCESS_DENIED;
|
||||
sei->hInstApp = (HINSTANCE)UlongToHandle(SE_ERR_ACCESSDENIED);
|
||||
SetLastError(ERROR_ACCESS_DENIED);
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
|
||||
hrCoInit = SHCoInitializeAnyApartment();
|
||||
|
||||
if (SHRegGetBoolUSValueW(L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer",
|
||||
L"MaximizeApps", FALSE, FALSE))
|
||||
{
|
||||
if (SHRegGetBoolUSValueW(L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer",
|
||||
L"MaximizeApps", FALSE, FALSE))
|
||||
switch (sei->nShow)
|
||||
{
|
||||
switch (sei->nShow)
|
||||
{
|
||||
case SW_SHOW:
|
||||
case SW_SHOWDEFAULT:
|
||||
case SW_SHOWNORMAL:
|
||||
case SW_RESTORE:
|
||||
sei->nShow = SW_SHOWMAXIMIZED;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
case SW_SHOW:
|
||||
case SW_SHOWDEFAULT:
|
||||
case SW_SHOWNORMAL:
|
||||
case SW_RESTORE:
|
||||
sei->nShow = SW_SHOWMAXIMIZED;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
fOldMask = sei->fMask;
|
||||
|
||||
if (!(fOldMask & SEE_MASK_NOASYNC) && SHELL_InRunDllProcess())
|
||||
sei->fMask |= SEE_MASK_WAITFORINPUTIDLE | SEE_MASK_NOASYNC;
|
||||
|
||||
dwError = ShellExecute_Normal(sei);
|
||||
|
||||
if (dwError && dwError != ERROR_DLL_NOT_FOUND && dwError != ERROR_CANCELLED)
|
||||
ShellExecute_ShowError(sei, NULL, dwError);
|
||||
|
||||
sei->fMask = fOldMask;
|
||||
}
|
||||
|
||||
fOldMask = sei->fMask;
|
||||
|
||||
if (!(fOldMask & SEE_MASK_NOASYNC) && SHELL_InRunDllProcess())
|
||||
sei->fMask |= SEE_MASK_WAITFORINPUTIDLE | SEE_MASK_NOASYNC;
|
||||
|
||||
dwError = ShellExecute_Normal(sei);
|
||||
|
||||
if (dwError && dwError != ERROR_DLL_NOT_FOUND && dwError != ERROR_CANCELLED)
|
||||
ShellExecute_ShowError(sei, NULL, dwError);
|
||||
|
||||
sei->fMask = fOldMask;
|
||||
|
||||
if (SUCCEEDED(hrCoInit))
|
||||
CoUninitialize();
|
||||
|
||||
|
|
Loading…
Reference in a new issue