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

Api Function user-mode WriteFile block

5 views
Skip to first unread message

Mathieu

unread,
Nov 2, 2009, 7:25:46 PM11/2/09
to
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.

Don Burn

unread,
Nov 2, 2009, 8:09:01 PM11/2/09
to
Why do you bug people in every newsgroup. Go back and try to understand the
answer you have already been given.


--
Don Burn (MVP, Windows DKD)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply

"Mathieu" <mat....@wanadoo.fr> wrote in message
news:4aef7891$0$923$ba4a...@news.orange.fr...

> __________ Information from ESET NOD32 Antivirus, version of virus
> signature database 4566 (20091102) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>

__________ Information from ESET NOD32 Antivirus, version of virus signature database 4566 (20091102) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


0 new messages