Platform SDK: Active Directory, ADSI, and Directory Services

Searching Binary Data

In ADSI you can search for binary data, even though ADSI works with strings, which cannot represent binary data. You can get around this limitation by converting the binary data to a string and making queries against the encoded string. ADSI exposes the ADsEncodeBinaryData function for converting binary data to a string. The following skeleton code illustrates how you might proceed to search for binary data.

BYTE *pFingerPrint;
DWORD dwSize;
/* … you get the FingerPrint data and size… */
hr = ADsEncodeBinaryData ( pFingerPrint, dwSize, &pszDest );
 
/* … do a search on the converted string, pszDest */
 
FreeADsMem( pszDest );

You must also free the string by calling the FreeADsMem function.