Windows Utilities
This part of Ikarus implements some WinAPI functions that can be used directly from Gothic scripts.
Initialization
The best way to initialize all Ikarus functions is to call MEM_InitAll()
in the Init_Global()
initialization function.
Warning
If you want to use Ikarus in Gothic 1, it is best to define your own Init_Global()
function and call it from every world initialization function.
Implementation
Functions
LoadLibrary
LoadLibrary
Loads the specified module into the address space of the calling process. Full documentation here.
var string lpFileName
Name of loaded module
Return value
The function returns a handle to the module.
GetProcAddress
GetProcAddress
Retrieves the address from the specified dynamic-link library. Full documentation here.
var int hModule
A handle to the DLL module that contains the function or variable. Can be obtained using theLoadLibrary
function.var string lpProcName
The function or variable name.
Return value The function returns address of the function or variable.
FindKernelDllFunction
FindKernelDllFunction
Uses GetProcAddress
to find function inside the KERNEL32.DLL
file.
var string name
Name of the looked function.
Return value
The function returns address of the function.
VirtualProtect
VirtualProtect
Changes the protection on a region of committed pages in the virtual address space of the calling process. Full documentation here.
var int lpAddress
The address of the starting page of the region of pages whose access protection attributes are to be changed.var int dwSize
The size of the region whose access protection attributes are to be changed, in bytes.var int flNewProtect
The memory protection option. All options can be found here.
Return value
The function returns lpflOldProtectPtr
- a pointer to a variable that receives the previous access protection value.
Author's comment:
I made
lpflOldProtectPtr
the return value and ignored the return Value of VirtualProtect.
MemoryProtectionOverride
MemoryProtectionOverride
Alias to VirtualProtect
but with predefined PAGE_EXECUTE_READWRITE
protection option
var int address
The address of the starting page of the region of pages whose access protection attributes are to be changed.var int size
The size of the region whose access protection attributes are to be changed, in bytes.
MEM_MessageBox
MEM_MessageBox
Calls the WinAPI MessageBox function.
var string txt
Content of the MessageBox.var string caption
Header of MessageBox.var int type
Type of MessageBox. All types listed here.
MEM_InfoBox
MEM_InfoBox
Alias to MEM_MessageBox
with "Information:" header and MB_OK | MB_ICONINFORMATION
type.
var string txt
Content of the InfoBox.
Examples
Sleep
Following function calls the Sleep
function from the KERNEL32.DLL
. A documentation of this function can be found here.