Author Topic: Is there any way to put resource section as the last section?  (Read 4108 times)

Dubby

  • Member
  • **
  • Posts: 60
So as the title says...
is there any linker directive to do so?

because sometimes I feel lazy to update resources through the source code...
especially, if I just want a quick dirty hack for resource layout inside my assembled program...  :P

Vortex

  • Member
  • *****
  • Posts: 2032
Re: Is there any way to put resource section as the last section?
« Reply #1 on: June 22, 2012, 04:43:08 AM »
Hi Dubby,

Not sure if it helps but, you can try Yaroslav's resource linker :

http://c--sphinx.narod.ru/indexe.htm

Vortex

  • Member
  • *****
  • Posts: 2032
Re: Is there any way to put resource section as the last section?
« Reply #2 on: June 23, 2012, 07:41:54 PM »
Here is a quick example :

Code: [Select]
#include    "Dlgbox.inc"

.data
DlgName     db "MyDialog",0

hInstance   dd ?
CommandLine dd ?
hCursor     dd ?

.code

start:

    invoke  GetModuleHandle,0
    mov     [hInstance],eax
    invoke  DialogBoxParam,[hInstance],ADDR DlgName,0,ADDR DlgProc,0
    invoke  ExitProcess,eax

DlgProc FRAME hWnd,uMsg,wParam,lParam
 
    cmp     d[uMsg],WM_CLOSE
    jne     >initdlg
    invoke  EndDialog,[hWnd],0
    jmp     >true

initdlg:

    cmp     d[uMsg],WM_INITDIALOG
    jne     >setcursor
    invoke  LoadCursor,0,IDC_CROSS
    mov     [hCursor],eax
    jmp     >true

setcursor:

    cmp     d[uMsg],WM_SETCURSOR
    jne     >false
    invoke  SetCursor,[hCursor]
    jmp     >true

false:

    xor     eax,eax
    ret

true:

    mov     eax,1
    ret

ENDF

Code: [Select]
\goasm\gorc /r rsrc.rc

\goasm\goasm Dlgbox.asm
\goasm\golink Dlgbox.obj kernel32.dll user32.dll

rl.com Dlgbox.exe rsrc.res /a

Dubby

  • Member
  • **
  • Posts: 60
Re: Is there any way to put resource section as the last section?
« Reply #3 on: June 24, 2012, 01:46:38 PM »
Thanks alot Vortex...
but looks like it's only work on x86 platform only....

but anyway thanks for the link....  :biggrin:

Vortex

  • Member
  • *****
  • Posts: 2032
Re: Is there any way to put resource section as the last section?
« Reply #4 on: August 13, 2012, 05:07:52 AM »
Not sure but it would be interesting to try a tool like Resource Hacker to accomplish the task.