阅读:1549回复:8
windows 中能用int 13 写软盘吗》? |
|
沙发#
发布于:2001-12-05 15:48
读写软盘可以直接用VWIN32
但是我想知道如何绝对读写物理盘,那位指教? 多谢! |
|
|
板凳#
发布于:2001-12-05 22:29
intel 32 cpu 不是重新定义了int 13吗?还能用他写盘?!windows 是如何执行的呢?
|
|
地板#
发布于:2001-12-06 07:57
directly use vwin32.vxd
createfile(\"\\\\\\\\.\\\\vwin32\"....) vwin32_dioc_dos_int13 etc. |
|
|
地下室#
发布于:2001-12-17 16:54
to:ycxu
可以做一个16位dll,在其中使用DPMI,在W32中调用dll16. |
|
5楼#
发布于:2001-12-18 17:02
谢谢你的回复
我已经用bc31做一个16dll,但是在调用DLL中的函数和进行数据传送时出现问题, 请问应用程序如何调用DLL函数?可否提供相关的信息或资料(信息)? |
|
|
6楼#
发布于:2001-12-20 18:07
标准的做法是使用THUNK机制,可参考TASM 5.0的例子(需做
DLL32),使用未公开的函数也可以,可参考《WIN95系统编程奥秘》。 |
|
7楼#
发布于:2002-03-24 13:36
可以写一个VXD,用嵌套执行来使用INT13,
具体参见《System programming for win95>> |
|
8楼#
发布于:2002-03-24 18:14
如果是读写软盘或是只读硬盘而不写硬盘比较简单:
#include <windows.h> #define VWIN32_DIOC_DOS_INT25 2 #define VWIN32_DIOC_DOS_INT26 3 #define VWIN32_DIOC_DOS_DRIVEINFO 6 typedef struct _DIOC_REGISTERS { DWORD reg_EBX; DWORD reg_EDX; DWORD reg_ECX; DWORD reg_EAX; DWORD reg_EDI; DWORD reg_ESI; DWORD reg_Flags; } DIOC_REGISTERS, *PDIOC_REGISTERS; #define CARRY_FLAG 1 #pragma pack(1) typedef struct _DISKIO { DWORD dwStartSector; // starting logical sector number WORD wSectors; // number of sectors DWORD dwBuffer; // address of read/write buffer } DISKIO, * PDISKIO; #pragma pack() NewReadSectors(hDev, bDrive, dwStartSector, wSectors, lpSectBuff) Purpose: Reads the specified number of sectors into a caller-supplied buffer. Uses Int 21h function 7305h Parameters: hDev Handle of VWIN32 bDrive The MS-DOS logical drive number. 0 = default, 1 = A, 2 = B, 3 = C, etc. dwStartSector The first sector to read. wSectors The number of sectors to read. lpSectBuff The caller-supplied buffer to read into. Return Value: Returns TRUE if successful, or FALSE if failure. Comments: This function does not validate its parameters. It assumes that lpSectBuff is allocated by the caller and is large enough to hold all of the data from all of the sectors being read. ------------------------------------------------------------------*/ BOOL NewReadSectors (HANDLE hDev, BYTE bDrive, DWORD dwStartSector, WORD wSectors, LPBYTE lpSectBuff) { BOOL fResult; DWORD cb; DIOC_REGISTERS reg = {0}; DISKIO dio; dio.dwStartSector = dwStartSector; dio.wSectors = wSectors; dio.dwBuffer = (DWORD)lpSectBuff; reg.reg_EAX = 0x7305; // Ext_ABSDiskReadWrite reg.reg_EBX = (DWORD)&dio; reg.reg_ECX = -1; reg.reg_EDX = bDrive; // Int 21h, fn 7305h drive numbers are 1-based fResult = DeviceIoControl(hDev, VWIN32_DIOC_DOS_DRIVEINFO, ®, sizeof(reg), ®, sizeof(reg), &cb, 0); // Determine if the DeviceIoControl call and the read succeeded. fResult = fResult && !(reg.reg_Flags & CARRY_FLAG); return fResult; } /*------------------------------------------------------------------ NewWriteSectors(hDev, bDrive, dwStartSector, wSectors, lpSectBuff) Purpose: Writes the specified number of sectors from a caller-supplied buffer. Uses Int 21h function 7305h Parameters: hDev Handle of VWIN32 bDrive The MS-DOS logical drive number. 0 = default, 1 = A, 2 = B, 3 = C, etc. dwStartSector The first sector to write. wSectors The number of sectors to write. lpSectBuff The caller-supplied buffer from which to write. Return Value: Returns TRUE if successful, or FALSE if failure. Comments: This function does not validate its parameters. It assumes that lpSectBuff is allocated by the caller and is large enough to hold all of the data to be written. ------------------------------------------------------------------*/ BOOL NewWriteSectors (HANDLE hDev, BYTE bDrive, DWORD dwStartSector, WORD wSectors, LPBYTE lpSectBuff) { BOOL fResult; DWORD cb; DIOC_REGISTERS reg = {0}; DISKIO dio; dio.dwStartSector = dwStartSector; dio.wSectors = wSectors; dio.dwBuffer = (DWORD)lpSectBuff; reg.reg_EAX = 0x7305; // Ext_ABSDiskReadWrite reg.reg_EBX = (DWORD)&dio; reg.reg_ECX = -1; reg.reg_EDX = bDrive; // Int 21h, fn 7305h drive numbers are 1-based reg.reg_ESI = 0x6001; // Normal file data (See function // documentation for other values) fResult = DeviceIoControl(hDev, VWIN32_DIOC_DOS_DRIVEINFO, ®, sizeof(reg), ®, sizeof(reg), &cb, 0); // Determine if the DeviceIoControl call and the write succeeded. fResult = fResult && !(reg.reg_Flags & CARRY_FLAG); return fResult; } //调用如下: HANDLE hDisk; hDisk=CreateFile(\"\\\\\\\\.\\\\vwin32\",0,0,NULL,0, FILE_FLAG_DELETE_ON_CLOSE,NULL); if(hDisk!=INVALID_HANDLE_VALUE) { //printf(\"\\n Read Sector Sector %,StartSectors); if(!NewReadSectors(hDisk,Driver,StartSectors, NumSectors,lpBuff)) { printf(\"Read Failed!\"); CloseHandle(hDisk); return FALSE; } //此代码不能对硬盘写,是因为windows的保护原因。我用来读硬盘的任意扇区没问题,软盘可任意读写。 |
|
|