Fix winnt+ problem with int26 by resetting the drive.

git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@457 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2002-11-09 19:07:11 +00:00
parent bf8d11a9a6
commit 04e8d7a5c6
1 changed files with 25 additions and 0 deletions

View File

@ -386,6 +386,17 @@ fat32readwrite(int DosDrive, void *diskReadPacket, unsigned intno);
modify [cx dx si] \ modify [cx dx si] \
value [ax]; value [ax];
void reset_drive(int DosDrive);
#pragma aux reset_drive = \
"push ds" \
"inc dx" \
"mov ah, 0xd" \
"int 0x21" \
"mov ah,0x32" \
"int 0x21" \
"pop ds" \
parm [dx] \
modify [ax bx];
#else #else
int2526readwrite(int DosDrive, void *diskReadPacket, unsigned intno) int2526readwrite(int DosDrive, void *diskReadPacket, unsigned intno)
{ {
@ -414,6 +425,18 @@ fat32readwrite(int DosDrive, void *diskReadPacket, unsigned intno)
return regs.x.cflag; return regs.x.cflag;
} }
void reset_drive(int DosDrive)
{
union REGS regs;
regs.h.ah = 0xd;
int86(0x21, &regs, &regs);
regs.h.ah = 0x32;
regs.h.dl = DosDrive + 1;
int86(0x21, &regs, &regs);
}
#endif #endif
int MyAbsReadWrite(int DosDrive, int count, ULONG sector, void *buffer, int MyAbsReadWrite(int DosDrive, int count, ULONG sector, void *buffer,
@ -518,6 +541,7 @@ VOID put_boot(COUNT drive, BYTE * bsFile, BOOL both)
printf("Reading old bootsector from drive %c:\n", drive + 'A'); printf("Reading old bootsector from drive %c:\n", drive + 'A');
#endif #endif
reset_drive(drive);
if (MyAbsReadWrite(drive, 1, 0, oldboot, 0x25) != 0) if (MyAbsReadWrite(drive, 1, 0, oldboot, 0x25) != 0)
{ {
printf("can't read old boot sector for drive %c:\n", drive + 'A'); printf("can't read old boot sector for drive %c:\n", drive + 'A');
@ -729,6 +753,7 @@ VOID put_boot(COUNT drive, BYTE * bsFile, BOOL both)
} }
close(fd); close(fd);
} }
reset_drive(drive);
} }
BOOL check_space(COUNT drive, BYTE * BlkBuffer) BOOL check_space(COUNT drive, BYTE * BlkBuffer)