运行时函数就是编译器会根据你写的底层的硬件再将你自己写的调用了API的代码翻译成底层可以用的代码。
1 #define BUFFER_SIZE 1024 2 void RtlTest() 3 { 4 PUCHAR pBuffer = (PUCHAR)ExAllocatePool(PagedPool, BUFFER_SIZE);//申请内存 5 //用0填充内存 6 RtlZeroMemory(pBuffer, BUFFER_SIZE); 7 8 9 PUCHAR pBuffer2 = (PUCHAR)ExAllocatePool(PagedPool, BUFFER_SIZE); 10 //用固定字节填充内存 11 RtlFillMemory(pBuffer2, BUFFER_SIZE, 0xAA); 12 13 //内存复制 14 RtlCopyMemory(pBuffer, pBuffer2, BUFFER_SIZE); 15 16 //判断内存是否一致 17 ULONG ulRet = RtlCompareMemory(pBuffer, pBuffer2, BUFFER_SIZE); 18 if (ulRet == BUFFER_SIZE) 19 { 20 KdPrint(("The two block are same.\n")); 21 } 22 ExFreePool(pBuffer); 23 ExFreePool(pBuffer2); 24 }