Subject: Help: Double Commander crashes on startup on some PCs, related to SendMessage in TWin32WSCustomForm.CreateHandle
the original issue ticket on doublecmd GitHub:
https://github.com/doublecmd/doublecmd/issues/2445Message:
Dear Lazarus community,
I'm not a Double Commander developer nor a Pascal expert, but as a user who loves Double Commander , and now I can't use this software on the corporate PC for work , and now I'm trying to troubleshoot this startup crash issue.
Problem Description:
Double Commander fails to start on some specific PCs(the corporate PC for work ). Through adding debug information, I've located the crash to occur in the
TWin32WSCustomForm.CreateHandle method in
win32wsforms.pp, specifically at this line:
pascal
Windows.SendMessage(Result, WM_CHANGEUISTATE,
MakeWParam(UIS_INITIALIZE, UISF_HIDEFOCUS or UISF_HIDEACCEL), 0);
Debugging Findings:
please see the attached debug code.1. The window handle
Result is valid (
IsWindow(Result) returns True)
2.
PostMessage works successfully, but
SendMessage causes a crash
3. Even a simple
Windows.SendMessage(Result, WM_NULL, 0, 0) crashes
4. The crash cannot be caught by Pascal exception handling (
try..except doesn't execute)
ps, I can't install Lazarus on the corporate PC for work as the limited of company policy, so I need to build double commander in my own PC, then transfer to the corporate PC to run..
Environment Information:
- Operating System: Windows 11
- Lazarus Version: 4.2 with FPC 3.2.2
Attempted Solutions:
- Replaced
SendMessage with
PostMessage - program continues but eventually crashes later
- Added window validity checks
- Verified that process and thread IDs match
Questions:
1. Under what circumstances would a valid window handle crash with
SendMessage but work with
PostMessage?
2. Could this be related to window creation timing or message loop state?
3. In LCL, is there a safer alternative approach for handling such window initialization messages?
4. Are there any other debugging methods I might have overlooked?
As I'm not very familiar with Pascal and LCL internals, any guidance would be greatly appreciated. I'm happy to provide more debug information if needed.
Thank you for your time and assistance!
----------updated on 2025/11/11--------------Additional Important Finding:I checked the Windows Event Viewer and discovered that the Double Commander crash is related to a module called
dgapi64.dll. This appears to be a security component. and I confirmed it with IT dept. they will not set whitelist for doublecmd.exe
The crash occurs when Double Commander (through LCL's window creation process) interacts with this DLL, particularly during the
SendMessage call for UI state initialization.
My Questions:
1. Has anyone encountered similar issues with some security software interfering with LCL applications?
2. Are there known workarounds for such third-party DLL conflicts in Lazarus applications?
3. Could there be a way to make the window creation more robust against such external interference?