> I forgot exactly where, but passing a string as the first parameter is
> permitted. That's why it's declared INT_PTR instead of INT. Tracing
> through the machine code shows the high-word is checked and it is
> interpreted as a string if non-zero. You can also trace through as the
> shell compares this string against "pastelink", "paste", etc.
OK.
> And this all
> works fine if you haven't called QCM. Once QCM is called, it compares
> the passed in verb string to a few others before loosing your string
> pointer and comparing to 0xffffffff. So it sure looks like a Microsoft
> bug to me.
Now that you're already into the dirty world of assembly, how about checking
out what exactly QCM( ) is doing to 'add' the new items? It must add them
to a list or an array of some sort if it's going to impact the later GCS( )
calls.
Maybe it's trying to interpret a param you pass into it as a string, but
that seems to be just a 0xffffffff pointer?
> For call context, this is what I'm doing:
>
> struct _CmdInfo
> {
> int nID; // Our menu ID
> OLECMDID nOLE; // Standard
> OLECMDID (if any)
> LPCTSTR pszVerb; // Standard canonical
> command name
> bool isEnabled(IContextMenu* pCM)
> {
> HRESULT hr = S_FALSE;
> TCHAR szHelp[128] = {0};
> if(this->pszVerb && pCM){
> hr =
> pCM->GetCommandString(reinterpret_cast<UINT_PTR>(this->pszVerb),
> GCS_HELPTEXT, NULL,
> reinterpret_cast<LPSTR>(szHelp), _countof(szHelp));
> }
> ATLTRACE2(atlTraceUser, 0, TEXT("Cmd=%d, Name='%s',
Help='%s'
> (hr=%#x)\n"),
> this->nID, this->pszVerb, szHelp, hr);
> return (hr == S_OK);
> }
> };
>
> static _CmdInfo _ItemCmds[] =
> {
> { SFVIDM_FILE_DELETE, OLECMDID_DELETE,
> TOCMDSTR_DELETE },
> { SFVIDM_FILE_PROPERTIES, OLECMDID_PROPERTIES,
> TOCMDSTR_PROPERTIES },
> { SFVIDM_EDIT_CUT, OLECMDID_CUT,
> TOCMDSTR_CUT },
> { SFVIDM_EDIT_COPY, OLECMDID_COPY,
> TOCMDSTR_COPY },
> { SFVIDM_FILE_RENAME, OLECMDID(-1),
> TOCMDSTR_RENAME },
> { FCIDM_PRINT, OLECMDID_PRINT,
> TOCMDSTR_PRINT }
> };
>
> Where TOCMDSTR_XXX are "delete", "properties", "cut", "copy", "rename"
> and "print", respectively.
I also suggest you test it on other platforms as well. You don't mention
what platform you're on, but I will be happy to test the project if you can
ZIP it up in a reasonably small package for 56K dial-up. :-)
If you seriously think it's an M$ bug (it's *not* likely, since they don't
write any bugs - all they write are features, some way or another!), I
suggest you asking this on an M$ newsgroup. The internal M$ folks read
those newsgroups, and in the past I have seen numerous replies from
developers working inside the VC++ compiler team or different parts of the
OS.
-------------
Ehsan Akhgari
List Owner: [EMAIL PROTECTED]
[ Email: [EMAIL PROTECTED] ]
[ WWW: http://www.beginthread.com/Ehsan ]
And when I saw my devil, I found him serious, thorough, profound, solemn: he
was the spirit of gravity- through him all things fall.
-Thus Spoke Zarathustra, F. W. Nietzsche