RtvdbCreateBufferVariable

RtvdbCreateBufferVariable creates and opens a buffer variable.

Syntax

Copy
DWORD RtvdbCreateBufferVariable(
  [in]    RTVDB_DIRECTORY Parent,
  [out]   RTVDB_VARIABLE_CONTROL* pVariable,
  [in]    const wchar_t* pName,
  [in]    byte* pBuffer,
  [in]    ULONG Size
);

Parameters

[in] Parent

A handle of the parent directory. To retrieve the corresponding handle, use RtvdbOpenDirectory, RtvdbOpenDatabase, RtvdbCreateDirectory, or RtvdbCreateDatabase.

[out] pVariable

A pointer to store the created variable handle and value pointer. See RTVDB_VARIABLE_CONTROL.

[in] pName

The variable name to create. The maximum length of variable names is 63 characters, as defined by RTVDB_MAX_NAME_LENGTH in the header file.

[in] pBuffer

A pointer to the value buffer of the variable.

[in] Size

The size, in bytes, of the value buffer of the variable.

Return Values

Error code Meaning

ERROR_SUCCESS

The function succeeded.

ERROR_NOT_READY

One of the following conditions occurred:

  • The calling process has not called RtvdbInitialize.
  • The database is currently invalidated.

ERROR_INVALID_PARAMETER

One of the following conditions occurred:

  • Parameter Parent, pVariable, pName, or pBuffer is NULL.
  • The value of parameter pName is either empty or exceeds 63 characters in length.
  • The value of parameter Size is zero (0).

ERROR_INVALID_HANDLE

Parameter Parent does not point to a directory or points to a closed directory.

ERROR_UNSUPPORTED_TYPE

The function is called from a Windows application.

ERROR_ALREADY_EXISTS

A variable with this name already exists in the parent directory.

ERROR_ABANDONED_WAIT_0

Failed to acquire the synchronization lock.

ERROR_NOT_ENOUGH_MEMORY

Failed to allocate memory.

Remarks

The pBuffer should be in a shared or allocated memory, not on the stack, so it can be accessed by other applications.

The value of buffer variables is only accessible from real-time applications.

Requirements

Minimum supported version Header Library

wRTOS 1.0 SDK

RtvdbApi.h

RtvdbApi_W64.lib (Windows), RtvdbApi.lib (RTSS)

See Also: