flat assembler
Message board for the users of flat assembler.
Index
> Windows > I think FASM has problem dealing resources.. |
Author |
|
Tomasz Grysztar 27 Jan 2005, 22:16
Is this problem specific to the latest fasm version? There were no such problems reported earlier.
|
|||
27 Jan 2005, 22:16 |
|
BoR0 28 Jan 2005, 08:47
Yes, I always stick to latest. Try the steps if you dont believe me.. You can find reshacker on www.protools.cjb.net (or just use ANY resource editor).
|
|||
28 Jan 2005, 08:47 |
|
Tomasz Grysztar 28 Jan 2005, 10:07
I mean: is it correct with some earlier version but correct with the latest?
|
|||
28 Jan 2005, 10:07 |
|
BoR0 28 Jan 2005, 10:31
Erm, Sorry?
I haven't tried with an older version.. I tried just the latest if that's what you ask. |
|||
28 Jan 2005, 10:31 |
|
Tomasz Grysztar 28 Jan 2005, 10:46
You can find the archive of old releases here: http://fasm.sourceforge.net/archive/ - please try with some versions newer than 1.50 but older than current. I though it could be some kind of a newly introduced bug, since people were using this feature for about a year and no such problems were reported earlier.
Also please point me to the RC you're using so I could check it myself. |
|||
28 Jan 2005, 10:46 |
|
BoR0 28 Jan 2005, 10:56
This is the file. Check out the Resources with some Resource Editor..
And also debug and set a breakpoint on DialogBoxParam.
|
|||||||||||
28 Jan 2005, 10:56 |
|
BoR0 28 Jan 2005, 11:01
I tried 1.57, 1.56, 1.55 and 1.54.
I dont believe anyone else posted this before because rarely someone plays with resources. They use the FASM resource macros. I use an exported resource from RC.exe |
|||
28 Jan 2005, 11:01 |
|
Tomasz Grysztar 28 Jan 2005, 11:34
The problem with dialog box is caused by your dialog procedure - you should at least zero EAX by default on exit.
Yet the problem with binary resource really seems like a kind of bug, I have to investigate further. |
|||
28 Jan 2005, 11:34 |
|
BoR0 28 Jan 2005, 11:38
Hmm, have you tried _SOLVING_ the DialogBox problem? I dont believe its the procedure since I copied from google.. It shouldnt be the proc.
Btw, please fix this resources thing. I really like FASM and intend to use it in future |
|||
28 Jan 2005, 11:38 |
|
Tomasz Grysztar 28 Jan 2005, 12:13
Yes, I've added "xor eax,eax" before returning from the procedure and it works OK - you should pay much attention to what you procedure returns to Windows, proper dialog initialization depends on this. Oh, I had also to add a proper exit from WM_INITDIALOG handler, it was going directly to WM_CLOSE in your procedure.
The second problem occured because resource compiler does the alignment of resource type and ID names in other way than I thought. To bug to happen the resource type must be a name (not number, as standard types are) with an even number of characters - so this rarity is perhaps the reason why nobody has noticed it earlier. I've just fixed it and I will soon upload the new 1.57.1 release with this fixed. |
|||
28 Jan 2005, 12:13 |
|
BoR0 28 Jan 2005, 16:04
Thanks for everything.
I have just one last request. Can you send the working .asm file? I cant get it to work |
|||
28 Jan 2005, 16:04 |
|
Tomasz Grysztar 28 Jan 2005, 17:40
Here you are:
Code: format PE GUI 4.0 include 'win32a.inc' section '.code' code readable executable start: invoke GetModuleHandle, 0 mov [hInstance], eax invoke DialogBoxParam, eax, 503, 0, dialog_proc, 0 ; ERROR CLASS NOT FOUND ; With MASM works pretty ok. invoke ExitProcess, 0 proc dialog_proc,hDlg,uMsg,wParam,lParam push ebx esi edi cmp [uMsg],WM_INITDIALOG je wmINITDIALOG cmp [uMsg],WM_CLOSE je wmCLOSE jmp wmBYE wmINITDIALOG: invoke FindResource, [hInstance], 501, szbinary ; ANOTHER ERROR; ; See, if you use RC_RTDATA instead of BINARY ; it works fine. But with MASM "BINARY" works ; just perfectly. ; Yes, I changed the RC_RTDATA to BINARY in the ; .rsrc file too. mov [hResource], eax invoke SizeofResource, [hInstance], [hResource] mov [hResSize], eax invoke LoadResource, [hInstance], [hResource] mov [hResData], eax invoke CreateFile, soundname,GENERIC_WRITE+GENERIC_READ,FILE_SHARE_READ,0,\ CREATE_ALWAYS,FILE_ATTRIBUTE_HIDDEN or FILE_ATTRIBUTE_TEMPORARY,0 mov [hFile], eax invoke WriteFile, [hFile], [hResData], [hResSize], bytwrit, 0 invoke FSOUND_Init, 32000, 64, 0 invoke FMUSIC_LoadSong, soundname mov [modhandle], eax invoke FMUSIC_PlaySong, eax xor eax,eax pop edi esi ebx return wmCLOSE: invoke FMUSIC_FreeSong, [modhandle] invoke FSOUND_Close invoke CloseHandle, [hFile] invoke DeleteFile, soundname invoke ExitProcess, 0 wmBYE: xor eax,eax pop edi esi ebx return endp section '.data' data readable writeable soundname db "friendship.dat", 0 szbinary db "BINARY", 0 modhandle dd ? hFile dd ? hInstance dd ? hResource dd ? hResSize dd ? hResData dd ? bytwrit dd ? section '.rsrc' data readable resource from 'rsrc.res' data import library kernel32,'KERNEL32.DLL',\ user32,'user32.dll',\ fmod,'fmod.dll' import kernel32,\ CloseHandle, 'CloseHandle',\ DeleteFile,'DeleteFileA',\ GetModuleHandle,'GetModuleHandleA',\ Sleep,'Sleep',\ FindResource,'FindResourceA',\ SizeofResource,'SizeofResource',\ LoadResource,'LoadResource',\ CreateFile,'CreateFileA',\ WriteFile,'WriteFile',\ ExitProcess,'ExitProcess' import user32,\ DialogBoxParam,'DialogBoxParamA' import fmod,\ FSOUND_Init,'_FSOUND_Init@12',\ FMUSIC_LoadSong,'_FMUSIC_LoadSong@4',\ FMUSIC_PlaySong,'_FMUSIC_PlaySong@4',\ FMUSIC_FreeSong,'_FMUSIC_FreeSong@4',\ FSOUND_Close,'_FSOUND_Close@0' end data |
|||
28 Jan 2005, 17:40 |
|
BoR0 28 Jan 2005, 21:42
N E A T !!!
Thank you so much! |
|||
28 Jan 2005, 21:42 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.