8/8/2023 0 Comments Free pascal asm db![]() ![]() you might just write offset field instead of offset SomeType.field. The type may or may not be allowed there i.e. You'd get 0 for the VMT pointer, 4 for the first field, and so on, assuming you have nothing larger than four bytes, and everything gets aligned.Ĭhange your code to read the value from memory, like in the line of code above. Does field happen to be the second data member declared in your class (including anything declared in any ancestor classes)? If so, then that explains where you get 8 from. ![]() Instead, it's just the offset of that field in the class. If Free Pascal interprets this code the same way Delphi does, then a bare reference to field isn't including the implicit Self part. You can check the CPU view in the debugger to see whether that's what's really happening. Does anyone know how I can implement the. In particular, the functions call the PCI BIOS to read and write 32-bit (dword) configuration registers. To read the value from Self.field, the compiler would actually need to replace your code with something like this: mov EAX, dword ptr Ive had relatively good success, except for a pair of functions which use 32-bit registers (eax, edx, ecx, etc.). All the renaming machinery is done in the pascal program calling it. And we are done, now the assembly program can be linked, without changing anything in it. It calls WrapperStdHandle (nicknamed AliasGetStdHandle), which jumps to WindowsGetStdHandle, the DLL function. Recall that member access implicitly goes through Self, so when you write field in your code, what you really mean is Self.field. AsmGetStdHandle is the name in FreePascal of the assembly function gethandle. To read a field of an object isn't as simple an ordinary read from memory. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |