FAR Portable proof-of-concept

You want to talk about Far Manager, but don't know where to turn?
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

FAR Portable proof-of-concept

Post by pepak »

Well, it works. I managed to write a wrapper around FAR which will intercept its registry access and replaces real registry with a registry-export file (.reg). Which means that FAR can run as a true portable application from a USB stick, for example.

I am looking for brave (perhaps foolish :-)) people with plenty of time on their hands, who would be willing to take my very early alpha demo, try it with FAR as much as possible, and report places which don't work. I know there will be some - I mean it when I say it is only a proof of concept, even though some of the functions did work for me (e.g. the FTP plugin). Note that at the moment 64bit applications aren't supported at all (and won't be at least until I switch to Windows 7), and while Unicode is mostly supported, I strongly urge to only use it if your locale fits into the 8-bit ANSI space (this will be fixed later, once I manage to build the program with Delphi 2009).

And a final note: You may run into trouble with antiviruses or firewalls. This is caused by the way registry interception is done (through injecting a foreign library into FAR and overwriting the involved API functions in memory). Some security software may well identify the injection and overwriting as malicious activity and freak out - that can't be helped, unfortunately, except by turning off the software (which is another reason why you certainly shouldn't run this tool on a production machine).

When it is mostly working, I plan to release the sources, too (under BSD, same as my other software), so if you subscribe to the myth of "open source software is safe", you will have something to check before you decide whether to trust it or not.

You can download the archive here:
http://tmp.pepak.net/far-portable-alpha001.zip
Setup instructions are inside the archive.
User avatar
vik
Posts: 15
Joined: Sat 15 Jan, 2011 13:36
Location: Vinnitsa, Ukraine

Re: FAR Portable proof-of-concept

Post by vik »

Nice idea.
I may guess that you are using API hook in your approach.

I also heard about another approach which is free of antiviruses or firewalls complains about malicious activity.

The idea is the following. Before starting Far the .reg file is loaded. Then Far is started and running as usual. After Far exits all settings are saved to the .reg file and removed from the registry.

But it's better should be done by Far, I think.
May be in the future we will have such kind of Far version which saves all settings in a separate file instead of the registry. This is one of the steps that should be done to have real portable Far version.

BTW. Is there any work started to make Far multiplatform?
It will be great if Far can be run under Linux, for example.
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

Re: FAR Portable proof-of-concept

Post by pepak »

vik wrote:I also heard about another approach which is free of antiviruses or firewalls complains about malicious activity.
The idea is the following. Before starting Far the .reg file is loaded. Then Far is started and running as usual. After Far exits all settings are saved to the .reg file and removed from the registry.
I considered it, but I dislike the idea of writing to the registry and then deleting it. If I truested the host computer so much, I could simply use a BAT file to RestoreSettings, Run FAR, SaveSettings, DeleteSettings, and save all the trouble of writing actual code.

With Windows Vista and newer, something similar could be done using RegLoadAppKey, but it has drawbacks of its own. In the end the hook approach is probably the best.
But it's better should be done by Far, I think.
I am not concerned about FAR itself; FAR is open source and could certainly be modified to use a XML-based-configuration. The problem are the plugins, many of which are not maintained anymore (but still useful).
User avatar
vik
Posts: 15
Joined: Sat 15 Jan, 2011 13:36
Location: Vinnitsa, Ukraine

Re: FAR Portable proof-of-concept

Post by vik »

pepak wrote: The problem are the plugins, many of which are not maintained anymore (but still useful).
Yes, you are right. To have old-good plugins work in portable version the API hook approach is the best.

I'm now working on java plugins infrastructure that will allow to write ones and work everywhere.
The code name of my project is j4far. It's not based on the existing project far4j (http://www.farmanager.com/enforum/viewtopic.php?t=565) but the idea is similar.
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

Re: FAR Portable proof-of-concept

Post by pepak »

http://tmp.pepak.net/far-portable-alpha002.zip

- Compiled with full (I hope) unicode support.
- Fixed writing to registry (reading was fine, but writing didn't do anything most of the time).
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

Re: FAR Portable proof-of-concept

Post by pepak »

I am rather disappointed no one seems to be interested. Oh well.
Third alpha version works even with RegEdit and MacroView plugins, which failed with version 2.
http://tmp.pepak.net/far-portable-alpha003.zip
User avatar
NightRoman
Posts: 6184
Joined: Fri 18 Aug, 2006 13:52
Location: Cambridge, UK
Has thanked: 32 times
Been thanked: 62 times
Contact:

Re: FAR Portable proof-of-concept

Post by NightRoman »

pepak
Do not be disappointed, it looks like you do some really useful stuff. Go on! Perhaps nobody wants to deal with alphas, it’s not a surprise. But things may change when you declare it tested and stable.
Игорь Юдинцев
Posts: 726
Joined: Sun 03 Apr, 2005 22:00
Location: Казань
Been thanked: 2 times

Re: FAR Portable proof-of-concept

Post by Игорь Юдинцев »

Couldn't get it working on my Windows XP SP3, i. e. a) settings are taken from the registry, instead of saved .REG file, b) FAR 2.0 (build 1796, no plugins) crashes immediately after start.
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

Re: FAR Portable proof-of-concept

Post by pepak »

Игорь Юдинцев wrote:Couldn't get it working on my Windows XP SP3, i. e. a) settings are taken from the registry, instead of saved .REG file
The only way I can see this happening is when a security software (usually a personal firewall, perhaps an antivirus as well) interferes with hooking the API.
b) FAR 2.0 (build 1796, no plugins) crashes immediately after start.
Which version of FakeReg? I did see immediate crashes, but those were in debug builds and should be fixed now. Just today I was experimenting with FAR build 1777 with all plugins, trying to get RegEdit and MacroView to work, and everything seemed to work just fine. I didn't try the nightly build, though.
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

Re: FAR Portable proof-of-concept

Post by pepak »

In fact, I just tried it with the nightly build. Just far.exe, far.map, fareng.* copied to a directory and started with a saved registry. Seems to work just fine for me in XP SP2, just as it worked OK on Vista earlier today.
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

Re: FAR Portable proof-of-concept

Post by pepak »

NightRoman wrote:Do not be disappointed, it looks like you do some really useful stuff. Go on! Perhaps nobody wants to deal with alphas, it’s not a surprise.
I am not surprised people aren't trying the concept - not when it is in alpha stage, requires turning off of security software AND doesn't provide source code (yet). But I admit I expected at least someone writing something along the lines of, "when it is finished, I will definitely want to try it".

I will continue anyway, since the functionality is useful for myself (especially after I add .reg encryption to the tool), but I did expect a bit more interest.
User avatar
Kerberos464
Posts: 1239
Joined: Wed 29 Jul, 2009 20:24
Location: Saint-Petersburg
Has thanked: 19 times
Been thanked: 1 time

Re: FAR Portable proof-of-concept

Post by Kerberos464 »

when it is finished, I will definitely want to try it! (c)
no jokes.
thanks in advance for your work!
16.09.2012 14:35:28 +0200 - build 2799 - все нативные плагины перестали работать.
30.09.2012 03:26:20 +0200 - build 2851 - все макросы перестали работать.
31.02.2029 25:61:61 +0200 - build 6666 - весь фар перестал работать.
Игорь Юдинцев
Posts: 726
Joined: Sun 03 Apr, 2005 22:00
Location: Казань
Been thanked: 2 times

Re: FAR Portable proof-of-concept

Post by Игорь Юдинцев »

pepak wrote:The only way I can see this happening is when a security software (usually a personal firewall, perhaps an antivirus as well) interferes with hooking the API.
I've got no firewall nor antivirus installed. Which test should I perform to identify possible presence of the interfering hook?
pepak wrote:Which version of FakeReg?
FakeReg.exe 0.3.0.37, FakeRegLib.dll 0.3.0.35.
Maximus5
Posts: 3295
Joined: Sun 11 Nov, 2007 02:03
Been thanked: 10 times
Contact:

Re: FAR Portable proof-of-concept

Post by Maximus5 »

alpha003

Registry is NOT hooked, when I try to use "Far.reg" (attached). No error messages or warnings was shown.

But, hooked (normally), when try to use empty "Far1.reg" (attached).

Win7x64, Far2 1783 x86, standard plugins
Attachments
Far.reg.7z
(2.13 KiB) Downloaded 241 times
Maximus5
Posts: 3295
Joined: Sun 11 Nov, 2007 02:03
Been thanked: 10 times
Contact:

Re: FAR Portable proof-of-concept

Post by Maximus5 »

Hm, it came home to me )
The key [HKEY_CURRENT_USER\Software\Far2] is absent in the *.reg file, and hooker does not hook this key.
Post Reply

Return to “General Discussions”