[原]ComFriendlyWaitForSingleObject

  1. structThreadParam
  2. {
  3. unsignedint p1;// +00h ebp-24h
  4. unsignedint p2;// +04h ebp-20h
  5. unsignedint cookie;// +08h ebp-1Ch
  6. LPSTREAM xxx;// +0Ch ebp-18h
  7. HANDLE hEvent;// +14h ebp-14h
  8. HANDLE hXXX;// +18h ebp-10h
  9. unsignedint xxx;// +1Ch ebp-0Ch
  10. }
 
c++代码
  1. HRESULT ComFriendlyWaitForSingleObject(LPUNKOWN p1, HANDLE* pThread)
  2. {
  3. HANDLE hh1;
  4. HANDLE hh2;
  5. HRESULT hr = S_OK;
  6. hr =HrCreateEvent(0, TRUE,0,0,&hh2);
  7. if( FAILED(hr))
  8. return hr;
  9. hr =HrCreateEvent(0, TRUE,0,0,&hh1);
  10. if( FAILED(hr))
  11. return hr;
  12. ThreadParam param;
  13. param.p1 = p1;
  14. param.p2 = pThread;
  15. param.hr = S_OK;
  16. param.pStream = NULL;
  17. param.hEvent = hh2;
  18. param.hXXX = hh1;
  19. param.xxx =0;
  20. HANDLE hThread =CreateThread(0,0,&ComFriendlyWaitMtaThreadProc,&param,0, NULL);
  21. WaitForSingleObject(hh2, INFINITE);
  22. if( SUCCEED(param.hr))
  23. {
  24. hr =CoGetInterfaceAndReleaseStream(param.pStream, GUID_6d5140c1_7436_11ce_8034_00aa006009fa,&p1);
  25. param.pStream = NULL;
  26. if( NULL != p1 )
  27. {
  28. p1->vtable[4](&p1);
  29. p1->Release();
  30. }
  31. SetEvent(hh1);
  32. WaitForSingleObject(*pThread, INFINITE);
  33. }
  34. AutoCleanupInfo(&hh1);
  35. AutoCleanupInfo(&hh2);
  36. AutoCleanupInfo(pThread);
  37. }
 
 
 
汇编码
  1. uf uiautomationcore!ComFriendlyWaitForSingleObject
  2. uiautomationcore!ComFriendlyWaitForSingleObject:
  3. 7303f4e98bff mov edi,edi
  4. 7303f4eb55 push ebp
  5. 7303f4ec8bec mov ebp,esp
  6. 7303f4ee83ec24 sub esp,24h
  7. 7303f4f153 push ebx
  8. 7303f4f256 push esi
  9. 7303f4f357 push edi
  10. 7303f4f433f6 xor esi,esi
  11. 7303f4f68d45f8 lea eax,[ebp-8]
  12. 7303f4f950 push eax
  13. 7303f4fa56 push esi
  14. 7303f4fb56 push esi
  15. 7303f4fc6a01 push 1
  16. 7303f4fe56 push esi
  17. 7303f4ff8975f8 mov dword ptr [ebp-8],esi
  18. 7303f502 e894fcffff call uiautomationcore!HrCreateEvent(7303f19b)
  19. 7303f5073bc6 cmp eax,esi
  20. 7303f5090f8c49950000 jl uiautomationcore!ComFriendlyWaitForSingleObject+0x22(73048a58)Branch
  21. uiautomationcore!ComFriendlyWaitForSingleObject+0x36:
  22. 7303f50f8d45fc lea eax,[ebp-4]
  23. 7303f51250 push eax
  24. 7303f51356 push esi
  25. 7303f51456 push esi
  26. 7303f5156a01 push 1
  27. 7303f51756 push esi
  28. 7303f5188975fc mov dword ptr [ebp-4],esi
  29. 7303f51b e87bfcffff call uiautomationcore!HrCreateEvent(7303f19b)
  30. 7303f5208bd8 mov ebx,eax
  31. 7303f5223bde cmp ebx,esi
  32. 7303f5240f8ca7000000 jl uiautomationcore!ComFriendlyWaitForSingleObject+0x4d(7303f5d1)Branch
  33. uiautomationcore!ComFriendlyWaitForSingleObject+0x58:
  34. 7303f52a8b4508 mov eax,dword ptr [ebp+8]
  35. 7303f52d8b7df8 mov edi,dword ptr [ebp-8]
  36. 7303f5308945dc mov dword ptr [ebp-24h],eax
  37. 7303f5338b450c mov eax,dword ptr [ebp+0Ch]
  38. 7303f53656 push esi
  39. 7303f5378945e0 mov dword ptr [ebp-20h],eax
  40. 7303f53a8b45fc mov eax,dword ptr [ebp-4]
  41. 7303f53d56 push esi
  42. 7303f53e8945f0 mov dword ptr [ebp-10h],eax
  43. 7303f5418d45dc lea eax,[ebp-24h]
  44. 7303f54450 push eax
  45. 7303f54568f1f50373 push offset uiautomationcore!ComFriendlyWaitMtaThreadProc(7303f5f1)
  46. 7303f54a56 push esi
  47. 7303f54b56 push esi
  48. 7303f54c8975e4 mov dword ptr [ebp-1Ch],esi
  49. 7303f54f8975e8 mov dword ptr [ebp-18h],esi
  50. 7303f552897dec mov dword ptr [ebp-14h],edi
  51. 7303f555 ff1514120373 call dword ptr [uiautomationcore!_imp__CreateThread (73031214)]
  52. 7303f55b89450c mov dword ptr [ebp+0Ch],eax
  53. 7303f55e3bc6 cmp eax,esi
  54. 7303f5600f84f9940000 je uiautomationcore!ComFriendlyWaitForSingleObject+0x90(73048a5f)Branch
  55. uiautomationcore!ComFriendlyWaitForSingleObject+0xac:
  56. 7303f5666aff push 0FFFFFFFFh
  57. 7303f56857 push edi
  58. 7303f5698b3d28120373 mov edi,dword ptr [uiautomationcore!_imp__WaitForSingleObject (73031228)]
  59. 7303f56f ffd7 call edi
  60. 7303f5718b5de4 mov ebx,dword ptr [ebp-1Ch]
  61. 7303f5743bde cmp ebx,esi
  62. 7303f5767c40 jl uiautomationcore!ComFriendlyWaitForSingleObject+0xfe(7303f5b8)Branch
  63. uiautomationcore!ComFriendlyWaitForSingleObject+0xbe:
  64. 7303f5788d4508 lea eax,[ebp+8]
  65. 7303f57b50 push eax
  66. 7303f57c68e4230373 push offset uiautomationcore!_GUID_6d5140c1_7436_11ce_8034_00aa006009fa (730323e4)
  67. 7303f581 ff75e8 push dword ptr [ebp-18h]
  68. 7303f584897508 mov dword ptr [ebp+8],esi
  69. 7303f587 ff1514130373 call dword ptr [uiautomationcore!_imp__CoGetInterfaceAndReleaseStream (73031314)]
  70. 7303f58d8b4d08 mov ecx,dword ptr [ebp+8]
  71. 7303f5908bd8 mov ebx,eax
  72. 7303f5928975e8 mov dword ptr [ebp-18h],esi
  73. 7303f5953bce cmp ecx,esi
  74. 7303f597741f je uiautomationcore!ComFriendlyWaitForSingleObject+0xfe(7303f5b8)Branch
  75. uiautomationcore!ComFriendlyWaitForSingleObject+0xdf:
  76. 7303f5998d45f4 lea eax,[ebp-0Ch]
  77. 7303f59c50 push eax
  78. 7303f59d b87c2e0373 mov eax,offset uiautomationcore!_GUID_00000000_0000_0000_c000_000000000046 (73032e7c)
  79. 7303f5a250 push eax
  80. 7303f5a350 push eax
  81. 7303f5a48975f4 mov dword ptr [ebp-0Ch],esi
  82. 7303f5a78b11 mov edx,dword ptr [ecx]
  83. 7303f5a951 push ecx
  84. 7303f5aa ff520c call dword ptr [edx+0Ch]
  85. 7303f5ad8bd8 mov ebx,eax
  86. 7303f5af8b4508 mov eax,dword ptr [ebp+8]
  87. 7303f5b28b08 mov ecx,dword ptr [eax]
  88. 7303f5b450 push eax
  89. 7303f5b5 ff5108 call dword ptr [ecx+8]
  90. uiautomationcore!ComFriendlyWaitForSingleObject+0xfe:
  91. 7303f5b8 ff75fc push dword ptr [ebp-4]
  92. 7303f5bb ff152c120373 call dword ptr [uiautomationcore!_imp__SetEvent (7303122c)]
  93. 7303f5c16aff push 0FFFFFFFFh
  94. 7303f5c3 ff750c push dword ptr [ebp+0Ch]
  95. 7303f5c6 ffd7 call edi
  96. 7303f5c88d450c lea eax,[ebp+0Ch]
  97. 7303f5cb50 push eax
  98. 7303f5cc e8e8f0ffff call uiautomationcore!AutoCleanupInfo<void*>::SafeRelease(7303e6b9)
  99. uiautomationcore!ComFriendlyWaitForSingleObject+0x4d:
  100. 7303f5d18d45fc lea eax,[ebp-4]
  101. 7303f5d450 push eax
  102. 7303f5d5 e8dff0ffff call uiautomationcore!AutoCleanupInfo<void*>::SafeRelease(7303e6b9)
  103. uiautomationcore!ComFriendlyWaitForSingleObject+0x24:
  104. 7303f5da8d45f8 lea eax,[ebp-8]
  105. 7303f5dd50 push eax
  106. 7303f5de e8d6f0ffff call uiautomationcore!AutoCleanupInfo<void*>::SafeRelease(7303e6b9)
  107. 7303f5e35f pop edi
  108. 7303f5e45e pop esi
  109. 7303f5e58bc3 mov eax,ebx
  110. 7303f5e75b pop ebx
  111. 7303f5e8 c9 leave
  112. 7303f5e9 c20800 ret 8
  113. uiautomationcore!ComFriendlyWaitForSingleObject+0x22:
  114. 73048a588bd8 mov ebx,eax
  115. 73048a5a e97b6bffff jmp uiautomationcore!ComFriendlyWaitForSingleObject+0x24(7303f5da)Branch
  116. uiautomationcore!ComFriendlyWaitForSingleObject+0x90:
  117. 73048a5f8d450c lea eax,[ebp+0Ch]
  118. 73048a6250 push eax
  119. 73048a63 e8515cffff call uiautomationcore!AutoCleanupInfo<void*>::SafeRelease(7303e6b9)
  120. 73048a688d45fc lea eax,[ebp-4]
  121. 73048a6b50 push eax
  122. 73048a6c e8485cffff call uiautomationcore!AutoCleanupInfo<void*>::SafeRelease(7303e6b9)
  123. 73048a71 bb0e000780 mov ebx,8007000Eh
  124. 73048a76 e95f6bffff jmp uiautomationcore!ComFriendlyWaitForSingleObject+0x24(7303f5da)Branch
 
 





posted @ 2016-12-27 14:38  BCN  阅读(695)  评论(0编辑  收藏  举报