flat assembler
Message board for the users of flat assembler.
![]() Goto page 1, 2 Next |
Author |
|
Reverend 05 Aug 2006, 13:08
As I said somewhere on this forum I am working on a converter between RC and fasm resource macro format. Such tool will be really useful for all of us coding under Windows. It allows you to create resource (eg. dialogs, icons, etc.) in other program and make the resource compilable under fasm. I present here frst beta release of this program. It still has some things to fix, but is working and someone may find it useful already.
FEATURES:
DISADVANTAGES:
EXAMPLES: Code: ; RC script with all possible dialog controls 100 DIALOG 231, 34, 316, 267 STYLE WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Dialog Title" FONT 8, "MS Sans Serif" BEGIN ICON "", 101, 16, 15, 21, 20 LISTBOX 102, 65, 14, 100, 40, LBS_SORT | WS_VSCROLL | WS_TABSTOP LTEXT "Text", 103, 53, 55, 20, 12 EDITTEXT 104, 27, 86, 32, 12, ES_AUTOHSCROLL GROUPBOX "Group", 105, 113, 47, 48, 35 PUSHBUTTON "Push", 106, 88, 116, 40, 14 AUTOCHECKBOX "Check", 107, 173, 89, 40, 10 AUTORADIOBUTTON "Radio", 108, 36, 139, 39, 10 COMBOBOX 109, 36, 154, 100, 35, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP SCROLLBAR 110, 233, 132, 48, 10 SCROLLBAR 111, 10, 73, 11, 40, SBS_VERT CONTROL "", 112, "Static", SS_BLACKFRAME, 9, 44, 20, 16 CONTROL "", 113, "Static", SS_BLACKRECT, 237, 36, 20, 16 CONTROL "", 114, "SysMonthCal32", 0x1 | WS_BORDER, 170, 161, 140, 100 CONTROL "", 115, "SysListView32", 0x241 | WS_BORDER, 225, 55, 70, 70 CONTROL "", 116, "SysTabControl32", 0x0 | WS_CLIPSIBLINGS, 98, 191, 70, 70 CONTROL "", 117, "SysTreeView32", 0x0 | WS_CLIPSIBLINGS, 25, 191, 70, 70 CONTROL "", 118, "msctls_progress32", 0x0 | WS_CLIPSIBLINGS, 240, 6, 70, 11 CONTROL "", 119, "msctls_updown32", 0x0 | WS_CLIPSIBLINGS, 291, 24, 12, 16, WS_EX_STATICEDGE CONTROL "", 120, "msctls_trackbar32", 0x21 | WS_CLIPSIBLINGS, 181, 18, 100, 18 CONTROL "", 121, "SysDateTimePick32", 0x0 | WS_BORDER, 160, 138, 60, 16 END Code: ; output directory RT_DIALOG, dir_dialogs resource dir_dialogs,\ 100, LANG_ENGLISH + SUBLANG_DEFAULT, res_dialog0 dialog res_dialog0, "Dialog Title", 231, 34, 316, 267, WS_POPUP or WS_VISIBLE or WS_CAPTION or WS_SYSMENU, 0, 0, "MS Sans Serif", 8 dialogitem "STATIC", "", 101, 16, 15, 0, 0, SS_ICON, 0 dialogitem "LISTBOX", 0, 102, 65, 14, 100, 40, LBS_SORT or WS_VSCROLL or WS_TABSTOP, 0 dialogitem "STATIC", "Text", 103, 53, 55, 20, 12, SS_LEFT or WS_GROUP, 0 dialogitem "EDIT", 0, 104, 27, 86, 32, 12, ES_AUTOHSCROLL, 0 dialogitem "BUTTON", "Group", 105, 113, 47, 48, 35, BS_GROUPBOX, 0 dialogitem "BUTTON", "Push", 106, 88, 116, 40, 14, BS_PUSHBUTTON or WS_TABSTOP, 0 dialogitem "BUTTON", "Check", 107, 173, 89, 40, 10, BS_AUTOCHECKBOX or WS_TABSTOP, 0 dialogitem "BUTTON", "Radio", 108, 36, 139, 39, 10, BS_AUTORADIOBUTTON or WS_TABSTOP, 0 dialogitem "COMBOBOX", 0, 109, 36, 154, 100, 35, CBS_DROPDOWN or CBS_SORT or WS_VSCROLL or WS_TABSTOP, 0 dialogitem "SCROLLBAR", 0, 110, 233, 132, 48, 10, SBS_HORZ, 0 dialogitem "SCROLLBAR", 0, 111, 10, 73, 11, 40, SBS_VERT, 0 dialogitem "Static", "", 112, 9, 44, 20, 16, SS_BLACKFRAME, 0 dialogitem "Static", "", 113, 237, 36, 20, 16, SS_BLACKRECT, 0 dialogitem "SysMonthCal32", "", 114, 170, 161, 140, 100, 0x1 or WS_BORDER, 0 dialogitem "SysListView32", "", 115, 225, 55, 70, 70, 0x241 or WS_BORDER, 0 dialogitem "SysTabControl32", "", 116, 98, 191, 70, 70, 0x0 or WS_CLIPSIBLINGS, 0 dialogitem "SysTreeView32", "", 117, 25, 191, 70, 70, 0x0 or WS_CLIPSIBLINGS, 0 dialogitem "msctls_progress32", "", 118, 240, 6, 70, 11, 0x0 or WS_CLIPSIBLINGS, 0 dialogitem "msctls_updown32", "", 119, 291, 24, 12, 16, 0x0 or WS_CLIPSIBLINGS, WS_EX_STATICEDGE dialogitem "msctls_trackbar32", "", 120, 181, 18, 100, 18, 0x21 or WS_CLIPSIBLINGS, 0 dialogitem "SysDateTimePick32", "", 121, 160, 138, 60, 16, 0x0 or WS_BORDER, 0 enddialog Code: ; all working resources 1 BITMAP "1.bmp" 2 ICON "2.ico" 3 CURSOR "3.cur" 4 ACCELERATORS { VK_F1, 1, VIRTKEY } 5 DIALOG 100, 100, 100, 100 { CTEXT "test", 1, 10, 10, 10, 10 } 6 MENU { MENUITEM "aaa", 1 POPUP "bbb" { POPUP "ccc" { MENUITEM "ddd", 2 } } } 7 RCDATA { "ANSI string", L"Unicode string", 100, 0x64, 0o144, } Code: ; fasm version directory RT_BITMAP, dir_bitmaps,\ RT_GROUP_CURSOR, dir_groupcursors,\ RT_GROUP_ICON, dir_groupicon,\ RT_ACCELERATOR, dir_accelerators,\ RT_DIALOG, dir_dialogs,\ RT_MENU, dir_menus,\ RT_RCDATA, dir_rcdatas,\ RT_CURSOR, dir_cursors,\ RT_ICON, dir_icons resource dir_bitmaps,\ 1, LANG_ENGLISH + SUBLANG_DEFAULT, res_bitmap0 resource dir_groupcursors,\ 3, LANG_ENGLISH + SUBLANG_DEFAULT, res_groupcursor0 resource dir_groupicon,\ 2, LANG_ENGLISH + SUBLANG_DEFAULT, res_groupicon0 resource dir_accelerators,\ 4, LANG_ENGLISH + SUBLANG_DEFAULT, res_accelerators0 resource dir_dialogs,\ 5, LANG_ENGLISH + SUBLANG_DEFAULT, res_dialog0 resource dir_menus,\ 6, LANG_ENGLISH + SUBLANG_DEFAULT, res_menu0 resource dir_rcdatas,\ 7, LANG_ENGLISH + SUBLANG_DEFAULT, res_rcdata0 resource dir_cursors,\ 3, LANG_ENGLISH + SUBLANG_DEFAULT, res_cursor0 resource dir_icons,\ 2, LANG_ENGLISH + SUBLANG_DEFAULT, res_icon0 bitmap res_bitmap0, "1.bmp" cursor res_groupcursor0, res_cursor0, "3.cur" icon res_groupicon0, res_icon0, "2.ico" accelerator res_accelerators0,\ FVIRTKEY, VK_F1, 1 dialog res_dialog0, "", 100, 100, 100, 100, 0, 0, 0 dialogitem "STATIC", "test", 1, 10, 10, 10, 10, SS_CENTER or WS_GROUP, 0 enddialog menu res_menu0 menuitem "aaa", 1 menuitem "bbb", 0, MFR_POPUP or MFR_END menuitem "ccc", 0, MFR_POPUP or MFR_END menuitem "ddd", 2, MFR_END resdata res_rcdata0 db "ANSI string" du "Unicode string" dd 100 dd 0x64 dd 144o endres Output is fully OK. If you add 'format PE GUI' and include resource macros, it compiles fine! USAGE: Code: rc-converter file.rc After the program finishes there will be new file 'output.inc'. As I will work on it further (adding stringtables, optimizng) I will post here vew versions. When everything is finished I will release the source. Have fun! ![]()
|
|||||||||||
![]() |
|
farrier 05 Aug 2006, 19:40
Reverend,
Thanks for this tool. I'll give it a try. farrier _________________ Some Assembly Required It's a good day to code! U.S.Constitution; Bill of Rights; Amendment 1: ... the right of the people peaceably to assemble, ... The code is dark, and full of errors! |
|||
![]() |
|
shoorick 06 Aug 2006, 18:52
very nice tool!
asking: 1.support DIALOGEX (at least simply treat it as DIALOG, just omiting EXSTYLE statement) (+ maybe same to menu ...) 2.optional output filename note to fix: 1. rc-converter /? - crash 2. errorlevel=1 both on error and on success - this aborts batch operations for me thanks! |
|||
![]() |
|
shoorick 06 Aug 2006, 19:10
also, when this file included at the end of source equs are invisible - maybe there is sence to create to separate files: for equs (to include it first) and for resource directories.
(for me it does not disturb too much as i get autoexport of equs in winasm/wafasm, but they appeared defined twice - at the end and at the start ![]() |
|||
![]() |
|
farrier 07 Aug 2006, 05:38
Reverend,
As a test--related to post http://board.flatassembler.net/topic.php?p=42033#42033 I tried the rsrc.rc from Iczelion's 10-2 tutorial, which included a menu in a dialog, the following occured: The first that happened was, the first line was: Code: #include "resource.h" With no path provided, the resource.h was skipped, but the output from rc-converter was incomplete: Code: IDR_MENU1 equ 3003 IDC_EDIT equ 3000 IDC_BUTTON equ 3001 IDC_EXIT equ 3002 IDM_GETTEXT equ 32000 IDM_CLEAR equ 32001 IDM_EXIT equ 32003 directory RT_MENU, dir_menus resource dir_menus,\ IDR_MENU1, LANG_ENGLISH + SUBLANG_DEFAULT, res_menu0 menu res_menu0 menuitem "Test Controls", 0, MFR_POPUP or MFR_END menuitem "Get Text", IDM_GETTEXT menuitem "Clear Text", IDM_CLEAR menuitem "", , menuitem "E&xit", IDM_EXIT, MFR_END and should have been more like: Code: directory RT_MENU,appMenu,\ RT_DIALOG,appDialog resource appMenu,\ 30,LANG_NEUTRAL,menuMain resource appDialog,\ 31,LANG_NEUTRAL,dlgMain menu menuMain menuitem 'Test Controls',0,MFR_POPUP + MFR_END menuitem 'Get Text',32000,MFT_STRING menuitem 'Clear Text',32001,MFT_STRING menuseparator menuitem 'E&xit',32002,MFR_END dialog dlgMain,'Our First Dialog Box',10,10,205,60,\ DS_CENTER + WS_CAPTION + WS_MINIMIZEBOX + WS_SYSMENU + WS_VISIBLE + WS_OVERLAPPED + DS_MODALFRAME + DS_3DLOOK,0,30 dialogitem 'EDIT','',3000,15,17,111,13,ES_AUTOHSCROLL + ES_LEFT + WS_BORDER + WS_VISIBLE + WS_TABSTOP dialogitem 'BUTTON','Say Hello',3001,141,10,52,13,BS_DEFPUSHBUTTON + WS_VISIBLE + WS_TABSTOP dialogitem 'BUTTON','E&xit',3002,141,26,52,13,WS_VISIBLE + WS_TABSTOP enddialog Some numbers and name are different, but the dialog resource was skipped. When the path to the resource.h file is provided, the resource.h file is converted but only 638 lines worth. And exciting start!! hth, farrier _________________ Some Assembly Required It's a good day to code! U.S.Constitution; Bill of Rights; Amendment 1: ... the right of the people peaceably to assemble, ... The code is dark, and full of errors! |
|||
![]() |
|
Garthower 07 Aug 2006, 09:49
Excellent work Reverend! Very useful utility.
|
|||
![]() |
|
Reverend 07 Aug 2006, 22:24
shoorick: Thanks for info. I'll get all your suggestions into consider
![]() farrier: The "resource.h" (or any other included file) is opened via CreateFile ![]() If the resource's name is defined by constant, and the constant has not yet been defined, rc-converter skips whole resource. Eg.: Code: //#define AAA 1 AAA ICON "1.ico" |
|||
![]() |
|
shoorick 08 Aug 2006, 04:35
how can this tool know which file to open > try to process "INCLUDE" environment variable
|
|||
![]() |
|
vid 08 Aug 2006, 07:12
this tool should be somehow highlighted in windows section, or linked from somewhere
|
|||
![]() |
|
farrier 08 Aug 2006, 10:52
Reverend,
I mentioned the problem with the path to "resource.h" to show that I ran into 2 problems with the 10-2 rc file. 1) with the path included, the resource.h file stopped being processed at line 638, and never made it to the "real" rc file code. 2)without the proper path, the "real" rc file code was not converted properly. I'm attaching the rsrc.rc file I used, from the Iczelion tutorial. The resource.h file was the one that comes standard with MASM32. (Using win xp sp2) Thanks again, farrier
_________________ Some Assembly Required It's a good day to code! U.S.Constitution; Bill of Rights; Amendment 1: ... the right of the people peaceably to assemble, ... The code is dark, and full of errors! |
|||||||||||
![]() |
|
OzzY 10 Aug 2006, 01:38
Nice work! Congratulations!
This utility will make a perfect combination: FASMW+ResEd+RC_CONVERTER ![]() Here are my results: This one: Code: #define IDD_DLG1 1000 #define IDC_BTN1 1001 IDD_DLG1 DIALOGEX 6,6,194,106 CAPTION "Window" FONT 8,"MS Sans Serif" STYLE 0x10CF0000 EXSTYLE 0x00000000 BEGIN CONTROL "Exit",IDC_BTN1,"Button",0x50010000,130,80,54,16,0x00000000 END gives me this: Code: IDD_DLG1 equ 1000 IDC_BTN1 equ 1001 directory And this one: Code: #define IDD_DLG1 1000 #define IDC_BTN1 1001 IDD_DLG1 DIALOG 6,6,194,106 CAPTION "Window" STYLE 0x10CF0000 BEGIN CONTROL "Exit",IDC_BTN1,"Button",0x50010000,130,80,54,16,0x00000000 END gives me this: Code: IDD_DLG1 equ 1000 IDC_BTN1 equ 1001 directory RT_DIALOG, dir_dialogs resource dir_dialogs,\ IDD_DLG1, LANG_ENGLISH + SUBLANG_DEFAULT, res_dialog0 dialog res_dialog0, "Window", 6, 6, 194, 106, 0x10CF0000, 0, 0 dialogitem "Button", "Exit", IDC_BTN1, 130, 80, 54, 16, 0x50010000, 0x00000000 enddialog I tested the output above and it compiles and execute without problems. I think I'll starting using it by now! ![]() I think it is on the right path. But it still needs some work to make it work with every output from RC Editor. Nice tool! Thanks |
|||
![]() |
|
OzzY 14 Aug 2006, 16:25
I think this thread should go to the "Projects and Ideas" section.
Also don't forget to post your progress, and if possible release the source so others can contribute. |
|||
![]() |
|
Reverend 10 Sep 2006, 15:11
Thanks everybody for all posts. Unfortunately I have made no progress since last post here as I was on holidays most of time. But of course such positive reaction from you encourages me for further work!
|
|||
![]() |
|
farrier 10 Sep 2006, 18:24
_________________ Some Assembly Required It's a good day to code! U.S.Constitution; Bill of Rights; Amendment 1: ... the right of the people peaceably to assemble, ... The code is dark, and full of errors! |
|||
![]() |
|
FlaFlaw 26 Aug 2007, 02:56
It's sadly not working with my .rc file =[
I have one version made with VC++ and ResEd : VC++ Code: IDD_DIALOG1 DIALOGEX 0, 0, 259, 102 STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "cGUID by FlaFlaw" FONT 8, "Verdana", 400, 0, 0x0 BEGIN GROUPBOX "Informations about the GUID",IDC_STATIC,7,7,245,50 LTEXT "&Actual GUID:",IDC_STATIC,18,18,52,11 EDITTEXT IDC_EDIT2,70,38,166,12,ES_CENTER | ES_AUTOHSCROLL EDITTEXT IDC_EDIT3,70,18,166,12,ES_CENTER | ES_AUTOHSCROLL | ES_READONLY LTEXT "&Updated GUID:",IDC_STATIC,18,38,52,12 PUSHBUTTON "&Validate",IDC_BUTTON1,7,63,63,18,SS_SUNKEN PUSHBUTTON "&Refresh",IDC_BUTTON2,97,63,63,18,SS_SUNKEN PUSHBUTTON "&Exit",IDC_BUTTON3,189,63,63,18,SS_SUNKEN CTEXT "Created by FlaFlaw",IDC_STATIC,7,85,245,10,SS_SUNKEN END ResEd: Code: #define IDD_DLG1 1000 #define IDC_GRP1 1001 #define IDC_STC1 1002 #define IDC_STC2 1003 #define IDC_EDT1 1004 #define IDC_EDT2 1005 #define IDC_BTN1 1006 #define IDC_BTN2 1007 #define IDC_BTN3 1008 #define IDC_STC3 1009 IDD_DLG1 DIALOGEX 5,6,225,73 CAPTION "cGUID by FlaFlaw" FONT 8,"Verdana",400,0 STYLE 0x10CA0000 BEGIN CONTROL "IDC_GRP",IDC_GRP1,"Button",0x50000007,1,1,220,41 CONTROL "&Actual GUID:",IDC_STC1,"Static",0x50000000,8,12,45,9 CONTROL "&Updated GUID:",IDC_STC2,"Static",0x50000000,8,27,50,9 CONTROL "",IDC_EDT1,"Edit",0x50010000,63,11,153,11,0x00020000 CONTROL "",IDC_EDT2,"Edit",0x50010000,63,25,153,11,0x00020000 CONTROL "&Validate",IDC_BTN1,"Button",0x50010000,1,44,71,13,0x00020000 CONTROL "&Refresh",IDC_BTN2,"Button",0x50010000,75,44,73,13,0x00020000 CONTROL "&Exit",IDC_BTN3,"Button",0x50010000,150,44,71,13,0x00020000 CONTROL "Created by FlaFlaw",IDC_STC3,"Static",0x50001201,1,59,220,13 END Result in output.inc : Code: directory And for ResEd : Code: IDD_DLG1 equ 1000 IDC_GRP1 equ 1001 IDC_STC1 equ 1002 IDC_STC2 equ 1003 IDC_EDT1 equ 1004 IDC_EDT2 equ 1005 IDC_BTN1 equ 1006 IDC_BTN2 equ 1007 IDC_BTN3 equ 1008 IDC_STC3 equ 1009 directory _________________ FlaFlaw |
|||
![]() |
|
Yardman 26 Aug 2007, 06:35
[ Post removed by author. ]
Last edited by Yardman on 04 Apr 2012, 02:44; edited 1 time in total |
|||
![]() |
|
FlaFlaw 26 Aug 2007, 23:27
The group parameter dont seem to work. I even tried to copy the one in the example made by Reverend and it's not working...
Error during assembling: Code: flat assembler version 1.67.21 (423278 kilobytes memory) main.asm [106]: dialogitem "Button", "Informations related to the GUID", IDC_GRP1, 1, 1, 22 0, 41, 0x50000007, 0 \fasm\include\macro/resource.inc [209] dialogitem [1]: dw x,y,cx,cy,id error: undefined symbol. Code: section '.rsrc' resource data readable IDD_MAIN = 100 ID_ACTUALGUID = 201 ID_UPDATEDGUID = 202 ID_VALIDATE = 203 ID_REFRESH = 204 ID_EXIT = 205 directory RT_DIALOG, dir_dialogs resource dir_dialogs,IDD_MAIN, LANG_ENGLISH + SUBLANG_DEFAULT, MainDialog dialog MainDialog, "cGUID by FlaFlaw", 5, 6, 225, 73, 0x10CA0000, 0, 0, "Verdana", 8 dialogitem "Button", "Informations related to the GUID", IDC_GRP1, 1, 1, 220, 41, 0x50000007, 0 dialogitem "Static", "&Actual GUID:", IDC_STC1, 8, 12, 45, 9, 0x50000000, 0 dialogitem "Static", "&Updated GUID:", IDC_STC2, 8, 27, 50, 9, 0x50000000, 0 dialogitem "Edit", "", IDC_EDT1, 63, 11, 153, 11, 0x50010000, 0x00020000 dialogitem "Edit", "", IDC_EDT2, 63, 25, 153, 11, 0x50010000, 0x00020000 dialogitem "Button", "&Validate", IDC_BTN1, 1, 44, 71, 13, 0x50010000, 0x00020000 dialogitem "Button", "&Refresh", IDC_BTN2, 75, 44, 73, 13, 0x50010000, 0x00020000 dialogitem "Button", "&Exit", IDC_BTN3, 150, 44, 71, 13, 0x50010000, 0x00020000 dialogitem "Static", "Created by FlaFlaw", IDC_STC3, 1, 59, 220, 13, 0x50001201, 0 enddialog |
|||
![]() |
|
Yardman 26 Aug 2007, 23:55
[ Post removed by author. ]
Last edited by Yardman on 04 Apr 2012, 02:44; edited 1 time in total |
|||
![]() |
|
FlaFlaw 27 Aug 2007, 01:29
Hmmm I thought equ and = was the same thing... It's working flawlessly now, thanks =D! Awesome application btw =D
|
|||
![]() |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.