Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/RTL/Delphi/WinAPI    [ Add a report in this area ]  
Report #:  90540   Status: Open
SHChangeNotification_Lock declared wrong in Shlobj.pas
Project:  Delphi Build #:  15.0.3890.34076
Version:    15.0 Submitted By:   Peter Below
Report Type:  Basic functionality failure Date Reported:  12/27/2010 10:44:08 PM
Severity:    Infrequently encountered problem Last Updated: 3/20/2012 2:24:39 AM
Platform:    All platforms Internal Tracking #:   281519
Resolution: None (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: (1 Total Rating)
5.00 out of 5
Total Votes: 2
Description
The declaration of SHChangeNotification_Lock is wrong. It uses a Delphi open array parameter, which is not compatible with the API declaration.

Wrong declaration:

function SHChangeNotification_Lock(hChange: THandle; dwProcId: DWORD;
  out pppidl: array of PItemIDList; out plEvent: ULONG): THANDLE; stdcall;

Using this declaration causes access violations in code calling the function.

API declaration:

HANDLE SHChangeNotification_Lock(      
    HANDLE hChange,
    DWORD dwProcId,
    PIDLIST_ABSOLUTE **pppidl,
    LONG *plEvent
);

Correct declaration:

function SHChangeNotification_Lock(hChange: THandle; dwProcId: DWORD;
out pppidl: PPItemIDList;
out plEvent: ULONG): THANDLE; stdcall;
Steps to Reproduce:
none
Workarounds
Redeclare the function in your own code with the correct declaration and bind it to the API DLL with

function SHChangeNotification_Lock;               external 'shell32.dll' name 'SHChangeNotification_Lock';
Attachment
None
Comments

None

Server Response from: ETNACODE01