InitializeWinIo
This function initializes the WinIo library.
bool _stdcall InitializeWinIo();
Parameters
None
Return Values
If the function succeeds, the return value is true. Otherwise, the function returns false.
Remarks
The InitializeWinIo function must be called before using any other function in the library.
Note:
There is no need to invoke the InitializeWinIo function before calling the InstallWinIoDriver and RemoveWinIoDriver functions.
Under Windows NT/2000/XP, calling InitializeWinIo grants the application full access to the I/O address space. Following a call to this function, an application is free to use the _inp/_outp functions provided by the C run-time library to access I/O ports on the system.
ShutdownWinIo
This function performs cleanup of the WinIo library.
void _stdcall ShutdownWinIo();
Parameters
None
Return Values
None
Remarks
The ShutdownWinIo function must be called before terminating the application or in case the WinIo library is no longer required. This function shuts down the WinIo library and frees the resources which were allocated by a call to the InitializeWinIo function.
InstallWinIoDriver
This function installs the WinIo driver.
bool _stdcall InstallWinIoDriver(
PSTR pszWinIoDriverPath,
bool IsDemandLoaded
);
Parameters
pszWinIoDriverPath
[in] Pointer to a null-terminated string that specifies the path to the winio.sys driver.
IsDemandLoaded
[in] This parameter must be set to false.
Return Values
If the function succeeds, the return value is true. Otherwise, the function returns false.
Remarks
The InstallWinIoDriver function installs the WinIo driver and configures it to load automatically when Windows starts. This function fails if called from a non-administrative account.
RemoveWinIoDriver
This function removes the WinIo driver from the system.
bool _stdcall RemoveWinIoDriver();
Parameters
None
Return Values
If the function succeeds, the return value is true. Otherwise, the function returns false.
Remarks
The RemoveWinIoDriver function removes the WinIo driver. This function fails if called from a non-administrative account.
GetPortVal
This function reads a BYTE/WORD/DWORD value from an I/O port.
bool _stdcall GetPortVal(
WORD wPortAddr,
PDWORD pdwPortVal,
BYTE bSize
);
Parameters
wPortAddr
[in] I/O port address
pdwPortVal
[out] Pointer to a DWORD variable that receives the value obtained from the port.
bSize
[in] Number of bytes to read.
Can be 1 (BYTE), 2 (WORD) or 4 (DWORD).
Return Values
If the function succeeds, the return value is true. Otherwise, the function returns false.
Remarks
The GetPortVal function reads a byte, a word or a double word from the specified I/O port.
Note: Under Windows 98/ME, an application must use the GetPortVal function to read values from an I/O port. Under Windows NT/2000/XP, it is possible to use the _inp/_inpw/_inpd functions instead of using GetPortVal, provided that the InitializeWinIo function has been called beforehand.
SetPortVal
This function writes a BYTE/WORD/DWORD value to an I/O port.
bool _stdcall SetPortVal(
WORD wPortAddr,
DWORD dwPortVal,
BYTE bSize
);
Parameters
wPortAddr
[in] I/O port address
dwPortVal
[in] Value to be written to the port
bSize
[in] Number of bytes to write.
Can be 1 (BYTE), 2 (WORD) or 4 (DWORD).
Return Values
If the function succeeds, the return value is true. Otherwise, the function returns false.
Remarks
The SetPortVal function writes a byte, a word or a double word to the specified I/O port.
Note: Under Windows 98/ME, an application must use the SetPortVal function to write values to an I/O port. Under Windows NT/2000/XP, it is possible to use the _outp/_outpw/_outpd functions instead of using SetPortVal, provided that the InitializeWinIo function has been called beforehand.
GetPhysLong
This function reads a double word from the specified physical memory location.
bool _stdcall GetPhysLong(
PBYTE pbPhysAddr,
PDWORD pdwPhysVal
);
Parameters
pbPhysAddr
[in] Pointer to the physical address
pdwPhysVal
[out] Pointer to a DWORD variable that receives the value obtained from the physical memory location.
Return Values
If the function succeeds, the return value is true. Otherwise, the function returns false.
Remarks
The GetPhysLong function reads a double word from the specified physical memory location.
SetPhysLong
This function writes a double word to the specified physical memory location.
bool _stdcall SetPhysLong(
PBYTE pbPhysAddr,
DWORD dwPhysVal
);
Parameters
pbPhysAddr
[in] Pointer to the physical address
dwPhysVal
[in] Specifies a DWORD value to be written to the physical memory location.
Return Values
If the function succeeds, the return value is true. Otherwise, the function returns false.
Remarks
The SetPhysLong function writes a double word to the specified physical memory location.
MapPhysToLin
This function maps a region of physical memory into the linear address space of the application.
PBYTE _stdcall MapPhysToLin(
PBYTE pbPhysAddr,
DWORD dwPhysSize,
HANDLE *pPhysicalMemoryHandle
);
Parameters
pbPhysAddr
[in] Pointer to the physical address
dwPhysSize
[in] Number of bytes to map
pPhysicalMemoryHandle
[out] Points to a variable that will receive the physical memory section handle if this call is successful. This handle should be used as the first parameter when calling the UnmapPhysicalMemory function.
Return Values
If the function succeeds, the return value is the linear address corresponding to the physical address that was passed in pbPhysAddr. Otherwise, the return value is NULL.
Remarks
The MapPhysToLin function maps a region of physical memory into the linear address space of the calling application.
UnmapPhysicalMemory
This function unmaps a region of physical memory which was previously mapped to the linear address space of the application using the MapPhysToLin function.
bool _stdcall UnmapPhysicalMemory(
HANDLE PhysicalMemoryHandle,
PBYTE pbLinAddr
);
Parameters
PhysicalMemoryHandle
[in] Handle to the physical memory section which was returned from the call to the MapPhysToLin function.
pbLinAddr
[in] Linear address which was returned from the call to the MapPhysToLin function.
Return Values
If the function succeeds, the return value is true. Otherwise, the function returns false.
Remarks
The UnmapPhysicalMemory function unmaps a region of physical memory which was previously mapped to the linear address space of the application using the MapPhysToLin function.
Note: Windows 98/ME applications are not required to call this function.