Platform SDK: Active Directory, ADSI, and Directory Services

LDAPMod

The LDAPMod structure holds information needed to perform a modification operation.

typedef struct ldapmod 
{
  ULONG     mod_op;
  PWCHAR    mod_type;
  union {
    PWCHAR          *modv_strvals;
    struct berval   **modv_bvals;
    } mod_vals;
} LDAPMod, *PLDAPMod;

Members

mod_op
Specifies the modification operation to perform, and whether the mod_vals union contains string values or BER values.
mod_type
The type of the attribute to modify.
mod_vals
The values (if any) to add, delete, or replace. Use either the modv_strvals or the modv_bvals field of the union, not both.

Remarks

Assign values to the fields of the LDAPMod structure before you call one of the modification functions (ldap_add*, or ldap_modify*). Specify the type of modification by setting the mod_op field to one of the following values.

Value Meaning
LDAP_MOD_ADD (0x00) Adds a value to the entry.
LDAP_MOD_BVALUES (0x80) Specifies that the modification involves a berval structure by using the bitwise OR operator to combine this value with one of the modification options preceding this table.
LDAP_MOD_DELETE (0x01) Deletes a value in the entry.
LDAP_MOD_REPLACE (0x02) Replaces a value in the entry.

ldap_modify_s with the LDAP_MOD_REPLACE operation does not delete an attribute when passed a null pointer. However, LDAP_MOD_DELETE deletes the entire attribute when the mod_val is set to null.

If you have specified the use of berval structures in the mod_op member, use the modv_bvals member (a null-terminated array of zero-terminated strings) of the mod_vals union to hold the new value. Otherwise, use the modv_strvals member (a null-terminated array of berval structures that can be used to pass binary values such as images).

Requirements

  Windows NT/2000: Requires Windows NT 4.0 SP4 or later.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in Winldap.h.
  Unicode: Declared as Unicode and ANSI structures.

See Also

berval, Data Structures, ldap_add*, ldap_modify*, ldap_modify_s, Modifying a Directory Entry