locked
Detecting that a file is being read without administrative or system previleges RRS feed

  • Question

  • I wonder if there is any way for me to create an application that, without registering a service and without being elevated to get administrator or system privileges upon execution, can detect that a specific file is being read or shared over a network (through Windows file sharing, for example). The client will run Vista.

    Is there a way through the standard API or as a hack to detect this?

    Thank you.
    Tuesday, October 6, 2009 8:10 PM

All replies

  • Use SHChangeNotifyRegister to get limited notifications. To get every file change possible, you need install a file filter driver running in the kernel.

    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful.
    Visual C++ MVP
    • Proposed as answer by Fisnik Hasani Monday, October 12, 2009 4:45 PM
    Wednesday, October 7, 2009 7:43 PM
  • Hi,

    Sheng Jiang is correct: check this link -> http://msdn.microsoft.com/en-us/library/bb762120(VS.85).aspx

    If you want to implement on .NET app, the you must P/Invoke the Shell32.dll,
    like this:

    [DllImport("shell32.dll", SetLastError=true, EntryPoint="#2", CharSet=CharSet.Auto)]
    static extern UInt32 SHChangeNotifyRegister(
                IntPtr hWnd,
                SHCNF fSources,
                SHCNE fEvents,
                uint wMsg,
                int cEntries,
                ref SHChangeNotifyEntry pFsne);

    I hope this helps as well!

    Have a nice day...

    Best regards,
    Fisnik
    Coder24.com
    • Proposed as answer by Fisnik Hasani Monday, October 12, 2009 4:45 PM
    Sunday, October 11, 2009 10:58 AM
  • Hello windevjoe:

    How are you? How is the situation on your side?
    Is this thread solved yet?

    Have a nice day...

    Best regards,
    Fisnik
    Coder24.com
    Monday, October 12, 2009 4:45 PM
  • Hello windevjoe:

    How are you? How is the situation on your side?
    Is this thread solved yet?

    Have a nice day...

    Best regards,
    Fisnik
    Coder24.com
    Wednesday, October 21, 2009 6:09 PM
  • Hi windevjoe:

    How is the situation on your side?
    Is this thread solved or NOT?

    Please tell me!

    Have a nice day...

    Best regards,
    Fisnik
    Coder24.com
    Friday, November 13, 2009 7:46 PM
  • Hi again:

    How is the situation on your side?
    Is this thread solved?

    Please tell me!

    Have a nice day...

    Best regards,
    Fisnik
    Coder24.com
    Sunday, December 27, 2009 10:19 AM
  • Hi again:

    Is this thread solved or NOT?
    Please tell me!

    Have a nice day...

    Best regards,
    Fisnik

    Coder24.com
    Saturday, January 2, 2010 2:32 PM