21,459
社区成员
发帖
与我相关
我的任务
分享
#include <stdio.h>
#include <stdlib.h>
#include <dos.h>
#ifdef __cplusplus
#define __CPPARGS ...
#else
#define __CPPARGS
#endif
struct FDPT
{
WORD cylns;/*number of cylinders*/
BYTE heads;/*number of heads*/
WORD srwcc;/*starting reduced write current cylinder (XT only, 0 for others)*/
WORD swpcn;/*starting write precompensation cylinder number*/
BYTE eccburst;/*maximum ECC burst length (XT only)*/
BYTE controlbyte;/*control byte (see #03197,#03198)*/
BYTE stimeout;/*standard timeout (XT only, 0 for others)*/
BYTE ftimeout;/*formatting timeout (XT and WD1002 only, 0 for others)*/
BYTE cdtimeout;/*timeout for checking drive (XT and WD1002 only, 0 for others)*/
WORD lzcyl;/*cylinder number of landing zone (AT and later only)*/
BYTE sects;/*number of sectors per track (AT and later only)*/
BYTE reserved;/*reserved*/
};
typedef struct FDPT FDPT;
void interrupt (*oldint41)(__CPPARGS);
int main()
{
FDPT fdpt;
unsigned char buffer[512];
oldint41 = getvect(0x41);
fdpt = *((FDPT*)oldint41);
fdpt.stimeout=171;/*这里的3个超时有关的参数除了我的硬盘默认的171,114,20以外,改其他数字硬盘立即无响应,但将int41挂回原地址后,马上正常*/
fdpt.ftimeout=114;
fdpt.cdtimeout=20;
setvect(0x41,(DWORD)&fdpt);
biosdisk(0x9,0x80,0,0,0,0,0);/*无论是否重新初始化,也一样的问题*/
biosdisk(0x2,0x80,2,2,16,buffer,1);/*这里死掉了*/
setvect(0x41,oldint41);
return 0;
}