moel@347: //----------------------------------------------------------------------------- moel@347: // Author : hiyohiyo moel@347: // Mail : hiyohiyo@crystalmark.info moel@347: // Web : http://openlibsys.org/ moel@347: // License : The modified BSD license moel@347: // moel@347: // Copyright 2007-2008 OpenLibSys.org. All rights reserved. moel@347: //----------------------------------------------------------------------------- moel@347: moel@347: #include moel@347: #include moel@347: #include "OlsIoctl.h" moel@347: moel@347: //----------------------------------------------------------------------------- moel@347: // moel@347: // Device Name moel@347: // moel@347: //----------------------------------------------------------------------------- moel@347: moel@347: #define NT_DEVICE_NAME L"\\Device\\WinRing0_1_2_0" moel@347: #define DOS_DEVICE_NAME L"\\DosDevices\\WinRing0_1_2_0" moel@347: moel@347: //----------------------------------------------------------------------------- moel@347: // moel@347: // Function Prototypes moel@347: // moel@347: //----------------------------------------------------------------------------- moel@347: moel@347: NTSTATUS DriverEntry( moel@347: IN PDRIVER_OBJECT DriverObject, moel@347: IN PUNICODE_STRING RegistryPath moel@347: ); moel@347: moel@347: NTSTATUS OlsDispatch( moel@347: IN PDEVICE_OBJECT pDO, moel@347: IN PIRP pIrp moel@347: ); moel@347: moel@347: VOID Unload( moel@347: IN PDRIVER_OBJECT DriverObject moel@347: ); moel@347: moel@347: //----------------------------------------------------------------------------- moel@347: // moel@347: // Function Prototypes for Control Code moel@347: // moel@347: //----------------------------------------------------------------------------- moel@347: moel@347: NTSTATUS ReadMsr( moel@347: void *lpInBuffer, moel@347: ULONG nInBufferSize, moel@347: void *lpOutBuffer, moel@347: ULONG nOutBufferSize, moel@347: ULONG *lpBytesReturned moel@347: ); moel@347: moel@347: NTSTATUS WriteMsr( moel@347: void *lpInBuffer, moel@347: ULONG nInBufferSize, moel@347: void *lpOutBuffer, moel@347: ULONG nOutBufferSize, moel@347: ULONG *lpBytesReturned moel@347: ); moel@347: moel@347: NTSTATUS ReadPmc( moel@347: void *lpInBuffer, moel@347: ULONG nInBufferSize, moel@347: void *lpOutBuffer, moel@347: ULONG nOutBufferSize, moel@347: ULONG *lpBytesReturned moel@347: ); moel@347: moel@347: NTSTATUS ReadIoPort( moel@347: ULONG ioControlCode, moel@347: void *lpInBuffer, moel@347: ULONG nInBufferSize, moel@347: void *lpOutBuffer, moel@347: ULONG nOutBufferSize, moel@347: ULONG *lpBytesReturned moel@347: ); moel@347: moel@347: NTSTATUS WriteIoPort( moel@347: ULONG ioControlCode, moel@347: void *lpInBuffer, moel@347: ULONG nInBufferSize, moel@347: void *lpOutBuffer, moel@347: ULONG nOutBufferSize, moel@347: ULONG *lpBytesReturned moel@347: ); moel@347: moel@347: NTSTATUS ReadPciConfig( moel@347: void *lpInBuffer, moel@347: ULONG nInBufferSize, moel@347: void *lpOutBuffer, moel@347: ULONG nOutBufferSize, moel@347: ULONG *lpBytesReturned moel@347: ); moel@347: moel@347: NTSTATUS WritePciConfig( moel@347: void *lpInBuffer, moel@347: ULONG nInBufferSize, moel@347: void *lpOutBuffer, moel@347: ULONG nOutBufferSize, moel@347: ULONG *lpBytesReturned moel@347: ); moel@347: moel@347: NTSTATUS ReadMemory( moel@347: void *lpInBuffer, moel@347: ULONG nInBufferSize, moel@347: void *lpOutBuffer, moel@347: ULONG nOutBufferSize, moel@347: ULONG *lpBytesReturned moel@347: ); moel@347: moel@347: NTSTATUS WriteMemory( moel@347: void *lpInBuffer, moel@347: ULONG nInBufferSize, moel@347: void *lpOutBuffer, moel@347: ULONG nOutBufferSize, moel@347: ULONG *lpBytesReturned moel@347: ); moel@347: moel@347: moel@347: //----------------------------------------------------------------------------- moel@347: // moel@347: // Support Function Prototypes moel@347: // moel@347: //----------------------------------------------------------------------------- moel@347: moel@347: NTSTATUS pciConfigRead(ULONG pciAddress, ULONG offset, void *data, int length); moel@347: NTSTATUS pciConfigWrite(ULONG pciAddress, ULONG offset, void *data, int length);