[SHELL32][VFDLIB] Handle size check of CMINVOKECOMMANDINFOEX correctly (#6767)

Older NT versions (< IE4) had a smaller CMINVOKECOMMANDINFOEX struct. Places where 3rd-party code passes in the struct needs to accept the small size.
This commit is contained in:
Whindmar Saksit 2024-05-01 14:17:08 +02:00 committed by GitHub
parent 5c3b1c78a7
commit db93cb1709
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 3 deletions

View file

@ -2595,9 +2595,10 @@ HRESULT CShellLink::DoOpen(LPCMINVOKECOMMANDINFO lpici)
HRESULT hr;
LPWSTR args = NULL;
LPWSTR path = strdupW(m_sPath);
BOOL unicode = lpici->cbSize >= FIELD_OFFSET(CMINVOKECOMMANDINFOEX, ptInvoke) &&
(lpici->fMask & CMIC_MASK_UNICODE);
if ( lpici->cbSize == sizeof(CMINVOKECOMMANDINFOEX) &&
(lpici->fMask & CMIC_MASK_UNICODE) )
if (unicode)
{
LPCMINVOKECOMMANDINFOEX iciex = (LPCMINVOKECOMMANDINFOEX)lpici;
SIZE_T len = 2;

View file

@ -339,12 +339,16 @@ STDMETHODIMP CVfdShExt::InvokeCommand(
DWORD ret;
CMINVOKECOMMANDINFOEX *excmi = (CMINVOKECOMMANDINFOEX *)lpcmi;
#ifdef __REACTOS__
unicode = lpcmi->cbSize >= FIELD_OFFSET(CMINVOKECOMMANDINFOEX, ptInvoke) &&
(lpcmi->fMask & CMIC_MASK_UNICODE);
#else
if (lpcmi->cbSize >= sizeof(CMINVOKECOMMANDINFOEX) &&
(lpcmi->fMask & CMIC_MASK_UNICODE)) {
unicode = TRUE;
}
#endif
if (!unicode && HIWORD(lpcmi->lpVerb)) {