Init.cpp
上传用户:yitai_qhd
上传日期:2008-04-24
资源大小:31k
文件大小:2k
- #include "hookndis.h"
- #include "init.h"
- #include "hook.h"
- #include "myfun.h"
- #include "fun.h"
- #include "memory.h"
- #include "WINDEF.H"
- #pragma code_seg("INIT")
- extern "C"
- NTSTATUS DriverEntry( IN PDRIVER_OBJECT DriverObject,
- IN PUNICODE_STRING RegistryPath)
- {
- PVOID m_NdisBaseAddress=NULL;
- NTSTATUS status = STATUS_SUCCESS;
- if(GetNdisModuleAddress(m_NdisBaseAddress) && m_NdisBaseAddress != NULL)
- {
- if(HookFun(m_NdisBaseAddress, "NdisSend", MY_NdisSend, (ULONG*)&m_pNdisSend) == NULL)
- dprintf(("Hook NdisSend Failuren"));
- else
- dprintf(("Hook NdisSend Successn"));
-
- if(HookFun(m_NdisBaseAddress, "NdisRegisterProtocol", MY_NdisRegisterProtocol, (ULONG*)&m_pNdisRegisterProtocol) == NULL
- )
- dprintf(("Hook NdisRegisterProtocol Failuren"));
- else
- dprintf(("Hook NdisRegisterProtocol Successn"));
-
- if(HookFun(m_NdisBaseAddress, "NdisOpenAdapter", MY_NdisOpenAdapter, (ULONG*)&m_pNdisOpenAdapter) == NULL
- )
- dprintf(("Hook NdisOpenAdapter Failuren"));
- else
- dprintf(("Hook NdisOpenAdapter Successn"));
- }
- DriverObject->MajorFunction[IRP_MJ_CREATE] = Open;
- DriverObject->MajorFunction[IRP_MJ_CLOSE] = Close;
- DriverObject->MajorFunction[IRP_MJ_READ] = Read;
- DriverObject->MajorFunction[IRP_MJ_WRITE] = Write;
- DriverObject->MajorFunction[IRP_MJ_CLEANUP] = Cleanup;
- DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = IoControl;
- return status;
- }
- #pragma code_seg()
- #pragma code_seg("PAGE")
- VOID DbpUnload(IN PDRIVER_OBJECT DriverObject)
- {
- }
- #pragma code_seg()
- //
- // IRP_MJ_CREATE
- //
- NTSTATUS
- Open(
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp
- )
- {
- return 0;
- }
- //
- // IRP_MJ_CLOSE
- //
- NTSTATUS
- Close(
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp
- )
- {
- return 0;
- }
- //
- // IRP_MJ_CLEANUP
- //
- NTSTATUS
- Cleanup(
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp
- )
- {
- return 0;
- }
- //
- // IRP_MJ_READ
- //
- NTSTATUS
- Read(
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp
- )
- {
- return 0;
- }
- //
- // IRP_MJ_WRITE
- //
- NTSTATUS
- Write(
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp
- )
- {
- return 0;
- }
- NTSTATUS
- IoControl(
- IN PDEVICE_OBJECT DeviceObject,
- IN PIRP Irp
- )
- {
- return STATUS_SUCCESS;
- }