Exemple #1
0
        internal ReplicationCursorCollection ConstructReplicationCursors(IntPtr dsHandle, bool advanced, IntPtr info, string partition, DirectoryServer server, LoadLibrarySafeHandle libHandle)
        {
            int num = 0;
            ReplicationCursorCollection replicationCursorCollection = new ReplicationCursorCollection(server);

            if (!advanced)
            {
                try
                {
                    if (info != (IntPtr)0)
                    {
                        DS_REPL_CURSORS dSREPLCURSOR = new DS_REPL_CURSORS();
                        Marshal.PtrToStructure(info, dSREPLCURSOR);
                        replicationCursorCollection.AddHelper(partition, dSREPLCURSOR, advanced, info);
                    }
                }
                finally
                {
                    this.FreeReplicaInfo(DS_REPL_INFO_TYPE.DS_REPL_INFO_CURSORS_FOR_NC, info, libHandle);
                }
            }
            else
            {
                while (true)
                {
                    try
                    {
                        if (info == (IntPtr)0)
                        {
                            break;
                        }
                        else
                        {
                            DS_REPL_CURSORS_3 dSREPLCURSORS3 = new DS_REPL_CURSORS_3();
                            Marshal.PtrToStructure(info, dSREPLCURSORS3);
                            int num1 = dSREPLCURSORS3.cNumCursors;
                            if (num1 > 0)
                            {
                                replicationCursorCollection.AddHelper(partition, dSREPLCURSORS3, advanced, info);
                            }
                            num = dSREPLCURSORS3.dwEnumerationContext;
                            if (num == -1 || num1 == 0)
                            {
                                break;
                            }
                        }
                    }
                    finally
                    {
                        this.FreeReplicaInfo(DS_REPL_INFO_TYPE.DS_REPL_INFO_CURSORS_3_FOR_NC, info, libHandle);
                    }
                    info = this.GetReplicationInfoHelper(dsHandle, 8, 1, partition, ref advanced, num, libHandle);
                }
            }
            return(replicationCursorCollection);
        }
        internal ReplicationCursorCollection ConstructReplicationCursors(IntPtr dsHandle, bool advanced, IntPtr info, string partition, DirectoryServer server, LoadLibrarySafeHandle libHandle)
        {
            int context     = 0;
            int cNumCursors = 0;
            ReplicationCursorCollection cursors = new ReplicationCursorCollection(server);

            if (!advanced)
            {
                try
                {
                    if (info != IntPtr.Zero)
                    {
                        DS_REPL_CURSORS structure = new DS_REPL_CURSORS();
                        Marshal.PtrToStructure(info, structure);
                        cursors.AddHelper(partition, structure, advanced, info);
                    }
                }
                finally
                {
                    this.FreeReplicaInfo(DS_REPL_INFO_TYPE.DS_REPL_INFO_CURSORS_FOR_NC, info, libHandle);
                }
                return(cursors);
            }
Label_000F:
            try
            {
                if (info != IntPtr.Zero)
                {
                    DS_REPL_CURSORS_3 ds_repl_cursors_ = new DS_REPL_CURSORS_3();
                    Marshal.PtrToStructure(info, ds_repl_cursors_);
                    cNumCursors = ds_repl_cursors_.cNumCursors;
                    if (cNumCursors > 0)
                    {
                        cursors.AddHelper(partition, ds_repl_cursors_, advanced, info);
                    }
                    context = ds_repl_cursors_.dwEnumerationContext;
                    if ((context != -1) && (cNumCursors != 0))
                    {
                        goto Label_005F;
                    }
                }
                return(cursors);
            }
            finally
            {
                this.FreeReplicaInfo(DS_REPL_INFO_TYPE.DS_REPL_INFO_CURSORS_3_FOR_NC, info, libHandle);
            }
Label_005F:
            info = this.GetReplicationInfoHelper(dsHandle, 8, 1, partition, ref advanced, context, libHandle);
            goto Label_000F;
        }
Exemple #3
0
        internal ReplicationCursorCollection ConstructReplicationCursors(IntPtr dsHandle, bool advanced, IntPtr info, string partition, DirectoryServer server, LoadLibrarySafeHandle libHandle)
        {
            int context = 0;
            int count   = 0;
            ReplicationCursorCollection collection = new ReplicationCursorCollection(server);

            // construct the collection
            if (advanced)
            {
                // using paging to get all the results
                while (true)
                {
                    try
                    {
                        if (info != (IntPtr)0)
                        {
                            DS_REPL_CURSORS_3 cursors = new DS_REPL_CURSORS_3();
                            Marshal.PtrToStructure(info, cursors);
                            count = cursors.cNumCursors;
                            if (count > 0)
                            {
                                collection.AddHelper(partition, cursors, advanced, info);
                            }

                            context = cursors.dwEnumerationContext;

                            // we already get all the results or there is no result
                            if (context == -1 || count == 0)
                            {
                                break;
                            }
                        }
                        else
                        {
                            // should not happen, treat as no result is returned.
                            break;
                        }
                    }
                    finally
                    {
                        FreeReplicaInfo(DS_REPL_INFO_TYPE.DS_REPL_INFO_CURSORS_3_FOR_NC, info, libHandle);
                    }

                    // get the next batch of results
                    info = GetReplicationInfoHelper(dsHandle, (int)DS_REPL_INFO_TYPE.DS_REPL_INFO_CURSORS_3_FOR_NC, (int)DS_REPL_INFO_TYPE.DS_REPL_INFO_CURSORS_FOR_NC, partition, ref advanced, context, libHandle);
                }
            }
            else
            {
                try
                {
                    if (info != (IntPtr)0)
                    {
                        // structure of DS_REPL_CURSORS_3 and DS_REPL_CURSORS actually are the same
                        DS_REPL_CURSORS cursors = new DS_REPL_CURSORS();
                        Marshal.PtrToStructure(info, cursors);

                        collection.AddHelper(partition, cursors, advanced, info);
                    }
                }
                finally
                {
                    FreeReplicaInfo(DS_REPL_INFO_TYPE.DS_REPL_INFO_CURSORS_FOR_NC, info, libHandle);
                }
            }

            return(collection);
        }
Exemple #4
0
        internal ReplicationCursorCollection ConstructReplicationCursors(IntPtr dsHandle, bool advanced, IntPtr info, string partition, DirectoryServer server, LoadLibrarySafeHandle libHandle)
        {
            int context = 0;
            int count = 0;
            ReplicationCursorCollection collection = new ReplicationCursorCollection(server);

            // construct the collection
            if (advanced)
            {
                // using paging to get all the results
                while (true)
                {
                    try
                    {
                        if (info != (IntPtr)0)
                        {
                            DS_REPL_CURSORS_3 cursors = new DS_REPL_CURSORS_3();
                            Marshal.PtrToStructure(info, cursors);
                            count = cursors.cNumCursors;
                            if (count > 0)
                                collection.AddHelper(partition, cursors, advanced, info);

                            context = cursors.dwEnumerationContext;

                            // we already get all the results or there is no result
                            if (context == -1 || count == 0)
                                break;
                        }
                        else
                        {
                            // should not happen, treat as no result is returned.
                            break;
                        }
                    }
                    finally
                    {
                        FreeReplicaInfo(DS_REPL_INFO_TYPE.DS_REPL_INFO_CURSORS_3_FOR_NC, info, libHandle);
                    }

                    // get the next batch of results		            
                    info = GetReplicationInfoHelper(dsHandle, (int)DS_REPL_INFO_TYPE.DS_REPL_INFO_CURSORS_3_FOR_NC, (int)DS_REPL_INFO_TYPE.DS_REPL_INFO_CURSORS_FOR_NC, partition, ref advanced, context, libHandle);
                }
            }
            else
            {
                try
                {
                    if (info != (IntPtr)0)
                    {
                        // structure of DS_REPL_CURSORS_3 and DS_REPL_CURSORS actually are the same
                        DS_REPL_CURSORS cursors = new DS_REPL_CURSORS();
                        Marshal.PtrToStructure(info, cursors);

                        collection.AddHelper(partition, cursors, advanced, info);
                    }
                }
                finally
                {
                    FreeReplicaInfo(DS_REPL_INFO_TYPE.DS_REPL_INFO_CURSORS_FOR_NC, info, libHandle);
                }
            }

            return collection;
        }
Exemple #5
0
		internal ReplicationCursorCollection ConstructReplicationCursors(IntPtr dsHandle, bool advanced, IntPtr info, string partition, DirectoryServer server, LoadLibrarySafeHandle libHandle)
		{
			int num = 0;
			ReplicationCursorCollection replicationCursorCollection = new ReplicationCursorCollection(server);
			if (!advanced)
			{
				try
				{
					if (info != (IntPtr)0)
					{
						DS_REPL_CURSORS dSREPLCURSOR = new DS_REPL_CURSORS();
						Marshal.PtrToStructure(info, dSREPLCURSOR);
						replicationCursorCollection.AddHelper(partition, dSREPLCURSOR, advanced, info);
					}
				}
				finally
				{
					this.FreeReplicaInfo(DS_REPL_INFO_TYPE.DS_REPL_INFO_CURSORS_FOR_NC, info, libHandle);
				}
			}
			else
			{
				while (true)
				{
					try
					{
						if (info == (IntPtr)0)
						{
							break;
						}
						else
						{
							DS_REPL_CURSORS_3 dSREPLCURSORS3 = new DS_REPL_CURSORS_3();
							Marshal.PtrToStructure(info, dSREPLCURSORS3);
							int num1 = dSREPLCURSORS3.cNumCursors;
							if (num1 > 0)
							{
								replicationCursorCollection.AddHelper(partition, dSREPLCURSORS3, advanced, info);
							}
							num = dSREPLCURSORS3.dwEnumerationContext;
							if (num == -1 || num1 == 0)
							{
								break;
							}
						}
					}
					finally
					{
						this.FreeReplicaInfo(DS_REPL_INFO_TYPE.DS_REPL_INFO_CURSORS_3_FOR_NC, info, libHandle);
					}
					info = this.GetReplicationInfoHelper(dsHandle, 8, 1, partition, ref advanced, num, libHandle);
				}
			}
			return replicationCursorCollection;
		}
 internal ReplicationCursorCollection ConstructReplicationCursors(IntPtr dsHandle, bool advanced, IntPtr info, string partition, DirectoryServer server, LoadLibrarySafeHandle libHandle)
 {
     int context = 0;
     int cNumCursors = 0;
     ReplicationCursorCollection cursors = new ReplicationCursorCollection(server);
     if (!advanced)
     {
         try
         {
             if (info != IntPtr.Zero)
             {
                 DS_REPL_CURSORS structure = new DS_REPL_CURSORS();
                 Marshal.PtrToStructure(info, structure);
                 cursors.AddHelper(partition, structure, advanced, info);
             }
         }
         finally
         {
             this.FreeReplicaInfo(DS_REPL_INFO_TYPE.DS_REPL_INFO_CURSORS_FOR_NC, info, libHandle);
         }
         return cursors;
     }
 Label_000F:
     try
     {
         if (info != IntPtr.Zero)
         {
             DS_REPL_CURSORS_3 ds_repl_cursors_ = new DS_REPL_CURSORS_3();
             Marshal.PtrToStructure(info, ds_repl_cursors_);
             cNumCursors = ds_repl_cursors_.cNumCursors;
             if (cNumCursors > 0)
             {
                 cursors.AddHelper(partition, ds_repl_cursors_, advanced, info);
             }
             context = ds_repl_cursors_.dwEnumerationContext;
             if ((context != -1) && (cNumCursors != 0))
             {
                 goto Label_005F;
             }
         }
         return cursors;
     }
     finally
     {
         this.FreeReplicaInfo(DS_REPL_INFO_TYPE.DS_REPL_INFO_CURSORS_3_FOR_NC, info, libHandle);
     }
 Label_005F:
     info = this.GetReplicationInfoHelper(dsHandle, 8, 1, partition, ref advanced, context, libHandle);
     goto Label_000F;
 }