Advertisement
Guest User

Untitled

a guest
Dec 5th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 15.55 KB | None | 0 0
  1.     //
  2.     // SerializeObjectToMemBuff()
  3.     //
  4.     //
  5.     //*********************************************************************************************
  6.     CSmartPtrRef<I_MemoryBufferExt> SerializeObjectToMemBuff(I_BaseObject &obj)
  7.     {
  8. 00007FF63D14CCA0  mov         qword ptr [rsp+18h],rbx  
  9. 00007FF63D14CCA5  push        rbp  
  10. 00007FF63D14CCA6  push        rsi  
  11. 00007FF63D14CCA7  push        rdi  
  12. 00007FF63D14CCA8  push        r12  
  13. 00007FF63D14CCAA  push        r13  
  14. 00007FF63D14CCAC  push        r14  
  15. 00007FF63D14CCAE  push        r15  
  16. 00007FF63D14CCB0  lea         rbp,[rsp-27h]  
  17. 00007FF63D14CCB5  sub         rsp,0B0h  
  18. 00007FF63D14CCBC  mov         rax,qword ptr [__security_cookie (07FF63F4CE748h)]  
  19. 00007FF63D14CCC3  xor         rax,rsp  
  20. 00007FF63D14CCC6  mov         qword ptr [rbp+1Fh],rax  
  21. 00007FF63D14CCCA  mov         rdi,rdx  
  22. 00007FF63D14CCCD  mov         r15,rcx  
  23. 00007FF63D14CCD0  mov         qword ptr [rbp-31h],rcx  
  24. 00007FF63D14CCD4  xor         r13d,r13d  
  25. 00007FF63D14CCD7  mov         dword ptr [rbp-69h],r13d  
  26.         const CHAR * classId(obj._GetRTTI()->GetClassId());
  27. 00007FF63D14CCDB  mov         rax,qword ptr [rdx]  
  28. 00007FF63D14CCDE  mov         rcx,rdx  
  29. 00007FF63D14CCE1  call        qword ptr [rax+18h]  
  30. 00007FF63D14CCE4  mov         rcx,rax  
  31. 00007FF63D14CCE7  call        Nexus::CRTTI::GetClassId (07FF63A4035C7h)  
  32. 00007FF63D14CCEC  mov         rbx,rax  
  33.  
  34.         NX_ASSERT(classId);
  35. 00007FF63D14CCEF  test        rax,rax  
  36. 00007FF63D14CCF2  jne         Nexus::SerializeObjectToMemBuff+6Bh (07FF63D14CD0Bh)  
  37. 00007FF63D14CCF4  lea         r8d,[r13+14h]  
  38. 00007FF63D14CCF8  lea         rdx,[string "O:\\Projects\\code\\nexus\\kernel\\u@"... (07FF63EADE5B0h)]  
  39. 00007FF63D14CCFF  lea         rcx,[string "(classId)" (07FF63E6468E0h)]  
  40. 00007FF63D14CD06  call        Nexus::SysAssertExpr (07FF63A4069D9h)  
  41.  
  42.         CSmartPtrRef<Persistence::COutputNode>  output(NX_NEW Persistence::COutputNode(4096));
  43. 00007FF63D14CD0B  mov         ecx,50h  
  44. 00007FF63D14CD10  call        Nexus::CPoolAllocatedObj<150,64,Nexus::CMTLockingPolicyNULL>::operator new (07FF63A400C46h)  
  45. 00007FF63D14CD15  mov         qword ptr [rbp-49h],rax  
  46. 00007FF63D14CD19  test        rax,rax  
  47. 00007FF63D14CD1C  je          Nexus::SerializeObjectToMemBuff+8Dh (07FF63D14CD2Dh)  
  48. 00007FF63D14CD1E  mov         edx,1000h  
  49. 00007FF63D14CD23  mov         rcx,rax  
  50. 00007FF63D14CD26  call        Nexus::Persistence::COutputNode::COutputNode (07FF63A42A276h)  
  51. 00007FF63D14CD2B  jmp         Nexus::SerializeObjectToMemBuff+90h (07FF63D14CD30h)  
  52. 00007FF63D14CD2D  mov         rax,r13  
  53. 00007FF63D14CD30  lea         rsi,[Nexus::CSmartPtrRef<Nexus::Persistence::COutputNode>::`vftable' (07FF63E64C8C8h)]  
  54. 00007FF63D14CD37  mov         qword ptr [rbp-61h],rsi  
  55. 00007FF63D14CD3B  mov         qword ptr [rbp-59h],rax  
  56. 00007FF63D14CD3F  test        rax,rax  
  57. 00007FF63D14CD42  je          Nexus::SerializeObjectToMemBuff+0A7h (07FF63D14CD47h)  
  58. 00007FF63D14CD44  inc         dword ptr [rax+8]  
  59.  
  60.         NX_CHECK(output->Process(CToken("__classId").Get(), CStdString(classId)));
  61. 00007FF63D14CD47  lea         rdx,[string "__classId" (07FF63EADE5F8h)]  
  62. 00007FF63D14CD4E  lea         rcx,[rbp-29h]  
  63. 00007FF63D14CD52  call        Nexus::CToken::CToken (07FF63A3E7124h)  
  64. 00007FF63D14CD57  mov         ecx,dword ptr [rax]  
  65. 00007FF63D14CD59  mov         dword ptr [rbp-51h],ecx  
  66. 00007FF63D14CD5C  mov         qword ptr [rbp+0Fh],r13  
  67. 00007FF63D14CD60  mov         qword ptr [rbp+17h],0Fh  
  68. 00007FF63D14CD68  mov         byte ptr [rbp-1],0  
  69. 00007FF63D14CD6C  mov         r8,0FFFFFFFFFFFFFFFFh  
  70. 00007FF63D14CD73  inc         r8  
  71. 00007FF63D14CD76  cmp         byte ptr [rbx+r8],0  
  72. 00007FF63D14CD7B  jne         Nexus::SerializeObjectToMemBuff+0D3h (07FF63D14CD73h)  
  73. 00007FF63D14CD7D  mov         rdx,rbx  
  74. 00007FF63D14CD80  lea         rcx,[rbp-1]  
  75. 00007FF63D14CD84  call        std::basic_string<char,std::char_traits<char>,std::allocator<char> >::assign (07FF63A3FC5F1h)  
  76. 00007FF63D14CD89  nop  
  77. 00007FF63D14CD8A  lea         r8,[rbp-1]  
  78. 00007FF63D14CD8E  lea         rdx,[rbp-51h]  
  79. 00007FF63D14CD92  mov         rcx,qword ptr [rbp-59h]  
  80. 00007FF63D14CD96  call        Nexus::Persistence::COutputNode::Process<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > (07FF63A3E1B7Fh)  
  81. 00007FF63D14CD9B  test        al,al  
  82. 00007FF63D14CD9D  jne         Nexus::SerializeObjectToMemBuff+119h (07FF63D14CDB9h)  
  83. 00007FF63D14CD9F  mov         r8d,18h  
  84. 00007FF63D14CDA5  lea         rdx,[string "O:\\Projects\\code\\nexus\\kernel\\u@"... (07FF63EADE5B0h)]  
  85. 00007FF63D14CDAC  lea         rcx,[string "(output->Process(CToken("__clas@"... (07FF63EADE610h)]  
  86. 00007FF63D14CDB3  call        Nexus::SysAssertExpr (07FF63A4069D9h)  
  87. 00007FF63D14CDB8  nop  
  88. 00007FF63D14CDB9  mov         rdx,qword ptr [rbp+17h]  
  89. 00007FF63D14CDBD  cmp         rdx,10h  
  90. 00007FF63D14CDC1  jb          Nexus::SerializeObjectToMemBuff+154h (07FF63D14CDF4h)  
  91. 00007FF63D14CDC3  inc         rdx  
  92. 00007FF63D14CDC6  mov         rcx,qword ptr [rbp-1]  
  93. 00007FF63D14CDCA  mov         rax,rcx  
  94. 00007FF63D14CDCD  cmp         rdx,1000h  
  95. 00007FF63D14CDD4  jb          Nexus::SerializeObjectToMemBuff+14Fh (07FF63D14CDEFh)  
  96. 00007FF63D14CDD6  add         rdx,27h  
  97. 00007FF63D14CDDA  mov         rcx,qword ptr [rcx-8]  
  98. 00007FF63D14CDDE  sub         rax,rcx  
  99. 00007FF63D14CDE1  add         rax,0FFFFFFFFFFFFFFF8h  
  100. 00007FF63D14CDE5  cmp         rax,1Fh  
  101. 00007FF63D14CDE9  ja          Nexus::DeserializeObjectFromMemBuff+9h (07FF63D14D069h)  
  102. 00007FF63D14CDEF  call        operator delete (07FF63A3C1C7Bh)  
  103. 00007FF63D14CDF4  mov         qword ptr [rbp+0Fh],r13  
  104. 00007FF63D14CDF8  mov         qword ptr [rbp+17h],0Fh  
  105. 00007FF63D14CE00  mov         byte ptr [rbp-1],0  
  106. 00007FF63D14CE04  lea         rax,[Nexus::Persistence::CIOCtxBase::`vftable' (07FF63E6CA998h)]  
  107. 00007FF63D14CE0B  mov         qword ptr [rbp-49h],rax  
  108.  
  109.         if (!obj.SaveState(output, Persistence::CIOCtxBase()))
  110. 00007FF63D14CE0F  mov         rax,qword ptr [rdi]  
  111. 00007FF63D14CE12  lea         r8,[rbp-49h]  
  112. 00007FF63D14CE16  lea         rdx,[rbp-61h]  
  113. 00007FF63D14CE1A  mov         rcx,rdi  
  114. 00007FF63D14CE1D  call        qword ptr [rax+30h]  
  115. 00007FF63D14CE20  test        al,al  
  116. 00007FF63D14CE22  jne         Nexus::SerializeObjectToMemBuff+222h (07FF63D14CEC2h)  
  117.         {
  118.             NX_TRACE_E(FS("%s: unable to serialize object of class %s", __NX_FUNC_ID, classId));
  119. 00007FF63D14CE28  mov         r9,rbx  
  120. 00007FF63D14CE2B  lea         r8,[string "Nexus::SerializeObjectToMemBuff" (07FF63EADE660h)]  
  121. 00007FF63D14CE32  lea         rdx,[string "%s: unable to serialize object @"... (07FF63EADE688h)]  
  122. 00007FF63D14CE39  lea         rcx,[rbp-1]  
  123. 00007FF63D14CE3D  call        Nexus::FS (07FF63A411168h)  
  124. 00007FF63D14CE42  nop  
  125. 00007FF63D14CE43  mov         rcx,rax  
  126. 00007FF63D14CE46  call        Nexus::NX_TRACE_E (07FF63A3FE17Bh)  
  127. 00007FF63D14CE4B  nop  
  128. 00007FF63D14CE4C  mov         rdx,qword ptr [rbp+17h]  
  129. 00007FF63D14CE50  cmp         rdx,10h  
  130. 00007FF63D14CE54  jb          Nexus::SerializeObjectToMemBuff+1E7h (07FF63D14CE87h)  
  131. 00007FF63D14CE56  inc         rdx  
  132. 00007FF63D14CE59  mov         rcx,qword ptr [rbp-1]  
  133. 00007FF63D14CE5D  mov         rax,rcx  
  134. 00007FF63D14CE60  cmp         rdx,1000h  
  135. 00007FF63D14CE67  jb          Nexus::SerializeObjectToMemBuff+1E2h (07FF63D14CE82h)  
  136. 00007FF63D14CE69  add         rdx,27h  
  137. 00007FF63D14CE6D  mov         rcx,qword ptr [rcx-8]  
  138. 00007FF63D14CE71  sub         rax,rcx  
  139. 00007FF63D14CE74  add         rax,0FFFFFFFFFFFFFFF8h  
  140. 00007FF63D14CE78  cmp         rax,1Fh  
  141. 00007FF63D14CE7C  ja          Nexus::DeserializeObjectFromMemBuff+3h (07FF63D14D063h)  
  142. 00007FF63D14CE82  call        operator delete (07FF63A3C1C7Bh)  
  143.  
  144.             return false;
  145. 00007FF63D14CE87  lea         rax,[Nexus::CSmartPtrRef<Nexus::I_MemoryBufferExt>::`vftable' (07FF63E649130h)]  
  146. 00007FF63D14CE8E  mov         qword ptr [r15],rax  
  147. 00007FF63D14CE91  mov         qword ptr [r15+8],r13  
  148. 00007FF63D14CE95  mov         qword ptr [rbp-61h],rsi  
  149. 00007FF63D14CE99  mov         rcx,qword ptr [rbp-59h]  
  150. 00007FF63D14CE9D  test        rcx,rcx  
  151. 00007FF63D14CEA0  je          Nexus::SerializeObjectToMemBuff+399h (07FF63D14D039h)  
  152. 00007FF63D14CEA6  dec         dword ptr [rcx+8]  
  153. 00007FF63D14CEA9  cmp         dword ptr [rcx+8],0  
  154. 00007FF63D14CEAD  jg          Nexus::SerializeObjectToMemBuff+399h (07FF63D14D039h)  
  155. 00007FF63D14CEB3  mov         rax,qword ptr [rcx]  
  156. 00007FF63D14CEB6  mov         edx,1  
  157. 00007FF63D14CEBB  call        qword ptr [rax]  
  158.         }
  159.  
  160. #if 0
  161.         const size_t streamSize(output->GetMemStream()->Size());
  162.  
  163.         return CMemoryBufferExt::CreateWithTakingDataOwnership(output->GetMemStream()->RetrieveDataOwnership(), streamSize, true);
  164. #else
  165.         //
  166.         // Codegen bug introduced Visual Studio 2019 16.4.0 causes following code to create memory buffer object of size 0
  167.         //
  168.  
  169.         return CMemoryBufferExt::CreateWithTakingDataOwnership(output->GetMemStream()->RetrieveDataOwnership(), output->GetMemStream()->Size(), true);
  170. 00007FF63D14CEBD  jmp         Nexus::SerializeObjectToMemBuff+399h (07FF63D14D039h)  
  171. 00007FF63D14CEC2  lea         rax,[Nexus::CSmartPtrRef<Nexus::CMemoryStream>::`vftable' (07FF63E6A2220h)]  
  172. 00007FF63D14CEC9  mov         qword ptr [rbp-21h],rax  
  173. 00007FF63D14CECD  mov         rdi,qword ptr [rbp-59h]  
  174. 00007FF63D14CED1  mov         rsi,qword ptr [rdi+28h]  
  175. 00007FF63D14CED5  mov         qword ptr [rbp-19h],rsi  
  176. 00007FF63D14CED9  test        rsi,rsi  
  177. 00007FF63D14CEDC  je          Nexus::SerializeObjectToMemBuff+245h (07FF63D14CEE5h)  
  178. 00007FF63D14CEDE  inc         dword ptr [rsi+8]  
  179. 00007FF63D14CEE1  mov         rdi,qword ptr [rbp-59h]  
  180. 00007FF63D14CEE5  mov         qword ptr [rbp-11h],rax  
  181. 00007FF63D14CEE9  mov         rdi,qword ptr [rdi+28h]  
  182. 00007FF63D14CEED  mov         qword ptr [rbp-9],rdi  
  183. 00007FF63D14CEF1  test        rdi,rdi  
  184. 00007FF63D14CEF4  je          Nexus::SerializeObjectToMemBuff+259h (07FF63D14CEF9h)  
  185. 00007FF63D14CEF6  inc         dword ptr [rdi+8]  
  186. 00007FF63D14CEF9  mov         r14,qword ptr [rsi+30h]  
  187. 00007FF63D14CEFD  mov         r12,qword ptr [rdi+18h]  
  188. 00007FF63D14CF01  mov         qword ptr [rdi+18h],r13  
  189. 00007FF63D14CF05  mov         qword ptr [rdi+28h],r13  
  190. 00007FF63D14CF09  mov         qword ptr [rdi+20h],r13  
  191. 00007FF63D14CF0D  mov         qword ptr [rdi+30h],r13  
  192. 00007FF63D14CF11  mov         ecx,28h  
  193. 00007FF63D14CF16  call        operator new (07FF63A42AA19h)  
  194. 00007FF63D14CF1B  mov         rbx,rax  
  195. 00007FF63D14CF1E  mov         qword ptr [rbp-41h],rax  
  196. 00007FF63D14CF22  test        rax,rax  
  197. 00007FF63D14CF25  je          Nexus::SerializeObjectToMemBuff+2AFh (07FF63D14CF4Fh)  
  198. 00007FF63D14CF27  lea         rax,[Nexus::CRefCountedMT::`vftable' (07FF63E648E30h)]  
  199. 00007FF63D14CF2E  mov         qword ptr [rbx],rax  
  200. 00007FF63D14CF31  mov         dword ptr [rbx+8],r13d  
  201. 00007FF63D14CF35  lea         rax,[Nexus::CMemoryBufferExt::`vftable' (07FF63E649038h)]  
  202. 00007FF63D14CF3C  mov         qword ptr [rbx],rax  
  203. 00007FF63D14CF3F  mov         qword ptr [rbx+10h],r12  
  204. 00007FF63D14CF43  mov         qword ptr [rbx+18h],r14  
  205. 00007FF63D14CF47  mov         word ptr [rbx+20h],101h  
  206. 00007FF63D14CF4D  jmp         Nexus::SerializeObjectToMemBuff+2B2h (07FF63D14CF52h)  
  207. 00007FF63D14CF4F  mov         rbx,r13  
  208. 00007FF63D14CF52  lea         rax,[Nexus::CSmartPtrRef<Nexus::CMemoryBufferExt>::`vftable' (07FF63E649098h)]  
  209. 00007FF63D14CF59  mov         qword ptr [rbp-41h],rax  
  210. 00007FF63D14CF5D  mov         qword ptr [rbp-39h],rbx  
  211. 00007FF63D14CF61  test        rbx,rbx  
  212. 00007FF63D14CF64  je          Nexus::SerializeObjectToMemBuff+2CFh (07FF63D14CF6Fh)  
  213. 00007FF63D14CF66  lea         rcx,[rbx+8]  
  214. 00007FF63D14CF6A  call        Nexus::InterlockedInc (07FF63A41D68Eh)  
  215. 00007FF63D14CF6F  mov         dword ptr [rbp-69h],2  
  216. 00007FF63D14CF76  lea         rax,[Nexus::CSmartPtrRef<Nexus::I_MemoryBufferExt>::`vftable' (07FF63E649130h)]  
  217. 00007FF63D14CF7D  mov         qword ptr [r15],rax  
  218. 00007FF63D14CF80  mov         qword ptr [r15+8],rbx  
  219. 00007FF63D14CF84  test        rbx,rbx  
  220. 00007FF63D14CF87  je          Nexus::SerializeObjectToMemBuff+2F2h (07FF63D14CF92h)  
  221. 00007FF63D14CF89  lea         rcx,[rbx+8]  
  222. 00007FF63D14CF8D  call        Nexus::InterlockedInc (07FF63A41D68Eh)  
  223. 00007FF63D14CF92  mov         dword ptr [rbp-69h],3  
  224. 00007FF63D14CF99  test        rbx,rbx  
  225. 00007FF63D14CF9C  je          Nexus::SerializeObjectToMemBuff+339h (07FF63D14CFD9h)  
  226. 00007FF63D14CF9E  lea         rcx,[rbx+8]  
  227. 00007FF63D14CFA2  call        Nexus::InterlockedDec (07FF63A3CAECAh)  
  228. 00007FF63D14CFA7  mov         r14d,eax  
  229. 00007FF63D14CFAA  test        eax,eax  
  230. 00007FF63D14CFAC  jns         Nexus::SerializeObjectToMemBuff+327h (07FF63D14CFC7h)  
  231. 00007FF63D14CFAE  mov         r8d,52h  
  232. 00007FF63D14CFB4  lea         rdx,[string "O:\\Projects\\code\\nexus\\common\\r@"... (07FF63E648E40h)]  
  233. 00007FF63D14CFBB  lea         rcx,[string "(static_cast<int32>(newCnt) >= @"... (07FF63E648E78h)]  
  234. 00007FF63D14CFC2  call        Nexus::SysAssertExpr (07FF63A4069D9h)  
  235. 00007FF63D14CFC7  test        r14d,r14d  
  236. 00007FF63D14CFCA  jne         Nexus::SerializeObjectToMemBuff+339h (07FF63D14CFD9h)  
  237. 00007FF63D14CFCC  mov         rax,qword ptr [rbx]  
  238. 00007FF63D14CFCF  lea         edx,[r14+1]  
  239. 00007FF63D14CFD3  mov         rcx,rbx  
  240. 00007FF63D14CFD6  call        qword ptr [rax]  
  241. 00007FF63D14CFD8  nop  
  242. 00007FF63D14CFD9  test        rdi,rdi  
  243. 00007FF63D14CFDC  je          Nexus::SerializeObjectToMemBuff+355h (07FF63D14CFF5h)  
  244. 00007FF63D14CFDE  dec         dword ptr [rdi+8]  
  245. 00007FF63D14CFE1  cmp         dword ptr [rdi+8],0  
  246. 00007FF63D14CFE5  jg          Nexus::SerializeObjectToMemBuff+355h (07FF63D14CFF5h)  
  247. 00007FF63D14CFE7  mov         rax,qword ptr [rdi]  
  248. 00007FF63D14CFEA  mov         edx,1  
  249. 00007FF63D14CFEF  mov         rcx,rdi  
  250. 00007FF63D14CFF2  call        qword ptr [rax]  
  251. 00007FF63D14CFF4  nop  
  252. 00007FF63D14CFF5  test        rsi,rsi  
  253. 00007FF63D14CFF8  je          Nexus::SerializeObjectToMemBuff+371h (07FF63D14D011h)  
  254. 00007FF63D14CFFA  dec         dword ptr [rsi+8]  
  255. 00007FF63D14CFFD  cmp         dword ptr [rsi+8],0  
  256. 00007FF63D14D001  jg          Nexus::SerializeObjectToMemBuff+371h (07FF63D14D011h)  
  257. 00007FF63D14D003  mov         rax,qword ptr [rsi]  
  258. 00007FF63D14D006  mov         edx,1  
  259. 00007FF63D14D00B  mov         rcx,rsi  
  260. 00007FF63D14D00E  call        qword ptr [rax]  
  261. 00007FF63D14D010  nop  
  262. 00007FF63D14D011  lea         rax,[Nexus::CSmartPtrRef<Nexus::Persistence::COutputNode>::`vftable' (07FF63E64C8C8h)]  
  263. 00007FF63D14D018  mov         qword ptr [rbp-61h],rax  
  264. 00007FF63D14D01C  mov         rcx,qword ptr [rbp-59h]  
  265. 00007FF63D14D020  test        rcx,rcx  
  266. 00007FF63D14D023  je          Nexus::SerializeObjectToMemBuff+399h (07FF63D14D039h)  
  267. 00007FF63D14D025  dec         dword ptr [rcx+8]  
  268. 00007FF63D14D028  cmp         dword ptr [rcx+8],0  
  269. 00007FF63D14D02C  jg          Nexus::SerializeObjectToMemBuff+399h (07FF63D14D039h)  
  270. 00007FF63D14D02E  mov         r8,qword ptr [rcx]  
  271. 00007FF63D14D031  mov         edx,1  
  272. 00007FF63D14D036  call        qword ptr [r8]  
  273. 00007FF63D14D039  mov         rax,r15  
  274. 00007FF63D14D03C  mov         rcx,qword ptr [rbp+1Fh]  
  275. 00007FF63D14D040  xor         rcx,rsp  
  276. 00007FF63D14D043  call        __security_check_cookie (07FF63A3EA315h)  
  277. 00007FF63D14D048  mov         rbx,qword ptr [rsp+100h]  
  278. 00007FF63D14D050  add         rsp,0B0h  
  279. 00007FF63D14D057  pop         r15  
  280. 00007FF63D14D059  pop         r14  
  281. 00007FF63D14D05B  pop         r13  
  282. 00007FF63D14D05D  pop         r12  
  283. 00007FF63D14D05F  pop         rdi  
  284. 00007FF63D14D060  pop         rsi  
  285. 00007FF63D14D061  pop         rbp  
  286. 00007FF63D14D062  ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement