Re: Can someone explain how a App on a Network server works?

From: Stefan Berglund (keepit_at_in.thegroups)
Date: 03/02/04


Date: Tue, 02 Mar 2004 10:05:51 -0800

On Tue, 2 Mar 2004 10:19:21 -0000, "Tony Proctor" <tony_proctor@aimtechnology_NOSPAM.com> wrote:
 in <#upQK#DAEHA.2180@TK2MSFTNGP09.phx.gbl>

>When you execute a normal EXE on a local drive, the O/S actually "memory
>maps" the code from the *.exe file, thus making it appear as part of the
>process virtual address space, and then passes control to it. Note that this
>is different to it actually being loaded into RAM, or "physical memory". As
>sections of that code are executed, the normal virtual memory paging brings
>the relevant bit of code into physical memory on demand, as they're needed.
>
>Although memory mapping can load a file from a network drive, I believe the
>file content is first fetched across the network into a local temporary
>file, and then memory mapped (all quietly, behind the scenes). This is
>because the virtual memory paging would be at a lower-level in the O/S than
>network access, and so cannot access a non-local disk.
>
>An EXE file is usually marked as "busy" when being executed because the code
>is being loaded into RAM on-demand, and the O/S has to prevent anything not
>yet loaded from being changed, or moved, before it gets to it. I find it
>annoying that this locking also seems to prevent a rename operation too,
>which isn't really modifying any data. Under UNIX, your can perform a 'mv'
>command on an executing program with no problems.
>
>I'm not aware of any XP differences in this area. I'm not running XP here so
>maybe someone else can tell me if you can successfully rename an executing
>local file. If it only works when executing a remote file then it sounds
>like the *whole* file is being fetched across the network, and the busy lock
>released on it before memory mapping the local version. I'm guessing here
>though.
>
> Tony Proctor

Yes it is possible to rename an executing file on W2K, but the
same code fails on 9x systems. Not tested on XP, but I'd assume
it would be similar to W2K. I abandoned this method for one employing
two exes since my code needs to run on 9x systems also.

Try it yourself:

Private Sub Command1_Click()

'delete old version if it exists
  If (Dir(App.Path & "\" & App.EXEName & ".old") <> "") Then Kill App.Path & "\" & App.EXEName & ".old"

'rename the current exe file
  Name App.Path & "\" & App.EXEName & ".exe" As App.Path & "\" & App.EXEName & ".old"

'rename the new (downloaded) exe file
' Name sUpdateExe As App.Path & "\" & App.EXEName & ".exe"
  Name App.Path & "\test1.exe" As App.Path & "\" & App.EXEName & ".exe"

'unload this version
  Unload Me

'transfer control to the new version
  Shell App.Path & "\" & App.EXEName & ".exe", vbNormalFocus

End Sub



Relevant Pages

  • Re: Widow/Orphan Doesnt Work
    ... If this doesn't fix the problem, quit Word again, trash the new Normal and ... rename OldNormal back to Normal. ... Navigate to your System folder> Preferences> Microsoft folder. ... Go to the Memory pane and try upping Word's Preferred memory ...
    (microsoft.public.mac.office.word)
  • Re: Data Execution Prevention
    ... >>DEP prevents malicious code from executing from protected areas of memory. ... > It has no inherent notion of "maliciousness". ...
    (microsoft.public.windowsxp.general)
  • Re: Execution of a COM file complied with BDS C
    ... gets around to executing your code? ... My situation is rather peculiar in that I'm running a hacked up CPM ... system resulted in "Out of Memory Program Aborted". ... great little compiler for the 8080, btw. Had mine since Aug 85. ...
    (comp.os.cpm)
  • Re: Linked List & Dynamic Memory Allocation
    ... understand what you meant by stack and heap. ... process is done executing and will it always lurk in the memory if OS ... this program large number of times, it will end of exhausting system ...
    (microsoft.public.vc.mfc)
  • Re: Self booting systems with out bootloader?!!!
    ... A non-fragmented memory just means that every byte from the start of memory ... This means that after a reset is made, ... in processor ROM. ... executing the 'work program'. ...
    (comp.arch.embedded)

Quantcast