Hi!
how to change the "this program cannot be run in the DOS mode" message in Win32 program when it runs in the pure DOS mode ?
how to change the "this program cannot be run in the DOS mode" message in Win32 program when it runs in the pure DOS mode ?
Modify fasm sources and recompile it, or modify the stub message using an hex editor or your own tool...
You can write your own stub (it should be MZ .exe program, but fasm can also convert binary .com into MZ stub), and then use it for your PE programs by putting "on" operator with quoted file name at the end of "format PE" directive.
For example you can assemble the following code into mystub.exe:
and the create Win32 program using this stub, this is the simpliest:
For example you can assemble the following code into mystub.exe:
format MZ
push cs
pop ds
mov dx,_msg
mov ah,9
int 21h
mov ax,4CFFh
int 21h
_msg db 'This is my own stub program!',0Dh,0Ah,24h
and the create Win32 program using this stub, this is the simpliest:
format PE on 'mystub.exe'
ret
Another point for the 1.40 docs :tongue:
thankyou !
"what i want is what i get"
"what i want is what i get"
is this means that when i compile the code, the output is 2-in-1 program (one for MZ and one for PE) ?
is that mean that i can create program can work in both DOS mode and Win32 ?
is that mean that i can create program can work in both DOS mode and Win32 ?
Certainly, and this is what FASM.EXE is! :)
yes you can !
by using "on" operator. for example :
by using "on" operator. for example :
; 2-in-1 program example (using "on" operator)
format PE GUI 4.0 on 'life.com' ; if in dos mode, it will run life.com automaticly
; life.asm can be found in '*\fasm\examples\life'.
include 'include\kernel.inc'
include 'include\user.inc'
include 'include\macro\stdcall.inc'
include 'include\macro\resource.inc'
include 'include\macro\import.inc'
repeat 5
invoke meb,NULL,mesej,tajuk,MB_OK
end repeat
invoke keluar
tajuk db 'win32',0
mesej db 'this is in win32',0
data import
library kdll,'kernel32.dll',\
udll,'user32.dll'
kdll:
import keluar,'ExitProcess'
udll:
import meb,'MessageBoxA'
end data
section '.rscr' resource data readable
directory RT_ICON,ikon,\
RT_GROUP_ICON,kumpikon
ikon:
resource 2,LANG_NEUTRAL,data_ikon
kumpikon:
resource 3,LANG_NEUTRAL,ikonutama
icon ikonutama,data_ikon,'c:\windows\asm.ico'
data fixups
end data