Hi
I have allready a problem to convert a C.h to inc
proto stdcall :HWND, :LPCTSTR, :LPRECT
error A2006: undefined symbol : LPRECT
error A2195: parameter or local cannot have void type
error A2131: VARARG parameter requires C calling convention
Have you any idea to translate it?
stdcall is already a defined symbol with masm
If the function declaration (prototype) in the C header file specified __stdcall, then it means that the function uses the STDCALL calling convention:
http://msdn.microsoft.com/en-us/library/zxk0tw93(v=VS.90).aspx
If in your assembly source STDCALL is specified in the language field of the model directive:
.model flat, stdcall ; 32 bit memory model
Then unless your function declaration (PROTO) for the C function specifies a different calling convention, INVOKE will use STDCALL. So in other words, if the C function that you are prototyping uses STDCALL, then you can skip the langtype attribute in the function declaration (PROTO).
The header files tend to use a complex system of declarations, where new symbols are defined in terms of previously defined symbols. So, for example, in WinDef.h you see:
#define WINAPI __stdcall
Which basically assigns __stdcall to the symbol WINAPI. See:
http://msdn.microsoft.com/en-US/library/teas0593(v=VS.80).aspx
So for example in the header file WinGdi.h, you can read this declaration:
WINGDIAPI int WINAPI GetClipBox( IN HDC, OUT LPRECT);
As:
int __stdcall GetClipBox( IN HDC, OUT LPRECT);
Note that I ignored the WINGDIAPI because it is not meaningful for your purposes.
http://msdn.microsoft.com/en-us/library/9w92dxk3.aspx
The MASM32 windows.inc includes many of the definitions that you find in the header files, for example:
HDC typedef DWORD
HWND typedef DWORD
LPCTSTR typedef DWORD
LPRECT is not included, but you could easily add it to your copy, or place the definition at the top of your source. In 32-bit code you can safely assume that a pointer will be a DWORD. So for example, assuming that LPRECT had been defined, the prototype for GetClipBox could then be:
GetClipBox PROTO :HDC, :LPRECT
The actual prototype in gdi32.inc is:
GetClipBox PROTO :DWORD,:DWORD