locked
KeWaitForSingleObject cause blue screen RRS feed

  • Question

  • Hi all:

           When I wait for thread which I create before, the PC will give me a blue screen, however, using a KEVENT it can work .

    Can anyone help me? Thanks a lot.

    Wednesday, March 23, 2016 9:12 AM

Answers

  • How are you referencing the thread?  PsCreateSystemThread returns a handle, but KeWaitForSingleObject requires a pointer to the thread object.


    Don Burn Windows Driver Consulting Website: http://www.windrvr.com

    • Marked as answer by xue.blood Wednesday, March 23, 2016 12:54 PM
    Wednesday, March 23, 2016 11:37 AM

All replies

  • How are you referencing the thread?  PsCreateSystemThread returns a handle, but KeWaitForSingleObject requires a pointer to the thread object.


    Don Burn Windows Driver Consulting Website: http://www.windrvr.com

    • Marked as answer by xue.blood Wednesday, March 23, 2016 12:54 PM
    Wednesday, March 23, 2016 11:37 AM
  • Oh no,it's amazing.Why don't compiler tell me an error when I don't use a point.

    And Execuse me,how can I disable error:c2220 while build a free edition driver with wdk 7.6.


    • Edited by xue.blood Wednesday, March 23, 2016 12:58 PM
    Wednesday, March 23, 2016 12:58 PM
  • First, HANDLES are defined as PVOID same as object pointers, but you need to use ObReferenceObjectByHandle to get the threads object pointer.  You should not be disabling c2220 since that is catching errors you should fix, instead fix the warnings that are issued.  If you really need to disable it you need to eliminate the /WX on the compile, but that is really a bad idea.


    Don Burn Windows Driver Consulting Website: http://www.windrvr.com

    Wednesday, March 23, 2016 1:12 PM
  • But how can I solve the error:  "no 'object' file generated"
    Wednesday, March 23, 2016 1:29 PM
  • Fix the warnings, C2220 is the error that indicates that no object file will be generated because you have warnings that are treated as errors.  Worst case take the output from completely rebuilding your driver and post it on this forum.


    Don Burn Windows Driver Consulting Website: http://www.windrvr.com

    Wednesday, March 23, 2016 1:55 PM
  • But it doesn't occur in check build environment.

    Wednesday, March 23, 2016 2:14 PM
  • There are a number of macros in the free build that evaluate to nothing, that in the checked build do something.  So a common problem is things like an unreferenced local variable that is used in one of the macros.  Also, consider that free build does optimization but checked build does not, so something as simple as:

    if (0 == 1 )
    {
        a = 25;
    }
    b = a+1;
    

    Will work in a checked build, but the optimizer will eliminate the a = 25; in the free build resulting in an error warning about a being unitialized.


    Don Burn Windows Driver Consulting Website: http://www.windrvr.com

    Wednesday, March 23, 2016 2:24 PM
  • Oh I see,and Thank you very much.
    Wednesday, March 23, 2016 2:42 PM