flat assembler
Message board for the users of flat assembler.

Index > Windows > [solved]Resource Editor needed (RC or Res)

Goto page 1, 2  Next
Author
Thread Post new topic This topic is locked: you cannot edit posts or make replies.
Overclick



Joined: 11 Jul 2020
Posts: 202
Overclick
Hi friends
I'm looking for Resource Editor that work with fasm on x64 code.
I tried different Editors and there is some issues with them:
1) Compiled Res seems wrong. Fasm don't accept it.
2) Deleted ID numbers
3) Editor doesn't compilate Res by itself
3) Third-party Res compilator doesn't accept RC files
4) Dialogue window looks different after all. That what I've got by RadAsm Editor and GoRC compilator -- rectangular buttons, rough as Windows 3.11. Seems like styles missing. I don't use tiled Windows if you ask.

Maybe some of you created macros to convert RC without Res or something?


Last edited by Overclick on 12 Jul 2020, 11:17; edited 1 time in total
Post 11 Jul 2020, 16:03
View user's profile Send private message Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 821
Location: Belarus
DimonSoft
Restorator used to be a great tool. Cracked versions sometimes have issues running on modern Windows systems (tend to register executables to themselves, but there’s an easy fix, just find it and read carefully before using).

It can create RES-files directly, edit resource sections in PE files (say, replace resources from files, etc.), has RC-like text editing mode, and as for dialog resources it provides an almost WYSIWYG environment.
Post 11 Jul 2020, 16:42
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 202
Overclick
I tried to use my own RC on Restorator to convert it to Res -- still the same issue. Check attached screenshot.
I tried to create new Res or RC but don't know how to add simple elements on mine dialogue window/tree? Maybe something wrong with my version of Restorator or it's absolutely useless


Description:
Filesize: 44.87 KB
Viewed: 2031 Time(s)

Capture.PNG


Post 11 Jul 2020, 18:07
View user's profile Send private message Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 821
Location: Belarus
DimonSoft
I don’t get what exactly should be paid attention to at the screenshot. I see two windows rich with controls, just with two different styles.

If you try Restorator, you just create a .res file there, add resources (say, dialog resource) and them switch to Edit mode. One of possible modes there is text editing mode. There you get syntax similar to RC-files to add and adjust any child windows. A comment with description of the syntax is provided by Restorator as well. Switching to another editing mode lets one see what the dialog is going to look like. The .res file can be saved as… uhm… a .res file and added to FASM PE source as shown in FASM.pdf:
Code:
resdata SomeLabel
  file 'MyFile.res'
endres    
Post 11 Jul 2020, 19:35
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 202
Overclick
Exactly! Missing styles. I use this form of res adding is it wrong?
Code:
section '.rsrc' resource from 'MyFile.res' data readable    

If I want to add each element by text editing I don't think I need any redactor at all, but I asking for specialized Editor where I can adjust elements by simple mouse clicking or convert my job without styles loosing.
Post 11 Jul 2020, 21:12
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3049
Location: vpcmipstrm
bitRAKE
http://www.angusj.com/resourcehacker/ is quite powerful! It can work with EXE, RES, RC, etc ...

_________________
¯\(°_o)/¯ unlicense.org
Post 11 Jul 2020, 22:21
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 202
Overclick
I tried already. Seems like fasm issue. Did you guys used it before this way?


Description:
Filesize: 55.69 KB
Viewed: 1997 Time(s)

Capture.PNG


Post 11 Jul 2020, 22:43
View user's profile Send private message Reply with quote
Ali.Z



Joined: 08 Jan 2018
Posts: 373
Ali.Z
Overclick wrote:
Hi friends
I'm looking for Resource Editor that work with fasm on x64 code.
I tried different Editors and there is some issues with them:
1) Compiled Res seems wrong. Fasm don't accept it.
2) Deleted ID numbers
3) Editor doesn't compilate Res by itself
3) Third-party Res compilator doesn't accept RC files
4) Dialogue window looks different after all. That what I've got by RadAsm Editor and GoRC compilator -- rectangular buttons, rough as Windows 3.11. Seems like styles missing. I don't use tiled Windows if you ask.

Maybe some of you created macros to convert RC without Res or something?


try mircosoft resource compiler, it will compile rc files to res.
then in fasm use this:
section '.rsrc' resource data readable from 'yourfilename.res' ; it must be in same directory

4) ... the graphic styles are affected by the GUI subsystem.
for example:
format PE GUI 4.0
is different than 6.0, and dialog boxes from resource are most affected by this subsystem version.
you can also try 3.1 which is also different than 4.0

_________________
Asm For Wise Humans
Post 12 Jul 2020, 02:06
View user's profile Send private message Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 821
Location: Belarus
DimonSoft
Styles have nothing to do with resource files or compiler. You might want to start from here: https://docs.microsoft.com/en-us/windows/win32/controls/cookbook-overview
Post 12 Jul 2020, 08:44
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7797
Location: Kraków, Poland
Tomasz Grysztar
DimonSoft wrote:
Styles have nothing to do with resource files or compiler.
Manifest file, described in the article you linked, needs to be included as a resource, so this very much has something to do with resources.
Post 12 Jul 2020, 08:49
View user's profile Send private message Visit poster's website Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 821
Location: Belarus
DimonSoft
Tomasz Grysztar wrote:
Manifest file, described in the article you linked, needs to be included as a resource, so this very much has something to do with resources.

Yep. But not with some bugs or misbehaviour of either resource compiler or FASM.
Post 12 Jul 2020, 09:26
View user's profile Send private message Visit poster's website Reply with quote
Ali.Z



Joined: 08 Jan 2018
Posts: 373
Ali.Z
Overclick, here is an example:

try changing the subsystem version from 4.0 to 3.1, and notice the difference.


Description:
Download
Filename: res.zip
Filesize: 1.77 KB
Downloaded: 60 Time(s)


_________________
Asm For Wise Humans
Post 12 Jul 2020, 09:50
View user's profile Send private message Reply with quote
Ali.Z



Joined: 08 Jan 2018
Posts: 373
Ali.Z
Overclick wrote:
I tried already. Seems like fasm issue. Did you guys used it before this way?


almost forgot to comment on this, what you see on the left side which is the editor obviously; the controls are rendered using CreateWindowEx that is why they look different.

but when compiled into a resource and used in a dialog box, then the dialog box manager will render it differently, of course that depends on the subsystem.

so if you want the modern look, you either use OWNERDRAW, or use CreateWindowEx.

_________________
Asm For Wise Humans
Post 12 Jul 2020, 10:43
View user's profile Send private message Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 202
Overclick
SUCCESS

format PE64 GUI 6.0 (any) deal almost nothing with that, but I added Manifest file on RadAsm to my exist RC and it renders just fine. Wink

Ali.Z
I tried to use CreateWindowEx. Could you explain for the future how to link exist dialogue file to this function? I gave up and use DialogBoxParam.
Post 12 Jul 2020, 11:09
View user's profile Send private message Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 821
Location: Belarus
DimonSoft
CreateWindowEx is what should internally be used by the dialog functions. Dialogs are just windows of a specific window class, so switching to CreateWindowEx won’t change anything. Except that you get more control over parameters passed (though most values are passed unchanged by the dialog functions) and lose the possibility to specify coordinates in dialog units instead of pixels (which is probably for good).
Post 12 Jul 2020, 15:55
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3049
Location: vpcmipstrm
bitRAKE
Quote:
DEBUGGING RULES:
#1 Don't assume your tools are wrong.
...

_________________
¯\(°_o)/¯ unlicense.org
Post 12 Jul 2020, 17:11
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 202
Overclick
DimonSoft
1) As I see CreateWindowEx needs to be called for each daughter unit separately. Am I wrong? It's a massive job to do if so.
2) How to link dialogue? Have I do it by hMenu some how or call it later from Window Proc?
3) What to do with styles parameters? How can I get them from Res file to call CreateWindowEx proper?
Too many questions for me. If you trying to help then show it on example please.
Post 12 Jul 2020, 22:58
View user's profile Send private message Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 821
Location: Belarus
DimonSoft
Overclick wrote:
1) As I see CreateWindowEx needs to be called for each daughter unit separately. Am I wrong? It's a massive job to do if so.

Yep. It’s a recursive job over a tree-like structure that a dialog resource is. Quite a simple piece of code except that for dialogs is has a lot of backwards-compatibility quirks. There’s nothing wrong with dialogs but I personally prefer to have pixel-perfect control over my windows (especially in the days of high-DPI and multimonitor setups) instead of messing with measurements relative to dialog font size.

Which doesn’t change the fact that windows are a more basic concept and dialogs are built on top of them hiding certain things but providing a simpler API for common tasks.

Overclick wrote:
2) How to link dialogue? Have I do it by hMenu some how or call it later from Window Proc?

Why are you talking about WindowProc while using dialogs? It’s DialogBoxParam/CreateDialogParam in the “main” program plus DialogProc at the dialog side.

If you mean the idea of implementing the dialog with plain CreateWindowEx, see the answer to the first question: you basically iterate through the tree and create windows. To show the “dialog” modally you run another message loop at the point you should show it. Also IsDialogMessage might be useful to have tab stops and similar features is a cleaner way.

Overclick wrote:
3) What to do with styles parameters? How can I get them from Res file to call CreateWindowEx proper?

If you really decide to use dialog resources but reimplement them with plain CreateWindowEx, there’re to things I should say. First: please don’t. If you need a dialog, use a dialog and let the OS deal with all the quirks. The only reason to switch to CreateWindowEx from dialogs is to have more control over what your program does (see notes above). Second: if you’re still eager to reimplement this stuff yourself, possibly changing some pieces, you might want to start with this page.
Post 13 Jul 2020, 04:57
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 202
Overclick
DimonSoft
I don't use CreateWindowEx for dialogue. That was your advice to use it for "more control", then it need WindowProc too. All units needs to be called separatelly by WM_CREATE section and Child windows. But to call it I need to load proper settings from Res file for each unit first. As I see I need to call FindResourceEx LoadResource SizeofResource LockResource etc
Can you show any example how to do that?
Post 13 Jul 2020, 09:10
View user's profile Send private message Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 821
Location: Belarus
DimonSoft
Overclick wrote:
I don't use CreateWindowEx for dialogue. That was your advice to use it for "more control", then it need WindowProc too. All units needs to be called separatelly by WM_CREATE section and Child windows. But to call it I need to load proper settings from Res file for each unit first. As I see I need to call FindResourceEx LoadResource SizeofResource LockResource etc
Can you show any example how to do that?

First of all,
DimonSoft wrote:
If you really decide to use dialog resources but reimplement them with plain CreateWindowEx, there’re two things I should say. First: please don’t. If you need a dialog, use a dialog and let the OS deal with all the quirks.

You somehow make me responsible for driving you through a complex and mostly useless process of recreating an ecosystem that is broken by design (see my note about specifying the coordinates in resources in DLU instead of pixels which are later used at runtime).

If you mean this post:
DimonSoft wrote:
CreateWindowEx is what should internally be used by the dialog functions. Dialogs are just windows of a specific window class, so switching to CreateWindowEx won’t change anything. Except that you get more control over parameters passed (though most values are passed unchanged by the dialog functions) and lose the possibility to specify coordinates in dialog units instead of pixels (which is probably for good).

it doesn’t state that you should use CreateWindowEx, it just states that DialogBoxParam/CreateDialogParam are based on CreateWindowEx, so switching to it might not magically give you what you initially wanted.

Still, if you’re so willing to dive deeper, let me delegate the task of showing a large piece of code I have to either cut out of my code base (adding the pieces that were unnecesary for my task, most of the pieces) or write again from scratch to a much more trustable person on the topic, the one who actually took part in creating the whole dialog stuff in Windows:

The dialog manager, part 1: Warm-ups
The dialog manager, part 2: Creating the frame window
The dialog manager, part 3: Creating the controls
The dialog manager, part 4: The dialog loop
The dialog manager, part 5: Converting a non-modal dialog box to modal
The dialog manager, part 6: Subtleties in message loops
The dialog manager, part 7: More subtleties in message loops
The dialog manager, part 8: Custom navigation in dialog boxes
The dialog manager, part 9: Custom accelerators in dialog boxes

Obligatory note once again: mixing CreateWindowEx and DialogBoxParam/CreateDialogParam for the same window is possible but might not be a good idea from consistent-code-style point of view, reimplementing the dialog box functions might be a cool educational task but almost never pays back for anything else.
Post 13 Jul 2020, 11:11
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic This topic is locked: you cannot edit posts or make replies.

Jump to:  
Goto page 1, 2  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.