Jump to content











Photo
- - - - -

Interrupting the read command

imdisk read windows driver ipc

Best Answer Olof Lagerkvist , 29 April 2013 - 10:34 PM

Thank you!

 

ImDiskSafeIOStream is only called for ImDisk drives where I/O is redirected to a user mode application rather than handled internally in the driver. This communication with user mode could be either through a named pipe, TCP/IP connection or serial port. This is specified on command line:

 

For example:

imdisk -a -t proxy -f \\.\pipe\SomePipeName -m P:

This will create a virtual drive P: and redirect all I/O requests to a named pipe. The application at the server end of the pipe needs to handle I/O messages and return status and data back to the driver.

 

If you would like to intercept I/O communication to any kind of ImDisk drive, for example also memory or image files backed disks, you would need to add your code to the device service thread routine ImDiskDeviceThread. There is a for loop in there, that fetches I/O requests from a queue and pass them to a switch statement that has specific handling for read or write requests. I guess you could add your code just above this switch statement.

 

Another idea could be to write a separate filter driver instead. For disk drivers like ImDisk, basic requirements on filter drivers are quite simple.

Go to the full post


  • Please log in to reply
3 replies to this topic

#1 imdiskuser

imdiskuser
  • Members
  • 4 posts
  •  
    United States

Posted 29 April 2013 - 09:32 PM

Hi,

 

Thanks for making ImDisk available. I'm trying to introduce false delay for read/write for my project purpose. I traced the read command finally into the ImDiskSafeIOStream method. Here, I'm circumvented the windows DDK call by creating a dummy buffer and returned this with status success. I've additionally added code here to communicate a message with a user process through named pipe.

 

I ran an IoMeter read test over the virtual drive, but the message is not being passed to the user process. Have I missed anything? Is this the correct routine which interprets reads/writes to the virtual drive?

 

I appreciate any help.

 

Thanks

 

 



#2 Olof Lagerkvist

Olof Lagerkvist

    Gold Member

  • Developer
  • 1398 posts
  • Location:Borås, Sweden
  •  
    Sweden

Posted 29 April 2013 - 10:34 PM   Best Answer

Thank you!

 

ImDiskSafeIOStream is only called for ImDisk drives where I/O is redirected to a user mode application rather than handled internally in the driver. This communication with user mode could be either through a named pipe, TCP/IP connection or serial port. This is specified on command line:

 

For example:

imdisk -a -t proxy -f \\.\pipe\SomePipeName -m P:

This will create a virtual drive P: and redirect all I/O requests to a named pipe. The application at the server end of the pipe needs to handle I/O messages and return status and data back to the driver.

 

If you would like to intercept I/O communication to any kind of ImDisk drive, for example also memory or image files backed disks, you would need to add your code to the device service thread routine ImDiskDeviceThread. There is a for loop in there, that fetches I/O requests from a queue and pass them to a switch statement that has specific handling for read or write requests. I guess you could add your code just above this switch statement.

 

Another idea could be to write a separate filter driver instead. For disk drivers like ImDisk, basic requirements on filter drivers are quite simple.


  • imdiskuser likes this

#3 imdiskuser

imdiskuser
  • Members
  • 4 posts
  •  
    United States

Posted 30 April 2013 - 12:39 PM

Thanks for the prompt reply Olof. I understand where I went wrong now.



#4 imdiskuser

imdiskuser
  • Members
  • 4 posts
  •  
    United States

Posted 30 April 2013 - 02:01 PM

Hi Olof,

 

I had a follow up question. If I intercept the read/write command, how can I make the disk show up as a physical device? The reason I'm asking is, after I intercepted the read routine, I'm no longer able to format the drive.

 

Also, IOMeter does not list the drive to perform any reads/writes against.

 

Is there a way to separate such requests from regular data read/write?

 

Thanks

 

 







Also tagged with one or more of these keywords: imdisk, read, windows driver, ipc

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users