Win95/98/NT 下對記憶體、埠、中斷的直接控制和讀寫 (轉)
TVicHw32.DLL version 2.0
Copyright (C) 1997 Victor Ishikeev
e-:
Portions Copyright (C) 1997 EnTech Taiwan
:
AS_DLL.TXT
CONTENTS
========
1. GENERAL TVicHW32 FUNCTIONS
2. DIRECT MEMORY ACCESS WITH TVicHW32
3. DIRECT PORT I/O WITH TVicHW32
4. HARDWARE INTERRUPT HANDLING WITH TVicHW32
5. CONTACT INFORMATION
1. GENERAL TVicHW32 FUNCTIONS
====================================================
TVicHW32 has the following general functions:
bool VICFN OpenTVicHW32(void);
-------------------------------
Loads the vichwXX.vxd (under 95) or vichwXX.sys (under
) kernel-mode , providing direct access to the
hardware. If the kernel-mode driver was succesully opened, the
IsDriverOpened() returns True; if the function fails, the IsDriverOpened()
returns False.
void VICFN CloseTVicHW32(void);
----------------------
Closes the kernel-mode driver and releases memory allocated to it.
If a hardware interrupt was "unmasked", the "mask" is restored. If the
driver was successfully closed, the IsDriverOpened() always returns False.
bool VICFN IsDriverOpened (void);
----------------------------------------------
This boolean function specifies whether the kernel-mode driver is open.
Returns True if the driver is already open, or False if it is not.
2. DIRECT MEMORY ACCESS WITH TVicHW32
=====================================
The following function pets direct memory acccess:
void* VICFN MapPhysToLinear(D PhAddr, DWORD Size);
---------------------------------------- ----------------------
Maps a specific physical address to a pointer in linear memory,
where PhAddr is the base address and Size is the actual number of
bytes to which access is required.
Note that a subsequent call to MapPhysToLinear invalidates the
previous pointer.
The following example returns a pointer to the system ROM area:
char *pBios;
OpenVicHW32();
if (IsDriverOpened()) {
pBi= MapPhysToLinear (0xF8000,256); bytes beginning at $F8000
with pBIOS...
CloseVicHW32();
}
else ... // failed
3. DIRECT PORT I/O WITH TVicHW32
================================
The following functions permit direct I/O port access:
------------------------------------------------------
BYTE VICFN ReadPort (WORD wPortAddress); // read one byte
WORD VICFN ReadPortW (WORD wPortAddress); // read one word
DWORD VICFN ReadPortL (WORD wPortAddress); // read four bytes
void VICFN WritePort (WORD wPortAddress, BYTE bData); // write one byte
void VICFN WritePortW (WORD wPortAddress, WORD wData); // write one word
void VICFN WritePortL (WORD wPortAddress, DWORD lData); // write four bytes
void VICFN SetHardAccess(bool HardAccess);
-------------------------------------------
The SetHardAccess() function determines whether the kernel-mode driver
should use "hard" or "soft" access to the I/O ports. If set to True
"hard" access is employed; if set to False "soft" access is employed.
"Soft" access provs higher performance access to ports, but may fail
if the port(s) addressed are already in use by another kernel-mode
driver. While slower, "Hard" access provides more reliable access to
ports which have already been opened by another kernel-mode driver.
bool VICFN TestHardAccess(void);
---------------------------------
Returns True is "hard" access is used.
4. HARDWARE INTERRUPT HANDLING WITH TVicHW32
============================================
In a environment, hardware interrupts are normally prohibited
by Windows; the TVicHW32 kernel-mode driver allows you to use the
interrupt for direct handling by your application. Note that only one
interrupt can be handled at a time.
The following functions permit access to hardware interrupts.
void VICFN SetIRQ(BYTE IRQNumber, void * lpfnOnHwInterrupt);
-------------------------------------------------------------
Assign the interrupt specified by the IRQNumber value (1..15) to
the lpfnOnHwInterrrupt() handler. If success then IsIRQSet() function
(see below) returns True.
Note that IRQ0 (the system timer) is *not* supported.
bool VICFN IsIRQSet(void);
----------------------------------------
Specifies whether the hardware interrupt handler has been
created by the SetIRQ method.
void VICFN UnMaskIRQ(void);
----------------------------
Physically unmasks the hardware interrupt specified by the IRQNumber
property, so that an lpfnOnHWInterrupt function will be generated
when a hardware interrupt occurs.
void VICFN MaskIRQ(void);
--------------------------
Physically masks the hardware interrupt specified by the IRQNumber value.
bool VICFN IsMasked(void);
---------------------------
Function which specifies whether the hardware interrupt
handler has been physically masked (True).
void VICFN DestroyIRQ(void);
-----------------------------
Frees the memory and code previously assigned for the hardware
interrupt specified by the IRQNumber value.
DWORD VICFN GetInterruptCounter(void);
--------------------------------------
Function which counts the number of hardware interrupts
intercepted by the TVicHW32 kernel-mode driver. The GetInterruptCounter()
function is provided largely for deging purposes, allowing you to
compare the actual number of hardware interrupts generated with the
number processed by your application.
void VICFN SimulateHWInt(void);
-------------------------------
This function is provided for purposes of debugging, and allows you to
simulate a hardware interrupt. When this procedure is called, the TVicHW32
kernel-mode driver will feign a "hardware interrupt", without directly
affecting the hardware.
5. CONTACT INFORMATION
======================
Comments, questions and suggestions regarding TVicHW32 can be directed
by e-mail to or .
With best wishes,
Victor Ishikeev
Jun 1997
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10752043/viewspace-988397/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Windows 95/98下直接訪問實體記憶體 (轉)Windows記憶體
- 讀寫CMOS記憶體 (轉)記憶體
- 直接記憶體和堆記憶體誰快記憶體
- [轉載] Java直接記憶體與堆記憶體Java記憶體
- Win98、NT和Linux的共存 NT的OS Loader ntosknl.exe (轉)Linux
- 直接記憶體記憶體
- 【轉】java中的記憶體溢位和記憶體洩漏Java記憶體溢位
- CIH病毒原理的應用——實體記憶體的讀寫 (轉)記憶體
- Linux讀寫實體記憶體Linux記憶體
- C++Builder下實現埠讀寫 (轉)C++UI
- Centos下10000次迴圈測試php對Redis和共享記憶體(shm)讀寫效率CentOSPHPRedis記憶體
- I/O埠和I/O記憶體記憶體
- 【轉lis的文章】Linux 下判斷Server 記憶體是否不足LinuxServer記憶體
- python能讀寫記憶體嗎Python記憶體
- 7.7 實現程式記憶體讀寫記憶體
- WallPaper Changer 2.5 for Windows 98/NTWindows
- 針對持久記憶體的後寫日誌記憶體
- 如何診斷 Java 中的記憶體洩露Java記憶體洩露
- 記憶體不能為read 記憶體讀寫錯誤的解決辦法記憶體
- 利用串列埠下載檔案到記憶體(SDRAM)中(loadb命令)串列埠記憶體
- 物理讀和記憶體讀較高SQL記憶體SQL
- 什麼是Java記憶體模型(JMM)中的主記憶體和本地記憶體?Java記憶體模型
- 遊戲記憶體對比普通記憶體區別 遊戲記憶體和普通記憶體相差大嗎?遊戲記憶體
- 堆記憶體和棧記憶體詳解(轉載)記憶體
- 用匯編編寫DOS下的記憶體駐留程式(5) (轉)記憶體
- 用匯編編寫DOS下的記憶體駐留程式(3) (轉)記憶體
- 用匯編編寫DOS下的記憶體駐留程式(4) (轉)記憶體
- 在servlet中直接寫埠傳送郵件的例子 (轉)Servlet
- Java堆外直接記憶體回收Java記憶體
- Linux 下判斷Server 記憶體是否不足LinuxServer記憶體
- 記憶體安全週報第98期 |“打砸搶”式攻擊:Office文件直接推送勒索軟體AstraLocker 2.0記憶體AST
- Linux下FrameBuffer直接寫屏(轉)Linux
- JS中的棧記憶體、堆記憶體JS記憶體
- Aix下檢視記憶體命令 -- 轉AI記憶體
- 控制C++的記憶體分配C++記憶體
- JavaScript 事件對記憶體和效能的影響JavaScript事件記憶體
- 在VisualStudio98 中 直 接 構 造NT kmode 驅 動 程 序 (轉)
- 來了解一下記憶體溢位和記憶體洩漏記憶體溢位