Don't allow the program to close while a global hook is active

This commit is contained in:
baldurk
2017-01-06 12:34:36 +00:00
parent 88b4fc92db
commit 329ebc2d05
3 changed files with 15 additions and 0 deletions
+3
View File
@@ -59,6 +59,7 @@ namespace renderdocui.Code
private bool m_LogLocal = false;
private bool m_LogLoaded = false;
private bool m_GlobalHookEnabled = false;
private FileSystemWatcher m_LogWatcher = null;
@@ -119,6 +120,8 @@ namespace renderdocui.Code
public string LogFileName { get { return m_LogFile; } set { if (LogLoaded) m_LogFile = value; } }
public bool IsLogLocal { get { return m_LogLocal; } set { m_LogLocal = value; } }
public bool GlobalHookEnabled { get { return m_GlobalHookEnabled; } set { m_GlobalHookEnabled = value; } }
public FetchFrameInfo FrameInfo { get { return m_FrameInfo; } }
public APIProperties APIProps { get { return m_APIProperties; } }
@@ -928,6 +928,8 @@ namespace renderdocui.Windows.Dialogs
toggleGlobalHook.Enabled = false;
m_Core.GlobalHookEnabled = false;
if (toggleGlobalHook.Checked)
{
if(!Helpers.IsElevated)
@@ -1124,6 +1126,8 @@ namespace renderdocui.Windows.Dialogs
logfile = m_Core.TempLogFilename(logfile);
StaticExports.StartGlobalHook(exe, logfile, GetSettings().Options);
m_Core.GlobalHookEnabled = true;
}
else
{
+8
View File
@@ -1709,6 +1709,14 @@ namespace renderdocui.Windows
}
}
if (m_Core.GlobalHookEnabled)
{
MessageBox.Show("Cannot close RenderDoc while global hook is active.", "Global hook active",
MessageBoxButtons.OK, MessageBoxIcon.Error);
e.Cancel = true;
return;
}
if (!PromptCloseLog())
{
e.Cancel = true;