News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

rsrc section any explanation

Started by xiahan, June 07, 2012, 05:38:22 AM

Previous topic - Next topic

xiahan


anyone can give me some doc about how rec file is embedded into the exe and how the CONTROL kind of statements to form a control in  the final UI
thanks ! :biggrin:

Mr Hippy

The resource-definition script is compiled. A linker then puts the compiled resources into the executable's resource segment.

Here are the resource-definition statements: http://msdn.microsoft.com/en-us/library/windows/desktop/aa381043%28v=vs.85%29.aspx

It's easier to use a visual resource editor (Visual Studio) than it is to write out the statements by hand.

xiahan

first i confess i'm a boy like to broke up a electronic device rather than just use it

i know there are many good UI designes and know how to use it

i want to know how the control is formed?

must be CreateWindow stuff any help doc?

qWord

The dialogs are described by so called "dialog box templates", which can be created at runtime or loaded from the resource section: About Dialog Boxes
MREAL macros - when you need floating point arithmetic while assembling!

MichaelW

The MASM32 package includes a system of macros (see \masm32\include\dialogs.inc and \masm32\help\imdialog.chm) that allow you to easily construct a dialog template in allocated memory, and then create a modal or modeless dialog from the template. See DialogBoxIndirectParam and CreateDialogIndirectParam.

The attachment contains a simple example.

Well Microsoft, here's another nice mess you've gotten us into.

dedndave

i don't think he has a problem creating them, Michael
i think he wants to know how they are stored in the resource section of the PE
and how the OS interprets that section

we rarely deal with it - we let the OS handle it   :P
you can use a program like ResHacker or something to examine them
but - that doesn't really show you the low-level implementation

MichaelW

AFAIK they are stored in at least more or less the same format, whether in a resource section or in a memory template.

The attachment is my crude attempt to compare a resource template to an in-memory template. I'm out of time to work on this, but they at least look very similar.
Well Microsoft, here's another nice mess you've gotten us into.

hutch--

If I remember correctly Donkey posted a set of structures for the RES file format some years ago and I think this type of data is probably what xiahan is after. It seems to have a directory tree type structure with various components stored within the dialog at addresses accessible from the tree.

P1

Quote from: xiahan on June 07, 2012, 05:38:22 AManyone can give me some doc about how rec file is embedded into the exe and how the CONTROL kind of statements to form a control in  the final UI thanks ! :biggrin:
http://www.madwizard.org/programming/snippets?id=55

Here is a code snippet, I did a while back to extract a file from resources.  Does this meet your need ???

Regards,  P1   8)

xiahan

seems like many of us are concerned about this and have made some explore ,aha

i also found MichaelW's achievements, as showing here

00000BF0  40  00  C8  10  01  00  06  00  06  00 C4  00  72   00  00  00
00000C00 00  00  46  00  6F  00  6E  00  74  00  20  00  4D  00  65  00    F  o  n  t    M  e
00000C10 6E  00  75  00  00  00  08  00  00  00  00  00  4D  00  53  00 n u               M  S
00000C20 20  00  53  00  61  00  6E  00  73  00  20  00  53  00  65  00    S  a  n  s    S   e
00000C30 72  00  69  00  66  00  00  00  00  00  00  00  00  02  00  00 r  i   f
00000C40 04  10  01  50  02  00  00  00  BE  00  5E  00  E9  03  00  00      P   
00000C50 FF   FF  81  00  00  00  00  00  00  00  00  00  00  00  00  00

1000 DIALOGEX 6,6,196,114
CAPTION "Font Menu"
FONT 8,"MS Sans Serif"
STYLE 0x10C80000
EXSTYLE 0x00000080
BEGIN
  CONTROL "",1001,"Edit",0x50011004,2,0,190,94,0x00000200
END

the above hex number are dumped from a exe file you can see that from [00000BF0] 40 00 C8 10 01 00 06 00 06 start
the 06 is just 6 the C4 00 7200 are just 196 114

at run time these parameters are possible load by the OS and execute to form the Dialog ,this part of work is what i what to know

i search the google there have resource directory tree(must be the key to the underground work ) 

sinsi

All you need is Microsoft's version of a PE file
http://www.microsoft.com/whdc/system/platform/firmware/PECOFF.mspx
Describes the layout of the .rsrc section.
🍺🍺🍺

dedndave


xiahan


Dubby

Also check "Peview" tool by Wayne J. Radburn here:
http://www.magma.ca/~wjr/

xiahan

i checked the program, it seems like what i have looked for. thanks so much Dubby! :bgrin: