Hi again :
I need to convert this C structure to win32 asm :
typedef struct {
UINT uiImageWidth;
UINT uiImageHeight;
BOOL fLiveWindow;
BOOL fOverlayWindow;
BOOL fScale;
POINT ptScroll;
BOOL fUsingDefaultPalette;
BOOL fAudioHardware;
BOOL fCapFileExists;
DWORD dwCurrentVideoFrame;
DWORD dwCurrentVideoFramesDropped;
DWORD dwCurrentWaveSamples;
DWORD dwCurrentTimeElapsedMS;
HPALETTE hPalCurrent;
BOOL fCapturingNow;
DWORD dwReturn;
UINT wNumVideoAllocated;
UINT wNumAudioAllocated;
} CAPSTATUS;
I tryed to do it as follows :
CAPSTATUS STRUCT
uiImageWidth DWORD ?
uiImageHeight DWORD ?
fLiveWindow DWORD ?
fOverlayWindow DWORD ?
fScalea DWORD ?
ptScroll DWORD ?
fUsingDefaultPalette DWORD ?
fAudioHardware DWORD ?
fCapFileExists DWORD ?
dwCurrentVideoFrame DWORD ?
dwCurrentVideoFramesDropped DWORD ?
dwCurrentWaveSamples DWORD ?
dwCurrentTimeElapsedMS DWORD ?
hPalCurrent DWORD ?
fCapturingNow DWORD ?
dwReturn DWORD ?
wNumVideoAllocated DWORD ?
wNumAudioAllocated DWORD ?
CAPSTATUS ENDS
Is this correct? Where can I find something about conversions from C to
asm?
Thanks again.
Sergio A.S. de Aguiar
The h2inc.exe utility does a decent enough job converting simple structures like this.
The only ref I found on C to asm types is on page 641 of the "Enviroment and Tools" manual for MASM (available here). It's not a complete list, but a decent enough start.
Thanks for the answer, but I could'nt find the answer anywhere
to my question.
I just need to know if the structure above is right in asm, because
I need to use it in my code.
Specially the BOOL type - is it converted to DWORD in asm????
thanks :
Sergio A.S. de Aguiar
DWORD should be OK for bool type.
I'm betting that ptScroll should be a POINT struct.
CAPSTATUS STRUCT
...
ptScroll POINT<>
...
CAPSTATUS ENDS
ssaguiar
for BYTE, CHAR, BOOL, BOOLEAN,
use db
for DWORD, LARGE_INTEGER, LPXX, HANDLE
LPTSTR, LPARAM, UINT, INT, WNDPROC,
HICON, HCURSOR, HBRUSH, LPCTSTR,
HPALETTE, LONG, POINT
use dd
these are some translation i've used until now. Hope it help.to determine if you have proper conversion of such things as BOOL its a good idea to take a look at the windows.inc file. many of the common paramters are such as BOOL, UINT etc and see what they have been TYPEDEF to.
here is a code snipet of the windows include of some of the paramaters TYPEDEF's:
BOOL TYPEDEF DWORD
BOOLEAN TYPEDEF BYTE
LPBYTE TYPEDEF PTR BYTE
LPDWORD TYPEDEF PTR DWORD
LPVOID TYPEDEF PTR
LPCVOID TYPEDEF PTR
LPSTR TYPEDEF DWORD
LPCSTR TYPEDEF DWORD
UINT TYPEDEF DWORD
LONG TYPEDEF DWORD
SCODE TYPEDEF LONG
WPARAM TYPEDEF UINT
LPARAM TYPEDEF DWORD
HANDLE TYPEDEF DWORD
HWND TYPEDEF DWORD
HGLOBAL TYPEDEF DWORD
HGDIOBJ TYPEDEF DWORD
HACCEL TYPEDEF DWORD
HBITMAP TYPEDEF DWORD
HBRUSH TYPEDEF DWORD
HDC TYPEDEF DWORD
HFONT TYPEDEF DWORD
HICON TYPEDEF DWORD
HMENU TYPEDEF DWORD
HINSTANCE TYPEDEF DWORD
HRGN TYPEDEF DWORD
HRSRC TYPEDEF DWORD
HCURSOR TYPEDEF DWORD
COLORREF TYPEDEF DWORD
in your conversion you can either use BOOL, or in your case DWORD they both mean the same thing.
anon is correct when he wrote that the POINT is refereing to a STRUCT. ill explain using the souce code:
typedef struct {
UINT uiImageWidth; <--typical dword conversion
UINT uiImageHeight; all the way till
BOOL fLiveWindow;
BOOL fOverlayWindow;
BOOL fScale;
POINT ptScroll; <--here.. POINT is actually one
BOOL fUsingDefaultPalette; of the more common structures
BOOL fAudioHardware; you will encounter
BOOL fCapFileExists;
DWORD dwCurrentVideoFrame;
DWORD dwCurrentVideoFramesDropped;
DWORD dwCurrentWaveSamples;
DWORD dwCurrentTimeElapsedMS;
HPALETTE hPalCurrent; <--dont get confused here this
BOOL fCapturingNow; is just refering to a handle
DWORD dwReturn; and all handles are converted
UINT wNumVideoAllocated; to DWORD
UINT wNumAudioAllocated;
} CAPSTATUS;
your final code should look like this:
CAPSTATUS STRUCT
uiImageWidth DWORD ?
uiImageHeight DWORD ?
fLiveWindow DWORD ?
fOverlayWindow DWORD ?
fScalea DWORD ?
ptScroll POINT <> <--this is pointing
fUsingDefaultPalette DWORD ? to a struct that
fAudioHardware DWORD ? is already defined
fCapFileExists DWORD ? for you in the
dwCurrentVideoFrame DWORD ? windows.inc
dwCurrentVideoFramesDropped DWORD ?
dwCurrentWaveSamples DWORD ?
dwCurrentTimeElapsedMS DWORD ?
hPalCurrent DWORD ?
fCapturingNow DWORD ?
dwReturn DWORD ?
wNumVideoAllocated DWORD ?
wNumAudioAllocated DWORD ?
CAPSTATUS ENDS
the struct POINT looks like this in the windows.inc:
POINT STRUCT
x DWORD ?
y DWORD ?
POINT ENDS
hope this clears things up.
smurf
This message was edited by smurf, on 5/4/2001 5:34:09 PM
This message was edited by smurf, on 5/4/2001 5:35:53 PM
Thanks to you all folks...
Now I can work on this structure on a very good way...
Thanks again :
Sergio A.S. de Aguiar