Page 2 of 2

Re: Portable install?

Posted: 09 Sep 2013, 16:06
by Jan Rysavy
SvA wrote:
Jan Rysavy wrote:Wasted time...
I disagree.
What about creating a poll on this?
Good idea! Proposed options regarding portable version:
1) Writing to registry and installing shell extension into TEMP is OK. (*)
2) Writing to registry is OK, but installing shell extension into TEMP is not possible. I can live without shell extension. (*)
3) Writing to registry and TEMP directory is not possible, I can live without Eroiica Viewer, WinSCP plugin, and shell extension.

(*) Assuming it would be cleaned on Salamander exit / Windows restart.

Re: Portable install?

Posted: 13 Sep 2013, 15:50
by johnd126
Petr Solin wrote:We have no experience with this, please give us more information.

Do you need to start Salamander on some protected computers where unknown applications (like Salamander) cannot write anything to registry? Or do you have some restrictions on registry keys? E.g. HKEY_CURRENT_USER\Software is OK, but HKEY_CLASSES_ROOT is forbidden?

I'm afraid that some plugins cannot work without access to registry. Eroiica registers its DLLs to registry because it is using COM model, without registering these DLLs to registry, it simply cannot work and I do not believe Parallax (author) will change COM to anything else. Next is WinSCP, it has configuration in own key in registry (not under Salamander's key), it shares configuration with standalone version of WinSCP.

Drag&drop from archives and filesystem plugins (e.g. FTP) to Explorer cannot work without registering our DLL with copy-hook in registry.

We have expected that if we place configuration in some special key ("portable" in name to avoid collision with client's installed Salamander) in registry and will create this key on start (load it from configuration file from USB) and remove this key on exit, it will be OK. We can register copy-hook to our DLL copied to TEMP directory and unregister it on Salamander's exit and schedule DLL in TEMP for deletion on Windows shutdown (or start). The same with Eroiica's registration and WinSCP configuration, simply make special support for start and exit of portable version (loading from file and cleaning from registry).
I'm the same as other posters: I can live without Eroiica or WinSCP and really don't want anything written to the registry, even temporarily. Mostly I would want the basic AS configuration settings ... nothing fancy.

I could live without drag and drop from archives ... but does the dll absolutely have to be registered in the registry? I've implemented keyboard hook dll's but they've never required any registration. They implement SetWindowsHookEx() on launch and it communicates with my main application. When the application exits the hook is removed. And as far as I know the dll can be loaded from any directory.

Keep up the good work.
jd

Re: Portable install?

Posted: 14 Sep 2013, 19:57
by Ether
3) +1; I believe that writing to registry is precisely what portable applications should not do. Besides, I don't need Eroiica nor drag'n'drop.

The WinSCP application can use an INI file for configuration, so it shouldn't be a lot of work to modify the plugin to allow the same.

Re: Portable install?

Posted: 18 Sep 2013, 04:45
by johnd126
Petr Solin wrote:We have no experience with this, please give us more information.
Here's some pseudo code which will show the idea.

Reading values:
--------------------

Instead of this:

DWORD Type = REG_DWORD, Size = sizeof(DWORD);
RegOpenKey((HKEY_CURRENT_USER, "Software\\Altap\\Altap Salamander 3.0 beta 3\\Configuration", &hKey);
RegQueryValueEx(hKey, "Always On Top", NULL, &Type, (PBYTE)Value, &Size);
RegCloseKey(hKey);

Use this:

char buf[MAX_PATH];
int Value;
GetPrivateProfileString("Configuration", "Always On Top", "0", buf, MAX_PATH, IniFile);
Value = atoi(buf);

Writing values:
------------------

Instead of this:

DWORD Value = 1;
RegOpenKey(HKEY_CURRENT_USER, "Software\\Altap\\Altap Salamander 3.0 beta 3\\Configuration", &hKey);
RegSetValueEx(hKey, "Always On Top", 0, REG_DWORD, (PBYTE)&Value, sizeof(Value));
RegCloseKey(hKey);

Use this:

char buf[MAX_PATH];
lstrcpy(buf, "1");
WritePrivateProfileString("Configuration", "Always On Top", buf, IniFile);

Which will create this in the IniFile:

[Configuration]
Always On Top=1

Re: Portable install?

Posted: 18 Sep 2013, 09:41
by Jan Rysavy
What about system libraries and shell extensions - tens of DLLs every process is loading anyway? How can we disable writing to the registry there?

You can use Process Monitor to get idea, there is A LOT activity on process background.

Please let us know exactly why do you see (runtime/temporary) writing into registry as problem. It will help us find proper solution for Salamander...

Re: Portable install?

Posted: 18 Sep 2013, 20:32
by SvA
Jan Rysavy wrote:What about system libraries and shell extensions - tens of DLLs every process is loading anyway? How can we disable writing to the registry there?
Don't care about those. That's what the system thinks it needs to do, let it do it. Only make sure you do not register any dlls nor write to the registry explicitly.
Jan Rysavy wrote:Please let us know exactly why do you see (runtime/temporary) writing into registry as problem.
Is there any part of the registry denoted by windows to hold temporary values, something that take the same role within the registry as does the TEMP directory in the file system? If there is, you may use it. But since there is not you ought not.

And regarding the code johnd126 gave. I suppose you know, not to do it just like that. Instead you should encapsulate operations to the config store such, that you easily can replace the config storage to whatever you choose, such as
  • an INI file
  • an XML file
  • a plist file
  • a JSON file
  • a database (e.g. SQLite
  • the registry
  • ...

Re: Portable install?

Posted: 18 Sep 2013, 23:06
by Jan Rysavy
SvA wrote:
Jan Rysavy wrote:Please let us know exactly why do you see (runtime/temporary) writing into registry as problem.
Is there any part of the registry denoted by windows to hold temporary values, something that take the same role within the registry as does the TEMP directory in the file system? If there is, you may use it. But since there is not you ought not.
Is any reference available? I didn't find guidelines for Windows portable apps.
SvA wrote: And regarding the code johnd126 gave. I suppose you know, not to do it just like that. Instead you should encapsulate operations to the config store such, that you easily can replace the config storage to whatever you choose, such as
Yes, we know, we already have this layer implemented and partially used in Salamander (for now it is handling command Option > Export Configuration).

Re: Portable install?

Posted: 25 Sep 2013, 17:47
by johnd126
Jan Rysavy wrote:
SvA wrote:
Jan Rysavy wrote:Please let us know exactly why do you see (runtime/temporary) writing into registry as problem.
Is there any part of the registry denoted by windows to hold temporary values, something that take the same role within the registry as does the TEMP directory in the file system? If there is, you may use it. But since there is not you ought not.
Is any reference available? I didn't find guidelines for Windows portable apps.
There is no such thing as a temporary section in the registry. Anything put in the registry stays there until it's removed. Truly portable apps simply just don't use the registry.

Re: Portable install?

Posted: 25 Sep 2013, 19:03
by Jan Rysavy
We are not talking about some imaginary temporary registry key. We are just proposing we will use registry when Salamander will be running with cleaning it on close.

Until someone show us some real guidelines / specifications for portable Windows applications, I still consider it as good solution for Salamander. Switch to file-only solution is much more complicated with existing code base.