Platform SDK: Active Directory, ADSI, and Directory Services

IADsExtension::PrivateInvoke

The IADsExtension::PrivateInvoke method is normally called by ADSI after the IADsExtension::PrivateGetIDsOfNames method. This method can either have a custom implementation or it can delegate the operation to IDispatch::DispInvoke method.

HRESULT IADsExtension::PrivateInvoke(
  DISPID dispidMember,
  REFIID riid,
  LCID lcid,
  WORD wFlags,
  DISPPARAMS *pDispParams,
  VARIANT *pvarResult,
  EXCEPINFO *pExcepInfo,
  UINT *puArgErr
);

Parameters

dispidMember
Identifies the member. Use the IADsExtension::PrivateGetIDsOfNames method to obtain the dispatch identifier.
riid
Reserved for future use. Must be IID_NULL.
lcid
The locale context in which to interpret arguments. The IADsExtension::PrivateGetIDsOfNames function uses lcid. It is also passed to the PrivateInvoke method to allow the object to interpret the arguments that are specific to a locale.
wFlags
Flags describing the context of the PrivateInvoke call, include:
Value Description
DISPATCH_METHOD The member is invoked as a method. If a property has the same name, both this and the DISPATCH_PROPERTYGET flag may be set.
DISPATCH_PROPERTYGET The member is retrieved as a property or data member.
DISPATCH_PROPERTYPUT The member is changed as a property or data member.
DISPATCH_PROPERTYPUTREF The member is changed by a reference assignment, rather than a value assignment. This flag is valid only when the property accepts a reference to an object.

pDispParams
Pointer to a structure that contains an array of arguments, an array of argument DISPIDs for named arguments, and counts for the number of elements in the arrays.
pvarResult
Pointer to the location where the result is to be stored, or NULL if the caller expects no result. This argument is ignored if DISPATCH_PROPERTYPUT or DISPATCH_PROPERTYPUTREF is specified.
pExcepInfo
Pointer to a structure that contains exception information. This structure should be filled in if DISP_E_EXCEPTION is returned. Can be NULL.
puArgErr
The index within rgvarg for the first argument that has an error. Arguments are stored in pDispParams->rgvarg in reverse order, so the first argument is the one with the highest index in the array. This parameter is returned only when the resulting return value is DISP_E_TYPEMISMATCH or DISP_E_PARAMNOTFOUND.

Return Values

This method supports the standard return values, as well as the following:

S_OK
Success.
DISP_E_BADPARAMCOUNT
The number of elements provided to DISPPARAMS is different from the number of arguments that the method or property accepts.
DISP_E_BADVARTYPE
One of the arguments in rgvarg is not a valid variant type.
DISP_E_EXCEPTION
The application needs to raise an exception. In this case, the structure passed in pExcepInfo should be filled in.
DISP_E_MEMBERNOTFOUND
The requested member does not exist, or the call to PrivateInvoke tried to set the value of a read-only property.
DISP_E_NONAMEDARGS
This implementation does not support named arguments.
DISP_E_OVERFLOW
One of the arguments in rgvarg could not be coerced to the specified type.
DISP_E_PARAMNOTFOUND
One of the parameter DISPIDs does not correspond to a parameter on the method. In this case, puArgErr should be set to the first argument that contains the error.
DISP_E_TYPEMISMATCH
One or more of the arguments could not be coerced. The index within rgvarg of the first parameter with the incorrect type is returned in the puArgErr parameter.
DISP_E_UNKNOWNINTERFACE
The interface identifier passed in riid is not IID_NULL.
DISP_E_UNKNOWNLCID
The member being invoked interprets string arguments according to the LCID, and the LCID is not recognized. If the LCID is not needed to interpret arguments, this error should not be returned.
DISP_E_PARAMNOTOPTIONAL
A required parameter was omitted.

For other return values, see ADSI Error Codes.

Example Code [C++]

The following implementation of IADsExtension::PrivateInvoke delegates the operation to the DispInvoke() method.

STDMETHOD(PrivateInvoke)(
   DISPID dispidMember, 
   REFIID riid, 
   LCID lcid, 
   WORD wFlags, 
   DISPPARAMS * pdispparams, 
   VARIANT * pvarResult, 
   EXCEPINFO * pexcepinfo, 
   UINT * puArgErr)
{
   return DispInvoke((IHelloWorld*)this, 
   m_pTypeInfo,
   dispidMember, 
   wFlags, 
   pdispparams, 
   pvarResult, 
   pexcepinfo, 
   puArgErr);
}

Requirements

  Windows NT/2000: Requires Windows 2000 (or Windows NT 4.0 with DSClient).
  Windows 95/98: Requires Windows 95 or later (with DSClient).
  Header: Declared in Iads.h.

See Also

IADsExtension, IADsExtension::PrivateGetIDsOfNames, DispInvoke, ADSI Error Codes