[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:
Katayama Hirofumi MZ 2024-05-14 23:00:54 +09:00 committed by GitHub
parent a0776922f4
commit 3e97f76a33
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2431,15 +2431,15 @@ 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))
{
@ -2467,7 +2467,6 @@ ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
ShellExecute_ShowError(sei, NULL, dwError);
sei->fMask = fOldMask;
}
if (SUCCEEDED(hrCoInit))
CoUninitialize();