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

  • SEARCH
  • Home
  • 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 8059993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:50:37+00:00 2026-06-05T09:50:37+00:00

I just started with driver development. For some experiments with loading, unloading and debugging

  • 0

I just started with driver development. For some experiments with loading, unloading and debugging I have written the following simple driver:

#include <ntddk.h> 

void DriverUnload(PDRIVER_OBJECT pDriverObject) 
{ 
    UNREFERENCED_PARAMETER(pDriverObject);
    DbgPrint("Driver unloading\n"); 
} 

NTSTATUS DriverEntry( 
    PDRIVER_OBJECT DriverObject, 
    PUNICODE_STRING RegistryPath) 
{ 
    UNREFERENCED_PARAMETER(DriverObject);
    UNREFERENCED_PARAMETER(RegistryPath);

    DriverObject->DriverUnload = DriverUnload; 
    DbgPrint("Hello, World\n"); 

    return STATUS_SUCCESS; 
}

I compiled the driver for my target system, Windows 7 64bit, with debug symbols, copied it to target system and loaded and run it with OSR Driver Loader.

Everything works fine and I can unload and load the driver:enter image description here

I can connect with WinDbg using a serial connection and can successfully break and run the target system. However, the problem occurs when I try to set a breakpoint.

I initially tried setting the breakpoint like this:

kd> bp MyDriver1!DriverEntry

but the problem was, if I reloaded the driver and checked the breakpoints:

kd> bl
0 e fffff880`03572010 0001 (0001) < Unloaded_MyDriver1.sys >+0x1010

For me as beginner, it didn’t look good (unloaded?) and no breaks occurred when loading.

So, I found out that its possible to set a breakpoint when a module is loaded:

kd> bu MyDriver1

0 e fffff880`03578000 0001 (0001) MyDriver1!DriverEntry < PERF > (MyDriver1+0x0)

When I continue system execution after the above command and load the driver (net start MyDriver1) the system crashes:

Break instruction exception – code 80000003 (first chance)


  • *
  • You are seeing this message because you pressed either *
  • CTRL+C (if you run console kernel debugger) or, *
  • CTRL+BREAK (if you run GUI kernel debugger), *
  • on your debugger machine’s keyboard. *
  • *
  • THIS IS NOT A BUG OR A SYSTEM CRASH *
  • *
  • If you did not intend to break into the debugger, press the “g” key, then *
  • press the “Enter” key now. This message might immediately reappear. If it *
  • does, press “g” and “Enter” again. *
  • *

nt!RtlpBreakWithStatusInstruction: fffff800028ca490 cc int 3
kd > bu MyDriver1 kd> bl 0 e fffff880
03572010 0001

(0001) MyDriver1!DriverEntry < PERF > (MyDriver1+0x0)

kd > bc 0 kd> bl 1 e fffff880`03578000 0001 (0001)

MyDriver1!DriverEntry (MyDriver1+0x0)

kd> g Access violation – code c0000005 (!!! second chance !!!)

nt!IopUnloadDriver+0x327: fffff800`02cb8b29 0fb74844 movzx

ecx,word ptr [rax+44h]

Finally, if I continue the execution now, I get a BSOD …

Whats wrong here? Is my code wrong or am I setting the breakpoints not correctly?

  • 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-06-05T09:50:38+00:00Added an answer on June 5, 2026 at 9:50 am

    The command you are looking for is
    sxe ld:MyDriver1

    This will break when the driver is mapped into memory but before calling MyDriver1!DriverEntry and will allow you to put breakpoints at DriverEntry.

    The command bu MyDriver1 puts a breakpoint in the first byte of the PE header of the driver image.

    Also, clean up breakpoints after you unload the driver otherwise you cause the debugger to modify memory that could be allocated for something else.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just started my first MVC 2.0 .net application. And I set up some default
I just started with the connectivity and tried this example. I have installed the
I've just started using Eclipse for Python development since we can make use of
I am just started coding of device driver and new to threading, went through
I have several projects with a very large over-lapping code-base. We've just recently started
I have just started working with nodejs. I am a java script newbie. I
I've just started digging into XProc (using Calabash ). I have a series of
I have just started learning about socket programming and learned about winsock and achieved
i have just started learning solr. i have installed apache tomcat server and solr
Just started to get my feet wet with C# and .NET, liking it so

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.