flat assembler
Message board for the users of flat assembler.
![]() Goto page 1, 2 Next |
Author |
|
revolution
Maybe:
Code: format PE GUI 4.0 DLL |
|||
![]() |
|
TimK
revolution wrote: Try a higher version number. Code: format PE GUI 5.0 DLL |
|||
![]() |
|
revolution
TimK wrote:
|
|||
![]() |
|
TimK
revolution wrote: Try a higher version number. Tried 5, 6, 7 ![]() Nothing has changed. |
|||
![]() |
|
bzdashek
TimK wrote:
If nothing changes, then output an error. |
|||
![]() |
|
TimK
bzdashek wrote: If nothing changes, then output an error. Same "Bad Image" error message. |
|||
![]() |
|
sinsi
Have you tried version 8?
|
|||
![]() |
|
bzdashek
Try this:
Code: format PE GUI 4.0 DLL entry EntryPoint include 'win32w.inc' section '.text' code readable executable proc EntryPoint hinstDLL,fdwReason,lpvReserved cmp [fdwReason],DLL_PROCESS_ATTACH jne .exit mov eax,[hinstDLL] mov [HInstance],eax push eax call [DisableThreadLibraryCalls] .exit: xor eax,eax inc eax ret endp proc Install HostWnd ; ret endp proc Uninstall ; ret endp section '.data' data readable writeable HInstance dd 0 section '.idata' import data readable library kernel32,'Kernel32.dll',\ user32,'User32.dll' include 'api\kernel32.inc' include 'api\user32.inc' section '.edata' export data readable export 'MyDll.dll',\ Install,'F1',\ Uninstall,'F2' section '.reloc' fixups data discardable |
|||
![]() |
|
TimK
bzdashek wrote: Try this Dont helps. Same error message text, but error code is 0xc0000020 (was 0xc0000005). |
|||
![]() |
|
bzdashek
Did you try to run DLL example from FASM? Does it work?
fasm\EXAMPLES\DLL |
|||
![]() |
|
TimK
bzdashek wrote: Did you try to run DLL example from FASM? Does it work? It does not work. Same "Bad Image" error. |
|||
![]() |
|
TimK
bzdashek wrote: Did you try to run DLL example from FASM? Does it work? It does not work. Same "Bad Image" error.
|
||||||||||
![]() |
|
typedef
It seems like Win8 changed maybe? Maybe it requires something else that's missing or some PE field that is not ignored anymore(if there was any that was ignored in previous versions of Windows).
|
|||
![]() |
|
r22
On win7 64 bit I've run into Bad Image error if you don't have a BSS section or if your data section isn't aligned (or is too small).
Try this, if it doesn't work try adding the reloc section to the bottom as well from one of the above posts. Code: format PE GUI 4.0 DLL entry EntryPoint include 'win32w.inc' section '.text' code readable executable proc EntryPoint hinstDLL,fdwReason,lpvReserved cmp [fdwReason],DLL_PROCESS_ATTACH jne .exit mov eax,[hinstDLL] mov [HInstance],eax push eax call [DisableThreadLibraryCalls] .exit: xor eax,eax inc eax ret endp proc Install HostWnd ; ret endp proc Uninstall ; ret endp section '.data' data readable writeable align 16 HInstance dd 0 section '.bss' data readable writable align 16 dd 0 section '.idata' import data readable library kernel32,'Kernel32.dll',\ user32,'User32.dll' include 'api\kernel32.inc' include 'api\user32.inc' section '.edata' export data readable export 'MyDll.dll',\ Install,'F1',\ Uninstall,'F2' |
|||
![]() |
|
TimK
r22 wrote: On win7 64 bit I've run into Bad Image error if you don't have a BSS section or if your data section isn't aligned (or is too small). Dont work... One difference: with align/bss, without .reloc section error code is 0xc0000020, with relocations 0xc0000005. |
|||
![]() |
|
LostCoder
I recently encountered a similar problem, though it was under Windows 7 x64 and it was EXE, not DLL. The problem resolved itself when the size of the EXE has increased, namely, the size of the sections .code and .data. Don't know why.
|
|||
![]() |
|
bzdashek
Maybe Tomasz will say something, if he notices this thread?
|
|||
![]() |
|
Tomasz Grysztar
I have just tested it and it appears that Windows 8 doesn't like .reloc section to not have "readable" attribute. So the correction should be to replace the last line with:
Code: section '.reloc' fixups data readable discardable I will update the official example with this fix soon. |
|||
![]() |
|
bzdashek
Thanks for the explanation, Tomasz
Just look at it - since 95 it didn't care, and now here it is! |
|||
![]() |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.