hi, i coded a program some time ago and i used assume, but i forgot what i needed that for? is assume edi:ptr IMAGE_DOS_HEADER the same as lea edi,IMAGE_DOS_HEADER (i'm not sure if this lea stuff is possible here) bye
Assume makes ML use the assumed register like what ever it is instructed assume (a nice and clear description :P )
However, you must assume NOTHING after you've finished or else MASM may do the unexpected (it'll keep treating it like a pointer to MyStruct). Much safer to use
assume eax:PTR MyStruct mov eax.Element1, ecx mov eax.Element2, edx assume eax:NOTHING
The compiled code is the same, and you only treat eax like a pointer when YOU want to! Plus its easier to read, you don't have to scan through your code for what you last assumed eax to be... Plus it kind of makes more sense when you come back to it later :P Mirno
mov (MyStruct PTR ).Element1, ecx mov (MyStruct PTR ).Element2, edx
ASSUME is the opposite of LEA. ASSUME tells the assembler what kind of addresses a register is supposed to have. The assembler uses this information to encode an addressing mode in an instruction. LEA is actual code that constructs the actual address when it executes.