Wait_Semaphore in IFSMGR_READ

Hi all,

I am writing a VxD in 98. I am hooking to the IFSMGR functions. The
requirement is

Whenevr a File read happens The VxD will block the call and inform the ring
3 application. Then the ring3 app will decide whether to allow or deny the
request.

For communication between the ring0 and ring 3 i am using a shared event.

When i am blocking the Read request in the IFSMGR read
I am using a Wait_Semaphore()

Once the response comes We will signal the semaphore.

It is working for some files and system hangs for others

Here is the pseudo code of what iam doing

IFS_MGR REad

Get The File Name
Copy the file name to a structure
structure.SemaphoreHandle = Create_Semaphore(0);
Put structure in Queue
_VWin32_SignalEvent( shared event);
Wait_Semaphore(structure.SemaphoreHandle);
Allow/deny the request
End IFMGR READ

whenever the ring 3 issues an ioctl to read the requests

Read from queue

Whenevr the ring 3 is giving a response

Signal_Semaphore(structure.SemaphoreHandle)

This works fine with notepad.
But when i am accessign anything in c:\windows, All dlls
it is hanging.

Is the code is reentrant as in case of 2000.

Thanks
Hari

It’s a well known yet irresolvable issue. KM->UM calls while blocking KM
thread are strictly prohibited in IFS request handling. This has to do
with a bunch of mutexes (Win16 is one of them but there are others as I
recall). Those mutexes somehow participate in UM thread scheduling in
such a way that scheduler acquires these mutexes before scheduling a new
thread to run. Yet, the same mutexes are acquired by Win32/IO system
before calling down IFS. Not always, but still… So, if one of these
mutexes is acquired by the thread that you’re blocking your app’s thread
will never run because scheduler will deadlock on that mutex. Weird
thing: in the KM you can see threads switching but in UM they are not.
Solution? Forget Win9x and develop for NT+ There is simply NO other
solution in this case.

-----Original Message-----
From: Kedar [mailto:xxxxx@hotmail.com]
Sent: Friday, May 28, 2004 2:05 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] Wait_Semaphore in IFSMGR_READ

Hi all,

I am writing a VxD in 98. I am hooking to the IFSMGR functions. The
requirement is

Whenevr a File read happens The VxD will block the call and inform the
ring
3 application. Then the ring3 app will decide whether to allow or deny
the
request.

For communication between the ring0 and ring 3 i am using a shared
event.

When i am blocking the Read request in the IFSMGR read
I am using a Wait_Semaphore()

Once the response comes We will signal the semaphore.

It is working for some files and system hangs for others

Here is the pseudo code of what iam doing

IFS_MGR REad

Get The File Name
Copy the file name to a structure
structure.SemaphoreHandle = Create_Semaphore(0);
Put structure in Queue
_VWin32_SignalEvent( shared event);
Wait_Semaphore(structure.SemaphoreHandle);
Allow/deny the request
End IFMGR READ

whenever the ring 3 issues an ioctl to read the requests

Read from queue

Whenevr the ring 3 is giving a response

Signal_Semaphore(structure.SemaphoreHandle)

This works fine with notepad.
But when i am accessign anything in c:\windows, All dlls
it is hanging.

Is the code is reentrant as in case of 2000.

Thanks
Hari


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as:
xxxxx@borland.com
To unsubscribe send a blank email to xxxxx@lists.osr.com