Memory.CreateStructure

number Memory.CreateStructure ( 

string  StructureForm )

Description

Create a structure with some fields in this form ("first field[multi field], second field, ..." ).

Parameters

StructureForm

(string) Structure fields in the string form.

Note: For creating sructure you must set your fileds that you want for examp with this we want create a structure with 2 long field "long, long" or "long[2]", or create a structure that have 10 field int and 1 field long and 3 field byte and 1 field short "int[10], long, byte[3], short".

Note: All fields that this pluin supports are long, int, in64, short, char, float, double, byte. this plugin supports string but creatin a string in structure is troublesome but possible, for this first we must create that field int or long then create a memory buffer with every size we want then set that structure field with the addressof memory buffer.(see Example2)

Returns

(number) Address of your created Sructure.

ResultVariable

When adding an action with the script editor, you can use this field to specify a variable that the return value will be stored in.

Example 1

struct = Memory.CreateStructure("long[3]") Memory.FreeStructure(struct)

Example 2

string_struct = Memory.CreateStructure("short, byte, int") -- instead of "short, byte, string" we use "short, byte, int" mem = Memory.Allocate(1024) -- create a memory buffer with 1024 bytes size Memory.SetStructureData(string_struct, 3, 0, mem) -- set memory buffer in that field -- -- do some work with structure -- Memory.FreeStructure(string_struct) -- free all allocated memory of our structure Memory.Free(mem) -- free our allocated memory of our memory buffer

See also:  Related Actions

Сайт управляется системой uCoz