Click here to Skip to main content
15,904,288 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to call the sdbinst.exe program in the dll. When I compile the program to an exe, sdbinst.exe can start normally. But when I compile it as dll, the sdbinst.exe program will deadlock. Exe or dll they call sdbinst.exe the code is exactly the same. The deadlock code is ShellExecuteEx. I used OD to follow ShellExecuteEx, then used in the dll will deadlock in USER32.MsgWaitForMultipleObjects, I do not know this is What causes it. Hope someone can help me. Thanks!

What I have tried:

I have tried using other APIs instead of ShellExecuteEx, but in that case the program will not work
Posted
Updated 21-Apr-18 1:29am
v3

1 solution

See the various warnings about deadlocks at ShellExecuteEx function (Windows)[^].
 
Share this answer
 
Comments
KarstenK 21-Apr-18 12:52pm    
I wonder why people DONT READ the documentation. RTFM ...
Richard MacCutchan 21-Apr-18 15:12pm    
Mainly because we do it for them.
hgggb 22-Apr-18 2:52am    
Thank you for answering this question for me. RTFM describes "When DLLs are loaded into your process, you acquire a lock known as a loader lock.....It is important that you do not call ShellExecuteEx while you hold a loader lock. "It means not to call ShellExecuteEx when loading dlls? (Note: I don't use any private locks in my dll.) But why did notepad.exe successfully execute ShellExecuteEx inside the dll? Thanks again for your answer!
Richard MacCutchan 22-Apr-18 3:15am    
Sorry, I do not know the answer, but obviously there is some issue with calling ShellExecute from within a DLL.
hgggb 22-Apr-18 21:15pm    
Okay thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900