Ejemplo n.º 1
0
 internal bool TryGetProcessId(out uint pid)
 {
     pid = 0;
     try
     {
         this.SendHostMessage(HhMessageId.GetPidMsgId);
         for (;;)
         {
             HhMessageReply reply = this.GetReply();
             if (reply == null)
             {
                 return(false);
             }
             HhGetPidReply pidReply = reply as HhGetPidReply;
             if (pidReply != null)
             {
                 pid = pidReply.Pid;
                 return(true);
             }
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Ejemplo n.º 2
0
        internal static string GetLogReplyText(HhMessageReply reply)
        {
            if (reply == null)
            {
                return(null);
            }
            HhGetPidReply pidReply = reply as HhGetPidReply;

            if (pidReply != null)
            {
                return("PID for host process is " + pidReply.Pid);
            }
            HhResultReply resultReply = reply as HhResultReply;

            if (resultReply != null)
            {
                return("Operation result for " + HhKindToText(resultReply.Kind) +
                       ": " + HResultToString(resultReply.HResult));
            }
            HhLogReply logReply = reply as HhLogReply;

            if (logReply != null)
            {
                return(logReply.Log);
            }
            return(null);
        }