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
S.
"RayM" <anon...@discussions.microsoft.com> wrote in message
news:062f01c395de$2493f320$a001...@phx.gbl...
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
>.
>
S.
"raym" <anon...@discussions.microsoft.com> wrote in message
news:087a01c3972f$d0b732f0$a001...@phx.gbl...
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
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?
>.
>
-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());
Thanks for you assistance. If you have any other ideas,
believe me, your time and help are much appreciated.
RayM
>.
>
HTH
--
============
Frank Hickman
NobleSoft, Inc.
============
"RayM" <anon...@discussions.microsoft.com> wrote in message
news:018b01c398c6$f1c59430$a401...@phx.gbl...
Thank you all for your input.
I'll see what I can dig up on IOCTL.
RayM
>.
>