Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.4j

Application v 5.22b

  

 

Chapter SixteenApplication (continued)

RegistryGetBlock Function

Overview

The RegistryGetBlock function loads a binary block of data for the specific the value name and key location. The value name must be REG_BINARY data type.

Syntax/Parameters

Syntax

int = RegistryGetBlock ( string key, string name, parameter *data, [int bytes] );

Parameters

key

A string containing the name of the key to access.

name

A string containing the name of value to access. If the value is an empty string, the default value for the key is returned.

data

A variable of any type that will receive the data. It cannot be a literal or a calculated expression value, and it must be in contiguous storage. See Section 3.7 Contiguous Data for more information. The parameter is treated as a pointer to the area of memory where the variable is held. Strings are an exception in that they must be zero-terminated (see the Remarks section below). By default, this parameter is treated as a reference and its contents will be altered.

bytes

An optional int containing the requested number of bytes to be read. If specified, it must be equal or less than the size of the name parameter. If name is a string type, the number of bytes read will always be reduced to allow for a terminator. The maximum number of bytes that can be read is 1GB or 0x3FFFFFFF. If bytes is less than 1 or omitted, the default size of the data parameter will be used. If the key source data is too large for the allocated area or specified size, an error will occur.

Return Value

Returns an int containing the number of bytes read or a formatted error code on failure.

If there is insufficient space, an ERROR_OVERFLOW will be returned with the low 30-bits containing the required size to read the data.

Other typical underlying errors codes are ERROR_PATH_NOT_FOUND (3) when the key is not found and ERROR_FILE_NOT_FOUND (2) and the value name is not found.

Remarks

RegistryGetBlock function is designed as an advanced function to give developers maximum flexibility in terms of accessing files and loading information into variables. It allows binary data to be loaded directly into variables. As a consequence, the variable must be a contiguous block of memory. Therefore, objects that contains strings or other auto-allocated data types cannot be used with this function. Source registry value data type must be REG_BINARY to retrieve data for the specified name.

The RegistryGetBlock function differs from most other functions in that the provided data parameter is always a reference and its content will be altered by the function. With the exception of strings, the data is read verbatim and treated as binary information. If the registry data is less than the requested size, the remaining area will be zero filled. Use the return value to determine the actual number of bytes returned.

The script/user must have access rights to the specified key and value.

Related Functions

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic