-
-
Notifications
You must be signed in to change notification settings - Fork 53
Inbuilt API
This page explains the various objects and values that have been added into the JS engine from within the tool.
The tool provides the following strongly typed enumerations (i.e. you cannot just mix them up without causing issues).
These values are used for representing the various known sections in the Exe.
Value | Notes |
---|---|
CODE |
Usually .text |
DATA |
Usually .rdata or .data |
DATA2 |
Sometimes .data is present in addition to .rdata, hence DATA2 is needed |
IMPORT |
usually .rsrc |
RSRC |
Resource section. usually .rsrc |
DIFF |
The .xdiff section |
MIXED |
Only valid for unpacked clients. Essentially a merger of CODE & DATA
|
Indicates the 2 primary type of addresses dealt with in WARP. i.e.
PHYSICAL
VIRTUAL
In addition to these, occasionally one may need to deal with Relative Virtual addresses or RVA for short.
RVA is simply a VIRTUAL
address - Exe.ImageBase.
Due to this straightforward conversion, we do not have a seperate type for it.
The Exe.GetUserInput function makes use of this enum for specifying the type of value expected from user.
Value | Description |
---|---|
D_Int8 |
8 bit Signed Integer. By default, ranges from -128 to 127 |
D_Int16 |
16 bit Signed Integer. By default, ranges from -32768 to 32767 |
D_Int32 |
32 bit Signed Integer. By default, ranges from -2147483648 to 2147483647 |
D_VecI8 |
Vector of 8 bit Signed Integers (upto 4 of them). By default, all of them ranges from -128 to 127 , but individually customizable. |
D_VecI16 |
Vector of 16 bit Signed Integers (upto 4 of them). By default, all of them ranges from -32768 to 32767 , but individually customizable. |
D_VecI32 |
Vector of 32 bit Signed Integers (upto 4 of them). By default, all of them ranges from -2147483648 to 2147483647 , but individually customizable. |
D_Uint8 |
8 bit Unsigned Integer. By default, ranges from 0 to 255 |
D_Uint16 |
16 bit Unsigned Integer. By default, ranges from 0 to 65535 |
D_Uint32 |
32 bit Unsigned Integer. By default, ranges from 0 to 2147483647 |
D_VecU8 |
Vector of 8 bit Unsigned Integers (upto 4 of them). By default, all of them ranges from 0 to 255 , but individually customizable. |
D_VecU16 |
Vector of 16 bit Unsigned Integers (upto 4 of them). By default, all of them ranges from 0 to 65535 , but individually customizable. |
D_VecU32 |
Vector of 32 bit Unsigned Integers (upto 4 of them). By default, all of them ranges from 0 to 2147483647 , but individually customizable. |
D_Float |
Floating point number 32 bit. By default, ranges from 0.0 to 100.0 with a stepsize of 0.1 |
D_VecF |
Vector of 32 bit Unsigned Integers (upto 4 of them). By default, all of them ranges from 0.0 to 100.0 with stepsize 0.1 , but individually customizable. |
D_Bool |
Boolean (Used either for Yes/No queries OR you can opt to store the value as 8/16/32 bit number) |
D_Text |
Text String (Default encoding is ASCII but can be changed. |
D_Hex |
Hex String (spaced out between bytes) |
D_Choice |
Select one item from a list of values. There is no type restriction amongst the values. |
D_MultiChoice |
Select multiple items from a list of values. There is no type restriction amongst the values. |
D_FontName |
Font name (The input dialog will contain the list of currently installed fonts). |
D_FontSize |
Font size/height (The input dialog will have a dropdown of currently installed fonts for demo purposes). Value is 1 byte long and by default, ranges from 0 to 127. |
D_InFile |
Name of file which serves as input. (The input dialog will have a text field, along with browse and view buttons) |
D_OutFile |
Name of file which serves as output. (The input dialog will have a text field, along with browse and view buttons) |
D_Folder |
Name of a folder in the system (usually used for output). (The input dialog will have a text field and browse button) |
D_Color |
Color (The input dialog will have Hue, Saturation & Value controls). Special constraints have been provided to manage the alpha component and byte order (like RGBA or ARGB etc.) while saving. |
Indicates the type of IMAGE DATA DIRECTORIES available in the Exe
Value | Description |
---|---|
D_Export | Export Directory |
D_Import | Import Directory |
D_Res | Resource Directory |
D_Except | Exception Directory |
D_Secure | Security Directory |
D_Reloc | Base Relocation Table |
D_Debug | Debug Directory |
D_Arch | Architecture Specific Data |
D_GlobPtr | RVA of Global Pointer |
D_TLS | TLS Directory |
D_LoadCfg | Load Configuration Directory |
D_BoundI | Bound Import Directory in headers |
D_IAT | Import Address Table |
D_DelayI | Delay Load Import Descriptors |
D_ComDesc | COM Runtime descriptor |
Exe works with ASCII text by default. However, with this enum, we can specify the encoding to be used while working with text strings. Currently only 3 values are supported. i.e.
ASCII
UTF8
UTF16
Indicates the case-sensitivity to be used for textual searches within the Exe. It has 2 possible values:
CASE_SENSITIVE
CASE_INSENSITIVE
This enum can be optionally provided to all 4 textual search functions i.e.
Generally we need it to be case-sensitive, so the enum is not provided then CASE_SENSITIVE
is assumed.
Well, the term 'constant' is sort of a misnomer, since they can be overridden but anyways the following 4 paths are available.
Name | Description |
---|---|
TEMPDIR |
The 'temp' directory of the host system |
ROOTDIR |
The root directory of the host system. In Windows, this would be a drive (usually C:) |
HOMEDIR |
User's home directory |
OUTDIR |
Output folder . The path is different based on whether you are running Main GUI/Console or Test Bench |
Currently, there are 3 global objects provided inbuilt from the tool:
Name | Description |
---|---|
Exe | For access to an exe's internals and setting up changes to it |
System | For access to specific functions of the host system |
Warp | For access to everything else that does not come under either of the above |
Refer to the respective links for details.
Just like C++ and other Object Oriented languages, Classes can be defined in QJS as a way to represent new types.
To use them we need to create an instance of these using the new
keyword.
The tools provide the following classes inbuilt:
Name | Description |
---|---|
TextFile | For accessing a text file (for e.g. INI files or some list files ) |
BinFile | For accessing a binary file (for e.g. DLL files or Icon files) |
IExe | The Base class which was used for creating Exe object. Be careful with this one. |
Refer to the respective links for details.