The standard Win32 include files that are delivered with FASMW are extremely useful (thanks to Privalov for the great work!). However, being a new project, they are not complete and seem to contain one or the other 'issue' [1]. I wondered if it would be possible to distribute the include files as a separate ZIP file via FASM's SourceForge site. The idea is to have a centrally managed, 'authoritative' set of include files that gets updated independent of, and possibly more frequently than, the assembler. I am sure that there would be volunteers on this board to do the maintenance work.

Thank you, Frank

[1]
I mean stuff like this that everyone can easily correct for themselves, but then has include files that differ from everybody else's:

    [*]'apia\kernel32.inc': QueryPerformanceFrequency is being imported as 'QueryPerformanceFrequencyA' where the trailing 'A' is wrong.
    [*]'apia\kernel32.inc': QueryPerformanceCounter is missing.
    [*]'equates\kernel32.inc': the SDK's SYSTEM_INFO structure is labelled 'SYSTEMINFO'.
Posted on 2003-04-27 17:41:04 by Frank
Yes, I have some additions as well. In user32, MENUITEMINFO structure and constants are missing. In comctl32, LVITEM structure does not support newer indent fields, among other things. Perhaps we should post additions here for now?
Posted on 2003-04-27 20:25:45 by comrade
I post additions here for now. I urge many to contribute, so Privalov could easily add.


[b]equates/user32.inc[/b]:
struc MENUITEMINFO {
.cbSize dd ?
.fMask dd ?
.fType dd ?
.fState dd ?
.wID dd ?
.hSubMenu dd ?
.hbmpChecked dd ?
.hbmpUnchecked dd ?
.dwItemData dd ?
.dwTypeData dd ?
.cch dd ?
}
struct MENUITEMINFO

struc MEASUREITEMSTRUCT {
.CtlType dd ?
.CtlID dd ?
.itemID dd ?
.itemWidth dd ?
.itemHeight dd ?
.itemData dd ?
}
struct MEASUREITEMSTRUCT

MIIM_STATE = 1
MIIM_ID = 2
MIIM_SUBMENU = 4
MIIM_CHECKMARKS = 8
MIIM_TYPE = 10h
MIIM_DATA = 20h
MIIM_STRING = 40h
MIIM_BITMAP = 80h
MIIM_FTYPE = 100h
WS_EX_LAYERED = 00080000h
LWA_COLORKEY = 00000001h
LWA_ALPHA = 00000002h
ULW_COLORKEY = 00000001h
ULW_ALPHA = 00000002h
ULW_OPAQUE = 00000004h
ODT_MENU = 1
ODT_LISTBOX = 2
ODT_COMBOBOX = 3
ODT_BUTTON = 4
ODT_STATIC = 5
ODA_DRAWENTIRE = 1h
ODA_SELECT = 2h
ODA_FOCUS = 4h
ODS_SELECTED = 1h
ODS_GRAYED = 2h
ODS_DISABLED = 4h
ODS_CHECKED = 8h
ODS_FOCUS = 10h
ODS_DEFAULT = 20h
ODS_COMBOBOXEDIT = 1000h
ODS_HOTLIGHT = 40h
ODS_INACTIVE = 80h

SWP_FRAMECHANGED = 0020h

[b]equates/comctl32.inc[/b]:
LVIF_INDENT = 10h

struc LVITEM
{
.mask dd ?
.iItem dd ?
.iSubItem dd ?
.state dd ?
.stateMask dd ?
.pszText dd ?
.cchTextMax dd ?
.iImage dd ?
.lParam dd ?
.iIndent dd ? ; new field
}
struct LVITEM

LVS_EX_FLATSB = 100h
LVS_EX_REGIONAL = 200h
LVS_EX_INFOTIP = 400h
LVS_EX_UNDERLINEHOT = 800h
LVS_EX_UNDERLINECOLD = 1000h
LVS_EX_MULTIWORKAREAS = 2000h
LVS_EX_LABELTIP = 4000h

[b]apia/user32.inc[/b]:
GetLayeredWindowAttributes,'GetLayeredWindowAttributes',\
SetLayeredWindowAttributes,'SetLayeredWindowAttributes',\
Posted on 2003-05-02 17:06:35 by comrade
I coded a small utility to convert the includes for masm in to a fasm-compatible format. You should check it out, it might help :)


http://www.asmcommunity.net/board/index.php?topic=8767
Posted on 2003-05-03 14:56:45 by Delight
Thanks Delight, but unfortunately FASM include files miss not only some imports, but structures and constants as well.
Posted on 2003-05-03 22:49:49 by comrade
More additions:
[b]equates/user32.inc[/b]:

WM_SETHOTKEY = 0032h
; WM_HOTKEY commands
HOTKEYF_SHIFT = 01h
HOTKEYF_CONTROL = 02h
HOTKEYF_ALT = 04h
HOTKEYF_EXT = 08h

; GetWindowLong
DWL_MSGRESULT = 0
DWL_DLGPROC = 4
DWL_USER = 8


[b]equates/comctl32.inc[/b]:
struc NMCUSTOMDRAW {
.hdr NMHDR
.dwDrawStage dd ?
.hdc dd ?
.rc RECT
.dwItemSpec dd ?
.uItemState dd ?
.lItemlParam dd ?
}
struct NMCUSTOMDRAW

struc NMLVCUSTOMDRAW {
.nmcd NMCUSTOMDRAW
.clrText dd ?
.clrTextBk dd ?
.iSubItem dd ?
.dwItemType dd ?
.clrFace dd ?
.iIconEffect dd ?
.iIconPhase dd ?
.iPartId dd ?
.iStateId dd ?
.rcText RECT
.uAlign dd ?
}
struct NMLVCUSTOMDRAW

NM_CUSTOMDRAW = NM_FIRST - 12
Posted on 2003-05-03 22:51:56 by comrade
Posted on 2003-05-04 10:33:48 by Vortex
Thanks Delight,

This is very useful for me. If i would ask the sources, is a problem?
Posted on 2003-05-04 10:34:25 by cakmak

Thanks Delight,

This is very useful for me. If i would ask the sources, is a problem?


Hi, cakmak!

I will happily give you the sources to the program, but the problem is that it's not written in assembly language, it's written in Delphi. Since i'm still a newbie, and probably will be for ever, it would have taken me a hundred years to do the same thing using fasm or masm.
Posted on 2003-05-04 12:40:12 by Delight
OK! thank you. Btw, don't think needs more than a couple years :alright:

Greets
Posted on 2003-05-04 20:40:26 by cakmak
[b]equates/user32.inc[/b]:

struc MSGBOXPARAMS {
.cbSize dd ?
.hwndOwner dd ?
.hInstance dd ?
.lpszText dd ?
.lpszCaption dd ?
.dwStyle dd ?
.lpszIcon dd ?
.dwContextHelpId dd ?
.lpfnMsgBoxCallback dd ?
.dwLanguageId dd ?
}
struct MSGBOXPARAMS
Posted on 2003-05-20 22:26:05 by comrade
For console input the following may be useful, comes from 'wincon.h'



macro UNION [lbl,strucs]
{
common
local ..struc_count,..struc_max,..struc_max_arg
..struc_count=0
..struc_max=0
..struc_max_arg=0
forward
local ..label_dummy
local ..struc_len
..struc_count=..struc_count+1
virtual at 0
..label_dummy strucs
..struc_len = $
if ..struc_len > ..struc_max
..struc_max=..struc_len
..struc_max_arg=..struc_count
end if
end virtual
common
..struc_count=0
forward
..struc_count=..struc_count+1
if ..struc_count<>..struc_max_arg
virtual
.#lbl strucs
end virtual
end if
common
..struc_count=0
forward
..struc_count=..struc_count+1
if ..struc_count=..struc_max_arg
.#lbl strucs
end if
}

STRUC COORD
{
.x dw ?
.y dw ?
}
struct COORD

STRUC UCHAR
{
;
;this doesn't work, why?
;UNION AsciiChar, 'db ?',\
; UnicodeChar, 'dw ?'
;
;And this also doesn't work, why?
;UNION AsciiChar, 'rb 1',\
; UnicodeChar, 'rw 1'
;
;Do I need to use < and > around the arguments?
;
;
;This does work
;
virtual
.AsciiChar db ?
end virtual
.UnicodeChar dw ?
}

STRUC KEY_EVENT_RECORD
{
.bKeyDown dd ?
.wRepeatCount dw ?
.wVirtualKeyCode dw ?
.wVirtualScanCode dw ?
.uChar UCHAR
.dwControlKeyState dd ?
}
struct KEY_EVENT_RECORD

STRUC MOUSE_EVENT_RECORD
{
.dwMousePosition COORD
.dwButtonState dd ?
.dwControlKeyState dd ?
.dwEventFlags dd ?
}
struct MOUSE_EVENT_RECORD

STRUC WINDOW_BUFFER_SIZE_RECORD
{
.dwSize COORD
}
struct WINDOW_BUFFER_SIZE_RECORD

STRUC MENU_EVENT_RECORD
{
.dwCommandId dd ?
}
struct MENU_EVENT_RECORD

STRUC FOCUS_EVENT_RECORD
{
.bSetFocus dd ?
}
struct FOCUS_EVENT_RECORD

struc IREVENT
{
UNION KeyEvent, KEY_EVENT_RECORD,\
MouseEvent, MOUSE_EVENT_RECORD,\
WindowBufferSizeEvent, WINDOW_BUFFER_SIZE_RECORD,\
MenuEvent, MENU_EVENT_RECORD,\
FocusEvent, FOCUS_EVENT_RECORD
}

struc INPUT_RECORD
{
.EventType dw ?,?
.Event IREVENT
}
struct INPUT_RECORD

KEY_EVENT EQU 00001h ; Event contains key event record
MOUSE_EVENT EQU 00002h ; Event contains mouse event record
WINDOW_BUFFER_SIZE_EVENT EQU 00004h ; Event contains window change event record
MENU_EVENT EQU 00008h ; Event contains menu event record
FOCUS_EVENT EQU 00010h ; event contains focus change
Posted on 2003-05-22 09:21:49 by revolution
Here's a version of the import macro, that allows importing using ordinal numbers:


macro import name,[label,string]
{ common
name:
forward
if used label
if string eqtype 0
label dd 80000000h+string
else
local _label
label dd RVA _label
end if
end if
common
if $ > name
name#.needed = FALSE
dd 0
else
name#.needed = TRUE
end if
forward
if used label
if ~ (string eqtype 0)
_label dw 0
db string,0
end if
end if }

Although, it adds some more macro processing overhead, at least on older machines and with large number of imports.

Here's a macro you can use, if importing only by ordinals (per library):


macro ord_import name,[label,ord]
{ common
name:
forward
if used label
label dd 80000000h+ord
end if
common
if $ > name
name#.needed = FALSE
dd 0
else
name#.needed = TRUE
end if }


-Stealth
Posted on 2003-05-26 09:11:52 by Stealth
Hi, Stealth. These macroses are interesting. Except small import section, what are the other advantages of using import by number of the function? And do you know, whether Microsoft keeps the indexes of the functions in system dlls in the diferent windows versions? If it's true we can make symbolic definitions for every API function and make exe files smaller. You know in the big project there is a hundreds of functions imported.

Regards.
Posted on 2003-05-26 10:44:34 by JohnFound
I think there are some previous threads about this...

Try for example:
http://www.asmcommunity.net/board/showthread.php?threadid=3526

Yes, it would be really nice if the ordinal numbers of the system libraries would remain unchanged, but I don't think they will. I haven't done any tests or ordinal listings to verify this, because I currenly only use Win98, and don't have access to other Windoze systems.

-Stealth
Posted on 2003-05-26 12:13:06 by Stealth