danielxu22
驱动中牛
驱动中牛
  • 注册日期2002-11-22
  • 最后登录2014-03-24
  • 粉丝0
  • 关注1
  • 积分2分
  • 威望18点
  • 贡献值0点
  • 好评度7点
  • 原创分0分
  • 专家分0分
阅读:1673回复:6

请大家总结以下宏的作用

楼主#
更多 发布于:2003-07-14 15:20
ASSERT
C_ASSERT
UNREFERENCED_PARAMETER
ARGUMENT_PRESENT
PAGED_CODE
alloc_text(INIT/PAGE/PAGESRP0/PAGESER/...,FuncName)
以及打印语句
DbgPrint
今天我发现我家的金鱼淹死了,:(
danielxu22
驱动中牛
驱动中牛
  • 注册日期2002-11-22
  • 最后登录2014-03-24
  • 粉丝0
  • 关注1
  • 积分2分
  • 威望18点
  • 贡献值0点
  • 好评度7点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2003-07-14 15:51
ASSERT:
VOID  ASSERT(Expression);
The ASSERT routine tests an expression. If the expression is false, a breakpoint occurs. On a free build, ASSERT has no effect.

C_ASSERT:
This handy macro will perform compile time assertion checking in your code.

UNREFERENCED_PARAMETER:
???

ARGUMENT_PRESENT:
ARGUMENT_PRESENT is a macro that takes an argument pointer and returns FALSE if the pointer is NULL, TRUE otherwise.


PAGED_CODE:
The PAGED_CODE macro ensures that the calling thread is running at an IRQL that is low enough to permit paging. If the IRQL > APC_LEVEL, PAGED_CODE() causes the system to ASSERT.


alloc_text:
???


还有RtlAssert???

我只找到这么多,其中似懂非懂,不是很明确,希望大家来补充
 :D :D :D
今天我发现我家的金鱼淹死了,:(
arthurtu
驱动巨牛
驱动巨牛
  • 注册日期2001-11-08
  • 最后登录2020-12-19
  • 粉丝0
  • 关注0
  • 积分26分
  • 威望161点
  • 贡献值0点
  • 好评度35点
  • 原创分0分
  • 专家分0分
  • 社区居民
板凳#
发布于:2003-07-14 16:16
UNREFERENCED_PARAMETER:
我记得是为了把参数用一下,免得warning出来,说参数没有用。其实什么也没有干。

alloc_text
多了。alloc_text(INIT, DriverEntry)把DriverEntry放到初始化节,等等。
escape
驱动老牛
驱动老牛
  • 注册日期2002-02-01
  • 最后登录2004-08-20
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
地板#
发布于:2003-07-14 16:46
PAGED_CODE其实也是assert的用法
danielxu22
驱动中牛
驱动中牛
  • 注册日期2002-11-22
  • 最后登录2014-03-24
  • 粉丝0
  • 关注1
  • 积分2分
  • 威望18点
  • 贡献值0点
  • 好评度7点
  • 原创分0分
  • 专家分0分
地下室#
发布于:2003-07-15 15:08
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.
今天我发现我家的金鱼淹死了,:(
danielxu22
驱动中牛
驱动中牛
  • 注册日期2002-11-22
  • 最后登录2014-03-24
  • 粉丝0
  • 关注1
  • 积分2分
  • 威望18点
  • 贡献值0点
  • 好评度7点
  • 原创分0分
  • 专家分0分
5楼#
发布于:2003-07-15 15:10
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
今天我发现我家的金鱼淹死了,:(
danielxu22
驱动中牛
驱动中牛
  • 注册日期2002-11-22
  • 最后登录2014-03-24
  • 粉丝0
  • 关注1
  • 积分2分
  • 威望18点
  • 贡献值0点
  • 好评度7点
  • 原创分0分
  • 专家分0分
6楼#
发布于:2003-07-16 14:08
> ASSERT

Debug print and int 3 if the condition is false in runtime.

> C_ASSERT

Compiler error if condition is false in compile time.

> UNREFERENCED_PARAMETER

Suppress the \"parameter not use\" compiler warning.

> ARGUMENT_PRESENT

Compares the parameter to NULL.

> PAGED_CODE

ASSERT( KeGetCurrentIrql() < DISPATCH_LEVEL )

Must be used in any function which is declared in pageable code
segment, to catch the cases if it is called on high IRQL - which is a
catastrophic bug.

> alloc_text(INIT/PAGE/PAGESRP0/PAGESER/...,FuncName)

Declares the code or the global variables as pageable.

> RtlAssert

Nearly same as ASSERT.

> DbgPrint

Prints something to the attached kernel debugger, no-op if no such
debugger.
Note KdPrint is more correct.

> bugcheck

Emergency OS stop with blue screen of death. You can cause it in your
code by calling KeBugCheck or KeBugCheckEx.

    Max


.

今天我发现我家的金鱼淹死了,:(
游客

返回顶部