資源簡介
Windows下直接寫屏c語言驅動源碼,找到顯卡的顯存地址,寫入數據,即可在屏幕上顯示出來!
代碼片段和文件信息
#include?
VOID?onunload(?IN?PDRIVER_object?Driverobject?)
{
DbgPrint(“My?Driver?Unloaded!“);
}
NTSTATUS?DriverEntry(?IN?PDRIVER_object?theDriverobject?IN?PUNICODE_STRING?theRegistryPath?)
{
LARGE_INTEGER?PhysicalAddress;
PVOID?pDisplayMem;
PVOID?pTemp;
ULONG?i?=?0;
ULONG?uWidth?=?1280; //?分辨率是1280*1024
ULONG?uHeight?=?1024;
ULONG?uLen?=?4*uWidth*uHeight;//?4個byte表示一個象素
DbgPrint(“My?Driver?Loaded!“);
theDriverobject->DriverUnload?=?onunload;
PhysicalAddress.LowPart?=?0xe0000000;?//在我電腦上,顯卡內存映射的起始地址
PhysicalAddress.HighPart?=?0;?
pDisplayMem?=?MmMapIoSpace(PhysicalAddress?uLen?MmNonCached?);
for?(?i?=?0;i {
if?(i {
//填充一個象素
(char)(*(char*)((ULONG)pDisplayMem?+?i?)?)?=?0xFF; //r
(char)(*(char*)((ULONG)pDisplayMem?+?i?+?1)?)?=?0xFF; //g
(char)(*(char*)((ULONG)pDisplayMem?+?i?+?2)?)?=?0xFF; //b
(char
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1854??2010-11-18?10:04??DirectDisplay.c
-----------?---------??----------?-----??----
?????????????????1854????????????????????1
- 上一篇:c++基礎代碼
- 下一篇:linux c++實現https
評論
共有 條評論