none
Bug of SetReceiveFolder function? RRS feed

  • Question

  • Hi,

    When reading the document on SetReceiveFolder in https://docs.microsoft.com/zh-cn/office/client-developer/outlook/mapi/imsgstore-setreceivefolder , I find there is a bug.

    The function is:

    HRESULT SetReceiveFolder( LPSTR lpszMessageClass, ULONG ulFlags, ULONG cbEntryID, LPENTRYID lpEntryID );

    If ulFlags set to MAPI_UNICODE, then the type of the first parameter should be LPWSTR.

    If not set, then the type should be LPSTR.

    Therefore, using a specific type LPSTR is not correct. I check the old document(VS2008) on that,

    and it uses LPCTSTR as the type, which is also not appropriate.

    Since there can be two types for the first parameter, the best choice should be LPVOID,

    is that correct?

    Wednesday, December 12, 2018 9:59 AM

All replies

  • The  Unicode support was added later when the headers were already out. The interface will not be changed.

    Why is this a problem?


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Wednesday, December 12, 2018 2:57 PM
  • Because the interface ask for a LPSTR or LPTSTR, but a Unicode string is LPWSTR, so one must cast a Unicode to LPSTR/LPTSTR, that is very strange.
    Friday, December 14, 2018 9:54 PM
  • Yes, because as I said, Unicode support was an afterthought, and since COM interfaces are immutable, we are stuck with the old definition.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.5 is now available!

    Friday, December 14, 2018 9:57 PM