Closes the handle to a search result and frees the memory allocated for the search result.
HRESULT CloseSearchHandle(
ADS_SEARCH_HANDLE hSearchResult, //Search result to be closed
);
This method returns the standard values E_INVALIDARG, E_OUTOFMEMORY, E_UNEXPECTED, and E_FAIL, as well as the following:
The CloseSearchHandle method must free all memory allocated by ExecuteSearch, including the search result and the search result handle.
Using Directory Service Queries