My driver allows multiple access by returning STATUS_PENDING.
But it is a thread in the driver disk manager who basically control
access to both and calls the function of gender IoCompleteRequest.
The driver create a volume that the user process that manages the disk.
The process link with the driver with the API DeviceIoControl function
for the proper functioning of the disc.
And it is the function WriteFile blocking because OS will access the
disk set. Although safe in user-mode I do not use the WriteFile API for
writing on my drive (\ \. \ K

otherwise it would create recursion, I
use the WriteFile API to write the image file that is my drive to create.
I use WriteFile on the same thread why use DeviceIoControl.
Alexander Grigoriev a écrit :
> I don't quite understand your problem, but one thing you might want to
> consider is to use FILE_FLAG_OVERLAPPED.
>
> Do you have a kernel driver to create a volume on a file? Do you allow for
> multiple simultaneous IO requests?
>
> "Mathieu" <> wrote in message
> news:4aef7870$0$923$...
>> Hello, I just develop a process to map a logical drive in user-mode to an
>> image file (ex: e: \ td.raw) through a driver specific to me. When the
>> event of write request on the unit I use is called WriteFile function of
>> the Windows API. The problem is that the WriteFile on an image file and
>> not on the logical drive mapped, well at the time he hangs up during such
>> copying files to the logical drive mapped to user-mode. I have to restart
>> Windows for all blocking. Bizarre: When I put the WriteFile in another
>> thread and I await his execution is completed, WriteFile no longer block.
>> More bizarrre: I try to put in the thread that writes the image file, and
>> use the fprintf function which writed another file (eg c: \
>> debugsecteur.txt) sector numbers. Well then there is blockage in the
>> fprintf or WriteFile function. I do not understand. Explanation of the
>> problem internally: When calling from WriteFile on an image file (eg e: \
>> td.raw), Well's system will write data on the logical drive mapped to
>> user-mode, the driver returns on STATUS_PENDING of IRP_MJ_WRITE because
>> the called the event write request is not completed. I try to remove the
>> latency of the thread writing the image file, ie the thread is created,
>> the event of write request returns OK on my driver and the WriteFile
>> function is thread releasing data at the time, but when I used my image
>> file, gives me the logical drive unformatted and unreadable! I'll retest!
>> Already it is the parameter of CreateFile should: ( nameraw char [] = "e:
>> \ \ td.raw"; Hrawi = CreateFile (nameraw, GENERIC_READ | GENERIC_WRITE,
>> FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
>> FILE_FLAG_NO_BUFFERING | FILE_ATTRIBUTE_NORMAL, NULL); ) Can you help me
>> because after the debug logs on the OS windows is at fault! Conclusion:
>> The kernel of Windows will write some data in the logical drive mapped to
>> user-mode during the WriteFile function and as the data recorded are not
>> OK, the kernel decides to block. Why? Why in a thread does not block at
>> the function Writefile. In the event of write access i call the
>> DeviceIoControl function pour retreive and return data requested by my
>> driver ! As for the event read request: no problem! Can you help me?
>>
>> WriteFile is sometimes block in case it works in the same thread or there
>> are functions DeviceIoControl for data retreived from my driver for all
>> application read / write about the logical drive.
>>
>> Thank you.
>
>