Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3978170
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:00:48+00:00 2026-05-20T05:00:48+00:00

I started learned windbg and I found this good post How to use WinDbg

  • 0

I started learned windbg and I found this good post
How to use WinDbg to analyze the crash dump for VC++ application?

Now I want to follow the instructions and do it step by step. Here is the problem: I need to write some sample code that can immediately crash, and create some dump files that can be used by windbg.

How to write such code?

void Example4()
{
    int* i = NULL;
    *i = 80;
}

The above code will crash immediately; however, I don’t know where to find the dump file?

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T05:00:49+00:00Added an answer on May 20, 2026 at 5:00 am
    #include <Windows.h>
    #include <Dbghelp.h>
    
    void make_minidump(EXCEPTION_POINTERS* e)
    {
        auto hDbgHelp = LoadLibraryA("dbghelp");
        if(hDbgHelp == nullptr)
            return;
        auto pMiniDumpWriteDump = (decltype(&MiniDumpWriteDump))GetProcAddress(hDbgHelp, "MiniDumpWriteDump");
        if(pMiniDumpWriteDump == nullptr)
            return;
    
        char name[MAX_PATH];
        {
            auto nameEnd = name + GetModuleFileNameA(GetModuleHandleA(0), name, MAX_PATH);
            SYSTEMTIME t;
            GetSystemTime(&t);
            wsprintfA(nameEnd - strlen(".exe"),
                "_%4d%02d%02d_%02d%02d%02d.dmp",
                t.wYear, t.wMonth, t.wDay, t.wHour, t.wMinute, t.wSecond);
        }
    
        auto hFile = CreateFileA(name, GENERIC_WRITE, FILE_SHARE_READ, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
        if(hFile == INVALID_HANDLE_VALUE)
            return;
    
        MINIDUMP_EXCEPTION_INFORMATION exceptionInfo;
        exceptionInfo.ThreadId = GetCurrentThreadId();
        exceptionInfo.ExceptionPointers = e;
        exceptionInfo.ClientPointers = FALSE;
    
        auto dumped = pMiniDumpWriteDump(
            GetCurrentProcess(),
            GetCurrentProcessId(),
            hFile,
            MINIDUMP_TYPE(MiniDumpWithIndirectlyReferencedMemory | MiniDumpScanMemory),
            e ? &exceptionInfo : nullptr,
            nullptr,
            nullptr);
    
        CloseHandle(hFile);
    
        return;
    }
    
    LONG CALLBACK unhandled_handler(EXCEPTION_POINTERS* e)
    {
        make_minidump(e);
        return EXCEPTION_CONTINUE_SEARCH;
    }
    
    int main()
    {
        SetUnhandledExceptionFilter(unhandled_handler);
    
        return *(int*)0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've started programming for iPhones about a month ago now, and have found the
I started to use Jackrabbit in my project. As i found out there is
I learned about Microsoft BizSpark the other day and started the sign up process.
Since I've started using NetBeans, I've learned of some powerful ways to abstract away
When I first started programming, I wrote everything in main. But as I learned,
I started an application in Google App Engine right when it came out, to
I started a Rails project recently and decided to use RESTful controllers. I created
When I learned about proxy_options I started using it to test all my named
When i started learning android i learned that R.java files goes to /gen folder
I just started studying Drupal 7 and learned how powerful CCK and Views are.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.