From 04e8d7a5c6773a157e835d510223754d1a83c9ec Mon Sep 17 00:00:00 2001 From: Bart Oldeman Date: Sat, 9 Nov 2002 19:07:11 +0000 Subject: [PATCH] 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 --- sys/sys.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/sys/sys.c b/sys/sys.c index 352c423..e6e02c1 100644 --- a/sys/sys.c +++ b/sys/sys.c @@ -386,6 +386,17 @@ fat32readwrite(int DosDrive, void *diskReadPacket, unsigned intno); modify [cx dx si] \ 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 int2526readwrite(int DosDrive, void *diskReadPacket, unsigned intno) { @@ -414,6 +425,18 @@ fat32readwrite(int DosDrive, void *diskReadPacket, unsigned intno) return regs.x.cflag; } + +void reset_drive(int DosDrive) +{ + union REGS regs; + + regs.h.ah = 0xd; + int86(0x21, ®s, ®s); + regs.h.ah = 0x32; + regs.h.dl = DosDrive + 1; + int86(0x21, ®s, ®s); +} + #endif 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'); #endif + reset_drive(drive); if (MyAbsReadWrite(drive, 1, 0, oldboot, 0x25) != 0) { 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); } + reset_drive(drive); } BOOL check_space(COUNT drive, BYTE * BlkBuffer)