Background
I'm working on developing an app based on Chromium Project.
I found that the Widget::Show function is often stuck while another thread is executing LoadLibraryEx with a big dll file. And I want to speed up showing windows.
What I have tried
- make a call of
Widget::Showbefore loading the big dll, next time the Show function would not be stuck by Loader Lock (from LoadLibraryEx, I guess), which means the lock only affects the first time of calling theShowfunction. - I tried open a native window, using win32 api like CreateWindowEx, RegisterClass, ShowWindow, UpdateWindow. It also works when next time
Widget::Showwhile loading dlls. - Loading a dll will get a lock, while other threads cannot load dlls or start a new thread.
Question
I guess UIAutomation set a hook and when some messages come, UIAutomation hooks it and do some initialization things like InitConnectionEvents, which will be locked by something.
I wonder is there any more elegant way to trigger UIAutomation "init" actions? Or how can I continue to debug this...
Stack
#0 Thread 23992 [CrBrowserMain]
0 ntdll.dll!NtWaitForSingleObject + 0xc
eip = 0x770c671c esp = 0x0753d708 ebp = 0x0753d774 ebx = 0x00000000
esi = 0x00000dbc edi = 0x00000dc4 eax = 0x00000000 ecx = 0x00000000
edx = 0x00000000 efl = 0x00000202
Found by: given as instruction pointer in context
1 KERNELBASE.dll!WaitForSingleObjectEx + 0x88
eip = 0x760e19b8 esp = 0x0753d70c ebp = 0x0753d774 ebx = 0x00000000
Found by: call frame info
2 KERNELBASE.dll!WaitForSingleObject + 0x12
eip = 0x760e1922 esp = 0x0753d77c ebp = 0x0753d788
Found by: call frame info
3 UIAutomationCore.DLL!OverlappedIOManager::AddChannel_AnyThread(ChannelInfo*, bool) + 0x67
eip = 0x68bf1b18 esp = 0x0753d790 ebp = 0x0753d7c0
Found by: call frame info
4 UIAutomationCore.DLL!OverlappedIOManager::AddWorkQueueChannel(IWorkQueueChannel**) + 0x9a
eip = 0x68beeb95 esp = 0x0753d7c8 ebp = 0x0753d7fc
Found by: call frame info
5 UIAutomationCore.DLL!ChannelBasedServerConnectionManager::SetupConnectionEvents(unsigned short const*, bool) + 0x30
eip = 0x68bf14cc esp = 0x0753d804 ebp = 0x0753de58
Found by: call frame info
6 UIAutomationCore.DLL!ChannelBasedServerConnectionManager::InitConnectionEvents(unsigned short const*, bool) + 0x45
eip = 0x68d590c8 esp = 0x0753de60 ebp = 0x0753de70
Found by: call frame info
7 UIAutomationCore.DLL!HandleHookMessage(tagCWPSTRUCT*&) + 0x245
eip = 0x68c48e5f esp = 0x0753de78 ebp = 0x0753ee78
Found by: call frame info
8 UIAutomationCore.DLL!wil::slim_event_t<0>::wait(void) + 0x2e
eip = 0x68d59970 esp = 0x0753de88 ebp = 0x0753eeb0
Found by: stack scanning
the next call frames are like PeekMessage by Chromium run loop.