none
What is the header (#include file) for types like: PBYTE, UINT ... etc? RRS feed

  • Question

  • With relation to my last question , i now want know what is the header (#include file) for types like: PBYTE, UINT ... etc?

    I now have only:

    #include <ntddk.h> in my file driver.h


    Wednesday, January 11, 2017 2:28 PM

Answers

  • You have to remember that the Windows kernel was originally designed to host multiple operating system personalities.  As such it does not always use exactly the same data types as Win32.   BYTE is an unsigned char or UCHAR in the kernel, and PBYTE is a PUCHAR. 

    You already have indicated you are trying to do something that is not recommended (hooking user space from the kernel), and is far out of the norm, as such you have to accept that you are going to run into disconnects in the interfaces you want to use.


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

    Wednesday, January 11, 2017 5:30 PM

All replies

  • Find in files in Visual Studio is your friend, search for the definition through the includes of the WDK.  You may have to cut and paste to make your own definitions.


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

    Wednesday, January 11, 2017 4:42 PM
  • Find in files in Visual Studio is your friend, search for the definition through the includes of the WDK.  You may have to cut and paste to make your own definitions.


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

    This solution does not seem very friendly :-(

    Wednesday, January 11, 2017 5:22 PM
  • You have to remember that the Windows kernel was originally designed to host multiple operating system personalities.  As such it does not always use exactly the same data types as Win32.   BYTE is an unsigned char or UCHAR in the kernel, and PBYTE is a PUCHAR. 

    You already have indicated you are trying to do something that is not recommended (hooking user space from the kernel), and is far out of the norm, as such you have to accept that you are going to run into disconnects in the interfaces you want to use.


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

    Wednesday, January 11, 2017 5:30 PM
  • There is no other headers (#includes file) similar to windows.h that can be used to build drivers?
    Wednesday, January 11, 2017 5:44 PM
  • Doing a quick check of the Windows 7 WDK, I did not find a file that defined PBYTE, that was usable in the kernel.  


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

    • Marked as answer by Doron Holan [MSFT] Wednesday, January 11, 2017 6:38 PM
    • Unmarked as answer by FLASHCODER Wednesday, January 11, 2017 6:47 PM
    Wednesday, January 11, 2017 6:25 PM
  • like I responded on the other thread (Starting in the win8 wdk and moving forward), the only header files usable to build drivers in are the KM and SHARED inc directories. everything in SDK inc is not applicable. the closest you have in drivers to windows.h is ntddk.h or wdm.h


    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Wednesday, January 11, 2017 6:40 PM
  • When I found this code on the web, ntapi.h was included. But ntapi.h can not be used because it also includes winbase.h ( which is forbidden to use in drivers ). I think this ntapi.h was a custom file that the post author forgot to show. And this possible custom ntapi.h could have these special types.

    Now i will try build this code using VS 2013 + WDK 8.1




    • Edited by FLASHCODER Wednesday, January 11, 2017 6:46 PM
    Wednesday, January 11, 2017 6:45 PM
  • I've encountered a number of ntapi.h files over the years, almost all of them are to define the native NT API, and none of them have Win32 types like PBYTE.  

    There is absolutely no harm in creating your own include with these types and basing it on the Win32 includes that have those type definitions.


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

    Wednesday, January 11, 2017 9:21 PM