1

My understanding of the /SWAPRUN option (MSDN link) is that it causes an executable to be loaded to the swap file and executed from there.

Is this mechanism possible in VB6?

CJ7
  • 22,579
  • 65
  • 193
  • 321

2 Answers2

1

There is no way to specify this in VB6.exe (i.e. the IDE/compiler).

However there are add-ins that "hook" the compile-and-link process, or you could do this yourself with a little effort.

The easiest way is to just re-edit the compiled and linked program via EditBin.exe or Link.exe. EditBin is just a stub that invokes Link, but Link is installed as part of VB6 so you may as well run it directly.

The main reason for doing this is to optimize running from a network share or CD/flashdrive device. It will not help you bypass security, fool antivirus software, or act anything at all like a "run extracted EXE from RAM" hack.

Bob77
  • 13,167
  • 1
  • 29
  • 37
0

We're doing a "C:\Program Files\Microsoft Visual Studio\VB98\LINK.EXE" /EDIT /NOLOGO /SWAPRUN:NET file.dll on all exe/dll/ocx for our portable builds. Unfortunately this does not prevent EXCEPTION_IN_PAGE_ERROR exceptions being raised when LAN gets down.

System components (e.g. COMCTL32.OCX) are not flagged with swaprun and are shipped signed by Microsoft. Editing the PE header results in broken digital certificate.

wqw
  • 11,771
  • 1
  • 33
  • 41
  • You would expect no less from changing a signed file. Since these were signed to facilitate use in a Web page I suppose you might strip the signature with some tool. Sounds like a lot of trouble though it might be justified for applications using such libraries in isolated assemblies. – Bob77 Mar 06 '12 at 21:30
  • @wqw: have you noticed any advantages gained in doing this? – CJ7 Mar 06 '12 at 23:00
  • The main advantages would be performance and reduced network traffic. This is just a kind of caching mechanism, so the underlying storage must stay connected or the pages get marked bad - kaboom. /SWAPRUN:CD seems to work for flash drive programs in improving performance and reducing "wear." – Bob77 Mar 07 '12 at 03:26
  • @CraigJ: Actually, it does work (on win7) -- just checked it. Probably system components have be raising in page errors. – wqw Mar 07 '12 at 09:18
  • @BobRiemersma: would there be any security issues with this? Will some enterprise networks restrict this kind of activity? – CJ7 Mar 08 '12 at 12:55
  • It isn't doing anything with a security impact. I haven't seen any Group Policy objects that address it. – Bob77 Mar 08 '12 at 16:33