when inject to two or more process,the problem coming.....

Jun 10, 2009 at 1:23 AM
Edited Jun 12, 2009 at 2:22 AM

there was an error while connecting to target:
  system.security.HostprotectionException:if no random channel name is being used,you shall specify all allowed SIDs.
 at easyhook.remotehooking.IpcCreateServer[TRemoteObject](String& RefChannelName,WellKnownObjectMode InObjectMode,WellKnown SidType[] InAllowedClientSIDs).

can you tell me why ? i am beginner in hook field !tks.

in the filemon demo ,i change it somewhere:

1).i changed the filemon.exe to classlibrary1.dll ,and the classlibrary1.dll is same as the filemon,the code list is :

namespace ClassLibrary1
{
    public class Class1 : MarshalByRefObject
    {
        public void IsInstalled(Int32 InClientPID)
        {
            Console.WriteLine("FileMon has been installed in target {0}.\r\n", InClientPID);
        }

        public void OnCreateFile(Int32 InClientPID, String[] InFileNames)
        {
            for (int i = 0; i < InFileNames.Length; i++)
            {
                Console.WriteLine(InFileNames[i]);
            }
        }

        public void ReportException(Exception InInfo)
        {
            Console.WriteLine("The target process has reported an error:\r\n" + InInfo.ToString());
        }

        public void Ping()
        {
        }

    }


   public  class Program
    {
      static String ChannelName = null;

      public  static void work(Int32 pid)
        {
            Int32 TargetPID = pid;

            try
            {
                try
                {
                    
                    Config.Register(
                        "A FileMon like demo application.",
                        "ClassLibrary1.dll",
                        "FileMonInject.dll");
                    
                }
                catch (ApplicationException)
                {
                    MessageBox.Show("This is an administrative task!", "Permission denied...", MessageBoxButtons.OK);

                    System.Diagnostics.Process.GetCurrentProcess().Kill();
                }

                RemoteHooking.IpcCreateServer<Class1>(ref ChannelName, WellKnownObjectMode.SingleCall);


                RemoteHooking.Inject(
                    TargetPID,
                    "FileMonInject.dll",
                    "FileMonInject.dll",
                    ChannelName);


                Console.ReadLine();
            }
            catch (Exception ExtInfo)
            {
                Console.WriteLine("There was an error while connecting to target:\r\n{0}", ExtInfo.ToString());
            }
        }
    }
}

2).i create a ConsoleApplication1.exe to invoke the ClassLibrary1.dll,and the code is :
#using "ClassLibrary1.dll"
#pragma managed
int PutPid(int pid)
{
	ClassLibrary1::Program ^h = gcnew ClassLibrary1::Program();
	h->work(pid);
	return 0;
}
question:
when i invoke the PutPid()  in a for loop state,the problem coming.the error is that :

there was an error while connecting to target:
  system.security.HostprotectionException:if no random channel name is being used,you shall specify all allowed SIDs.
 at easyhook.remotehooking.IpcCreateServer[TRemoteObject](String& RefChannelName,WellKnownObjectMode InObjectMode,WellKnown SidType[] InAllowedClientSIDs).

can you tell me why ? i am beginner in hook field !tks.