Re: WriteFile( ) function. Error

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Call FSCTL_ALLOW_EXTENDED_DASD_IO after CreateFile and before writes.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@xxxxxxxxxxxxxxxx
http://www.storagecraft.com

"hitesh" <hitesh.ughreja@xxxxxxxxx> wrote in message
news:1186489820.733563.195730@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello All,
I am writing a format application where i found a strange problem.

I have to write some data in last 512 bytes of partition.
Now the problem is i am able to write data at anyplace except this
location.
when i call the function

bRet = WriteFile(hFile,lpBuffer,length,(LPDWORD)&byteswritten,NULL);

i am getting byteswritten=0 and bRet=TRUE.
It is strange, though no data is written on disk, still it returns
TRUE.

Now if i am running the same application second time, it is executing
successfully.

So i guess it is because of the driver. Because first time when i
format there is NTFS driver which is already running. And during the
first time half of data is written in disk and partition table is
corrupted so driver is unmounted. and second time it is running
successfully.

Then i am calling FSCTL_DISMOUNT_VOLUME for unloading the driver,
still i am facing the same problem,

Can anybody help me please?

thanks,

Hitesh


.



Relevant Pages

  • WriteFile( ) function. Error
    ... I am writing a format application where i found a strange problem. ... I have to write some data in last 512 bytes of partition. ... Now if i am running the same application second time, ... So i guess it is because of the driver. ...
    (microsoft.public.development.device.drivers)
  • Re: disable 64-bit dma for one PCI slot only?
    ... gwollman) for PCI 1.0 (at a time when their was no standard for PCI to ... PCI brigdes, yet;-)), the current format seemed sensible, but the ... selection of a driver. ... CAPs and/or decoded vendor and device information. ...
    (freebsd-stable)
  • Re: Flash memory formating - Mac/Windows?
    ... For the format test, I used Disk Utility. ... 1:23.98 - immediately after writing the files ... 0:01.11 - the second time after the re-insert ... MS-DOS file system (FAT32) ...
    (comp.sys.mac.system)
  • Re: [linux-dvb] [PATCH] Userspace tuner
    ... We keep format conversion ... code duplication in userspace since there's no library available at the ... it is convenient for apps to be able to use standard libraries ... access to it should be part of its driver. ...
    (Linux-Kernel)
  • Re: WDF for Storage CLASS device
    ... You can format it on your own using WdfRequestWdmFormatUsingStackLocation. ... stuff and then have my driver custom format the CDBs and SRBs. ... I'm trying to figure out how to get access to the IRP/SRB and CDB so I can ... Can I do that from the WDF Request object? ...
    (microsoft.public.development.device.drivers)