2012年4月15日 星期日

Unknown IOCTL, IOCTL_PSL_NOTIFY

在使用 XXX_IOControl  的時候 發現會有不名的 IOCTL 自動進來
其code 為 0x10303FF (16974847)
經查結果如下
IOCTL_PSL_NOTIFY 是屬於 OAL IOCTL 之一
它在什麼時候被呼叫呢?
也就是當AP Process Main Thread 結束的時候
它呼叫Driver 的 thread 尚未結束(或被block住)
這時系統就會call IOCTL_PSL_NOTIFY 去通知Device Driver unblock, release 這個thread.


The OS uses this I/O control when all of the following conditions are true:
  • The main application thread exits.
  • The application has other threads still running.
  • The application has open file handles that refer to the device.




http://www.itlisting.org/4-windows-ce-embedded/81ac8dc06a35379f.aspx
hey... 
Why does my XXX_IOControl receive a unknown IOCTL code when closing my
application ?? 
The IOCTL code is received before the XXX_Close is called. 
The received code is: 16974847 (0x10303FF) 
What is causing this ???
What is this used for ??? 


This is IOCTL_PSL_NOTIFY (see common\oak\inc\pkfuncs.h).  It's issued when a 
process is exiting. 
Basically what happens is this: when a process exits (i.e. the main thread
is terminating), all threads in that process will be terminated.  Some of
these threads may be blocked inside drivers.  This IOCTL is issued to all
drivers so that they can unblock these threads if they so desire (most
drivers ignore this, but check out the serial driver
(common\oak\drivers\serial\com_mdd2\mdd.c) for an example of how this might
be done. 

沒有留言: