This explains how to read the path of windows dump file in your c# code.
This code works on windows XP as well as windows 7. Even if the dump path has been modified, we will get the modified one.
This needs only basic knowledge of registry. Using RegistryKey class of Win32, we will read the key and the value associate with it as below:
=========================================================================
private string GetMiniDumpFilePath()
{
RegistryKey key = Registry.LocalMachine;
if (key != null)
{
RegistryKey sub = key.OpenSubKey(@"SYSTEM\CurrentControlSet\Control\CrashControl");
if (sub != null)
{
object obj = sub.GetValue("MinidumpDir", null, RegistryValueOptions.None);
if (obj != null)
{
return Convert.ToString(obj);
}
}
}
}
========================================================================