Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
|
|
@ -0,0 +1,44 @@
|
|||
format PE console
|
||||
entry start
|
||||
include 'win32ax.inc'
|
||||
|
||||
section '.rdata' data readable
|
||||
message db 'Hello, World!', 13, 10
|
||||
; `=` is used to define the constant. `$` is the address of current position
|
||||
message_len = $ - message
|
||||
|
||||
section '.code' code readable executable
|
||||
; `invoke <PROC>, <...ARGS>` is a macro, equivalent to pushing arguments on the stack and `call`ing the procedure
|
||||
start:
|
||||
; Get a handle to standard output. Result is stored in EAX.
|
||||
invoke GetStdHandle, \ ; https://learn.microsoft.com/en-us/windows/console/getstdhandle
|
||||
STD_OUTPUT_HANDLE ; -11
|
||||
|
||||
; Print the message to the console using the handle from EAX
|
||||
invoke WriteConsoleA, \ ; https://learn.microsoft.com/en-us/windows/console/writeconsole
|
||||
eax, \ ; HANDLE hConsoleOutput
|
||||
message, \ ; void *lpBuffer
|
||||
message_len, \ ; DWORD nNumberOfCharsToWrite
|
||||
NULL, \ ; LPDWORD lpNumberOfCharsWritten (optional)
|
||||
NULL ; void *lpReserved (must be null)
|
||||
|
||||
; Exit the program
|
||||
invoke ExitProcess, 0
|
||||
|
||||
; Import Section (used to interface with dynamic libraries)
|
||||
section '.idata' import data readable
|
||||
; `library` is a macro that must be placed directly in the beginning of the import data.
|
||||
; It defines from what libraries the functions will be imported.
|
||||
; It should be followed by any amount of the pairs of parameters,
|
||||
; each pair being the label for the table of imports from the given library,
|
||||
; and the quoted string defining the name of the library.
|
||||
library kernel32, 'kernel32.dll'
|
||||
|
||||
; `import` macro generates the import table.
|
||||
; It needs first parameter to define the label for the table (the same as declared earlier to the library macro),
|
||||
; and then the pairs of parameters each containing the label for imported pointer and the quoted string
|
||||
; defining the name of function exactly as exported by library.
|
||||
import kernel32, \
|
||||
GetStdHandle, 'GetStdHandle', \
|
||||
WriteConsoleA, 'WriteConsoleA', \
|
||||
ExitProcess, 'ExitProcess'
|
||||
Loading…
Add table
Add a link
Reference in a new issue