Recent

Author Topic: shellapi.pp definitions for non-existent functions  (Read 520 times)

440bx

  • Hero Member
  • *****
  • Posts: 5820
shellapi.pp definitions for non-existent functions
« on: September 11, 2025, 06:32:52 pm »
Hello,

shellapi.pp defines:
Code: Pascal  [Select][+][-]
  1. function SHEnumerateUnreadMailAccountsA(hKeyUser:HKEY; dwIndex:DWORD; pszMailAddress:LPSTR; cchMailAddress:longint):HRESULT;external shell32 name 'SHEnumerateUnreadMailAccountsA';
  2. function SHEnumerateUnreadMailAccountsW(hKeyUser:HKEY; dwIndex:DWORD; pszMailAddress:LPWSTR; cchMailAddress:longint):HRESULT;external shell32 name 'SHEnumerateUnreadMailAccountsW';
  3.  
  4. function SHEnumerateUnreadMailAccounts(hKeyUser:HKEY; dwIndex:DWORD; pszMailAddress:LPWSTR; cchMailAddress:longint):HRESULT;external shell32 name 'SHEnumerateUnreadMailAccountsW';
  5.  
the only function that exists is the "W" version.  Neither the "A" nor the plain/"non-A" functions exist.  Therefore using either one in a program will result in a load failure due to a non-existent entry point.

The above applies to Win XP up to Win 11.  I have not checked any version of Windows prior to Win XP. 

HTH.



ETA:

the same applies to:
Code: Pascal  [Select][+][-]
  1. function SHGetUnreadMailCountA(hKeyUser:HKEY; pszMailAddress:LPCSTR; pdwCount:PDWORD; pFileTime:PFILETIME; pszShellExecuteCommand:LPSTR;cchShellExecuteCommand:longint):HRESULT;external shell32 name 'SHGetUnreadMailCountA';
  2. function SHGetUnreadMailCountW(hKeyUser:HKEY; pszMailAddress:LPCWSTR; pdwCount:PDWORD; pFileTime:PFILETIME; pszShellExecuteCommand:LPWSTR;cchShellExecuteCommand:longint):HRESULT;external shell32 name 'SHGetUnreadMailCountW';
  3. function SHGetUnreadMailCount(hKeyUser:HKEY; pszMailAddress:LPCSTR; pdwCount:PDWORD; pFileTime:PFILETIME; pszShellExecuteCommand:LPSTR;cchShellExecuteCommand:longint):HRESULT;external shell32 name 'SHGetUnreadMailCountA';
  4. function SHGetUnreadMailCount(hKeyUser:HKEY; pszMailAddress:LPCWSTR; pdwCount:PDWORD; pFileTime:PFILETIME; pszShellExecuteCommand:LPWSTR;cchShellExecuteCommand:longint):HRESULT;external shell32 name 'SHGetUnreadMailCountW';
  5.  
Only the "W" version exists.  The others do not.



ETA2:

same as above for:
Code: Pascal  [Select][+][-]
  1.  
  2. function SHSetUnreadMailCountA(pszMailAddress:LPCSTR; dwCount:DWORD; pszShellExecuteCommand:LPCSTR):HRESULT;external shell32 name 'SHSetUnreadMailCountA';
  3. function SHSetUnreadMailCountW(pszMailAddress:LPCWSTR; dwCount:DWORD; pszShellExecuteCommand:LPCWSTR):HRESULT;external shell32 name 'SHSetUnreadMailCountW';
  4. function SHSetUnreadMailCount(pszMailAddress:LPCSTR; dwCount:DWORD; pszShellExecuteCommand:LPCSTR):HRESULT;external shell32 name 'SHSetUnreadMailCountA';
  5. function SHSetUnreadMailCount(pszMailAddress:LPCWSTR; dwCount:DWORD; pszShellExecuteCommand:LPCWSTR):HRESULT;external shell32 name 'SHSetUnreadMailCountW';
  6.  
Only the "W" version exists.


« Last Edit: September 11, 2025, 06:42:08 pm by 440bx »
FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

Zvoni

  • Hero Member
  • *****
  • Posts: 3140
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

440bx

  • Hero Member
  • *****
  • Posts: 5820
Re: shellapi.pp definitions for non-existent functions
« Reply #2 on: September 12, 2025, 08:47:48 am »
There is nothing to disagree.

Those are facts  You can verify them using dumpbin.  Of course, feel free to disagree with dumpbin.  Good luck with that one.
FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

AlexTP

  • Hero Member
  • *****
  • Posts: 2625
    • UVviewsoft
Re: shellapi.pp definitions for non-existent functions
« Reply #3 on: September 12, 2025, 09:54:49 am »
Agree. Maybe it is better to write to FPC bugtracker? (With nearest issue.)

Zvoni

  • Hero Member
  • *****
  • Posts: 3140
Re: shellapi.pp definitions for non-existent functions
« Reply #4 on: September 12, 2025, 10:27:08 am »
There is nothing to disagree.

Those are facts  You can verify them using dumpbin.  Of course, feel free to disagree with dumpbin.  Good luck with that one.
OK, i'll take your word for it.
It just rubs me the wrong way, when the official MS-Documentation says nothing resp. otherwise.

OTOH, i think to have read something, that some API's haven't been "removed" as such, but are only accessible via ordinal, not via Function-Name-Symbol.

Maybe those are some of those?

EDIT: regarding the functions above
https://learn.microsoft.com/en-us/windows/win32/api/shellapi/
They are still in the shellapi.h-Headerfile
Huh?
« Last Edit: September 12, 2025, 10:50:14 am by Zvoni »
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad

440bx

  • Hero Member
  • *****
  • Posts: 5820
Re: shellapi.pp definitions for non-existent functions
« Reply #5 on: September 12, 2025, 04:09:09 pm »
It just rubs me the wrong way, when the official MS-Documentation says nothing resp. otherwise.

OTOH, i think to have read something, that some API's haven't been "removed" as such, but are only accessible via ordinal, not via Function-Name-Symbol.

Maybe those are some of those?

EDIT: regarding the functions above
https://learn.microsoft.com/en-us/windows/win32/api/shellapi/
They are still in the shellapi.h-Headerfile
Huh?
yes, they are still in the header file in spite of the fact that they do not exist.

In general, MS' documentation is _mostly_ right but, there are a _large_ number of mistakes which range from defining APIs that are long gone, claiming an API is not available when in fact, it is available all the way to Windows 11.  Other mistakes include declaring the wrong result type which ranges from mistaking a BOOL for an int or even worse, mistaking a DWORD for an int64.

Literally, between what is documented and what is declared in the C headers, there are _hundreds_ of problems. 

The reason MS gets away with it is because there are extremely few people that verify what is declared in the C headers with what is documented and cross reference that with disassemblies of the function (of which there may be multiple because some functions are implemented in more than one dll.)  Doing that is very revealing and, what's revealed is that MS has made quite a mess. 

I only report a very small number of the problems because the number of Pascal programmers interested in this low-level stuff is small, which means very few will experience the problematic definitions.  Still, at least in theory, the definitions should be correct.
FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

 

TinyPortal © 2005-2018