Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#59 Crash fix on context menu handling

open
nobody
None
5
2012-12-07
2006-04-06
Anonymous
No

To fix crash reported in bug tracker id# 1465577,
1445742 and possibly 1440394, 1421957.

Modify ContexMenu.cpp:

STDMETHODIMP CZipContextMenu::InvokeCommand
(LPCMINVOKECOMMANDINFO commandInfo)
{
int commandOffset;

/*if(HIWORD(commandInfo->lpVerb) == 0)
commandOffset = LOWORD(commandInfo->lpVerb);
else
commandOffset = FindVerb(GetUnicodeString
(commandInfo->lpVerb));*/
/*
#ifdef _UNICODE*/
if(commandInfo->cbSize == sizeof
(CMINVOKECOMMANDINFOEX))
{
if ((commandInfo->fMask & CMIC_MASK_UNICODE) != 0)
{
LPCMINVOKECOMMANDINFOEX aCommandInfoEx =
(LPCMINVOKECOMMANDINFOEX)commandInfo;
if(HIWORD(aCommandInfoEx->lpVerb) == 0)
commandOffset = LOWORD(aCommandInfoEx->lpVerb);
else
{
commandOffset = FindVerb(aCommandInfoEx->
lpVerbW);
/*MessageBox(0, TEXT("1"), TEXT("1"), 0);
return E_FAIL;*/
}
}
else
{
if(HIWORD(commandInfo->lpVerb) == 0)
commandOffset = LOWORD(commandInfo->lpVerb);
else
commandOffset = FindVerb(GetUnicodeString
(commandInfo->lpVerb));
}
// return E_FAIL;
}
else
{
if(HIWORD(commandInfo->lpVerb) == 0)
commandOffset = LOWORD(commandInfo->lpVerb);
else
commandOffset = FindVerb(GetUnicodeString
(commandInfo->lpVerb));
}
/*
#else

{
if(HIWORD(commandInfo->lpVerb) == 0)
commandOffset = LOWORD(commandInfo->lpVerb);
else
commandOffset = FindVerb(commandInfo->lpVerb);
}

#endif
*/

// code below remained unchanged

}

Discussion

  • Logged In: NO

    Sorry, the code doesn't fully work, need to patch my patch
    as follows:

    if(commandInfo->cbSize == sizeof(CMINVOKECOMMANDINFOEX))
    {
    LPCMINVOKECOMMANDINFOEX aCommandInfoEx =
    (LPCMINVOKECOMMANDINFOEX)commandInfo;
    if ((aCommandInfoEx->fMask & CMIC_MASK_UNICODE) != 0)
    {
    if(HIWORD(aCommandInfoEx->lpVerb) == 0)
    commandOffset = LOWORD(aCommandInfoEx->lpVerb);
    else
    {
    commandOffset = FindVerb(aCommandInfoEx->
    lpVerbW);
    }
    }
    ...
    }

     
  • Igor Pavlov
    Igor Pavlov
    2006-04-12

    Logged In: YES
    user_id=65083

    I've fixed that code already. Thanks!

    if (commandInfo->cbSize == sizeof(CMINVOKECOMMANDINFOEX)
    &&
    (commandInfo->fMask & CMIC_MASK_UNICODE) != 0)
    {
    LPCMINVOKECOMMANDINFOEX commandInfoEx =
    (LPCMINVOKECOMMANDINFOEX)commandInfo;
    if(HIWORD(commandInfoEx->lpVerbW) == 0)
    commandOffset = LOWORD(commandInfo->lpVerb);
    else
    commandOffset = FindVerb(commandInfoEx->lpVerbW);
    }
    else
    if(HIWORD(commandInfo->lpVerb) == 0)
    commandOffset = LOWORD(commandInfo->lpVerb);
    else
    commandOffset = FindVerb(GetUnicodeString
    (commandInfo->lpVerb));