Author Topic: rsrc section any explanation  (Read 8445 times)

xiahan

  • Guest
rsrc section any explanation
« on: June 07, 2012, 05:38:22 AM »

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

  • Guest
Re: rsrc section any explanation
« Reply #1 on: June 07, 2012, 05:43:17 AM »
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

  • Guest
Re: rsrc section any explanation
« Reply #2 on: June 07, 2012, 06:16:28 AM »
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

  • Member
  • *****
  • Posts: 1471
  • The base type of a type is the type itself
    • SmplMath macros
Re: rsrc section any explanation
« Reply #3 on: June 07, 2012, 06:41:45 AM »
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

  • Global Moderator
  • Member
  • *****
  • Posts: 1209
Re: rsrc section any explanation
« Reply #4 on: June 07, 2012, 07:41:22 AM »
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

  • Member
  • *****
  • Posts: 8751
  • Still using Abacus 2.0
    • DednDave
Re: rsrc section any explanation
« Reply #5 on: June 07, 2012, 10:13:55 AM »
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

  • Global Moderator
  • Member
  • *****
  • Posts: 1209
Re: rsrc section any explanation
« Reply #6 on: June 07, 2012, 10:20:41 AM »
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--

  • Administrator
  • Member
  • ******
  • Posts: 4930
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: rsrc section any explanation
« Reply #7 on: June 07, 2012, 11:25:28 AM »
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.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

P1

  • Global Moderator
  • Member
  • *****
  • Posts: 64
Re: rsrc section any explanation
« Reply #8 on: June 07, 2012, 12:36:42 PM »
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:
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

  • Guest
Re: rsrc section any explanation
« Reply #9 on: June 07, 2012, 06:11:40 PM »
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

  • Member
  • *****
  • Posts: 1005
Re: rsrc section any explanation
« Reply #10 on: June 07, 2012, 06:54:59 PM »
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.
I can walk on water but stagger on beer.

dedndave

  • Member
  • *****
  • Posts: 8751
  • Still using Abacus 2.0
    • DednDave
Re: rsrc section any explanation
« Reply #11 on: June 08, 2012, 12:38:02 AM »

xiahan

  • Guest
Re: rsrc section any explanation
« Reply #12 on: June 08, 2012, 01:22:11 AM »
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.
thanks :greensml:

Dubby

  • Member
  • **
  • Posts: 60
Re: rsrc section any explanation
« Reply #13 on: June 09, 2012, 02:03:22 PM »
Also check "Peview" tool by Wayne J. Radburn here:
http://www.magma.ca/~wjr/

xiahan

  • Guest
Re: rsrc section any explanation
« Reply #14 on: June 14, 2012, 01:00:26 AM »
i checked the program, it seems like what i have looked for. thanks so much Dubby! :bgrin: