External/WinRing0/OpenLibSys.h
author moel.mich
Sat, 07 Sep 2013 08:07:11 +0000
changeset 423 47f5dcaf8e9f
permissions -rw-r--r--
Fixed an issue with the Nuvoton NCT6791D (hardware monitor i/o space lock wasn't disabled before attempting to read data).
     1 //-----------------------------------------------------------------------------
     2 //     Author : hiyohiyo
     3 //       Mail : hiyohiyo@crystalmark.info
     4 //        Web : http://openlibsys.org/
     5 //    License : The modified BSD license
     6 //
     7 //                     Copyright 2007-2008 OpenLibSys.org. All rights reserved.
     8 //-----------------------------------------------------------------------------
     9 
    10 #include <ntddk.h>
    11 #include <devioctl.h>
    12 #include "OlsIoctl.h"
    13 
    14 //-----------------------------------------------------------------------------
    15 //
    16 // Device Name
    17 //
    18 //-----------------------------------------------------------------------------
    19 
    20 #define NT_DEVICE_NAME	L"\\Device\\WinRing0_1_2_0"
    21 #define DOS_DEVICE_NAME	L"\\DosDevices\\WinRing0_1_2_0"
    22 
    23 //-----------------------------------------------------------------------------
    24 //
    25 // Function Prototypes
    26 //
    27 //-----------------------------------------------------------------------------
    28 
    29 NTSTATUS	DriverEntry(
    30 				IN PDRIVER_OBJECT DriverObject,
    31 				IN PUNICODE_STRING RegistryPath
    32 			);
    33 
    34 NTSTATUS	OlsDispatch(
    35 				IN PDEVICE_OBJECT pDO,
    36 				IN PIRP pIrp
    37 			);
    38 
    39 VOID		Unload(
    40 				IN PDRIVER_OBJECT DriverObject
    41 			);
    42 
    43 //-----------------------------------------------------------------------------
    44 //
    45 // Function Prototypes for Control Code
    46 //
    47 //-----------------------------------------------------------------------------
    48 
    49 NTSTATUS	ReadMsr(
    50 				void *lpInBuffer, 
    51 				ULONG nInBufferSize, 
    52 				void *lpOutBuffer, 
    53 				ULONG nOutBufferSize, 
    54 				ULONG *lpBytesReturned
    55 			);
    56 
    57 NTSTATUS	WriteMsr(
    58 				void *lpInBuffer, 
    59 				ULONG nInBufferSize, 
    60 				void *lpOutBuffer, 
    61 				ULONG nOutBufferSize, 
    62 				ULONG *lpBytesReturned
    63 			);
    64 			
    65 NTSTATUS	ReadPmc(
    66 				void *lpInBuffer, 
    67 				ULONG nInBufferSize, 
    68 				void *lpOutBuffer, 
    69 				ULONG nOutBufferSize, 
    70 				ULONG *lpBytesReturned
    71 			);
    72 
    73 NTSTATUS	ReadIoPort(
    74 				ULONG ioControlCode,
    75 				void *lpInBuffer, 
    76 				ULONG nInBufferSize, 
    77 				void *lpOutBuffer, 
    78 				ULONG nOutBufferSize, 
    79 				ULONG *lpBytesReturned
    80 			);
    81 
    82 NTSTATUS	WriteIoPort(
    83 				ULONG ioControlCode,
    84 				void *lpInBuffer, 
    85 				ULONG nInBufferSize, 
    86 				void *lpOutBuffer, 
    87 				ULONG nOutBufferSize, 
    88 				ULONG *lpBytesReturned
    89 			);
    90 
    91 NTSTATUS	ReadPciConfig(
    92 				void *lpInBuffer, 
    93 				ULONG nInBufferSize, 
    94 				void *lpOutBuffer, 
    95 				ULONG nOutBufferSize, 
    96 				ULONG *lpBytesReturned
    97 			);
    98 
    99 NTSTATUS	WritePciConfig(
   100 				void *lpInBuffer, 
   101 				ULONG nInBufferSize, 
   102 				void *lpOutBuffer, 
   103 				ULONG nOutBufferSize, 
   104 				ULONG *lpBytesReturned
   105 			);
   106 			
   107 NTSTATUS	ReadMemory(
   108 				void *lpInBuffer, 
   109 				ULONG nInBufferSize, 
   110 				void *lpOutBuffer, 
   111 				ULONG nOutBufferSize, 
   112 				ULONG *lpBytesReturned
   113 			);
   114 
   115 NTSTATUS	WriteMemory(
   116 				void *lpInBuffer, 
   117 				ULONG nInBufferSize, 
   118 				void *lpOutBuffer, 
   119 				ULONG nOutBufferSize, 
   120 				ULONG *lpBytesReturned
   121 			);
   122 
   123 
   124 //-----------------------------------------------------------------------------
   125 //
   126 // Support Function Prototypes
   127 //
   128 //-----------------------------------------------------------------------------
   129 
   130 NTSTATUS pciConfigRead(ULONG pciAddress, ULONG offset, void *data, int length);
   131 NTSTATUS pciConfigWrite(ULONG pciAddress, ULONG offset, void *data, int length);