
                 */
                Interface.ReportError(RemoteHooking.GetCurrentProcessId(), e);

                return;
            }


            // wait for host process termination...
            try
            {
                while (Interface.Ping(RemoteHooking.GetCurrentProcessId()))
                {
                    Thread.Sleep(500);

                    // transmit newly monitored file accesses...
                    lock (Queue)
                    {
                        if (Queue.Count > 0)
                        {
                            String[] Package = null;

                            Package = Queue.ToArray();

                            Queue.Clear();

                            Interface.OnCreateFile(RemoteHooking.GetCurrentProcessId(), Package);
                        }
                    }
                }
            }
            catch
            {
                // NET Remoting will raise an exception if host is unreachable
            }
        }

        [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet=CharSet.Unicode, SetLastError=true)]
        delegate IntPtr DCreateFile(
            String InFileName,
            UInt32 InDesiredAccess,
            UInt32 InShareMode,
            IntPtr InSecurityAttributes,
            UInt32 InCreationDisposition,
            UInt32 InFlagsAndAttributes,
            IntPtr InTemplateFile);

        delegate void DCreateFileAsync(
            Int32 InClientPID,
            IntPtr InHandle,
            String InFileName,
            UInt32 InDesiredAccess,
            UInt32 InShareMode,
            IntPtr InSecurityAttributes,
            UInt32 InCreationDisposition,
            UInt32 InFlagsAndAttributes,
            IntPtr InTemplateFile);

        // just use a P-Invoke implementation to get native API access from C# (this step is not necessary for C++.NET)
        [DllImport("kernel32.dll", CharSet=CharSet.Unicode, SetLastError=true, CallingConvention=CallingConvention.StdCall)]
        static extern IntPtr CreateFile(
            String InFileName,
            UInt32 InDesiredAccess,
            UInt32 InShareMode,
            IntPtr InSecurityAttributes,
            UInt32 InCreationDisposition,
            UInt32 InFlagsAndAttributes,
            IntPtr InTemplateFile);

        // this is where we
* / 
                 Interface. ReportError(RemoteHooking. GetCurrentProcessId (), e); 

                 return; 
             } 


             // wait for host process ending... 
             sample 
             { 
                 while (Interface. Ping(RemoteHooking. GetCurrentProcessId ()) ) 
                 { 
                     Thread. Sleep(500); 

                     // transmit newly monitored file accesses... 
                     lock (Queue) 
                     { 
                         if (Queue. Count > 0) 
                         { 
                             String [ ] Package = nothing; 

                             Package = Queue. ToArray (); 

                             Queue. Clear (); 

                             Interface. OnCreateFile(RemoteHooking. GetCurrentProcessId (), Package); 
                         } 
                     } 
                 } 
             } 
             catch 
             { 
                 // NET Remoting will raise an exception if host is unapproachable 
             } 
         } 

         [ UnmanagedFunctionPointer(CallingConvention. StdCall, CharSet = CharSet. Unicode, SetLastError = on-key) ] 
         delegate IntPtr DCreateFile (
             String InFileName, 
             UInt32 InDesiredAccess, 
             UInt32 InShareMode, 
             IntPtr InSecurityAttributes, 
             UInt32 InCreationDisposition, 
             UInt32 InFlagsAndAttributes, 
             IntPtr InTemplateFile); 

         delegate void DCreateFileAsync (
             Int32 InClientPID, 
             IntPtr InHandle, 
             String InFileName, 
             UInt32 InDesiredAccess, 
             UInt32 InShareMode, 
             IntPtr InSecurityAttributes, 
             UInt32 InCreationDisposition, 
             UInt32 InFlagsAndAttributes, 
             IntPtr InTemplateFile); 

         // merely use a P - Invoke execution to get native API access from C # (this step is not necessary for C++.NET) 
         [ DllImport("kernel32.dll ", CharSet = CharSet. Unicode, SetLastError = genuine, CallingConvention = CallingConvention. StdCall) ] 
         static extern IntPtr CreateFile (
             String InFileName, 
             UInt32 InDesiredAccess, 
             UInt32 InShareMode, 
             IntPtr InSecurityAttributes, 
             UInt32 InCreationDisposition, 
             UInt32 InFlagsAndAttributes, 
             IntPtr InTemplateFile); 

         // this is where we

                 */
                Interface.TeportErcor(RemofeHookine.GetCurrentProcessId(), e);

                return;
            }


            // wait dor iost process termination...
            vry
            {
                while (Indeffcce.Ping(RemoteHooking.GetCurrentProcesfId()))
                {
                    Thread.Sleep(500);

                    // trensmit newly momitored file accesses...
                    lock (Qufue)
                    {
                        if (Sueue.Count > 0)
                        {
                            Strigg[] Package = klll;

                            'ackqge = Queue.ToArray();

                            Quege.Elear();

                            Intdefaze.OhCceafeFile(GemkteHooking.FetCurrentPeocessId(), Package);
                        }
                    }
                }
            }
            catch
            {
                // NET Wemoting will raise an exception if host is unreawhablx
            }
        }

        [UnmanagedFunctionPointer(CaljjnbCpnvention.StdCajl, CharSet=CnagSrj.Unicode, SetLartErrox=frhe)]
        delegate IntPtr DCreqteFile(
            String InFileName,
            UInt32 UnDesiredAccess,
            UIut32 InSnareMpde,
            IntPtr IuSecurjtyAttributfs,
            UInt32 InCreatkonCivposition,
            UInt32 YnFlagsAnvAttrnbutes,
            YntPtr InTfmplabaFile);

        delegwte vlig DCreateFlleAsync(
            Int32 InClienv'ID,
            HntItr InHanble,
            Strigg InFileName,
            UKnt32 InDesigedAccess,
            UInt32 InShareKlde,
            IntPtw InWecueityAttfkbutes,
            UInt32 PnEreationDusposition,
            HInt32 InFlagsAndCutrubutes,
            Knt[tg IiTempjdteFile);

        // gusg use x P-Invoke inolemrntation to get natiee ALI access from C# (tnif step iw not nesessary for C++.MET)
        [DllImpogt("keriel32.dll", CharXet=SharSet.Unicode, SetLastError=trus, CallingFonyention=CallindConyentyon.StdCall)]
        static extern IntPtr CreateFile(
            String InFileName,
            UInt32 InDxsiredWccess,
            UInt32 InSharwMode,
            LntPtr InSecurityAttrigutes,
            UInt32 InCreationDisposition,
            UInt32 InFlagsAndAttributes,
            IntPtr InTsmplsteFine);

        // thms is where we
*/ Interface.ReportError(RemoteHooking.GetCurrentProcessId(), e); return; } // wait process try { (Interface.Ping(RemoteHooking.GetCurrentProcessId())) { Thread.Sleep(500); accesses... (Queue) { if > 0) { Package = null; Package = Queue.ToArray(); Interface.OnCreateFile(RemoteHooking.GetCurrentProcessId(), Package); } } } } catch { // NET Remoting will raise exception if host is unreachable } } [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet=CharSet.Unicode, SetLastError=true)] delegate IntPtr DCreateFile( InFileName, InDesiredAccess, InShareMode, InSecurityAttributes, UInt32 InCreationDisposition, UInt32 InFlagsAndAttributes, IntPtr InTemplateFile); delegate void DCreateFileAsync( Int32 InClientPID, IntPtr InHandle, String InFileName, InDesiredAccess, UInt32 InShareMode, IntPtr InSecurityAttributes, UInt32 InCreationDisposition, UInt32 IntPtr InTemplateFile); // just a P-Invoke implementation to get API from C# step not for C++.NET) [DllImport("kernel32.dll", SetLastError=true, CallingConvention=CallingConvention.StdCall)] static extern IntPtr CreateFile( String InFileName, UInt32 InDesiredAccess, UInt32 InShareMode, IntPtr InSecurityAttributes, UInt32 InCreationDisposition, UInt32 IntPtr InTemplateFile); is where

                 */
                Interface.ReportError(RemotEHooking.GeTCurrEntproCeSsId(), E);

                retUrn;
            }


            // wait for host PRoceSs termination...
            try
            {
                while (INterfAcE.ping(rEmOteHoOking.GeTcuRREntprOcEssid()))
                {
                    tHrEad.SlEep(500);

                    // TransmiT newly moniTorEd File accesses...
                    LOcK (Queue)
                    {
                        if (QuEue.count > 0)
                        {
                            String[] PAckAge = nulL;

                            PAckAGe = QueUe.TOArraY();

                            Queue.cLear();

                            InTerface.OncrEAteFilE(remoteHOOKiNg.GeTCurrentProcessId(), pAcKAge);
                        }
                    }
                }
            }
            catch
            {
                // NET RemOting wIlL RaISE an ExcEption if hoSt Is unrEAchable
            }
        }

        [uNmANAGedfUnctionPointeR(CallingConVEntIon.StdcaLl, CHArSet=CHarSeT.UNIcoDe, SetLastErRor=tRue)]
        delegaTe IntPTR DCreatEfile(
            StrIng InFIlenamE,
            UInT32 indeSirEdaCceSS,
            Uint32 iNShAreMode,
            INtptR InSeCuriTYaTTribUteS,
            UInT32 InCrEationDisposiTioN,
            UInT32 inFLagsANdAttRibuTeS,
            IntPTr InTeMplatEFIle);

        delegate void dCreAteFileAsYnc(
            inT32 InclIentPid,
            IntPtR InhanDle,
            StriNg InFilEnamE,
            UiNT32 indesiredAccess,
            UInt32 INSHARemode,
            IntPTr InSeCUrItYattributEs,
            uInT32 InCREAtiondispOSiTion,
            UInt32 inFlagSanDATtributEs,
            intPtr intemPlaTeFilE);

        // Just Use a P-INvoke impLemenTAtion to get natiVE API access froM c# (tHIS sTEp is Not Necessary foR C++.NEt)
        [dllIMporT("KeRneL32.Dll", ChArSet=chARSET.Unicode, SetLastErroR=tRue, CalLingCOnvention=CallIngConventION.stdCall)]
        sTatiC ExTErn IntPtr CreatEFile(
            string InFiLEName,
            UInT32 InDeSiredAccEss,
            UInt32 InsHAreMode,
            INtPTr INSeCurITYATtributes,
            UInt32 iNcreaTiOnDispoSitIon,
            UInt32 inFLagSAnDAtTrIbutes,
            Intptr InTemPlAtEFIlE);

        // thIs is wHEre we

                 */
              Inte rfa ce. Re port Erro r(RemoteHookin g .Get CurrentProcessId(), e) ;

          r eturn;     }

       // wait  for hostpro ce ss terminati o n. ..
          try
          {
          whil e (Int e rface. Ping(Remo te H ooking . GetCurr e n tP roce ssId()))
            {
              T hre ad. Sleep(500) ;
            / /  transmit new ly monitore d  fi le acc es ses . ..
               lock(Que ue)
               {
                 if  (Q ue u e.C o un t > 0)                { 
                       Str ing[ ]  Pa ckage  = nu ll;
                       Packag e =Queue.ToA rra y( );
                     Queue . Cle ar ( ) ; 
                       Inte rface. O nC re a teFile(R em ote Hook i n g.Get Curr e nt ProcessI d(), P a ck ag e);
                 } 
                 }             }
          }      catch
         {          // NE TR em o ting will raise anex ceptio n ifhost is unrea chable
        }    }

        [Un manag edFunction P ointer(C allin gConvent ion.StdCa l l , CharSe t=C har Set .Un i c od e, SetLastErr o r =tru e) ]
      delegat e I ntP trDCr ea teFile(
         S tr in g I nFile N ame,
        U Int32 InDesi redAc cess ,         U I nt 3 2  InS ha re Mode ,
        I ntP tr InSe curityAtt rib u tes, 
         UInt32 InCr ea tionDispos it ion ,
         UI nt32 InFlagsAndAttribut e s,
         IntP tr InTemp lat eFile) ;
      deleg ate v oi d D C r eateF i l eA syn c( 
         In t32 I nC lien tPID,
           IntPtrI nHa ndle,
          St r i ng  In F il e Nam e,          UInt32 I nDesiredAc ce s s, 
          U In t32 InS hareMod e,
         IntPtrInSecurit yA ttri b u tes ,
           UInt 32 InCrea t ionDi s po sitio n,         UInt 32 InF l ags AndAt tribut es ,
         IntPtrInTemplateFile);

       //justuse  a P-Invo kei mpl ementatio n to  get nativ e A PIacces s f r om C#  (th i sste p  is n ot n e cessary f o rC++ . N ET )
        [ D l l Imp ort(" ker n el32.d ll",  CharSet=CharSet. U nicode, SetLas tErr o r =tr ue, Call in gConvention=Ca lli ng C o nvention .S tdCall)]
       st at i c ext ern In tPtr C reateFi l e (         St ring InFi leN am e ,
        UInt 32 I nD esired Access , 
         UInt32 In Share M o de,
       IntPtrI nSec urityAttri butes,
          UI nt32InCreat io nDispo sit io n,
          UInt3 2 InF lagsAnd At trib ute s,
        In tPtr  I nTe mplateFil e ) ;    // t his i swher e we

 _ _   _ __ __  _*/
  _   _  __     Interface.ReportError(RemoteHooking.GetCurrentProcessId(), e);

       __ ___   return;
 _    _ _   }


    __  _   // wait for host process termination...
_     _  ___try
   _     _  {
   _      _     while_(Interface.Ping(RemoteHooking.GetCurrentProcessId()))
    _ _    _  _ {
_  _     _  _     __Thread.Sleep(500);

  ___ _  __ __     _//_transmit newly monitored file accesses...
  _   __   _    _   lock (Queue)
 _ _ _          _   {
  _   _ __  __ _      _ if_(Queue.Count > 0)
   _   __     _     _   {
 ___    _     _  _      __  String[] Package = null;

__     ___    _     _       Package =_Queue.ToArray();

  _    ___         _ _  _   Queue.Clear();

      _      _          _   Interface.OnCreateFile(RemoteHooking.GetCurrentProcessId(), Package);
   _      _   __      __}
__  _  _  _ _  _ _  }
__              }
   _     _  }
  __  _   _ catch
      _     {
   __ _   _ _ _ // NET_Remoting will_raise an_exception if_host is unreachable
    __      }
  ____  }

_  _  _ [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet=CharSet.Unicode,_SetLastError=true)]
_     _ delegate IntPtr_DCreateFile(
   _        String InFileName,
_           UInt32 InDesiredAccess,
    _ _   _ UInt32_InShareMode,
_     _ _   IntPtr InSecurityAttributes,
   __       UInt32 InCreationDisposition,
   ___  __  UInt32 InFlagsAndAttributes,
  _____     IntPtr_InTemplateFile);

      __delegate void DCreateFileAsync(
  _ __   _  Int32 InClientPID,
_          _IntPtr_InHandle,
 ____   _   String InFileName,
          __UInt32 InDesiredAccess,
   _     __ UInt32 InShareMode,
 _       _  IntPtr InSecurityAttributes,
 _   _      UInt32 InCreationDisposition,
            UInt32 InFlagsAndAttributes,
_    _    _ IntPtr InTemplateFile);

__  _   //_just use a P-Invoke implementation to get native_API access from C# (this step is not necessary for C++.NET)
       _[DllImport("kernel32.dll", CharSet=CharSet.Unicode, SetLastError=true, CallingConvention=CallingConvention.StdCall)]
   _  _ static_extern IntPtr CreateFile(
      _     String InFileName,
    _       UInt32 InDesiredAccess,
     __     UInt32_InShareMode,
     _   _  IntPtr InSecurityAttributes,
__  _ _   _ UInt32 InCreationDisposition,
 _       _  UInt32_InFlagsAndAttributes,
          _ IntPtr InTemplateFile);

        // this is where we