internal bool SyncAllCallbackRoutine(IntPtr data, IntPtr update)
        {
            if (this.SyncFromAllServersCallback == null)
            {
                return(true);
            }
            DS_REPSYNCALL_UPDATE structure = new DS_REPSYNCALL_UPDATE();

            Marshal.PtrToStructure(update, structure);
            SyncFromAllServersEvent eventType = structure.eventType;
            IntPtr pErrInfo = structure.pErrInfo;
            SyncFromAllServersOperationException exception = null;

            if (pErrInfo != IntPtr.Zero)
            {
                exception = ExceptionHelper.CreateSyncAllException(pErrInfo, true);
                if (exception == null)
                {
                    return(true);
                }
            }
            string targetServer = null;
            string sourceServer = null;

            pErrInfo = structure.pSync;
            if (pErrInfo != IntPtr.Zero)
            {
                DS_REPSYNCALL_SYNC ds_repsyncall_sync = new DS_REPSYNCALL_SYNC();
                Marshal.PtrToStructure(pErrInfo, ds_repsyncall_sync);
                targetServer = Marshal.PtrToStringUni(ds_repsyncall_sync.pszDstId);
                sourceServer = Marshal.PtrToStringUni(ds_repsyncall_sync.pszSrcId);
            }
            return(this.SyncFromAllServersCallback(eventType, targetServer, sourceServer, exception));
        }
Example #2
0
 internal bool SyncAllCallbackRoutine(IntPtr data, IntPtr update)
 {
     if (this.SyncFromAllServersCallback != null)
     {
         DS_REPSYNCALL_UPDATE dSREPSYNCALLUPDATE = new DS_REPSYNCALL_UPDATE();
         Marshal.PtrToStructure(update, dSREPSYNCALLUPDATE);
         SyncFromAllServersEvent syncFromAllServersEvent = dSREPSYNCALLUPDATE.eventType;
         IntPtr intPtr = dSREPSYNCALLUPDATE.pErrInfo;
         SyncFromAllServersOperationException syncFromAllServersOperationException = null;
         if (intPtr != (IntPtr)0)
         {
             syncFromAllServersOperationException = ExceptionHelper.CreateSyncAllException(intPtr, true);
             if (syncFromAllServersOperationException == null)
             {
                 return(true);
             }
         }
         string stringUni = null;
         string str       = null;
         intPtr = dSREPSYNCALLUPDATE.pSync;
         if (intPtr != (IntPtr)0)
         {
             DS_REPSYNCALL_SYNC dSREPSYNCALLSYNC = new DS_REPSYNCALL_SYNC();
             Marshal.PtrToStructure(intPtr, dSREPSYNCALLSYNC);
             stringUni = Marshal.PtrToStringUni(dSREPSYNCALLSYNC.pszDstId);
             str       = Marshal.PtrToStringUni(dSREPSYNCALLSYNC.pszSrcId);
         }
         SyncUpdateCallback syncFromAllServersCallback = this.SyncFromAllServersCallback;
         return(syncFromAllServersCallback(syncFromAllServersEvent, stringUni, str, syncFromAllServersOperationException));
     }
     else
     {
         return(true);
     }
 }
Example #3
0
        internal bool SyncAllCallbackRoutine(IntPtr data, IntPtr update)
        {
            if (SyncFromAllServersCallback == null)
            {
                // user does not specify callback, resume the DsReplicaSyncAll execution
                return(true);
            }
            else
            {
                // user specifies callback
                // our callback is invoked, update should not be NULL, do assertion here
                Debug.Assert(update != (IntPtr)0);

                DS_REPSYNCALL_UPDATE syncAllUpdate = new DS_REPSYNCALL_UPDATE();
                Marshal.PtrToStructure(update, syncAllUpdate);

                // get the event type
                SyncFromAllServersEvent eventType = syncAllUpdate.eventType;

                // get the error information
                IntPtr temp = syncAllUpdate.pErrInfo;
                SyncFromAllServersOperationException exception = null;

                if (temp != (IntPtr)0)
                {
                    // error information is available
                    exception = ExceptionHelper.CreateSyncAllException(temp, true);
                    if (exception == null)
                    {
                        // this is the special case that we ingore the failure when SyncAllOptions.CheckServerAlivenessOnly is specified
                        return(true);
                    }
                }

                string targetName = null;
                string sourceName = null;

                temp = syncAllUpdate.pSync;
                if (temp != (IntPtr)0)
                {
                    DS_REPSYNCALL_SYNC sync = new DS_REPSYNCALL_SYNC();
                    Marshal.PtrToStructure(temp, sync);

                    targetName = Marshal.PtrToStringUni(sync.pszDstId);
                    sourceName = Marshal.PtrToStringUni(sync.pszSrcId);
                }

                // invoke the client callback
                SyncUpdateCallback clientCallback = SyncFromAllServersCallback;

                return(clientCallback(eventType, targetName, sourceName, exception));
            }
        }
Example #4
0
        internal bool SyncAllCallbackRoutine(IntPtr data, IntPtr update)
        {
            if (SyncFromAllServersCallback == null)
            {
                // user does not specify callback, resume the DsReplicaSyncAll execution
                return true;
            }
            else
            {
                // user specifies callback
                // our callback is invoked, update should not be NULL, do assertion here
                Debug.Assert(update != (IntPtr)0);

                DS_REPSYNCALL_UPDATE syncAllUpdate = new DS_REPSYNCALL_UPDATE();
                Marshal.PtrToStructure(update, syncAllUpdate);

                // get the event type
                SyncFromAllServersEvent eventType = syncAllUpdate.eventType;

                // get the error information
                IntPtr temp = syncAllUpdate.pErrInfo;
                SyncFromAllServersOperationException exception = null;

                if (temp != (IntPtr)0)
                {
                    // error information is available		            
                    exception = ExceptionHelper.CreateSyncAllException(temp, true);
                    if (exception == null)
                    {
                        // this is the special case that we ingore the failure when SyncAllOptions.CheckServerAlivenessOnly is specified
                        return true;
                    }
                }

                string targetName = null;
                string sourceName = null;

                temp = syncAllUpdate.pSync;
                if (temp != (IntPtr)0)
                {
                    DS_REPSYNCALL_SYNC sync = new DS_REPSYNCALL_SYNC();
                    Marshal.PtrToStructure(temp, sync);

                    targetName = Marshal.PtrToStringUni(sync.pszDstId);
                    sourceName = Marshal.PtrToStringUni(sync.pszSrcId);
                }

                // invoke the client callback
                SyncUpdateCallback clientCallback = SyncFromAllServersCallback;

                return clientCallback(eventType, targetName, sourceName, exception);
            }
        }
Example #5
0
		internal bool SyncAllCallbackRoutine(IntPtr data, IntPtr update)
		{
			if (this.SyncFromAllServersCallback != null)
			{
				DS_REPSYNCALL_UPDATE dSREPSYNCALLUPDATE = new DS_REPSYNCALL_UPDATE();
				Marshal.PtrToStructure(update, dSREPSYNCALLUPDATE);
				SyncFromAllServersEvent syncFromAllServersEvent = dSREPSYNCALLUPDATE.eventType;
				IntPtr intPtr = dSREPSYNCALLUPDATE.pErrInfo;
				SyncFromAllServersOperationException syncFromAllServersOperationException = null;
				if (intPtr != (IntPtr)0)
				{
					syncFromAllServersOperationException = ExceptionHelper.CreateSyncAllException(intPtr, true);
					if (syncFromAllServersOperationException == null)
					{
						return true;
					}
				}
				string stringUni = null;
				string str = null;
				intPtr = dSREPSYNCALLUPDATE.pSync;
				if (intPtr != (IntPtr)0)
				{
					DS_REPSYNCALL_SYNC dSREPSYNCALLSYNC = new DS_REPSYNCALL_SYNC();
					Marshal.PtrToStructure(intPtr, dSREPSYNCALLSYNC);
					stringUni = Marshal.PtrToStringUni(dSREPSYNCALLSYNC.pszDstId);
					str = Marshal.PtrToStringUni(dSREPSYNCALLSYNC.pszSrcId);
				}
				SyncUpdateCallback syncFromAllServersCallback = this.SyncFromAllServersCallback;
				return syncFromAllServersCallback(syncFromAllServersEvent, stringUni, str, syncFromAllServersOperationException);
			}
			else
			{
				return true;
			}
		}
 internal bool SyncAllCallbackRoutine(IntPtr data, IntPtr update)
 {
     if (this.SyncFromAllServersCallback == null)
     {
         return true;
     }
     DS_REPSYNCALL_UPDATE structure = new DS_REPSYNCALL_UPDATE();
     Marshal.PtrToStructure(update, structure);
     SyncFromAllServersEvent eventType = structure.eventType;
     IntPtr pErrInfo = structure.pErrInfo;
     SyncFromAllServersOperationException exception = null;
     if (pErrInfo != IntPtr.Zero)
     {
         exception = ExceptionHelper.CreateSyncAllException(pErrInfo, true);
         if (exception == null)
         {
             return true;
         }
     }
     string targetServer = null;
     string sourceServer = null;
     pErrInfo = structure.pSync;
     if (pErrInfo != IntPtr.Zero)
     {
         DS_REPSYNCALL_SYNC ds_repsyncall_sync = new DS_REPSYNCALL_SYNC();
         Marshal.PtrToStructure(pErrInfo, ds_repsyncall_sync);
         targetServer = Marshal.PtrToStringUni(ds_repsyncall_sync.pszDstId);
         sourceServer = Marshal.PtrToStringUni(ds_repsyncall_sync.pszSrcId);
     }
     return this.SyncFromAllServersCallback(eventType, targetServer, sourceServer, exception);
 }