码迷,mamicode.com
首页 > 其他好文 > 详细

MinGW 可以编译驱动的

时间:2019-09-17 17:38:12      阅读:107      评论:0      收藏:0      [点我收藏+]

标签:try   -o   ali   nat   alignment   ima   ase   string   编译   

#include <ddk/ntddk.h>

static VOID STDCALL
my_unload( IN PDRIVER_OBJECT DriverObject ) {
}

NTSTATUS STDCALL
DriverEntry( IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath ) {
DbgPrint("DriverEntry called\r\n");

DriverObject->DriverUnload = my_unload;

return STATUS_SUCCESS;
}


gcc -o drvtest.obj -O3 -c drvtest.c
ld Drv.obj --subsystem=native --image-base=0x10000 --file-alignment=0x20 --section-alignment=0x20 --entry=_DriverEntry -nostartfiles --nostdlib -L d:\MinGW\lib -shared -l ntoskrnl -o Drv.sys

MinGW 可以编译驱动的

标签:try   -o   ali   nat   alignment   ima   ase   string   编译   

原文地址:https://www.cnblogs.com/csnd/p/11535427.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!