閱讀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 六度分隔與最短路徑