Computes, in conjunction with NWDSGetAttrVal, the size of the attribute value at the current position in the result buffer.
#include <nwnet.h> or #include <nwdsbuft.h> N_EXTERN_LIBRARY (NWDSCCODE) NWDSComputeAttrValSize ( NWDSContextHandle context, pBuf_T buf, nuint32 syntaxID, pnuint32 attrValSize);
uses netwin32 Function NWDSComputeAttrValSize (context : NWDSContextHandle; buf : pBuf_T; syntaxID : nuint32; attrValSize : pnuint32 ) : NWDSCCODE;
(IN) Specifies the NDS context for the request.
(IN) Points to a result buffer positioned at an attribute value.
(IN) Specifies the numeric ID of the attribute value (see Section 5.26, Syntax IDs).
(OUT) Points to the size (in bytes) required to retrieve the attribute.
0x0000 0000 |
SUCCESSFUL |
nonzero value |
Nonzero values indicate errors. See |
Since Buf_T buffers are opaque to client applications, a client cannot view a result buffer directly to see the size of the values returned in the buffer. Call NWDSComputeAttrValSize to find the size and syntax of the current attribute value in the buffer and then dynamically allocate memory of that size to hold the current attribute’s value. Then retrieve the value by calling NWDSGetAttrVal.
If NWDSRead is called using infoTypes DS_VALUE_INFO (3) or DS_ABBREVIATED_VALUE (4), eDirectory returns the attribute value flags and modification timestamp. If the attribute value has been deleted, but not synchronized, eDirectory can return a value flag of DS_NOT_PRESENT (value not present) and no data. In this case, the attribute value length is zero. NWDSComputeAttrValSize returns the correct size of 0, and the application should not call NWDSGetAttrVal to retrieve the data because there is no data to retrieve.
Call NWDSComputeAttrValSize once for each attribute value you retrieve from the result buffer.
The syntaxID parameter identifies the syntax data type the attribute information is stored in. The data structures associated with the syntaxes are listed in Attribute Syntax Definitions
. The enumerated types for syntaxes (such as SYN_DIST_NAME) are located in NWDSDEFS.H. The NWDSGetAttrName function returns the syntax ID of the attribute.
The attrValSize parameter points to the size of the attribute value in bytes. This size can be used as input to a memory allocation request. The size is large enough to contain the attribute value along with any structure returned by NWDSGetAttrVal.
For complete steps on reading the information from the buffer, see Reading Attributes of eDirectory Objects.