Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Non PC formatted floppy read/write

15 views
Skip to first unread message

RayM

unread,
Oct 18, 2003, 9:13:02 PM10/18/03
to
Does anyone know how to read a non formatted floppy? I
have tried everything I can think of and I cannot read a
floppy unless it is formatted. The following does not
work http://www.codeproject.com/system/cfloppydisk.asp as
I have tried it already. The sample program in the SDK
(mfmt.c) also does not work. I am looking for a Win2K
solution (using VC++ .NET or VC++ 6.0)

The above DOES work with formatted PC type floppies, but
not with floppy disks that have data from other systems,
which is what I need.

Can anyone offer a helping hand?

RayM

Simon Trew

unread,
Oct 20, 2003, 9:55:36 AM10/20/03
to
What format is it?

S.

"RayM" <anon...@discussions.microsoft.com> wrote in message
news:062f01c395de$2493f320$a001...@phx.gbl...

raym

unread,
Oct 20, 2003, 1:30:11 PM10/20/03
to

It's an image of an AED620 8" floppy, so most of the 1.44
MB is wasted. (There can actually be two 8" images on the
floppy.)

I just want to be able to read any chunk possible. It's
just not a PC formatted floppy.

So far, nobody has an answer for this.

R

>.
>

Simon Trew

unread,
Oct 21, 2003, 4:39:07 AM10/21/03
to
I guess what you are saying is that the AED620 8" floppy has been copied
sector-for-sector to the 3.5" floppy (assuming the same sector size)? In
which case you would need to use APIs to get the raw data out of the sectors
directly, which, AFAIK, you would need to write a device driver to do, using
the Windows DDK.

S.

"raym" <anon...@discussions.microsoft.com> wrote in message
news:087a01c3972f$d0b732f0$a001...@phx.gbl...

Carl Daniel [VC++ MVP]

unread,
Oct 21, 2003, 10:51:02 AM10/21/03
to
raym wrote:
> It's an image of an AED620 8" floppy, so most of the 1.44
> MB is wasted. (There can actually be two 8" images on the
> floppy.)
>
> I just want to be able to read any chunk possible. It's
> just not a PC formatted floppy.
>
> So far, nobody has an answer for this.

You can open raw devices, such as a floppy drive using the Win32 file API.
Specifically, you open the file using CreateFile. See the discussion for
"Physical Disks and Volumes" in the documentation for the CreateFile
function (look it up on MSDN, or in your VC++ help).

Once you've opened the raw device, you can read and write sectors using the
DeviceIoControl API.

-cd


raym

unread,
Oct 21, 2003, 2:10:24 PM10/21/03
to
Thank you for your input.

I have already tried using Createfile etc. I get an
error 27 from GetLastError after 0 bytes are read in.
(that's a 'cannot read specified sector' error).

in essence, I have tried the following code snippets:

(assume that my vars are OK and server their purpose)

hDrive = CreateFile( Drive,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL,
OPEN_EXISTING,
0,
NULL
);

.
.
.
.
b = ReadFile(hDrive,IoBuffer, VirtBufSize, &BytesRead,
NULL);

in this case, BytesRead is 0 and GetLastError is 27.

While I can SEEK just fine to any location, any subsequent
read fails miserably with error 27.


Writing a device driver is not my Forte, some other
suggestions?

>.
>

Carl Daniel [VC++ MVP]

unread,
Oct 21, 2003, 7:07:05 PM10/21/03
to
The following program successfuly reads sector 0 of A: on my machine. Be
sure to seek & read/write only in 512 byte multiples.

-cd

#include <windows.h>
#include <stdio.h>

int main()
{
HANDLE hDr =
CreateFile("\\\\.\\A:",GENERIC_READ,0,0,OPEN_EXISTING,FILE_FLAG_NO_BUFFERING
,0);
if (hDr != INVALID_HANDLE_VALUE)
{
char sector[512];
DWORD dwRead;
BOOL bSuccess = ReadFile(hDr,sector,sizeof(sector),&dwRead,0);
if (bSuccess)
{
printf("Sector 0:\n");
for (int i = 0; i < 512; ++i)
printf("%02x %s",0xff & sector[i],((i % 16) == 15)?"\n":"");
}
else
{
printf("ReadFile failed, GetLastError()=%d\n",GetLastError());
}
}
else
{
printf("CreateFile failed, GetLastError()=%d\n",GetLastError());

RayM

unread,
Oct 22, 2003, 2:04:32 PM10/22/03
to
Absolutely...this works if the floppy is formatted for PC
usage. Does not work for a floppy that is not formatted,
which is the crux of the problem.

Thanks for you assistance. If you have any other ideas,
believe me, your time and help are much appreciated.

RayM

>.
>

Frank Hickman

unread,
Oct 22, 2003, 4:01:48 PM10/22/03
to
The only way your going to be able to read that floppy is to write your own
file system driver, as Simon already replied. Or find someone that has
already written one for the format of the floppy. You may want to look at
the IOCTL disk functions.

HTH
--
============
Frank Hickman
NobleSoft, Inc.
============

"RayM" <anon...@discussions.microsoft.com> wrote in message

news:018b01c398c6$f1c59430$a401...@phx.gbl...

RayM

unread,
Oct 22, 2003, 5:02:59 PM10/22/03
to
I was *hoping* that wasn't the case, but I have accepted
the fact that it is indeed the case.

Thank you all for your input.

I'll see what I can dig up on IOCTL.

RayM

>.
>

0 new messages