I have an application in which some code integrity check procedure is used. I calculate CRC of the code fragment after applicaztion is built and then check in in runtime.
All works well om 32bit platform, but there are lot of troubles on 64-bit platform.
What I have tried:
Integrity check looks like the following:
codemark1_start:
<Some code>
codemark1_end:
AsmCrcCodeMrk((MyTinyBuff), codemark1_start, codemark1_end, 1,Procedure);
AsmCrcCodeMrk macro looks like
AsmCrcCodeMrk(DescriptorAddr, StartAddr, EndAddr, Id, BPA) \
AsmCrcCodeSig \
__asm mov EAX, offset DescriptorAddr \
__asm mov EAX, StartAddr \
__asm mov EAX, EndAddr \
__asm mov EAX, Id\
__asm mov EAX, BPA\
After compilation, the program has been processed by an additional application that "pulls out" the fragments between labels and calculates theirs CRC. Under Win32, everything compiles and works.
However, for X64 there are difficulties:
1) X64 in Visual Studio 2015 does not support inline assembler. But I can make macro as function in separate file and I can make the function __forceinline.
2) It is necessary to get addresses of labels at the compilation time. And this is a problem.
Can anyone tell me how to get addresses of labels at the compilation time for X64 platform?