📄 winio.~pas
字号:
unit winio;
interface
uses
Windows;
function InitializeWinIo: boolean; stdcall;
{This function initializes the WinIo library.
For applications running under Windows NT/2000, this function
must be called before calling any other function in the library.
Windows 9x applications are not required to call this function.
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero.}
procedure ShutdownWinIo; stdcall;
{This function performs cleanup of the WinIo library.
For applications running under Windows NT/2000, this function
must be called before terminating the application or when the
WinIo library is no longer required.
Windows 9x applications are not required to call this function.}
function GetPortVal(wPortAddr: WORD; pdwPortVal: PDWORD; bSize: BYTE): boolean; stdcall;
{Use this function to read a BYTE/WORD/DWORD value from an I/O port.
Parameters:
wPortAddr - I/O port address
pdwPortVal - Pointer to a DWORD variable that receives the value
obtained from the port.
bSize - Number of bytes to read.
Can be 1 (BYTE), 2 (WORD) or 4 (DWORD).
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero.}
function SetPortVal(wPortAddr: WORD; dwPortVal: DWORD; bSize: BYTE): boolean; stdcall;
{Use this function to write a BYTE/WORD/DWORD value to an I/O port.
Parameters:
wPortAddr - I/O port address
dwPortVal - A DWORD value to be written to the port
bSize - Number of bytes to write.
Can be 1 (BYTE), 2 (WORD) or 4 (DWORD).
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero.}
function MapPhysToLin(pbPhysAddr: PBYTE; dwPhysSize: DWORD; pPhysicalMemoryHandle: PHANDLE): PBYTE; stdcall;
{Use this function to map a region of physical memory into the linear address
space of a 32-bit Windows application.
Here is an example:
PBYTE pbLinAddr;
HANDLE PhysicalMemoryHandle;
pbLinAddr = MapPhysToLin(0xA0000, 65536, &PhysicalMemoryHandle);
The function will map physical addresses 0xA0000 - 0xAFFFF into the linear
address space of the application. The value returned is a linear address
corresponding to physical address 0xA0000. In case of an error, the return
value is NULL.
Parameters:
pbPhysAddr - Pointer to the physical address
dwPhysSize - Number of bytes to map
pPhysicalMemoryHandle - Points to a variable that will receive the physical memory section
handle if this call is successful. This handle is later used as
the first parameter when calling the UnmapPhysicalMemory function.}
function UnmapPhysicalMemory(PhysicalMemoryHandle: THANDLE; pbLinAddr: PBYTE): boolean; stdcall;
{Use this function to unmap a region of physical memory which was previously mapped
to the linear address space of the application using the MapPhysToLin function.
Windows 9x applications are not required to call this function.
Parameters:
PhysicalMemoryHandle - Handle to the physical memory section which was returned
from the call to the MapPhysToLin function.
pbLinAddr - Linear address which was returned from the call to the MapPhysToLin
function.}
function GetPhysLong(pbPhysAddr: PBYTE; pdwPhysVal: PDWORD): boolean; stdcall;
{This function reads one DWORD from the specified physical address.
Parametes:
pbPhysAddr - Pointer to the physical address
pdwPhysVal - Pointer to a DWORD variable that receives the value
obtained from the physical memory location.
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero.}
function SetPhysLong(pbPhysAddr: PBYTE; dwPhysVal: DWORD): boolean; stdcall;
{This function writes one DWORD to the specified physical address.
Parametes:
pbPhysAddr - Pointer to the physical address
pdwPhysVal - Specifies a DWORD value to be written to the physical
memory location.
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero.}
implementation
function InitializeWinIo; external 'winio.dll';
procedure ShutdownWinIo; external 'winio.dll';
function GetPortVal; external 'winio.dll';
//function SetPortVal; external 'winio.dll';
function MapPhysToLin; external 'winio.dll';
function UnmapPhysicalMemory; external 'winio.dll';
function GetPhysLong; external 'winio.dll';
function SetPhysLong; external 'winio.dll';
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -