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
 
 

[原]ComFriendlyWaitForSingleObject的更多相关文章

  1. [原]调试实战——使用windbg调试崩溃在ComFriendlyWaitMtaThreadProc

    原调试debugwindbgcrash崩溃COM 前言 这是几年前在项目中遇到的一个崩溃问题,崩溃在了ComFriendlyWaitMtaThreadProc()里,没有源码.耗费了我很大精力,最终通 ...

  2. 【原】谈谈对Objective-C中代理模式的误解

    [原]谈谈对Objective-C中代理模式的误解 本文转载请注明出处 —— polobymulberry-博客园 1. 前言 这篇文章主要是对代理模式和委托模式进行了对比,个人认为Objective ...

  3. 【原】FMDB源码阅读(三)

    [原]FMDB源码阅读(三) 本文转载请注明出处 —— polobymulberry-博客园 1. 前言 FMDB比较优秀的地方就在于对多线程的处理.所以这一篇主要是研究FMDB的多线程处理的实现.而 ...

  4. 【原】Android热更新开源项目Tinker源码解析系列之一:Dex热更新

    [原]Android热更新开源项目Tinker源码解析系列之一:Dex热更新 Tinker是微信的第一个开源项目,主要用于安卓应用bug的热修复和功能的迭代. Tinker github地址:http ...

  5. 多线程爬坑之路-学习多线程需要来了解哪些东西?(concurrent并发包的数据结构和线程池,Locks锁,Atomic原子类)

    前言:刚学习了一段机器学习,最近需要重构一个java项目,又赶过来看java.大多是线程代码,没办法,那时候总觉得多线程是个很难的部分很少用到,所以一直没下决定去啃,那些年留下的坑,总是得自己跳进去填 ...

  6. 【原】FMDB源码阅读(二)

    [原]FMDB源码阅读(二) 本文转载请注明出处 -- polobymulberry-博客园 1. 前言 上一篇只是简单地过了一下FMDB一个简单例子的基本流程,并没有涉及到FMDB的所有方方面面,比 ...

  7. 【原】FMDB源码阅读(一)

    [原]FMDB源码阅读(一) 本文转载请注明出处 —— polobymulberry-博客园 1. 前言 说实话,之前的SDWebImage和AFNetworking这两个组件我还是使用过的,但是对于 ...

  8. 【原】AFNetworking源码阅读(六)

    [原]AFNetworking源码阅读(六) 本文转载请注明出处 —— polobymulberry-博客园 1. 前言 这一篇的想讲的,一个就是分析一下AFSecurityPolicy文件,看看AF ...

  9. 【原】AFNetworking源码阅读(五)

    [原]AFNetworking源码阅读(五) 本文转载请注明出处 —— polobymulberry-博客园 1. 前言 上一篇中提及到了Multipart Request的构建方法- [AFHTTP ...

随机推荐

  1. ubuntu-vnc

    Centos 中文gnome: 全新以最小化包安装了64位的CentOS6.3系统,作为本地的Web服务器使用,现记录全过程: 1.先安装X Window yum groupinstall " ...

  2. iOS开发路线简述

    1 iOS开发环境1.1 开发环境标准的配置是MacOSX+Xcode.MacOSX的话首选用苹果电脑,Macmini最便宜只要4000多就好了然后自己配一个显示器,MacBookPro 也可以,不推 ...

  3. 16C554(8250)驱动分析

    参考: http://www.cnblogs.com/zym0805/p/4815041.html 一. 硬件数据手册 The ST16C554D is a universal asynchronou ...

  4. Leetcode: Design Phone Directory

    Design a Phone Directory which supports the following operations: get: Provide a number which is not ...

  5. jQuery ajax的traditional参数的作用///////////////////////////////////zzzzzzzzzzz

    jQuery ajax的traditional参数的作用 i33 发布时间: 2013/04/03 10:05 阅读: 9859 收藏: 9 点赞: 1 评论: 0 一般的,可能有些人在一个参数有多个 ...

  6. windows shell api SHEmptyRecycleBin 清空回收站

    HRESULT SHEmptyRecycleBin( HWND hwnd, LPCTSTR pszRootPath, DWORD dwFlags ); hwnd 父窗口句柄 pszRootPath 将 ...

  7. NLog路由规则和上下文信息

    NLog配置路由规则和上下文信息 rules: 规则节点 logger:一个路由规则 <rules> <!--<logger name="*" writeT ...

  8. splitFile2SmallFile

    1. split file into several files """ this is aa customizable version of the standard ...

  9. python的应该关注的语法

    1.try...finally def test_return(): try: print "try" raise ValueError("valueError" ...

  10. HTTPS原理详解

         HTTPS(全称:Hypertext Transfer Protocol over Secure Socket Layer),是以安全为目标的HTTP通道,简单讲是HTTP的安全版.即HTT ...