tn3rt
tn3rt

Reputation: 270

What does IN mean in Windows device driver functions?

I'm starting to learn how to program Windows drivers but can't seem to find anywhere that contains the definition of IN located in the argument declarations of functions. For example:

NTSTATUS DriverEntry( IN PDRIVER_OBJECT DriverObject, 
                      IN PUNICODE_STRING RegistryPath)

Could someone please explain what IN means?

Upvotes: 2

Views: 189

Answers (3)

isaac
isaac

Reputation: 66

In the WDK this is defined in the ntdef.h file. Normally in your drivers you would just include the ntddk.h or wdm.h files, which will in turn include ntdef.h and other important header files. For example:

#include <ntddk.h>

As mentioned above, this annotation is used for static analysis and is simply defined as

#define IN

Upvotes: 0

Marcel Gheorghita
Marcel Gheorghita

Reputation: 1863

These are called SAL (Source Annotation Language) annotations and there is MSDN documentation on how to use them to benefit from great static analysis.

The actual syntax may differ from one SAL version to another (e.g. IN and _In_). There's backwards compatibility, but I recommend using the latest syntax consistently.

Upvotes: 4

Dipto
Dipto

Reputation: 2738

To my knowledge, it is defined as follows:

///
/// Datum is passed to the function.
///
#define IN

This is used to indicate that the parameter is an input parameter only.

As OUT and OPTIONAL is used to indicate output and optional parameters.

These are maybe for convenience.

Upvotes: 2

Related Questions