コード例 #1
0
        private void checkProcessAndClose(Process pro, string name)
        {
            ushort handle = RefreshHandles(pro, name);

            if (handle != 0)
            {
                HandleModle.CloseProcessHandle(pro.Id, handle);
            }
        }
コード例 #2
0
        private ushort RefreshHandles(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))
                {
                    return(lw.Handle);
                }
            }
            return(0);
        }