Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: Read a file that is opened by another process

by ady (Deacon)
on Nov 20, 2010 at 15:16 UTC ( [id://872672]=note: print w/replies, xml ) Need Help??


in reply to Re: Read a file that is opened by another process
in thread Read a file that is opened by another process

Sorry, you're right BrowserUk, --
Let me rephrase the question:

* assume a file with exclusive access by a process (ex .NET C#: FileStream fs = fi.Open(FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None);

* it seems I can't use any Windows API to read that file, - not from managed C# at least, so i tried from Perl, - but I can't find a way here either.

* and no, Notepad will not open this file.

But I assume there must be a way, since some backup applications are able to copy files, that are currently opened by other processes ?

Replies are listed 'Best First'.
Re^3: Read a file that is opened by another process
by BrowserUk (Patriarch) on Nov 20, 2010 at 15:51 UTC

    With the appropriate privileges and access to the right APIs this is possible.

    But gaining access to those APIs is far harder from Perl than C or C#, and way beyond the scope of this forum.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      I'll gladly help someone with an XS or Win32::API solution once they've id'ed the proper interface.
        once they've id'ed the proper interface.

        It is the identification of the appropriate APIs and security settings--basically reading & understanding the appropriate MS documentation--that I consider beyond the scope of this forum.

        Once so identified, calling those is still far easier from C# than via either of XS or Win32::API


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.
      OK, I feared that might be the case.
      I'll see how far I can get with the Windows unmanaged API from .NET (P/Invoke to C DLLs).

      Thanks anyway :)
      allan

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://872672]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-03-28 16:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found