Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Hardware & Devices
  4. BSOD-PAGE_FAULT_IN_NON_PAGED_AREA

BSOD-PAGE_FAULT_IN_NON_PAGED_AREA

Scheduled Pinned Locked Moved Hardware & Devices
helpquestiondebugging
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    FotisSs
    wrote on last edited by
    #1

    Hi there people, I have problem running the following driver code. It worked for sometime but without no obvious reason whenever I try to stop the driver service a BSOD appears with the PAGE_FAULT_IN_NON_PAGED_AREA error. I found out that when I remove the set DriverName code the problem disappears but the question is why. I'm desperate I cant find a way to fix this thing. I load the driver with the instdrv.In the Debug Viewer only the HI message apperars Any ideas? Here is the code VOID UnLoadMe(IN PDRIVER_OBJECT obj); UNICODE_STRING us; NTSTATUS DriverEntry ( IN PDRIVER_OBJECT theDriverObject, IN PUNICODE_STRING theRegistryPath ) { DbgPrint("HELLO"); RtlInitUnicodeString( &us, L"TEST\0" ); theDriverObject->DriverName=us; theDriverObject->DriverUnload=UnLoadMe; return STATUS_SUCCESS; } VOID UnLoadMe(IN PDRIVER_OBJECT obj) { DbgPrint("BYE"); }

    L J 3 Replies Last reply
    0
    • F FotisSs

      Hi there people, I have problem running the following driver code. It worked for sometime but without no obvious reason whenever I try to stop the driver service a BSOD appears with the PAGE_FAULT_IN_NON_PAGED_AREA error. I found out that when I remove the set DriverName code the problem disappears but the question is why. I'm desperate I cant find a way to fix this thing. I load the driver with the instdrv.In the Debug Viewer only the HI message apperars Any ideas? Here is the code VOID UnLoadMe(IN PDRIVER_OBJECT obj); UNICODE_STRING us; NTSTATUS DriverEntry ( IN PDRIVER_OBJECT theDriverObject, IN PUNICODE_STRING theRegistryPath ) { DbgPrint("HELLO"); RtlInitUnicodeString( &us, L"TEST\0" ); theDriverObject->DriverName=us; theDriverObject->DriverUnload=UnLoadMe; return STATUS_SUCCESS; } VOID UnLoadMe(IN PDRIVER_OBJECT obj) { DbgPrint("BYE"); }

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      You shouldnt set the driver name, its given to you, its the name in the services key of your drivers entry. (Like 'serial', 'tcp', etc).

      Morality is indistinguishable from social proscription

      1 Reply Last reply
      0
      • F FotisSs

        Hi there people, I have problem running the following driver code. It worked for sometime but without no obvious reason whenever I try to stop the driver service a BSOD appears with the PAGE_FAULT_IN_NON_PAGED_AREA error. I found out that when I remove the set DriverName code the problem disappears but the question is why. I'm desperate I cant find a way to fix this thing. I load the driver with the instdrv.In the Debug Viewer only the HI message apperars Any ideas? Here is the code VOID UnLoadMe(IN PDRIVER_OBJECT obj); UNICODE_STRING us; NTSTATUS DriverEntry ( IN PDRIVER_OBJECT theDriverObject, IN PUNICODE_STRING theRegistryPath ) { DbgPrint("HELLO"); RtlInitUnicodeString( &us, L"TEST\0" ); theDriverObject->DriverName=us; theDriverObject->DriverUnload=UnLoadMe; return STATUS_SUCCESS; } VOID UnLoadMe(IN PDRIVER_OBJECT obj) { DbgPrint("BYE"); }

        J Offline
        J Offline
        JudyL_MD
        wrote on last edited by
        #3

        First, listen to fat-boy - he's correct!! However, to help understand what is causing your problem ... Given that error (which is very precise in telling you what the problem is), my guess is that your us variable is stored in a paged data area. You have to be careful with global variables in drivers that they are stored how you think they are stored. There may be a pragma in effect putting all code and data into paged-pool - this is quite common for initialization code. Judy

        L 1 Reply Last reply
        0
        • J JudyL_MD

          First, listen to fat-boy - he's correct!! However, to help understand what is causing your problem ... Given that error (which is very precise in telling you what the problem is), my guess is that your us variable is stored in a paged data area. You have to be careful with global variables in drivers that they are stored how you think they are stored. There may be a pragma in effect putting all code and data into paged-pool - this is quite common for initialization code. Judy

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Unless he didnt paste all his code in (ie he is using the PAGED pragma) then all driver code is memory resident, and global vars. But, since DriverEntry runs at passive level you can access paged out code without any problem. This is probably one of those odd errors where the error used doesnt really reflect what went on. Probably, its read only memory, or the unicode string actually points to part of the registry file or some such.

          Morality is indistinguishable from social proscription

          J 1 Reply Last reply
          0
          • L Lost User

            Unless he didnt paste all his code in (ie he is using the PAGED pragma) then all driver code is memory resident, and global vars. But, since DriverEntry runs at passive level you can access paged out code without any problem. This is probably one of those odd errors where the error used doesnt really reflect what went on. Probably, its read only memory, or the unicode string actually points to part of the registry file or some such.

            Morality is indistinguishable from social proscription

            J Offline
            J Offline
            JudyL_MD
            wrote on last edited by
            #5

            fat_boy wrote:

            Unless he didnt paste all his code in (ie he is using the PAGED pragma)

            That is what I was suspecting and was referring to when I talked about a pragma asociated with the initialization code. My guess on the crash is that after the OP changes the driver name to use that paged variable and DriverEntry returns, the page fault occurs as soon as the driver object is used somewhere not at Passive level since it references paged memory. Judy

            L 1 Reply Last reply
            0
            • J JudyL_MD

              fat_boy wrote:

              Unless he didnt paste all his code in (ie he is using the PAGED pragma)

              That is what I was suspecting and was referring to when I talked about a pragma asociated with the initialization code. My guess on the crash is that after the OP changes the driver name to use that paged variable and DriverEntry returns, the page fault occurs as soon as the driver object is used somewhere not at Passive level since it references paged memory. Judy

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              Yeah, a stack trace would show whether the bug is due to setting the name in the devo, or something else referencing the name, now in this drivers image. I suspect its the former though.

              Morality is indistinguishable from social proscription

              1 Reply Last reply
              0
              • F FotisSs

                Hi there people, I have problem running the following driver code. It worked for sometime but without no obvious reason whenever I try to stop the driver service a BSOD appears with the PAGE_FAULT_IN_NON_PAGED_AREA error. I found out that when I remove the set DriverName code the problem disappears but the question is why. I'm desperate I cant find a way to fix this thing. I load the driver with the instdrv.In the Debug Viewer only the HI message apperars Any ideas? Here is the code VOID UnLoadMe(IN PDRIVER_OBJECT obj); UNICODE_STRING us; NTSTATUS DriverEntry ( IN PDRIVER_OBJECT theDriverObject, IN PUNICODE_STRING theRegistryPath ) { DbgPrint("HELLO"); RtlInitUnicodeString( &us, L"TEST\0" ); theDriverObject->DriverName=us; theDriverObject->DriverUnload=UnLoadMe; return STATUS_SUCCESS; } VOID UnLoadMe(IN PDRIVER_OBJECT obj) { DbgPrint("BYE"); }

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                By the way, when you get a crash like this, then you can look at the memory dump in WinDbg. The crash dump will either be called memory.dmp in the windows dir or it'll be in the minidump dir dependig on how your machine is set up. The best way to fix bugs though is kernel debuging. Take alook in the DDK for how to do this. (Null modem cable, modify boot.ini, and use windbg)

                Morality is indistinguishable from social proscription

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups