Click here to Skip to main content
16,017,852 members
Articles / Programming Languages / C# 3.5
Tip/Trick

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

Rate me:
Please Sign up or sign in to vote.
1.00/5 (1 vote)
23 Nov 2010CPOL 8.2K   1   1
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);
                    }
                }
            }
        }

========================================================================

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralReason for my vote of 1 No real explanation at all :-( Pin
Marc Scheuner23-Nov-10 11:03
professionalMarc Scheuner23-Nov-10 11:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.