Reading floppy disks
-
Does anyone know where I could get some code to read the tracks of a floppy disk? I haven't been able to find an API to do this and I'm not sure how to handle this between Windows 95/98/ME and Windows NT/2000. I would like to create a disk copy program that you can store images on your hard drive and write multiple copies. I think this feature is lacking for Windows (it should be built-in) and I would like to solve this problem. If you know how to do this for Zip drives, I could also use any information anyone has. Brigham W. Thorp Software Engineer Timex Corporation
-
Does anyone know where I could get some code to read the tracks of a floppy disk? I haven't been able to find an API to do this and I'm not sure how to handle this between Windows 95/98/ME and Windows NT/2000. I would like to create a disk copy program that you can store images on your hard drive and write multiple copies. I think this feature is lacking for Windows (it should be built-in) and I would like to solve this problem. If you know how to do this for Zip drives, I could also use any information anyone has. Brigham W. Thorp Software Engineer Timex Corporation
Brigham I found this if it helps... #include #include #include /***** WARNING!!!!! ******/ /* If you change the following line so that DRIVE_A is assigned a 2 or above, you could destroy data on your hard drive. This test program segment was written to read and write from the floppy disk A: */ #define DRIVE_A 0 /* 0=A, 1=B, 2=C, etc. */ #define ONE_SECTOR 1 #define ABS_WRITE 38 /* Decimal value of int call */ #define ABS_READ 37 /* Decimal value of int call */ unsigned int far *out; /* Pointer to Data to be output */ unsigned int far *input; /* Pointer to Data Transfer Area */ unsigned int output; /* Data to be output */ union REGS inregs, outregs; struct SREGS segregs; void main(void) { out = &output; input = (unsigned int far *) malloc(1024 * sizeof(unsigned int)); *out = 11; inregs.h.al = DRIVE_A; /* Write to drive A */ inregs.x.cx = ONE_SECTOR; /* Write one sector only */ inregs.x.dx = 3; /* Logical sector 3 */ segregs.ds = FP_SEG(out); /* Get Seg address of output */ inregs.x.bx = FP_OFF(out); /* Get Offset of output */ outregs.x.ax = 0; /* No error */ int86x (ABS_WRITE, &inregs, &outregs, &segregs); inregs.h.al = DRIVE_A; /* Read to drive A */ inregs.x.cx = ONE_SECTOR; /* Read one sector only */ inregs.x.dx = 3; /* Logical sector 3 */ segregs.ds = FP_SEG(input); /* Get Seg address of buffer */ inregs.x.bx = FP_OFF(input); /* Get Offset of buffer */ outregs.x.ax = 0; /* No error */ int86x (ABS_READ, &inregs, &outregs, &segregs); printf ("%u was read from drive A: \n", *input); } Regards Norm
-
Brigham I found this if it helps... #include #include #include /***** WARNING!!!!! ******/ /* If you change the following line so that DRIVE_A is assigned a 2 or above, you could destroy data on your hard drive. This test program segment was written to read and write from the floppy disk A: */ #define DRIVE_A 0 /* 0=A, 1=B, 2=C, etc. */ #define ONE_SECTOR 1 #define ABS_WRITE 38 /* Decimal value of int call */ #define ABS_READ 37 /* Decimal value of int call */ unsigned int far *out; /* Pointer to Data to be output */ unsigned int far *input; /* Pointer to Data Transfer Area */ unsigned int output; /* Data to be output */ union REGS inregs, outregs; struct SREGS segregs; void main(void) { out = &output; input = (unsigned int far *) malloc(1024 * sizeof(unsigned int)); *out = 11; inregs.h.al = DRIVE_A; /* Write to drive A */ inregs.x.cx = ONE_SECTOR; /* Write one sector only */ inregs.x.dx = 3; /* Logical sector 3 */ segregs.ds = FP_SEG(out); /* Get Seg address of output */ inregs.x.bx = FP_OFF(out); /* Get Offset of output */ outregs.x.ax = 0; /* No error */ int86x (ABS_WRITE, &inregs, &outregs, &segregs); inregs.h.al = DRIVE_A; /* Read to drive A */ inregs.x.cx = ONE_SECTOR; /* Read one sector only */ inregs.x.dx = 3; /* Logical sector 3 */ segregs.ds = FP_SEG(input); /* Get Seg address of buffer */ inregs.x.bx = FP_OFF(input); /* Get Offset of buffer */ outregs.x.ax = 0; /* No error */ int86x (ABS_READ, &inregs, &outregs, &segregs); printf ("%u was read from drive A: \n", *input); } Regards Norm
This is great for a DOS based application, but the REGS stuff is not supported for Windows based applications. This won't compile in a Windows application. You can do any inp and outp stuff winth NT anyhow. If anyone knows of a way to do this under Windows I would appreciate it. Brigham W. Thorp Software Engineer Timex Corporation
-
Does anyone know where I could get some code to read the tracks of a floppy disk? I haven't been able to find an API to do this and I'm not sure how to handle this between Windows 95/98/ME and Windows NT/2000. I would like to create a disk copy program that you can store images on your hard drive and write multiple copies. I think this feature is lacking for Windows (it should be built-in) and I would like to solve this problem. If you know how to do this for Zip drives, I could also use any information anyone has. Brigham W. Thorp Software Engineer Timex Corporation
Look at the CreateFile API in the Platform SDK, you can specify a device such as "\\.\A:" to open the floppy disk. This handle can then be used with DeviceIoControl function to read sectors.