RTL記憶體函數

來源:互聯網
上載者:User
VOID RTL_Test(){const int BUFSIZE=1024;UCHAR* pBuf1=(UCHAR*)ExAllocatePool(PagedPool,BUFSIZE);// 分配記憶體KdPrint(("分配的記憶體位址pBuf1=%08X",pBuf1));UCHAR* pBuf2=(UCHAR*)ExAllocatePool(PagedPool,BUFSIZE);// 分配記憶體KdPrint(("分配的記憶體位址pBuf2=%08X",pBuf2));RtlZeroMemory(pBuf1,BUFSIZE);// 記憶體清零KdPrint(("將記憶體位址pBuf1=%08X初始化為零",pBuf1));RtlFillMemory(pBuf2,BUFSIZE,0xAA);// 記憶體填充為0xAAKdPrint(("將記憶體位址pBuf2=%08X填充為0xAA",pBuf2));if (BUFSIZE==RtlCompareMemory(pBuf1,pBuf2,BUFSIZE))// 記憶體比較{KdPrint(("記憶體 %08X 和記憶體 %08X 相等",pBuf1,pBuf2));}else{KdPrint(("記憶體 %08X 和記憶體 %08X 不相等",pBuf1,pBuf2));}RtlCopyMemory(pBuf2,pBuf1,BUFSIZE);// 記憶體拷貝KdPrint(("將記憶體位址pBuf1=%08X拷貝到記憶體位址pBuf2=%08X",pBuf1,pBuf2));RtlMoveMemory(pBuf2,pBuf1,BUFSIZE);// 記憶體移動KdPrint(("將記憶體位址pBuf1=%08X移動到記憶體位址pBuf2=%08X",pBuf1,pBuf2));if (BUFSIZE==RtlCompareMemory(pBuf1,pBuf2,BUFSIZE))// 記憶體比較{KdPrint(("記憶體 %08X 和記憶體 %08X 相等",pBuf1,pBuf2));}else{KdPrint(("記憶體 %08X 和記憶體 %08X 不相等",pBuf1,pBuf2));}ExFreePool(pBuf1);// 釋放記憶體ExFreePool(pBuf2);}

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.