Allocates a new memory block with the given <size>.
Note: API call: <result> = GlobalAlloc( GMEM_FIXED or GMEM_ZEROINIT,
<size> )
Returns: <>0: Pointer to memory block, =0: Error.
$ptr = MemAlloc( 4096 )
Frees the given memory block.
Note: API call: <result> = GlobalFree( <ptr> )
Returns: 0: OK.
MemFree( $ptr )
The script engine takes care, that allocated memory is freed again when script terminates. For special cases, this behaviour can be turned off for the given <ptr>.
Returns: <ptr>
MemForget( $ptr )
Returns the size of the given memory block.
Note: API call: <result> = GlobalSize( <ptr> )
Returns: <>0: Size, =0: Error.
print( MemSize( $ptr ) )
Assumes, that <ptr> points to at least 4 byte containing a number (Integer, DWORD) and either sets or returns that value.
Returns: Number
MemSetInt( $ptr, 42 ) print( MemGetInt( $ptr ) )
MemSetStr( <ptr>, <str>,
<length> )
MemSetStr( <ptr>, <int> )
MemGetStr( <ptr> )
Sets or returns multiple bytes at the position, that <ptr> is pointing
to.
If no <length> is given, a null terminated string is assumed.
Returns: String
MemSetStr( $ptr, "This will become a ASCIIZ string!" ) print( MemGetStr( $ptr ) )
Returns a pointer to the value of the given variable (string or integer). This pointer is only valid as long as the variable remains unchanged.
Returns: <ptr>
$ptr = MemVarPtr( $var )