internal unsafe byte[] RetrieveDirectorySynchronizationCookie() { if (_disposed) { throw new ObjectDisposedException(GetType().Name); } // get the dirsync cookie back AdsSearchColumn column = new AdsSearchColumn(); AdsSearchColumn *pColumn = &column; SearchObject.GetColumn(Handle, _adsDirsynCookieName, (INTPTR_INTPTRCAST)pColumn); try { AdsValue *pValue = column.pADsValues; byte[] value = (byte[])new AdsValueHelper(*pValue).GetValue(); return(value); } finally { try { SearchObject.FreeColumn((INTPTR_INTPTRCAST)pColumn); } catch (COMException) { } } }
internal unsafe DirectoryVirtualListView RetrieveVLVResponse() { if (_disposed) { throw new ObjectDisposedException(GetType().Name); } // get the vlv response back AdsSearchColumn column = new AdsSearchColumn(); AdsSearchColumn *pColumn = &column; SearchObject.GetColumn(Handle, _adsVLVResponseName, (INTPTR_INTPTRCAST)pColumn); try { AdsValue *pValue = column.pADsValues; DirectoryVirtualListView value = (DirectoryVirtualListView) new AdsValueHelper(*pValue).GetVlvValue(); return(value); } finally { try { SearchObject.FreeColumn((INTPTR_INTPTRCAST)pColumn); } catch (COMException) { } } }
private unsafe SearchResult GetCurrentResult() { SearchResult entry = new SearchResult(_parentCredentials, _parentAuthenticationType); int hr = 0; IntPtr pszColumnName = (IntPtr)0; hr = _results.SearchObject.GetNextColumnName(_results.Handle, (INTPTR_INTPTRCAST)(&pszColumnName)); while (hr == 0) { try { AdsSearchColumn column = new AdsSearchColumn(); AdsSearchColumn *pColumn = &column; _results.SearchObject.GetColumn(_results.Handle, pszColumnName, (INTPTR_INTPTRCAST)pColumn); try { int numValues = column.dwNumValues; AdsValue *pValue = column.pADsValues; object[] values = new object[numValues]; for (int i = 0; i < numValues; i++) { values[i] = new AdsValueHelper(*pValue).GetValue(); pValue++; } entry.Properties.Add(Marshal.PtrToStringUni(pszColumnName), new ResultPropertyValueCollection(values)); } finally { try { _results.SearchObject.FreeColumn((INTPTR_INTPTRCAST)pColumn); } catch (COMException) { } } } finally { SafeNativeMethods.FreeADsMem(pszColumnName); } hr = _results.SearchObject.GetNextColumnName(_results.Handle, (INTPTR_INTPTRCAST)(&pszColumnName)); } return(entry); }
private unsafe SearchResult GetCurrentResult() { SearchResult result = new SearchResult(this.parentCredentials, this.parentAuthenticationType); int num = 0; IntPtr zero = IntPtr.Zero; for (num = this.results.SearchObject.GetNextColumnName(this.results.Handle, (IntPtr)((ulong)((IntPtr) & zero))); num == 0; num = this.results.SearchObject.GetNextColumnName(this.results.Handle, (IntPtr)((ulong)((IntPtr) & zero)))) { try { AdsSearchColumn column = new AdsSearchColumn(); AdsSearchColumn *columnPtr = &column; this.results.SearchObject.GetColumn(this.results.Handle, zero, (IntPtr)((ulong)columnPtr)); try { int dwNumValues = column.dwNumValues; AdsValue *pADsValues = column.pADsValues; object[] values = new object[dwNumValues]; for (int i = 0; i < dwNumValues; i++) { values[i] = new AdsValueHelper(pADsValues[0]).GetValue(); pADsValues++; } result.Properties.Add(Marshal.PtrToStringUni(zero), new ResultPropertyValueCollection(values)); } finally { try { this.results.SearchObject.FreeColumn((IntPtr)((ulong)columnPtr)); } catch (COMException) { } } } finally { SafeNativeMethods.FreeADsMem(zero); } } return(result); }