mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +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;
|
DWORD dwError;
|
||||||
ULONG fOldMask;
|
ULONG fOldMask;
|
||||||
|
|
||||||
hrCoInit = SHCoInitializeAnyApartment();
|
|
||||||
|
|
||||||
if (sei->cbSize != sizeof(SHELLEXECUTEINFOW))
|
if (sei->cbSize != sizeof(SHELLEXECUTEINFOW))
|
||||||
{
|
{
|
||||||
dwError = ERROR_ACCESS_DENIED;
|
sei->hInstApp = (HINSTANCE)UlongToHandle(SE_ERR_ACCESSDENIED);
|
||||||
sei->hInstApp = (HINSTANCE)ERROR_ACCESS_DENIED;
|
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",
|
switch (sei->nShow)
|
||||||
L"MaximizeApps", FALSE, FALSE))
|
|
||||||
{
|
{
|
||||||
switch (sei->nShow)
|
case SW_SHOW:
|
||||||
{
|
case SW_SHOWDEFAULT:
|
||||||
case SW_SHOW:
|
case SW_SHOWNORMAL:
|
||||||
case SW_SHOWDEFAULT:
|
case SW_RESTORE:
|
||||||
case SW_SHOWNORMAL:
|
sei->nShow = SW_SHOWMAXIMIZED;
|
||||||
case SW_RESTORE:
|
break;
|
||||||
sei->nShow = SW_SHOWMAXIMIZED;
|
default:
|
||||||
break;
|
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))
|
if (SUCCEEDED(hrCoInit))
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue