zylthinking
驱动牛犊
驱动牛犊
  • 注册日期2006-03-22
  • 最后登录2009-07-28
  • 粉丝0
  • 关注0
  • 积分62分
  • 威望9点
  • 贡献值0点
  • 好评度7点
  • 原创分0分
  • 专家分0分
阅读:1997回复:0

*(volatile UCHAR * const)MM_USER_PROBE_ADDRESS = 0 是不是就是为了引发一个访问异常?

楼主#
更多 发布于:2008-03-21 10:52
如下函数:

VOID
ProbeForRead(
    __in_bcount(Length) VOID *Address,
    __in SIZE_T Length,
    __in ULONG Alignment
    )

/*++

Routine Description:

    This function probes a structure for read accessibility and ensures
    correct alignment of the structure. If the structure is not accessible
    or has incorrect alignment, then an exception is raised.

Arguments:

    Address - Supplies a pointer to the structure to be probed.

    Length - Supplies the length of the structure.

    Alignment - Supplies the required alignment of the structure expressed
        as the number of bytes in the primitive datatype (e.g., 1 for char,
        2 for short, 4 for long, and 8 for quad).

Return Value:

    None.

--*/

{

    PAGED_CODE();

    ASSERT((Alignment == 1) || (Alignment == 2) ||
           (Alignment == 4) || (Alignment == 8) ||
           (Alignment == 16));

    if (Length != 0) {
        if (((ULONG_PTR)Address & (Alignment - 1)) != 0) {
            ExRaiseDatatypeMisalignment();

        } else if ((((ULONG_PTR)Address + Length) > (ULONG_PTR)MM_USER_PROBE_ADDRESS) ||
                   (((ULONG_PTR)Address + Length) < (ULONG_PTR)Address)) {

           *(volatile UCHAR * const)MM_USER_PROBE_ADDRESS = 0;
        }
    }
}
游客

返回顶部