Can anybody explan these macros?

ASSERT
C_ASSERT
UNREFERENCED_PARAMETER
ARGUMENT_PRESENT
PAGED_CODE
alloc_text(INIT/PAGE/PAGESRP0/PAGESER/…,FuncName)
RtlAssert
DbgPrint
bugcheck

Regards
Daniel

Sure – you can if you do a bit of homework. The DDK help has stuff
about ASSERT, and MSDN has stuff about C_ASSERT. So your homework
assignment before the next time you ask us another question about driver
programming is to to search those two sources plus google.com for each
of these terms. You might also find their declarations in the DDK header
files and try to figure them out. We’ll be looking for your report.

In short, as we like to say in the states when people ask questions that
they could answer for themselves, kindly Read The Friendly Manual…

Daniel Xu wrote:

ASSERT
C_ASSERT
UNREFERENCED_PARAMETER
ARGUMENT_PRESENT
PAGED_CODE
alloc_text(INIT/PAGE/PAGESRP0/PAGESER/…,FuncName)
RtlAssert
DbgPrint
bugcheck

Regards
Daniel


Walter Oney, Consulting and Training
Basic and Advanced Driver Programming Seminars
Check out our schedule at http://www.oneysoft.com

Hi Daniel,

I have used only followings:
ASSERT: for making ensure that the expression provided as an argument is
TRUE. If it is false, ur program will exit.
ARGUMENT_PRESENT- to check whether the pointer provided is non NULL. If yes,
then return TRUE otherwise FALSE.
PAGED_CODE: by default the code lies in non paged area. but that is a very
scarce thing in kernel. so we can specify some part of code as paged.
Marking the text as PAGED, we are telling the kernel that the code can be
swapped out of the memory. You MUST be careful while using this.
DbgPrint: it’s just like printf in user mode application. The string is
displayed in the application like DbgView.

These things are explained in detail in MSDN.

Rest of the things someone who has used them can explain.

Amit Manocha
----- Original Message -----
From: “Daniel Xu”
Newsgroups: ntdev
To: “Windows System Software Developers Interest List”
Sent: Monday, July 14, 2003 12:58 AM
Subject: [ntdev] Can anybody explan these macros?

> ASSERT
> C_ASSERT
> UNREFERENCED_PARAMETER
> ARGUMENT_PRESENT
> PAGED_CODE
> (INIT/PAGE/PAGESRP0/PAGESER/…,FuncName)
> RtlAssert
> DbgPrint
> bugcheck
>
> Regards
> Daniel
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@hotmail.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

The first four of these (and a number of other macros) are described in my
article
“Simplifying Development with DDK Macros” at http://www.osronline.com.
RtlAssert,
PAGED_CODE and DbgPrint are well documented in the DDK.

Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting

----- Original Message -----
From: “Daniel Xu”
> Newsgroups: ntdev
> To: “Windows System Software Developers Interest List”

> Sent: Monday, July 14, 2003 12:58 AM
> Subject: [ntdev] Can anybody explan these macros?
>
>
> ASSERT
> C_ASSERT
> UNREFERENCED_PARAMETER
> ARGUMENT_PRESENT
> PAGED_CODE
> (INIT/PAGE/PAGESRP0/PAGESER/…,FuncName)
> RtlAssert
> DbgPrint
> bugcheck
>
> Regards
> Daniel
>
> You are currently subscribed to ntdev as: xxxxx@acm.org
> To unsubscribe send a blank email to xxxxx@lists.osr.com

Nope, this is defintely NOT what PAGED_CODE() does. From wdm.h

#if DBG
#define PAGED_CODE() \
{ if (KeGetCurrentIrql() > APC_LEVEL) { \
KdPrint(( “EX: Pageable code called at IRQL %d\n”,
KeGetCurrentIrql() )); \
ASSERT(FALSE); \
} \
}
#else
#define PAGED_CODE() NOP_FUNCTION;
#endif

All this does is assert that you’re running at <= DISPATCH. If you want to
actually put code into a pageable section you need to use #pragma.

-scott


Scott Noone
Software Engineer
OSR Open Systems Resources, Inc.
http://www.osr.com

PAGED_CODE: by default the code lies in non paged area. but that is a very
scarce thing in kernel. so we can specify some part of code as paged.
Marking the text as PAGED, we are telling the kernel that the code can be
swapped out of the memory. You MUST be careful while using this.

>> All this does is assert that you’re running at <= DISPATCH.

Actually, is clearly < only not <=

Dan

Monday, July 14, 2003, 1:51:05 PM, you wrote:

SN> Nope, this is defintely NOT what PAGED_CODE() does. From wdm.h

SN> #if DBG
SN> #define PAGED_CODE() \
SN> { if (KeGetCurrentIrql() > APC_LEVEL) { \
SN> KdPrint(( “EX: Pageable code called at IRQL %d\n”,
SN> KeGetCurrentIrql() )); \
SN> ASSERT(FALSE); \
SN> } \
SN> }
SN> #else
SN> #define PAGED_CODE() NOP_FUNCTION;
SN> #endif

SN> All this does is assert that you’re running at <= DISPATCH. If you want to
SN> actually put code into a pageable section you need to use #pragma.

SN> -scott


Best regards,
Dan mailto:xxxxx@rdsor.ro

Blast those early morning typos…Thanks for clarifying

-scot


Scott Noone
Software Engineer
OSR Open Systems Resources, Inc.
http://www.osr.com

“Dan Partelly” wrote in message news:xxxxx@ntdev…
>
>
> >> All this does is assert that you’re running at <= DISPATCH.
>
> Actually, is clearly < only not <=
>
> Dan
>
>
> Monday, July 14, 2003, 1:51:05 PM, you wrote:
>
> SN> Nope, this is defintely NOT what PAGED_CODE() does. From wdm.h
>
> SN> #if DBG
> SN> #define PAGED_CODE() <br>> SN> { if (KeGetCurrentIrql() > APC_LEVEL) { <br>> SN> KdPrint(( “EX: Pageable code called at IRQL %d\n”,
> SN> KeGetCurrentIrql() )); <br>> SN> ASSERT(FALSE); <br>> SN> } <br>> SN> }
> SN> #else
> SN> #define PAGED_CODE() NOP_FUNCTION;
> SN> #endif
>
>
> SN> All this does is assert that you’re running at <= DISPATCH. If you
want to
> SN> actually put code into a pageable section you need to use #pragma.
>
> SN> -scott
>
>
>
>
> –
> Best regards,
> Dan mailto:xxxxx@rdsor.ro
>
>
>
>