News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Tim's tips

Started by TWell, August 05, 2016, 03:56:22 AM

Previous topic - Next topic

TWell

ml64 dll without def-file
ml64.exe  testdll64.asm -Fetestdll64.dll
...
Myfunc proc export
...
Myfunc  endp
end
Plain commandline as subsystem comes from obj-file and WinMainCRTStartup is default name for GUI entry function in link
ml64.exe Hello64-3.asm; Sample x64 Assembly Program
extern ExitProcess: PROC
includelib kernel32.lib
extern MessageBoxA: PROC
includelib user32.lib
public WinMainCRTStartup

option dotname
.drectve segment byte info
db "-subsystem:windows ",0
.drectve ends

.data
caption db 'Hello64', 0
message db 'Hello 64-bit World!', 0
.code
WinMainCRTStartup:
  sub    rsp, 28h     ; shadow space, aligns stack
  mov    rcx, 0       ; hWnd = HWND_DESKTOP
  mov    rdx, offset message ; LPCSTR lpText
  mov    r8,  offset caption ; LPCSTR lpCaption
  mov    r9d, 0       ; uType = MB_OK
  call   MessageBoxA  ; call MessageBox API function
  mov    ecx, eax     ; uExitCode = MessageBox(...)
  call ExitProcess
end

Mikl__

Hi, Tim!
Thank you for information! Where it can be found? Or did you know that by experience?

jj2007

http://masm32.com/board/index.php?topic=5150.msg55398#msg55398

Mikl__

Grazie mille, jj2007!

TWell

Reading Windows ProductId from bios.
I put this hjwasm example to here too.
Only hjwasm is needed for this example.
; hjwasm64 -win64 -pe ReadProdId64hja.asm
    .x64                ; -pe requires to set cpu, model & language
    .model flat, fastcall

option casemap :none
option epilogue:none
option prologue:none

    option dllimport:<kernel32.dll>
GetSystemFirmwareTable proto :dword,:dword,:qword,:dword
    option dllimport:<msvcrt.dll>
;includelib msvcrt.lib
exit proto :dword
printf proto args:vararg

public mainCRTStartup
.data
msg  db "ACPI not found",13,10,0

.code
mainCRTStartup proc
  sub rsp, 428h ; local buffer
  invoke GetSystemFirmwareTable,'ACPI','MDSM',addr [rsp+20h],400h
  .if rax
    invoke printf,addr [rsp+58h]
  .else
    invoke printf,offset msg
  .endif
  invoke exit,0
mainCRTStartup endp
;msg  db "ACPI not found",13,10,0

end mainCRTStartup