In tutorial 2 it says that most function prototypes (ExitProcess) are kept in the include files. Therefore all that you need to do is write this

include \masm32\include\windows.inc
include \masm32\include\kernel32.inc

in your file. You are then able to invoke ExitProcess and everything works ok.

In tutorial 3 it says to use the prototype WinMain, but first you have to define its function.

Tutorial 2 does not have written in the code
ExitProcess proto uExitCode:DWORD
becasue it is in the kernel32.inc but you can still invoke the function.

Tutorial 3 says that you must define the function in the code.
WinMain proto :DWORD,:DWORD,:DWORD,:DWORD
so that you can invoke the function.

Why is there a difference? Surely the WinMain prot can be invoked without having to write it in the code? Wouldn't its definiton be in kernel32.inc or some other inc file?

Thanks
Steve
Posted on 2005-01-10 19:54:08 by stevenroyals
kernel32.inc and friends have prototypes for the functions that are in the windows API, located in the various DLL files (user32.dll, kernel32.dll etc.)

WinMain is *your* code, and not part of the API. You could call it anything you want, "myFuNkYWiZZaRd" for example, and thus you must declare a proto for it (or write the proc *before* code that uses it).
Posted on 2005-01-10 20:31:47 by f0dder
Thanks for your help

So it would only work if it was present in a dll file. Since it is not present there you have to write the code in your own program.

WinMain is explained in win32 programmers guide and yet cannot be used in the same way as ExitProcess proto which is also explained in the guide.

I think I understand it a bit now.

Steve
Posted on 2005-01-10 21:36:12 by stevenroyals
Thank you for your help! 8)
Posted on 2005-08-04 06:13:12 by lc00