moka.lang
Class DLL

java.lang.Object
  |
  +--moka.lang.Object
        |
        +--moka.lang.DLL

public final class DLL
extends Object

Class DLL provides methods to deal with DLLs. Look moka.lang.DLL_Interface interface to learn more about using DLLs in Moka.

Since:
MDK2.2

Field Summary
static short DLL_ALREADYLOADED
          There is already another DLL loaded in the RAM.
static short DLL_LOCKFAILED
          The attempt to lock the DLL in memory has failed due to some strange reason.
static short DLL_NOTFOUND
          The DLL is not found.
static short DLL_NOTINGHOSTSPACE
          The DLL could not be loaded because the program counter is not in the "ghost space" (the virtual address space where HW2 protections do not take effect).
static short DLL_OK
          The DLL was loaded and initialized successfully.
static short DLL_OUTOFMEM
          There is not memory to load the DLL into RAM.
static short DLL_WRONGVERSION
          There is at least one valid DLL file with the name DLLName and with the correct extension, signature, and identification number, but none of them has a major version number which is equal to the expected major number (determined by the Major parameter) and a minor version number which is greater or equal than the expected minor number (determined by the Minor parameter).
 
Method Summary
abstract static short load(char[] varName, uint id, ushort major, ushort minor)
          Loads a DLL into memory and prepares it for use.
static short load(moka.lang.String varName, uint id, ushort major, ushort minor)
          Loads a DLL into memory and prepares it for use.Unloads the previously loaded DLL, if any, using System.unloadDLL(), before attempting to load a new DLL.
static void unload()
          Unloads a previously loaded DLL.
 
Methods inherited from class moka.lang.Object
equals, finalize, getClassName, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DLL_OK

public static final short DLL_OK
The DLL was loaded and initialized successfully.

See Also:
Constant Field Values

DLL_NOTINGHOSTSPACE

public static final short DLL_NOTINGHOSTSPACE
The DLL could not be loaded because the program counter is not in the "ghost space" (the virtual address space where HW2 protections do not take effect). Note that exe-packed programs are always executed in the ghost space. By default Moka programs executes in ghost space.

See Also:
Constant Field Values

DLL_NOTFOUND

public static final short DLL_NOTFOUND
The DLL is not found. This means that either a file with the name DLLName is not found in any folder, or such files exist, but none of them has the correct extension ('DLL'), the correct embedded signature, and the correct identification number (determined by the ID parameter).

See Also:
Constant Field Values

DLL_LOCKFAILED

public static final short DLL_LOCKFAILED
The attempt to lock the DLL in memory has failed due to some strange reason. This error code is very unlikely.

See Also:
Constant Field Values

DLL_OUTOFMEM

public static final short DLL_OUTOFMEM
There is not memory to load the DLL into RAM.

See Also:
Constant Field Values

DLL_ALREADYLOADED

public static final short DLL_ALREADYLOADED
There is already another DLL loaded in the RAM. Due to efficiency reasons, only one DLL is allowed to be loaded at the same time. You need to unload the current DLL using UnloadDLL before loading another one. Anyway, using more than one DLL is strongly deprecated if you don't know exactly what you are doing and why you are doing so.

See Also:
Constant Field Values

DLL_WRONGVERSION

public static final short DLL_WRONGVERSION
There is at least one valid DLL file with the name DLLName and with the correct extension, signature, and identification number, but none of them has a major version number which is equal to the expected major number (determined by the Major parameter) and a minor version number which is greater or equal than the expected minor number (determined by the Minor parameter).

See Also:
Constant Field Values
Method Detail

load

public abstract static short load(char[] varName,
                                  uint id,
                                  ushort major,
                                  ushort minor)
Loads a DLL into memory and prepares it for use. Unloads the previously loaded DLL, if any, using System.unloadDLL(), before attempting to load a new DLL.

Parameters:
varName - an ANSI string representing the standard ANSI C name of the DLL file which is to be loaded.
id - a DLL identification number introduced for safety reasons: any file which does not have the extension 'DLL', a valid embedded signature and an embedded identification number which is equal to ID is ignored.
major - the expected major version number of the DLL, loadDLL will refuse to load a DLL if the expected and actual version numbers are not the same.
minor - the expected minor version number of the DLL, loadDLL will refuse to load a DLL if the expected minor version number is greater than the actual minor version number.
Returns:
System.DLL_OK if the DLL was loaded successfully, an error code otherwize.

load

public static short load(moka.lang.String varName,
                         uint id,
                         ushort major,
                         ushort minor)
Loads a DLL into memory and prepares it for use.Unloads the previously loaded DLL, if any, using System.unloadDLL(), before attempting to load a new DLL.

Parameters:
varName - an String representing the standard ANSI C name of the DLL file which is to be loaded.
id - a DLL identification number introduced for safety reasons: any file which does not have the extension 'DLL', a valid embedded signature and an embedded identification number which is equal to ID is ignored.
major - the expected major version number of the DLL, loadDLL will refuse to load a DLL if the expected and actual version numbers are not the same.
minor - the expected minor version number of the DLL, loadDLL will refuse to load a DLL if the expected minor version number is greater than the actual minor version number.
Returns:
System.DLL_OK if the DLL was loaded successfully, an error code otherwize.

unload

public static void unload()
Unloads a previously loaded DLL. It does nothing if the DLL was not previously loaded.