Re: How use ShellExecute with a "RAM file"?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Arnaud Debaene (adebaene_at_club-internet.fr)
Date: 02/19/05


Date: Sat, 19 Feb 2005 07:59:36 +0100

Please don't top-post...

Al Koch wrote:
> Hi Gary,
>
> Thanks for the prompt reply (but I sure didn't want to get that
> particular answer!). I realize that an app like ShellExec() that is
> designed to "read a file" can't just be given a memory pointer, but
> the MFC CMemFile emulates a file and can be treated as such (at least
> by the application that has created the CMemFile)
This the whole point : the memory chunk managed by CMemFile is accessible
only in the process that created . For any other process, this pointer is
meaningless.

> Based on your reply, I have two follow on questions.
>
> 1) Would you possibly know if this is how IE works? When you click
> on a web site link in IE that corresponds to a file such as the types
> I mentioned (.doc, .xls, .jpg, .pdf, .wmv, ...) IE initially obtains
> the file in RAM (it's downloaded into the browser). Is IE always
> writing a temp file before it launches the associated app (such as
> Word, Acrobat, ...)?
Yes, the files are saved in the browser cache.

> I had hoped that IE was somehow able to
> accomplish what I want to do but it sounds as if even IE has to write
> a temp file 1st.
Yes. Read about processes address spaces separation to understand why.
>
> 2) If I can only launch ShelllExec() by 1st writing a temp file can
> you suggest how I can determine when the app that is launched has
> shutdown since that would be the earliest that I could safely delete
> the temp file?
WaitForSingleObject on the process handle.

Arnaud
MVP - VC



Relevant Pages

  • Re: How use ShellExecute with a "RAM file"?
    ... I realize that an app like ShellExec() that is designed to "read ... Is IE always writing a temp file before ... it launches the associated app? ...
    (microsoft.public.win32.programmer.kernel)
  • XP sp1 problem with Win2k server
    ... fine to the network. ... You can exit the app, ... Microsoft product) a temp file along with the actual file. ... happens for any domain account including administrators. ...
    (microsoft.public.windowsxp.security_admin)
  • Re: XP sp1 problem with Win2k server
    ... > fine to the network. ... You can exit the app, ... > Microsoft product) a temp file along with the actual file. ... > happens for any domain account including administrators. ...
    (microsoft.public.windowsxp.security_admin)
  • Re: kwrite creates darn visible temp files?
    ... >>made under program control (app or kernel), ... this often confuses folks moving from Windows. ... temp file created by MS Office while 'stuff'doc' is ...
    (alt.os.linux.suse)
  • Re: only one instance
    ... >>It is no matter that temp file can exists while app's instance is not ... >>instance has exclusive access to file. ... File is open while app is running. ...
    (comp.lang.java.gui)