Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. How to hook file handling routines.

How to hook file handling routines.

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharptutorial
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sundar156
    wrote on last edited by
    #1

    Hi All, How to hook file handling routines in windows using .Net..I have to hook a file Open routine through an application in .Net...i.e i should call my dll defare the call goes to the windows procedure ..Any sample codes/ideas are appreciated.

    Luck is Opportunity with hardwork

    D M 2 Replies Last reply
    0
    • S sundar156

      Hi All, How to hook file handling routines in windows using .Net..I have to hook a file Open routine through an application in .Net...i.e i should call my dll defare the call goes to the windows procedure ..Any sample codes/ideas are appreciated.

      Luck is Opportunity with hardwork

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      There's no such thing in Managed code. This requires Black Belt level knowledge of NTFS and a specially written shim that sits on top of the NT kernel to intercept the call. I don't know of any examples, short of FileMon from SysInternals. They DON'T supply the source code for the NT driver that's required to do this.

      Dave Kreskowiak Microsoft MVP - Visual Basic

      S 1 Reply Last reply
      0
      • D Dave Kreskowiak

        There's no such thing in Managed code. This requires Black Belt level knowledge of NTFS and a specially written shim that sits on top of the NT kernel to intercept the call. I don't know of any examples, short of FileMon from SysInternals. They DON'T supply the source code for the NT driver that's required to do this.

        Dave Kreskowiak Microsoft MVP - Visual Basic

        S Offline
        S Offline
        sundar156
        wrote on last edited by
        #3

        Thanks for the reply and yes! it is a sort of FileMon from SysInternals..

        Luck is Opportunity with hardwork

        1 Reply Last reply
        0
        • S sundar156

          Hi All, How to hook file handling routines in windows using .Net..I have to hook a file Open routine through an application in .Net...i.e i should call my dll defare the call goes to the windows procedure ..Any sample codes/ideas are appreciated.

          Luck is Opportunity with hardwork

          M Offline
          M Offline
          Mike Dimmick
          wrote on last edited by
          #4

          If you're trying to hook one application then you could do API hooking on the CreateFile, ReadFile, WriteFile APIs. This is a task that really needs to be done in C++. See here[^] for an example. Otherwise you'll be writing a File System Filter Driver which runs in kernel mode, and for that you'll basically need to write in C. You'll need the Driver Development Kit[^] (I think - file system filters might be an advanced driver type only permitted in the Installable File System Kit[^]). Don't do this unless absolutely necessary - unstable applications merely crash the application, but unstable drivers crash the system. Kernel mode is very very hard, and you should at least read Windows Internals, Fourth Edition[^] by Mark Russinovich and David Solomon before starting.

          Stability. What an interesting concept. -- Chris Maunder

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups