这个有点麻烦啊,转个文章你看看吧:For the Windows 9x driver, the heart of FileMon is in the virtual device driver, Filevxd.vxd. It is dynamically loaded, and in its initialization it installs a file system filter via the VxD service, IFSMGR_InstallFileSystemApiHook, to insert itself onto the call chain of all file system requests. On Windows NT the heart of FileMon is a file system driver that creates and attaches filter device objects to target file system device objects so that FileMon will see all IRPs and FastIO requests directed at drives. When FileMon sees an open, create or close call, it updates an internal hash table that serves as the mapping between internal file handles and file path names. Whenever it sees calls that are handle based, it looks up the handle in the hash table to obtain the full name for display. If a handle-based access references a file opened before FileMon started, FileMon will fail to find the mapping in its hash table and will simply present the handle's value instead. 
Information on accesses is dumped into an ASCII buffer that is periodically copied up to the GUI for it to print in its listbox. http://www.sysinternals.com/Utilities/Filemon.html

解决方案 »

  1.   

    作为windows 9x驱动,FileMon的核心——Filevxd.vxd,是虚拟设备驱动程序,它是动态装载的,由VXD服务在安装文件系统过滤驱动是初始化的,并把自己插入文件系统请求链表中(IRP)。在windows NT系统上,FileMon的核心是一个文件系统过滤驱动,它创建并附着一个设备过滤对象(过滤驱动)到文件系统的目标设备上(硬件驱动对象),因此FileMon直接由驱动来监视系统中所有的IRPs和FastIO请求。当FileMon监视到文件打开,创建或者关闭时,它更新一张内核hash表,以便在内核文件句柄和文件路径之间建立映射关系。无论什么时候,只要它监视到基于句柄的调用,它都会查找hash表中的句柄以取得显示的全路径名。如果基于句柄的访问一个在FileMon启动以前打开的文件,FileMon将因为查找hash表映射失败而简单的用一个句柄来替代。
      

  2.   

    本想使用file.open()的,可是自己本身的程序是有占用文件的。现在希望能知道除自己的程序外有没有其它程序占用着文件?