Ziron Linker and File Formats
Ziron comes with it's own linker plugin which supports a variety of formats and extended in newer releases. Ziron can
have numerous other formats added via plugins. This documentation only currently covered the included linker.dll formats.
PE32_GUI
PE32_GUI creates a Windows x32 compatible executable (.exe) which is designed to run as a graphical user interface.
PE32_CUI
PE32_CUI creates a Windows x32 compatible executable (.exe) which is designed to run as a console user interface.
PE32_DLL
PE32_DLL creates a Windows x32 compatible dynamic link library (.dll).
PE32P_CUI
PE32P_CUI creates a Windows x64 compatible executable (.exe) which is designed to run as a graphical user interface.
PE32P_GUI
PE32P_GUI creates a Windows x64 compatible executable (.exe) which is designed to run as a console user interface.
MSCOFF
MSCOFF creates a Microsoft compatible COFF object file (.obj) which can be linked with MSCOFF compatible linkers.
RAW_IMAGE
RAW_IMAGE creates a plain raw file that can be used to create numerous file formats (.raw)
INTEL_FLOPPY
INTEL_FLOPPY creates a plain bootable raw file with a 1.4MB filesize which is compatible with intel based systems that can be used to create bootloaders among other things (.img)
KOLIBRI32
KOLIBRI32 creates a
Kolibri OS x32 compatible executable (.kex).
MENUET01
MENUET01 creates a Menuet OS x32 compatible executable (...).
Plugin API
Definitions and Structs
TRIGGER_EVENT
enum TRIGGER_EVENT: DWord {
TRIGGER_START = 0,
TRIGGER_COMPLETE = 1
}
TRIGGER_START | Passed when the trigger is about to begin. |
TRIGGER_COMPLETE | Passed when the trigger has completed. |
Methods exportable by Plugins
onEntry
procedure stdcall onEntry(pointer funcTable): char*;
This function must be exported for it to be a valid Ziron plugin.
funcTable | Pointer to the plugin API method table. |
Plugin must return an address to a null terminated string which contains the name of the plugin.
onExit
procedure stdcall onExit();
This function can be exported if any deinitialization code is required.
onFileEntry
procedure stdcall onFileEntry(DWord handle; char* pCode; DWord len): boolean;
Export this program to receive events for each file/vfile that is included.
handle | The internal handle of the file. |
pCode | Pointer to the code/file buffer. |
len | Length of the code/file buffer. |
The return is currently unused.
Callback definitions
function stdcall onBuildEvent(TRIGGER_EVENT evt; DWord id): boolean;
Called on file build event.
evt | Returns the current event. TRIG_START = 0, TRIG_COMPLETE = 1. |
id | The unique id for this file type. |
Return result is currently unused.
function stdcall onKeywordEvent(): boolean;
Called on keyword triggered.
Return true if keyword was processed or return false if the assembler should try to process the keyword instead.
Methods callable by Plugins using the function table.
Please note that the names used are using the default method names from the framework
include. You can manually call methods from the address or assign them to custom method names as desired.
ziron_log_messageA [table offset: 0]
procedure stdcall ziron_log_messageA(char* msg; boolean fatal);
Output a message to the assembler console.
msg | Pointer to a null terminated ansi string containing your message. |
fatal | True to prevent further assembling. |
ziron_log_messageW [table offset: 4]
procedure stdcall ziron_log_messageW(wchar* msg; boolean fatal);
Output a message to the assembler console.
msg | Pointer to a null terminated wide string containing your message. |
fatal | True to prevent further assembling. |
ziron_reg_builder [table offset: 8]
function stdcall ziron_reg_builder(char* name; pointer cb): int32;
Register a file builder callback.
name | Pointer to a null terminated ansi string containing the file format name. e.g. KOLIBRI32 |
cb | Pointer to the callback function (see events) |
This function returns a unique ID for this builder.
ziron_file_commit [table offset: 12]
procedure stdcall ziron_file_commit();
Commits file buffer to disk.
ziron_file_write [table offset: 16]
function stdcall ziron_file_write(pointer bytes; DWord len): DWord;
Write bytes to end of file buffer.
bytes | Pointer to a buffer. |
len | Length of buffer to write. |
Returns the file position where the bytes were written.
ziron_file_len [table offset: 20]
function stdcall ziron_file_len(): DWord;
Get the current file buffer size.
Returns the size of the file buffer in bytes.
ziron_file_rewrite [table offset: 24]
function stdcall ziron_file_rewrite(DWord pos; pointer bytes; DWord len): DWord;
Rewrite bytes in file buffer.
pos | Position in buffer where the replacement will occur. |
bytes | Pointer to a buffer. |
len | Length of buffer to write. |
Returns the file position where the bytes were written.
ziron_code_get [table offset: 28]
function stdcall ziron_code_get(DWord i; DWord* len): pointer;
Get the code from function.
i | ID of the method. |
len | Pointer to a DWord variable where the length can be written. |
Returns a pointer to the code buffer.
ziron_code_count [table offset: 32]
function stdcall ziron_code_count(): DWord;
Get the code buffer count.
Returns the counter of code buffers.
ziron_const_get [table offset: 36]
function stdcall ziron_const_get(DWord i): pointer;
Get a pointer to a const struct.
Returns a pointer to the const struct.
ziron_const_count [table offset: 40]
function stdcall ziron_const_count(): DWord;
Get the const count.
Returns the counter of consts.
ziron_fixup_get [table offset: 44]
function stdcall ziron_fixup_get(Pointer fn; DWord i): Pointer;
Get a pointer to a fixup struct.
fn | Pointer to a function struct. |
i | ID of the fixup. |
Returns a pointer to a fixup struct.
ziron_fixup_count [table offset: 48]
function stdcall ziron_fixup_count(Pointer fn): DWord;
Return the fixup count for specified method.
fn | Pointer to a function struct. |
Returns the counter of fixups for specified method.
ziron_func_get [table offset: 52]
function stdcall ziron_func_get(DWord i): Pointer;
Returns a method struct.
Returns a pointer to a method struct.
ziron_func_count [table offset: 56]
function stdcall ziron_func_count(): DWord;
Get the total amount of methods.
Returns the counter of methods.
ziron_file_writecode [table offset: 60]
procedure stdcall ziron_file_writecode(DWord i);
Writes the method buffer to the end of the file buffer.
ziron_imp_get [table offset: 64]
function stdcall ziron_imp_get(DWord ilib; DWord i): Pointer;
Info coming soon....
ziron_imp_count [table offset: 68]
function stdcall ziron_imp_count(DWord ilib): DWord;
Get the total amount of imported methods.
Returns the counter of imported methods.
ziron_ilib_count [table offset: 72]
function stdcall ziron_ilib_count(): DWord;
Get the total amount of import libraries.
Returns the counter of import libraries.
ziron_ilib_name [table offset: 76]
function stdcall ziron_ilib_name(DWord ilib): char*;
Info coming soon....
ziron_fixup_add [table offset: 80]
procedure stdcall ziron_fixup_add(FIXUP_TYPE ft; pointer func; DWord index; DWord pos; byte size; DWord ofs);
Info coming soon....
ziron_func_emit [table offset: 84]
procedure stdcall ziron_func_emit(pointer fn; pointer p; DWord len);
Info coming soon....
ziron_func_rem [table offset: 88]
procedure stdcall ziron_func_rem(Pointer fn; DWord start; DWord len);
Info coming soon....
ziron_func_exec [table offset: 92]
function stdcall ziron_func_exec(char* c; DWord len): boolean;
Info coming soon....
ziron_var_get [table offset: 96]
function stdcall ziron_var_get(DWord i): Pointer;
Info coming soon....
ziron_var_count [table offset: 100]
function stdcall ziron_var_count(): DWord;
Get the total amount of variables.
Returns the counter of variables.
ziron_set_fileext [table offset: 104]
procedure stdcall ziron_set_fileext(wchar* s);
Info coming soon....
ziron_file_getbuf [table offset: 108]
function stdcall ziron_file_getbuf(): Pointer;
Info coming soon....
ziron_file_writeresources [table offset: 112]
function stdcall ziron_file_writeresources(DWord rva): DWord;
Info coming soon....
ziron_get_flags [table offset: 116]
function stdcall ziron_get_flags(): Pointer;
Info coming soon....
ziron_register_keyword [table offset: 120]
function stdcall ziron_register_keyword(char* name; pointer callback): DWord;
Info coming soon....
ziron_unregister_keyword [table offset: 124]
function stdcall ziron_unregister_keyword(char* name): boolean;
Info coming soon....
ziron_expect_token [table offset: 128]
function stdcall ziron_expect_token(DWord tk): Int32;
Info coming soon....
ziron_expect_ident [table offset: 132]
function stdcall ziron_expect_ident(DWord id): Int32;
Info coming soon....
ziron_curtoken_size [table offset: 136]
function stdcall ziron_curtoken_size(): DWord;
Info coming soon....
ziron_token_next [table offset: 140]
function stdcall ziron_token_next(): DWord;
Info coming soon....
ziron_curtoken_int32 [table offset: 144]
procedure stdcall ziron_curtoken_int32(pointer buf);
Info coming soon....
ziron_curtoken_int64 [table offset: 148]
procedure stdcall ziron_curtoken_int64(pointer buf);
Info coming soon....
ziron_curtoken_charptr [table offset: 152]
function stdcall ziron_curtoken_charptr(): char*;
Info coming soon....
ziron_curtoken_wcharptr [table offset: 156]
function stdcall ziron_curtoken_wcharptr(): wchar*;
Info coming soon....
ziron_curtoken_real [table offset: 160]
procedure stdcall ziron_curtoken_real(pointer buf; DWord size);
Info coming soon....
ziron_token_peek [table offset: 164]
function stdcall ziron_token_peek(): DWord;
Info coming soon....
ziron_eol [table offset: 168]
function stdcall ziron_eol(): boolean;
Info coming soon....
ziron_extractline [table offset: 172]
function stdcall ziron_extractline(char* buf; int32 maxlen): int32;
Info coming soon....
ziron_token_ident [table offset: 176]
function stdcall ziron_token_ident(): Int32;
Info coming soon....
ziron_conv_labelref [table offset: 180]
function stdcall ziron_conv_labelref(): DWord;
Info coming soon....
ziron_curtoken_dataptr [table offset: 184]
function stdcall ziron_curtoken_dataptr(): pointer;
Info coming soon....
ziron_func_index [table offset: 188]
function stdcall ziron_func_index(pointer fn): DWord;
Info coming soon....