' ########################################################################################
' Microsoft Windows
' File: AdsHlp.inc
' Contents: Public header file for all oleds client code
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
#IF NOT %DEF(PBX_AdsHlp_PBI)
#DEFINE PBX_AdsHlp_PBI
%EQUATE `ADSHLP_INC = 1
#INCLUDE ONCE "Legacy/System/Iads.inc"
DECLARE FUNCTION ADsGetObject LIB "activeds.dll" ALIAS "ADsGetObject" ( BYREF lpszPathName AS WSTRINGZ , BYREF riid AS GUID , BYREF ppObject AS ANY ) AS LONG
DECLARE FUNCTION ADsBuildEnumerator LIB "activeds.dll" ALIAS "ADsBuildEnumerator" ( BYVAL pADsContainer AS IADsContainer
 , BYREF ppEnumVariant AS IEnumVARIANT
 ) AS LONG
DECLARE FUNCTION ADsFreeEnumerator LIB "activeds.dll" ALIAS "ADsFreeEnumerator" ( BYVAL pEnumVariant AS IEnumVARIANT
 ) AS LONG
DECLARE FUNCTION ADsEnumerateNext LIB "activeds.dll" ALIAS "ADsEnumerateNext" ( BYVAL pEnumVariant AS IEnumVARIANT
 , BYVAL cElements AS DWORD
 , BYREF pvar AS VARIANT
 , BYREF pcElementsFetched AS DWORD
 ) AS LONG
DECLARE FUNCTION ADsBuildVarArrayStr LIB "activeds.dll" ALIAS "ADsBuildVarArrayStr" ( BYREF lppPathNames AS DWORD
 , BYVAL dwPathNames AS DWORD
 , BYREF pVar AS VARIANT
 ) AS LONG
DECLARE FUNCTION ADsBuildVarArrayInt LIB "activeds.dll" ALIAS "ADsBuildVarArrayInt" ( BYREF lpdwObjectTypes AS DWORD
 , BYVAL dwObjectTypes AS DWORD
 , BYREF pVar AS VARIANT
 ) AS LONG
DECLARE FUNCTION ADsOpenObject LIB "activeds.dll" ALIAS "ADsOpenObject" ( BYREF lpszPathName AS WSTRINGZ
 , BYREF lpszUserName AS WSTRINGZ
 , BYREF lpszPassword AS WSTRINGZ
 , BYVAL dwReserved AS DWORD
 , BYREF riid AS GUID
 , BYREF ppObject AS ANY
 ) AS LONG
'//
'// Helper functions for extended error support
'//
DECLARE FUNCTION ADsGetLastError LIB "activeds.dll" ALIAS "ADsGetLastError" ( BYREF lpError AS QUAD , BYREF lpErrorBuf AS WSTRINGZ , BYVAL dwErrorBufLen AS QUAD , BYREF lpNameBuf AS WSTRINGZ , BYVAL dwNameBufLen AS QUAD ) AS LONG
DECLARE FUNCTION ADsSetLastError LIB "activeds.dll" ALIAS "ADsSetLastError" ( BYVAL dwErr AS QUAD
 , BYREF pszError AS WSTRINGZ
 , BYREF pszProvider AS WSTRINGZ
 ) AS LONG
' Obsolete
DECLARE SUB ADsFreeAllErrorRecords LIB "activeds.dll" ALIAS "ADsFreeAllErrorRecords" ( )
DECLARE FUNCTION AllocADsMem LIB "activeds.dll" ALIAS "AllocADsMem" ( BYVAL cb AS QUAD ) AS QUAD
DECLARE FUNCTION FreeADsMem LIB "activeds.dll" ALIAS "FreeADsMem" ( BYVAL pMem AS QUAD
 ) AS LONG
DECLARE FUNCTION ReallocADsMem LIB "activeds.dll" ALIAS "ReallocADsMem" ( BYVAL pOldMem AS DWORD
 , BYVAL cbOld AS DWORD
 , BYVAL cbNew AS DWORD
 ) AS DWORD
DECLARE FUNCTION AllocADsStr LIB "activeds.dll" ALIAS "AllocADsStr" ( BYREF pStr AS WSTRINGZ
 ) AS DWORD
DECLARE FUNCTION FreeADsStr LIB "activeds.dll" ALIAS "FreeADsStr" ( BYREF pStr AS WSTRINGZ
 ) AS LONG
DECLARE FUNCTION ReallocADsStr LIB "activeds.dll" ALIAS "ReallocADsStr" ( BYREF ppStr AS DWORD
 , BYREF pStr AS WSTRINGZ
 ) AS LONG
DECLARE FUNCTION ADsEncodeBinaryData LIB "activeds.dll" ALIAS "ADsEncodeBinaryData" ( BYVAL pbSrcData AS BYTE PTR
 , BYVAL dwSrcLen AS DWORD
 , BYREF ppszDestData AS DWORD
 ) AS LONG
' Obsolete
DECLARE FUNCTION ADsDecodeBinaryData LIB "activeds.dll" ALIAS "ADsDecodeBinaryData" ( BYREF szSrcData AS WSTRINGZ , BYVAL ppbDestData AS BYTE PTR , BYREF pdwDestLen AS QUAD ) AS LONG
' Obsolete
DECLARE FUNCTION PropVariantToAdsType LIB "activeds.dll" ALIAS "PropVariantToAdsType" ( BYREF pVariant AS VARIANT , BYVAL dwNumVariant AS QUAD , BYREF ppAdsValues AS ADSVALUE , BYREF pdwNumValues AS QUAD ) AS LONG
' Obsolete
DECLARE FUNCTION AdsTypeToPropVariant LIB "activeds.dll" ALIAS "AdsTypeToPropVariant" ( BYREF ppAdsValues AS ADSVALUE , BYVAL dwNumValues AS QUAD , BYREF pVariant AS VARIANT ) AS LONG
' Obsolete
DECLARE FUNCTION AdsFreeAdsValues LIB "activeds.dll" ALIAS "AdsFreeAdsValues" ( BYREF ppAdsValues AS ADSVALUE , BYVAL dwNumValues AS QUAD ) AS LONG
'//
'// Helper routines to convert IADsSecurityDescriptor to a binary
'// security descriptor and also to convert a binary SD to
'// IADsSecurityDescriptor.
'//
DECLARE FUNCTION BinarySDToSecurityDescriptor LIB "activeds.dll" ALIAS "BinarySDToSecurityDescriptor" ( BYREF pSecurityDescriptor AS SECURITY_DESCRIPTOR , BYREF pVarsec AS VARIANT , BYREF pszServerName AS WSTRINGZ , BYREF userName AS WSTRINGZ , BYREF passWord AS WSTRINGZ , BYVAL dwFlags AS QUAD ) AS LONG
DECLARE FUNCTION SecurityDescriptorToBinarySD LIB "activeds.dll" ALIAS "SecurityDescriptorToBinarySD" ( BYVAL vVarSecDes AS VARIANT
 , BYREF pSecurityDescriptor AS SECURITY_DESCRIPTOR
 , BYREF pdwSDLength AS DWORD
 , BYREF pszServerName AS WSTRINGZ
 , BYREF userName AS WSTRINGZ
 , BYREF passWord AS WSTRINGZ
 , BYVAL dwFlags AS DWORD
 ) AS LONG
#ENDIF
