65.9K
CodeProject is changing. Read more.
Home

Reading path of small dump file(windows dump) through code

starIconemptyStarIconemptyStarIconemptyStarIconemptyStarIcon

1.00/5 (1 vote)

Nov 23, 2010

CPOL
viewsIcon

8210

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);
                    }
                }
            }
        }
========================================================================