[原]ComFriendlyWaitForSingleObject
structThreadParam
{
unsignedint p1;// +00h ebp-24h
unsignedint p2;// +04h ebp-20h
unsignedint cookie;// +08h ebp-1Ch
LPSTREAM xxx;// +0Ch ebp-18h
HANDLE hEvent;// +14h ebp-14h
HANDLE hXXX;// +18h ebp-10h
unsignedint xxx;// +1Ch ebp-0Ch
}
c++代码
HRESULT ComFriendlyWaitForSingleObject(LPUNKOWN p1, HANDLE* pThread)
{
HANDLE hh1;
HANDLE hh2;
HRESULT hr = S_OK;
hr =HrCreateEvent(0, TRUE,0,0,&hh2);
if( FAILED(hr))
return hr;
hr =HrCreateEvent(0, TRUE,0,0,&hh1);
if( FAILED(hr))
return hr;
ThreadParam param;
param.p1 = p1;
param.p2 = pThread;
param.hr = S_OK;
param.pStream = NULL;
param.hEvent = hh2;
param.hXXX = hh1;
param.xxx =0;
HANDLE hThread =CreateThread(0,0,&ComFriendlyWaitMtaThreadProc,¶m,0, NULL);
WaitForSingleObject(hh2, INFINITE);
if( SUCCEED(param.hr))
{
hr =CoGetInterfaceAndReleaseStream(param.pStream, GUID_6d5140c1_7436_11ce_8034_00aa006009fa,&p1);
param.pStream = NULL;
if( NULL != p1 )
{
p1->vtable[4](&p1);
p1->Release();
}
SetEvent(hh1);
WaitForSingleObject(*pThread, INFINITE);
}
AutoCleanupInfo(&hh1);
AutoCleanupInfo(&hh2);
AutoCleanupInfo(pThread);
}
汇编码
uf uiautomationcore!ComFriendlyWaitForSingleObject
uiautomationcore!ComFriendlyWaitForSingleObject:
7303f4e98bff mov edi,edi
7303f4eb55 push ebp
7303f4ec8bec mov ebp,esp
7303f4ee83ec24 sub esp,24h
7303f4f153 push ebx
7303f4f256 push esi
7303f4f357 push edi
7303f4f433f6 xor esi,esi
7303f4f68d45f8 lea eax,[ebp-8]
7303f4f950 push eax
7303f4fa56 push esi
7303f4fb56 push esi
7303f4fc6a01 push 1
7303f4fe56 push esi
7303f4ff8975f8 mov dword ptr [ebp-8],esi
7303f502 e894fcffff call uiautomationcore!HrCreateEvent(7303f19b)
7303f5073bc6 cmp eax,esi
7303f5090f8c49950000 jl uiautomationcore!ComFriendlyWaitForSingleObject+0x22(73048a58)Branch
uiautomationcore!ComFriendlyWaitForSingleObject+0x36:
7303f50f8d45fc lea eax,[ebp-4]
7303f51250 push eax
7303f51356 push esi
7303f51456 push esi
7303f5156a01 push 1
7303f51756 push esi
7303f5188975fc mov dword ptr [ebp-4],esi
7303f51b e87bfcffff call uiautomationcore!HrCreateEvent(7303f19b)
7303f5208bd8 mov ebx,eax
7303f5223bde cmp ebx,esi
7303f5240f8ca7000000 jl uiautomationcore!ComFriendlyWaitForSingleObject+0x4d(7303f5d1)Branch
uiautomationcore!ComFriendlyWaitForSingleObject+0x58:
7303f52a8b4508 mov eax,dword ptr [ebp+8]
7303f52d8b7df8 mov edi,dword ptr [ebp-8]
7303f5308945dc mov dword ptr [ebp-24h],eax
7303f5338b450c mov eax,dword ptr [ebp+0Ch]
7303f53656 push esi
7303f5378945e0 mov dword ptr [ebp-20h],eax
7303f53a8b45fc mov eax,dword ptr [ebp-4]
7303f53d56 push esi
7303f53e8945f0 mov dword ptr [ebp-10h],eax
7303f5418d45dc lea eax,[ebp-24h]
7303f54450 push eax
7303f54568f1f50373 push offset uiautomationcore!ComFriendlyWaitMtaThreadProc(7303f5f1)
7303f54a56 push esi
7303f54b56 push esi
7303f54c8975e4 mov dword ptr [ebp-1Ch],esi
7303f54f8975e8 mov dword ptr [ebp-18h],esi
7303f552897dec mov dword ptr [ebp-14h],edi
7303f555 ff1514120373 call dword ptr [uiautomationcore!_imp__CreateThread (73031214)]
7303f55b89450c mov dword ptr [ebp+0Ch],eax
7303f55e3bc6 cmp eax,esi
7303f5600f84f9940000 je uiautomationcore!ComFriendlyWaitForSingleObject+0x90(73048a5f)Branch
uiautomationcore!ComFriendlyWaitForSingleObject+0xac:
7303f5666aff push 0FFFFFFFFh
7303f56857 push edi
7303f5698b3d28120373 mov edi,dword ptr [uiautomationcore!_imp__WaitForSingleObject (73031228)]
7303f56f ffd7 call edi
7303f5718b5de4 mov ebx,dword ptr [ebp-1Ch]
7303f5743bde cmp ebx,esi
7303f5767c40 jl uiautomationcore!ComFriendlyWaitForSingleObject+0xfe(7303f5b8)Branch
uiautomationcore!ComFriendlyWaitForSingleObject+0xbe:
7303f5788d4508 lea eax,[ebp+8]
7303f57b50 push eax
7303f57c68e4230373 push offset uiautomationcore!_GUID_6d5140c1_7436_11ce_8034_00aa006009fa (730323e4)
7303f581 ff75e8 push dword ptr [ebp-18h]
7303f584897508 mov dword ptr [ebp+8],esi
7303f587 ff1514130373 call dword ptr [uiautomationcore!_imp__CoGetInterfaceAndReleaseStream (73031314)]
7303f58d8b4d08 mov ecx,dword ptr [ebp+8]
7303f5908bd8 mov ebx,eax
7303f5928975e8 mov dword ptr [ebp-18h],esi
7303f5953bce cmp ecx,esi
7303f597741f je uiautomationcore!ComFriendlyWaitForSingleObject+0xfe(7303f5b8)Branch
uiautomationcore!ComFriendlyWaitForSingleObject+0xdf:
7303f5998d45f4 lea eax,[ebp-0Ch]
7303f59c50 push eax
7303f59d b87c2e0373 mov eax,offset uiautomationcore!_GUID_00000000_0000_0000_c000_000000000046 (73032e7c)
7303f5a250 push eax
7303f5a350 push eax
7303f5a48975f4 mov dword ptr [ebp-0Ch],esi
7303f5a78b11 mov edx,dword ptr [ecx]
7303f5a951 push ecx
7303f5aa ff520c call dword ptr [edx+0Ch]
7303f5ad8bd8 mov ebx,eax
7303f5af8b4508 mov eax,dword ptr [ebp+8]
7303f5b28b08 mov ecx,dword ptr [eax]
7303f5b450 push eax
7303f5b5 ff5108 call dword ptr [ecx+8]
uiautomationcore!ComFriendlyWaitForSingleObject+0xfe:
7303f5b8 ff75fc push dword ptr [ebp-4]
7303f5bb ff152c120373 call dword ptr [uiautomationcore!_imp__SetEvent (7303122c)]
7303f5c16aff push 0FFFFFFFFh
7303f5c3 ff750c push dword ptr [ebp+0Ch]
7303f5c6 ffd7 call edi
7303f5c88d450c lea eax,[ebp+0Ch]
7303f5cb50 push eax
7303f5cc e8e8f0ffff call uiautomationcore!AutoCleanupInfo<void*>::SafeRelease(7303e6b9)
uiautomationcore!ComFriendlyWaitForSingleObject+0x4d:
7303f5d18d45fc lea eax,[ebp-4]
7303f5d450 push eax
7303f5d5 e8dff0ffff call uiautomationcore!AutoCleanupInfo<void*>::SafeRelease(7303e6b9)
uiautomationcore!ComFriendlyWaitForSingleObject+0x24:
7303f5da8d45f8 lea eax,[ebp-8]
7303f5dd50 push eax
7303f5de e8d6f0ffff call uiautomationcore!AutoCleanupInfo<void*>::SafeRelease(7303e6b9)
7303f5e35f pop edi
7303f5e45e pop esi
7303f5e58bc3 mov eax,ebx
7303f5e75b pop ebx
7303f5e8 c9 leave
7303f5e9 c20800 ret 8
uiautomationcore!ComFriendlyWaitForSingleObject+0x22:
73048a588bd8 mov ebx,eax
73048a5a e97b6bffff jmp uiautomationcore!ComFriendlyWaitForSingleObject+0x24(7303f5da)Branch
uiautomationcore!ComFriendlyWaitForSingleObject+0x90:
73048a5f8d450c lea eax,[ebp+0Ch]
73048a6250 push eax
73048a63 e8515cffff call uiautomationcore!AutoCleanupInfo<void*>::SafeRelease(7303e6b9)
73048a688d45fc lea eax,[ebp-4]
73048a6b50 push eax
73048a6c e8485cffff call uiautomationcore!AutoCleanupInfo<void*>::SafeRelease(7303e6b9)
73048a71 bb0e000780 mov ebx,8007000Eh
73048a76 e95f6bffff jmp uiautomationcore!ComFriendlyWaitForSingleObject+0x24(7303f5da)Branch
欢迎各位小伙伴指出不足,提出建议!感谢关注我的博客:)
github博客:https://bianchengnan.github.io
版权所有,转载请保留原文链接:)