|
-
Apr 30th, 2020, 09:50 PM
#29
Re: AddressOf for Class Methods (and other VTable exploration)?
 Originally Posted by JAAFAR
Any suggestions ?
Honestly, start a new thread. Specifically address COM in 64 bit, VTable layout and more.
For example, and I'm not even sure this is correct... In a 64 bit Access module to scan an Access class
Code:
Option Explicit
Private Declare PtrSafe Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" (ByRef src As Any, ByRef dst As Any, ByVal cbLen As LongLong)
Public Sub doIt()
Dim c As New Class1
Dim nAddr As LongPtr, nMethod As LongPtr, b As Byte
CopyMemory nAddr, ByVal ObjPtr(c), 8
CopyMemory nMethod, ByVal nAddr + 7 * 8, 8
CopyMemory b, ByVal nMethod, 1
Debug.Print "byte "; b ' opcode
End Sub
Is that opcode the method signature that 32bit routine is looking for? I don't know. As you can see, just getting to the VTable is a bit challenging. Instead of using offset 28 (7*4 or &H1C) as we would for 32bit VB/VBA class, I used 7*8 hoping it is right. I actually crashed the first time when I guessed wrong.
Now, the code we know and has been tested on VB6 classes (not 64bit office), likely is not coded the same in 64bit which means someone needs to spend time spelunking. For example, in 32bit, we'd expect the 1st byte of the class to be &H33 when uncompiled, but the above sample returned &H258. Is that because a) I guessed wrong on how to access the VTable and its function, or b) 64bit Office rewrote its classes using 64bit registers vs 16/32bit, or c) 64bit office rewrote their class stubs and known opcodes no longer apply anyway.
But as I suggested, may want to start a new thread. I would suspect it might get lengthy. In addition, you may want to explain what you plan on doing with the function pointers once you get them (which will also be in 8-byte lengths).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|