I tried to connect ml64 and link
when ml64 + link
asm
include win64a.inc
.data
MsgCaption db "Iczelion's tutorial #2",0
MsgBoxText db "Win64 Assembly is Great!",0
.code
WinMain proc
sub esp,28h
invoke MessageBox,NULL,offset MsgCaption,offset MsgCaption,MB_OK
invoke ExitProcess,NULL
WinMain endp
end
bat
%masm64_path%bin\ml64 /Cp /c /I%masm64_path%Include tut_02ms.asm
%masm64_path%bin\link /SUBSYSTEM:WINDOWS /LIBPATH:%masm64_path%lib /entry:WinMain tut_02ms.obj
the result is a source file is 2560 bytes,
if poasm + polink
asm
include user32.inc
includelib user32.lib
include kernel32.inc
includelib kernel32.lib
MB_OK equ 0
NULL equ 0
.data
MsgCaption db "Iczelion's tutorial #2",0
MsgBoxText db "Win64 Assembly is Great!",0
.code
start:
sub esp,28h
invoke MessageBox,NULL,offset MsgCaption,offset MsgCaption,MB_OK
invoke ExitProcess,NULL
end start
bat
%masm64_path%bin\poasm /AAMD64 /Gr tut_02po.asm
%masm64_path%bin\polink /SUBSYSTEM:WINDOWS /LIBPATH:%masm64_path%lib tut_02po.obj
as a result of a file of 1536 bytes
if ml64 + polink
asm
include win64a.inc
.data
MsgCaption db "Iczelion's tutorial #2",0
MsgBoxText db "Win64 Assembly is Great!",0
.code
WinMain proc
sub esp,28h
invoke MessageBox,NULL,offset MsgCaption,offset MsgCaption,MB_OK
invoke ExitProcess,NULL
WinMain endp
end
bat
%masm64_path%bin\ml64 /Cp /c /I%masm64_path%Include tut_02mp.asm
%masm64_path%bin\polink /SUBSYSTEM:WINDOWS /LIBPATH:%masm64_path%lib /entry:WinMain tut_02mp.obj
as a result of a file of 64000 bytes, file not runs
Quoteentry point BaseProcessPostImport procedure not found in kernel32.dll
What have I done wrong?
Hello Mikl__,
I guess some other modules are interfering. Can you send here the object module tut_02mp.obj producing an executable of 64000 bytes?
Hi, Vortex!
tut_02mp.asm contains this line.
include win64a.inc
How are defined the external functions in this include file? Normally, the API functions should be declared with EXTERNDEF otherwise your code will import a lot of unnecessary symbols making larger your object module. Disassembling tut_02mp.obj :
H:\masm32\bin\objconv.exe -fmasm tut_02mp.obj disasm.txt
disasm.txt
option dotname
public start
extern __imp_wvsprintfW: byte
extern __imp_wvsprintfA: byte
extern __imp_wsprintfW: byte
extern __imp_wsprintfA: byte
extern __imp_mouse_event: byte
extern __imp_keybd_event: byte
.
.
.
.
extern __imp_AddLocalAlternateComputerNameW: byte
extern __imp_AddLocalAlternateComputerNameA: byte
extern __imp_AddConsoleAliasW: byte
extern __imp_AddConsoleAliasA: byte
extern __imp_AddAtomW: byte
extern __imp_AddAtomA: byte
extern __imp_ActivateActCtx: byte
@comp.id equ 00957809H
_text SEGMENT PARA 'CODE'
start PROC
sub esp, 40
xor ecx, ecx
mov rdx, offset MsgCaption
mov r8, rdx
xor r9d, r9d
call qword ptr [__imp_MessageBoxA]
xor ecx, ecx
call qword ptr [__imp_ExitProcess]
start ENDP
_text ENDS
The number of symbols defined with EXTERN is 1731. This the reason why you get a large executable.
\masm64\bin\link.exe -dump /HEADERS tut_02mp.exe
SECTION HEADER #1
.text name
23 virtual size
1000 virtual address (0000000140001000 to 0000000140001022)
200 size of raw data
200 file pointer to raw data (00000200 to 000003FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
60000020 flags
Code
Execute Read
SECTION HEADER #2
.data name
F476 virtual size
2000 virtual address (0000000140002000 to 0000000140011475)
F600 size of raw data
400 file pointer to raw data (00000400 to 0000F9FF)
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
C0000040 flags
Initialized Data
Read Write
F600 size of raw data. This is the size of the .data section containing all the API functions mentioned above.
batset filename=tut_02mp
%masm64_path%bin\ml64 /Cp /c /I%masm64_path%Include %filename%.asm
%masm64_path%bin\polink /SUBSYSTEM:WINDOWS /LIBPATH:%masm64_path%lib ^
/entry:start %filename%.obj
asminclude user32.inc
includelib user32.lib
include kernel32.inc
includelib kernel32.lib
extern __imp_MessageBoxA:byte
extern __imp_ExitProcess:byte
.data
MsgCaption db "Iczelion's tutorial #2",0
MsgBoxText db "Win64 Assembly is Great!",0
.code
start proc
sub esp,28h
xor r9,r9
mov r8,offset MsgCaption
mov rdx,offset MsgBoxText
xor ecx,ecx
call MessageBoxA
xor ecx,ecx
call ExitProcess
start endp
end
Size of exe-file is 1536 bites
Thank you, Vortex, very mutch! And special for you tut_02mp.exe in 660 bytes (http://www.kolobok.us/smiles/light_skin/bye.gif)