Hi, I am a bit confused with the following statement from http://win32assembly.programminghorizon.com/tut3.html (http://win32assembly.programminghorizon.com/tut3.html) the tutorial I am refering to at the moment.
.code
start:
invoke GetModuleHandle, NULL
mov hInstance, eax
invoke GetCommandLine
mov CommandLine,eax
invoke WinMain, hInstance, NULL, CommandLine, SW_SHOWDEFAULT
invoke ExitProcess, eax
Is the statement mov hInstance, eax
and mov eax, hInstance
the same. As I have understood from the books I have refered so far, mov instruction will move the contents/address of the operand after coma (eax) into the operand before the coma (hInstance). I changed the code into mov eax, hInstance and run it, I still get the same result which makes me believe that there is no difference at least for this mov operation. Are they the same and what is really getting moved in this code? Great tutorial though!
for MASM syntax,
mov destination,source
some assemblers reverse the operands though - i hate them - lol
"i get the same result" will depend on how you verify that fact :P
Thanks @Dedndave. Please can you tell me why there is a NULL in here (invoke GetModuleHandle, NULL). Is it there for the same reason as terminating a string with null
NULL indicates that you want the handle of the current process
in some cases, you might want the handle of some other module...
.DATA
szKernel32 db 'kernel32.dll',0
.CODE
INVOKE GetModuleHandle,offset szKernel32
https://msdn.microsoft.com/en-us/library/windows/desktop/ms683199%28v=vs.85%29.aspx (https://msdn.microsoft.com/en-us/library/windows/desktop/ms683199%28v=vs.85%29.aspx)
NULL means ZERO it is 0 and it is assembled to 0
it means empty handle or pointer
if you write 0 that means it is ZERO integer
if you write FALSE that means ZERO Boolean
we write it that way for us programmers for better understanding
computers don't care, they want there a zero and assemblers translate it for them :biggrin:
sorry - i misunderstood the question
NULL is a standard windows constant that is defined in windows.inc
as Habran mentioned...
NULL EQU 0
Thank you Dedndave and Habran