I'm looking at 
http://bitbucket.org/tortoisehg/crew/src/e214839bf369/win32/shellext/ContextMenu.cpp#cl-445

we have

STDMETHODIMP
CShellExt::GetCommandString(
    UINT_PTR idCmd, UINT uFlags, UINT FAR *reserved,
    LPSTR pszName, UINT cchMax)
{
    *pszName = 0;
    char *psz;

    TDEBUG_TRACE(
        "CShellExt::GetCommandString: idCmd = " << idCmd
        << ", uFlags = " << uFlags
    );
    MenuIdCmdMap::iterator iter = MenuIdMap.find(static_cast<UINT>(idCmd));
    if (iter != MenuIdMap.end())
    {
        TDEBUG_TRACE(
            "CShellExt::GetCommandString: name = " << iter->second.name);
        psz = (char*)iter->second.helpText.c_str();
    }
    else
    {
        TDEBUG_TRACE(
            "CShellExt::GetCommandString: can't find idCmd " << idCmd);
        psz = "";
    }

    if (uFlags & GCS_UNICODE)
    {
        wcscpy((wchar_t*)pszName, _WCSTR(psz));
    }
    else
    {
        strcpy((char*)pszName, psz);
    }
    return NOERROR;
}

Can someone explain what _WCSTR() does?

http://msdn.microsoft.com/en-us/library/bb776083(VS.85).aspx specifies
that if uFlags & GCS_UNICODE, a "unicode" string must be copied into
pszName (I assume a wstring is meant with that).

But how do we get that wstring?

See also
http://bitbucket.org/tortoisehg/crew/changeset/70f7297adda2/

Usage of _WCTSR() seems to go back to
http://bitbucket.org/tortoisehg/crew/src/c3caaf07dbcc/tortoise/shellext/ContextMenu.cpp#cl-260
(TK Soh's initial commit)


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Tortoisehg-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to