阅读394 返回首页    go 阿里云 go 技术社区[云栖]


[原创]浅谈如何使用gcc开发NT核心驱动程序

 [原创]浅谈如何使用gcc开发NT核心驱动程序

   

;****************************************************************
.code INIT
;****************************************************************

        pusRegistryPath:PUNICODE_STRING
 
 local status:NTSTATUS    

 invoke DbgPrint,$CTA0("enter driverentry")

 invoke DbgPrint,addr szenter


 invoke DbgPrint,addr szleave
  
 mov eax, status

DriverEntry endp
;****************************************************************
         end DriverEntry

;****************************************************************
.code INIT
;****************************************************************

DriverEntry proc pDriverObject:PDRIVER_OBJECT,/

        pusRegistryPath:PUNICODE_STRING
 
 local status:NTSTATUS    

  jmp Real_Start

  szenter db "enter driverentry",0
  szleave db "leave driverentry",0

Real_Start:

 mov status,STATUS_DEVICE_CONFIGURATION_ERROR

 invoke DbgPrint,addr szenter

;do someting you want!


 invoke DbgPrint,addr szleave
  
 mov eax, status

 ret

DriverEntry endp
;****************************************************************
         end DriverEntry

 invoke DbgPrint,$CTA0("enter driverentry")
 
 invoke DbgPrint,$CTA0("leave driverentry")

puts("So Cool!");

#include <stdio.h>
#include "ddk/ntddk.h"

_stdcall NTSTATUS DriverEntry(PDRIVER_OBJECT pDriverObject,/
 PUNICODE_STRING pRegistryPath)
{
 NTSTATUS status = STATUS_DEVICE_CONFIGURATION_ERROR;
 
 DbgPrint("enter DriverEntry,I'm Hopy!/n");
 
 DbgPrint("Leave DriverEntry,byb :)!/n");
 
 return status;
}

    总结如下:

    使用gcc编写NT下的驱动十分方便,只需要

    gcc 包 + MS link + 一个好用的编辑器 即可。 :)

 

最后更新:2017-04-02 00:06:27

  上一篇:go 请删除你的NPP吧,可以用EmEditor,MadEdit,PSPad等编辑工具!
  下一篇:go 六度分隔与最短路径