mem_allocΒΆ

mem_alloc creates a scalar string of the given length.

ssString = mem_alloc(n)
ssString = mem_alloc(n, c)

Return Value

ssString is string with n bytes.

Parameters

n

n is the number of bytes of the string.

c

c is a string or number which is used to initialize the string. If c is a string only the first character is used. If c is a number, the number is converted to a 8-bit value.

Example

def GetCurrentDirectory()
{
    ret = RegisterFunction("KERNEL32", "GetCurrentDirectoryA",..
                     "uint", "_GetCurDir", ["uint", "char*"]);
    ssBuffer = mem_alloc(1024);
    _GetCurDir(1024, ssBuffer)
    return strtrim(ssBuffer);
}

History

Version Description
5.0.0 ???
4.2.0 New.

id-783686