NASM Forum > Summer of Code Ideas

Direct output to PE32, PE64, DLL32 and DLL64 with Macro Sets

<< < (2/5) > >>

nalsakas:
They are short for VA = Virtual Address and RVA = Relative Virtual Address. You can find these definitions in official/unofficial pe file format specifications.

nalsakas:
#VERSION 0.3, 16/06/2015
- README file updated
- Sample applications added.
- DIALOG resource added.
- STRINGTABLE resource added.
- Many control types added for DIALOG resource


With this version we can add DIALOG resource type to our executables. Sample usage is given below.


1) First we need to add DIALOG to the RESOURCE tree

RESOURCE
   TYPE RT_DIALOG
      ID ID_DIALOG
         LANG
            LEAF RVA(dialog), SIZEOF(dialog)
         ENDLANG
      ENDID 
   ENDTYPE
ENDRESOURCE

2) Next we define our DIALOG resource

; dialogs name/label is same as the one mentioned on LEAF node.
; x,y coordinates
; cx, cy are width and heights
DIALOG dialog, x, y, cx, cy
 
   ; Dialogs can have optional FONT, CAPTION, MENU, STYLE and EXSTYLE macros
   FONT size, 'font face'
   STYLE bitflags
   EXSTYLE bitflags
   MENU resource_id
   CAPTION 'text'

   ; Child controls
   CONTROL 'text', id, class_id, x, y, cx, cy, optional style, optional exstyle

   ; Predefined child controls doesn't have class_id
   PUSHBUTTON 'text', id, x, y, cx, cy, optional style, optional exstyle
   ...
ENDDIALOG


How to use STRINGTABLES?

1) Add stringtable to the resource tree as above.

2) Add stringtable as below

   STRINGTABLE label
      STRING 'First String'
      STRING "Second String"
   ENDSTRINGTABLE

3) Access strings from assembly code by using SID() macro. Short for string id.

   LoadString, hInst, SID(String Table Resource ID, Index of string in the table)

   SID(x,y) takes two parameter. First is ID of table defined in resource tree and other is string's index in table.


New sample applications are added to the project and old ones are updated.

nalsakas:
ACCELERATOR resource support added. Example application is added to the project.

USAGE: First include accelerator into resorce tree than add following definitions.

ACCELERATORTABLE accelerator
         
         ; %1 = ascii key or virtual key
         ; %2 = ID of key
         ; %3 = flags
   ACCELERATOR 'A', ID_ACTION_SHIFT_A, FSHIFT
   ACCELERATOR VK_F5, ID_ACTION_CONTROL_F5, FCONTROL | FVIRTKEY
   ACCELERATOR VK_RETURN, ID_ACTION_ALT_ENTER, FALT | FVIRTKEY
   
        ; default flag is shift key if not entered.
   ACCELERATOR 'H', IDM_FILE_HELP
ENDACCELERATORTABLE

nalsakas:
BITMAP resource support added.

With BITMAP macro you can include bitmaps into your resources. Then you can use them inside asm code with LoadBitmap API. To start with bitmaps first include an resource of type RT_BITMAP into resource tree. Than add file with BITMAP macro. Sample application is given in samples directory.

; %1 = label
; %2 = Bitmap file in string form

BITMAP bitmap1, 'bitmap.bmp'


Get the latest work is here:
https://github.com/nalsakas/pe

nalsakas:
64-bit support added.

Now you can use PE64 and DLL64. Sample applications are added. Project is 99% completed. I will work on ICON resources next.

Get the latest work from here: https://github.com/nalsakas/pe

Is there anyone using NASM PE MACROS out there?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version