Example #1
0
        private ushort RefreshHandles2(Process pro, string check = "")
        {
            List <Win32API.SYSTEM_HANDLE_INFORMATION> lws = HandleModle.GetHandles(pro);

            foreach (Win32API.SYSTEM_HANDLE_INFORMATION lw in lws)
            {
                string str_handle_name = HandleModle.GetFilePath(lw, pro);

                if ("" == str_handle_name)
                {
                    continue;
                }
                if (str_handle_name == null)
                {
                    continue;
                }
                if (str_handle_name.Contains(check))
                {
                    Console.WriteLine(lw.ProcessID);
                    Console.WriteLine(lw.ObjectTypeNumber);
                    Console.WriteLine(lw.Flags);
                    Console.WriteLine(lw.Handle);
                    Console.WriteLine(str_handle_name);
                    Console.WriteLine("===========================");
                    return(lw.Handle);
                }
            }
            return(0);
        }
Example #2
0
        private void checkProcessAndClose(Process pro, string name)
        {
            ushort handle = RefreshHandles2(pro, name);

            if (handle != 0)
            {
                HandleModle.CloseProcessHandle(pro.Id, handle);
            }
        }