How to get the include paths of DDK compiler?

Hello, I’m new to Windows driver development. I’m trying to read a device driver code some other guys wrote several years ago. To understand the code, I used some tools (Eclipse or Source Insight) to browse the whole project. The tool need to know the exact include paths so that it can trace back to any type definitions and function definitions etc.

I know that the ‘inc’ directory of winddk and its subdirectories should be considered, but I really want to know if there is a way to get the complete include paths the DDK compiler uses. Plus, I also want to know the library paths of the linker.

Any help will be greatly appreciated. Thanks in advance!

Build your driver and look at the build log. All /I flags to cl.exe are include paths, there are no lib paths, all libs are referenced using full paths (which you can see in the log as well).

d

dent from a phpne with no keynoard

-----Original Message-----
From: xxxxx@gmail.com
Sent: November 03, 2010 7:10 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to get the include paths of DDK compiler?

Hello, I’m new to Windows driver development. I’m trying to read a device driver code some other guys wrote several years ago. To understand the code, I used some tools (Eclipse or Source Insight) to browse the whole project. The tool need to know the exact include paths so that it can trace back to any type definitions and function definitions etc.

I know that the ‘inc’ directory of winddk and its subdirectories should be considered, but I really want to know if there is a way to get the complete include paths the DDK compiler uses. Plus, I also want to know the library paths of the linker.

Any help will be greatly appreciated. Thanks in advance!


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

The log file generated when you run BUILD should have that information.

Thomas F. Divine
http://www.pcausa.com


From:
Sent: Wednesday, November 03, 2010 10:10 PM
To: “Windows System Software Devs Interest List”
Subject: [ntdev] How to get the include paths of DDK compiler?

> Hello, I’m new to Windows driver development. I’m trying to read a device
> driver code some other guys wrote several years ago. To understand the
> code, I used some tools (Eclipse or Source Insight) to browse the whole
> project. The tool need to know the exact include paths so that it can
> trace back to any type definitions and function definitions etc.
>
> I know that the ‘inc’ directory of winddk and its subdirectories should be
> considered, but I really want to know if there is a way to get the
> complete include paths the DDK compiler uses. Plus, I also want to know
> the library paths of the linker.
>
> Any help will be greatly appreciated. Thanks in advance!
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer

Thanks, but is there any built-in include paths of the compiler?

No. How would that work? The same compiler can generate user and kernel binaries, how would a default inc path baked info the compiler work for that?

d

dent from a phpne with no keynoard

-----Original Message-----
From: xxxxx@gmail.com
Sent: November 03, 2010 7:45 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] How to get the include paths of DDK compiler?

Thanks, but is there any built-in include paths of the compiler?


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Well, some tool chains such as MingW has such concept of ‘built-in’ include paths.
I’m now struggling to find the definition of ‘__int64’. Where can I find this symbol?

The SDK help (describes most compiler stuff…) says this:

"The types __int8, __int16, and __int32 are synonyms for the ANSI types that
have the same size, and are useful for writing portable code that behaves
identically across multiple platforms. The __int8 data type is synonymous
with type char, __int16 is synonymous with type short, and __int32 is
synonymous with type int. The __int64 type has no ANSI equivalent. "

Good luck,

Thomas F. Divine


From:
Sent: Wednesday, November 03, 2010 10:58 PM
To: “Windows System Software Devs Interest List”
Subject: RE:[ntdev] How to get the include paths of DDK compiler?

> Well, some tool chains such as MingW has such concept of ‘built-in’
> include paths.
> I’m now struggling to find the definition of ‘__int64’. Where can I find
> this symbol?
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer

Thank you! So that means those types are ‘built-in’ for Microsoft cl compiler and no header file have ever defines such things, right?

I’m going to port the existing driver from xp32 to xp64, and my first thought is that I gonna change all things such as ‘ULONG’ or ‘LONG’ to ‘__int32’ or ‘unsigned __int32’. It will be ok, right?

On Wed, Nov 3, 2010 at 10:22 PM, wrote:
> Thank you! So that means those types are ‘built-in’ for Microsoft cl compiler and no header file have ever defines such things, right?
>
> I’m going to port the existing driver from xp32 to xp64, and my first thought is that I gonna change all things such as ‘ULONG’ or ‘LONG’ to ’ int32’ or 'unsigned int32’. It will be ok, right?
>
If ULONG variable is a pointer then change it to ULONG_PTR

thanks,
–rc

They are intrinsic.

You don’t have to change ULONG or LONG when moving to xp64 unless you want
to do extra work. They will port naturally.

See the WDK topic “Porting Your Driver to 64-Bit Windows” for some advice.
It’s really fairly painless if you read the docs.

Thomas F. Divine
http://www.pcausa.com


From:
Sent: Wednesday, November 03, 2010 11:22 PM
To: “Windows System Software Devs Interest List”
Subject: RE:[ntdev] How to get the include paths of DDK compiler?

> Thank you! So that means those types are ‘built-in’ for Microsoft cl
> compiler and no header file have ever defines such things, right?
>
> I’m going to port the existing driver from xp32 to xp64, and my first
> thought is that I gonna change all things such as ‘ULONG’ or ‘LONG’ to
> ’ int32’ or 'unsigned int32’. It will be ok, right?
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer

Why change them at all? The only reason to change LONG/INT to something else is if it contains a pointer, in which case it should really be a PVOID. Go to http://www.microsoft.com/whdc/driver/64bitguide.mspx and read all of the docs before you start banging on the code

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Wednesday, November 03, 2010 8:22 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] How to get the include paths of DDK compiler?

Thank you! So that means those types are ‘built-in’ for Microsoft cl compiler and no header file have ever defines such things, right?

I’m going to port the existing driver from xp32 to xp64, and my first thought is that I gonna change all things such as ‘ULONG’ or ‘LONG’ to ‘__int32’ or ‘unsigned __int32’. It will be ok, right?


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

! Thank you guys !

> I know that the ‘inc’ directory of winddk and its subdirectories should be considered, but I really want

to know if there is a way to get the complete include paths the DDK compiler uses. Plus, I also want to
know the library paths of the linker.

Run BUILD and look at the logs.

Note: with C, there is no need for such tools, just “Find in Files” is enough.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

> I’m now struggling to find the definition of ‘__int64’. Where can I find this symbol?

No definition, it is embedded to MS’s compiler as intrinsic keyword. See the docs.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

> I’m going to port the existing driver from xp32 to xp64, and my first thought is that I gonna change all

things such as ‘ULONG’ or ‘LONG’ to ‘__int32’ or ‘unsigned __int32’

No need at all.

ULONG is always ‘unsigned __int32’, even on x64.

Pay attention to size_t, pointers and “integer to hold a pointer” (must be ULONG_PTR or size_t), also to HANDLE (which is a pointer type-wise).

Also pay attention to IOCTL buffer structures which contain any of the above.

Also pay attention to any structures with externally defined layout (network protocols, on-disk formats), which contain any of the above.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

>ULONG is always ‘unsigned __int32’, even on x64.

I that it’s ‘typedef unsigned long ULONG;’

mm

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
Sent: Thursday, November 04, 2010 7:56 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] How to get the include paths of DDK compiler?

I’m going to port the existing driver from xp32 to xp64, and my first
thought is that I gonna change all
things such as ‘ULONG’ or ‘LONG’ to ‘__int32’ or ‘unsigned __int32’

No need at all.

ULONG is always ‘unsigned __int32’, even on x64.

Pay attention to size_t, pointers and “integer to hold a pointer” (must be
ULONG_PTR or size_t), also to HANDLE (which is a pointer type-wise).

Also pay attention to IOCTL buffer structures which contain any of the
above.

Also pay attention to any structures with externally defined layout (network
protocols, on-disk formats), which contain any of the above.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer