i just wanted to know the differences between these two instructions. when should i use retn and when ret.
thanks not the macro ret but the instruction ret.
i disassembled a file in pe explorer and pebrowse and for the return instruction
pe explorer shows this:
retn 0h
while pebrowse shows this:
ret 0h
why is that are they different instructions or are they aliases
i disassembled a file in pe explorer and pebrowse and for the return instruction
pe explorer shows this:
retn 0h
while pebrowse shows this:
ret 0h
why is that are they different instructions or are they aliases
If you look into the Intel manual, you would realise that there is no such opcode for retn or retf (?!). I personally think that retn and retf are some invented by assembler coders/writers. The only word to put it is simply "personal choice".
evil__donkey,
As you would be aware, instruction names are just a human readable way of working with machine opcodes.
The return NEAR or FAR is a viable distinction in opcode choice but you normally use return NEAR for flat memory model 32 buit windows code.
The opcode for return NEAR is C3
The opcode for return FAR is CB
Far calls are part of a segmented model that is not normally used in 32 bit flat model.
What this means in an assembler like MASM is if you use the PROC system, just use RET at rthe end but if you write a manual procedure,
The RETN is the correct instruction to use as it is opcode C3.
As you would be aware, instruction names are just a human readable way of working with machine opcodes.
The return NEAR or FAR is a viable distinction in opcode choice but you normally use return NEAR for flat memory model 32 buit windows code.
The opcode for return NEAR is C3
The opcode for return FAR is CB
Far calls are part of a segmented model that is not normally used in 32 bit flat model.
What this means in an assembler like MASM is if you use the PROC system, just use RET at rthe end but if you write a manual procedure,
label:
; code
retn
The RETN is the correct instruction to use as it is opcode C3.
thank you hutch--. in another thread they were discussing about the number of parameters and there was a link to how one can export the decorations of functions in masm. They are using the export keyword which i am unable to find in the masm reference. I dont like the proc system so i normally code in the normal label syntax. how do i export the decorations. thank you.
evil__donkey,
I have dabbled with the EXPORT directive in ASM and from memory it puts a procedure name with a leading underscore into the export table of the EXE/DLL.
For a DLL a DEF file is very reliable and not much extra work so I tend to do it that way.
Regards,
http://www.asmcommunity.net/board/cryptmail.php?tauntspiders=in.your.face@nomail.for.you&id=2f46ed9f24413347f14439b64bdc03fd
I have dabbled with the EXPORT directive in ASM and from memory it puts a procedure name with a leading underscore into the export table of the EXE/DLL.
For a DLL a DEF file is very reliable and not much extra work so I tend to do it that way.
Regards,
http://www.asmcommunity.net/board/cryptmail.php?tauntspiders=in.your.face@nomail.for.you&id=2f46ed9f24413347f14439b64bdc03fd