Thanks,
Lloyd
code please,...
Regards
Ken
--
-----------------------
Beste Gr�sse / Best regards / Votre bien devoue
Kerem G�mr�kc�
Latest Project: http://www.pro-it-education.de/software/deviceremover
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"Lloyd" <llo...@gmail.com> schrieb im Newsbeitrag
news:6ad1af05-f32a-4489...@y10g2000prg.googlegroups.com...
...
...
interfaceData.cbSize = sizeof(SP_INTERFACE_DEVICE_DATA);
status = SetupDiEnumDeviceInterfaces(hDevInfo,0,(LPGUID)
&GUID_DEVINTERFACE_DISK,Index,&interfaceData);
...
....
status = SetupDiGetDeviceInterfaceDetail (hDevInfo,&interfaceData,NULL,
0,&reqSize,NULL);
...
....
hDevice = CreateFile(interfaceDetailData->DevicePath,GENERIC_READ|
GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,
0,NULL);
//All the above calls succeeds....
retSetFilePtr=SetFilePointer(hDevice ,1024*1024*1024 /*1GB*/,
NULL,FILE_BEGIN);
//This call too succeeds!! The device is only 128MB!!
did you try FILE_END on SFP? What do you get on GetLastError()
and SFP return Code,...for FILE_BEGIN and FILE_END? Can you
drop ReadFile/WriteFile Operations on the Device Object after
open it with CreateFile, just to make sure your Handle is valid
for these operations,...
Regards
Kerem
--
-----------------------
Beste Gr�sse / Best regards / Votre bien devoue
Kerem G�mr�kc�
Latest Project: http://www.pro-it-education.de/software/deviceremover
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"Lloyd" <llo...@gmail.com> schrieb im Newsbeitrag
news:2af3fcb3-825e-443c...@z10g2000prh.googlegroups.com...
> hDevInfo =SetupDiGetClassDevs((LPGUID)
> &GUID_DEVINTERFACE_DISK,NULL,NULL,(DIGCF_PRESENT|
> DIGCF_INTERFACEDEVICE));
>
> ...
> ...
>
> interfaceData.cbSize = sizeof(SP_INTERFACE_DEVICE_DATA);
> status = SetupDiEnumDeviceInterfaces(hDevInfo,0,(LPGUID)
> &GUID_DEVINTERFACE_DISK,Index,&interfaceData);
>
> ...
> ....
> status = SetupDiGetDeviceInterfaceDetail (hDevInfo,&interfaceData,NULL,
> 0,&reqSize,NULL);
>
> ...
> ....
> hDevice = CreateFile(interfaceDetailData->DevicePath,GENERIC_READ|
> GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,
> 0,NULL);
>
> //All the above calls succeeds....
>
> retSetFilePtr=SetFilePointer(hDevice ,1024*1024*1024 /*1GB*/,
> NULL,FILE_BEGIN);
>
> //This call too succeeds!! The device is only 128MB!!
>
>
When I try from FILE_END, it returns "ERROR_INVALID_FUNCTION"
"It is not an error to set a file pointer to a position beyond the end of
the file."
"Lloyd" <llo...@gmail.com> wrote in message
news:6ad1af05-f32a-4489...@y10g2000prg.googlegroups.com...
> I have opened a USB device using its PnP name retrieved
In general, SetFilePointer() is allowed to move beyond the end of a file. That allows a new EOF marker to be set by SetEndOfFile(), thus expanding the file size without having to write data to it.
I don't know if the same applies to a USB device. If the device does not support moving past EOF, then SetFilePointer() will likely just move to the EOF itself. Are you looking at the actual file position that SetFilePointer() returns on success?
--
Remy Lebeau (TeamB)
The reason is probably that the driver for your USB device does not support
the ReadFile and WriteFile APIs. USB devices are not files. A driver can
support read and write mechanisms, but it's entirely up to the driver to
determine which functions mean what things.
What kind of a device is this?
--
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.
if(!SetFilePointerEx(
h,
0,
&pNewFilePointer,
FILE_END
))
{
dwErr = GetLastError(); // handle error
}
As others have mentioned, the behavior will be device dependent and file
pointers usually have no meaning for a block device as they exist to support
stream IO
"Lloyd" <llo...@gmail.com> wrote in message
news:37e7e9b3-d39d-46bb...@2g2000prl.googlegroups.com...
> I tried ReadFile() on the "handle" got from CreateFile, and it returns
> valid data...
>
> When I try from FILE_END, it returns "ERROR_INVALID_FUNCTION"
>
>