Nobody uses them so they weren’t corrected.

At the moment I prepare Rudy Velthuis’ API headers for JEDI API integration. By accident I found some functions which are only available as UNICODE version. However they were also declared as ANSI !? To make it quick, it wasn’t Rudy’s mistake but Microsoft’s. The following functions are only available as UNCIODE version, as MSDN states :

  • SHSetUnreadMailCountW
  • SHEnumerateUnreadMailAccountsW
  • SHGetUnreadMailCountW

However, if you get the newest version of the Microsoft Windows SDK (I used v6 for Vista), you’ll find these function declarations:

#if         _WIN32_IE >= 0×0600
STDAPI          SHEnumerateUnreadMailAccountsA(HKEY hKeyUser, DWORD dwIndex, __out_ecount(cchMailAddress) LPSTR pszMailAddress, int cchMailAddress);
STDAPI          SHEnumerateUnreadMailAccountsW(HKEY hKeyUser, DWORD dwIndex, __out_ecount(cchMailAddress) LPWSTR pszMailAddress, int cchMailAddress);
#ifdef UNICODE
#define SHEnumerateUnreadMailAccounts  SHEnumerateUnreadMailAccountsW
#else
#define SHEnumerateUnreadMailAccounts  SHEnumerateUnreadMailAccountsA
#endif // !UNICODE
STDAPI          SHGetUnreadMailCountA(HKEY hKeyUser, LPCSTR pszMailAddress, __out_opt DWORD *pdwCount, __out_opt FILETIME *pFileTime, __out_ecount_opt(cchShellExecuteCommand) LPSTR pszShellExecuteCommand, int cchShellExecuteCommand);
STDAPI          SHGetUnreadMailCountW(HKEY hKeyUser, LPCWSTR pszMailAddress, __out_opt DWORD *pdwCount, __out_opt FILETIME *pFileTime, __out_ecount_opt(cchShellExecuteCommand) LPWSTR pszShellExecuteCommand, int cchShellExecuteCommand);
#ifdef UNICODE
#define SHGetUnreadMailCount  SHGetUnreadMailCountW
#else
#define SHGetUnreadMailCount  SHGetUnreadMailCountA
#endif // !UNICODE
STDAPI          SHSetUnreadMailCountA(LPCSTR pszMailAddress, DWORD dwCount, LPCSTR pszShellExecuteCommand);
STDAPI          SHSetUnreadMailCountW(LPCWSTR pszMailAddress, DWORD dwCount, LPCWSTR pszShellExecuteCommand);
#ifdef UNICODE
#define SHSetUnreadMailCount  SHSetUnreadMailCountW
#else
#define SHSetUnreadMailCount  SHSetUnreadMailCountA
#endif // !UNICODE#endif  /*  _WIN32_IE >= 0×0600     */

They shouldn’t be declared like this. Make sure you use just the unicode version directly and nothing else.

I wonder who uses these functions anyway. Comments are appreciated.