How can i know the TC configuratin file loaded by /i=

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
ts4242
Power Member
Power Member
Posts: 2081
Joined: 2004-02-02, 20:08 UTC
Contact:

How can i know the TC configuratin file loaded by /i=

Post by *ts4242 »

My two programs Ultra TC Start/Directory Menu Editor has a command called (Add Me) which add a link to the program at the end of your start or dir menu, when the program start by clicking this link it is run and load the start/directory menu from the default wincmd.ini founded in registery
but suppose you run TC using another configuration file by using the (/i=) parameter when my program run it will read the menu from the default configuration file not from the current file used by TC.
my question is how can i know the current configuration file used by TC?
is there is something like "Commander_Path"

Thanks for help
User avatar
SanskritFritz
Power Member
Power Member
Posts: 3693
Joined: 2003-07-24, 09:25 UTC
Location: Budapest, Hungary

Post by *SanskritFritz »

I dont know much about this, but there must be an API function to enquire the command line used to start a process. The Process Explorer ( Sysinternals: http://www.sysinternals.com ) is able to show such information about any process in the system. Maybe asking Mark Russinovich could help?
I switched to Linux, bye and thanks for all the fish!
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

Yep, Process Explorer can do it and cmdline can do it:
http://www.diamondcs.com.au/index.php?page=console-cmdline

According to them:
CmdLine uses an undocumented technique discovered by DiamondCS to read the full commandline from every process, a trick that is basically achieved by reading memory in the right places. It doesn't use code injection or any other techniques that may cause unstability so it's very safe to use.
Icfu
User avatar
norfie
Power Member
Power Member
Posts: 1194
Joined: 2003-02-18, 14:18 UTC

Post by *norfie »

Last edited by norfie on 2004-09-11, 11:52 UTC, edited 1 time in total.
User avatar
ts4242
Power Member
Power Member
Posts: 2081
Joined: 2004-02-02, 20:08 UTC
Contact:

Post by *ts4242 »

What i need is that when my program start can find (by itself not by another application) the current configuratin file used by TC if it is running.

I suggest that: if TC start with another configuration file it is create a registry value under "...\Software\Ghisler\Total Commander\" named say "CurrentIniFileName" and store the path of this file and delete it if it used the default ini file or when it is closed.

this will be very useful for any add-on work on the contents of TC configuration file.

just thought
User avatar
SanskritFritz
Power Member
Power Member
Posts: 3693
Joined: 2003-07-24, 09:25 UTC
Location: Budapest, Hungary

Post by *SanskritFritz »

I suggest that: if TC start with another configuration file it is create a registry value under "...\Software\Ghisler\Total Commander\" named say "CurrentIniFileName" and store the path of this file and delete it if it used the default ini file or when it is closed. this will be very useful for any add-on work on the contents of TC configuration file.
Hmm, not im my case though, I have more instances of TC, one which I use, and one where I test my plugin I develop, and they have different ini paths. So if I start the second instance of TC, it overwrites the first instance's registry notes. And of course I want to use the first instance's ini settings...
I switched to Linux, bye and thanks for all the fish!
User avatar
norfie
Power Member
Power Member
Posts: 1194
Joined: 2003-02-18, 14:18 UTC

Post by *norfie »

Last edited by norfie on 2004-09-11, 11:51 UTC, edited 1 time in total.
User avatar
SanskritFritz
Power Member
Power Member
Posts: 3693
Joined: 2003-07-24, 09:25 UTC
Location: Budapest, Hungary

Post by *SanskritFritz »

2norfie
There are 2 problems with that:
1. It does not solve the more TC instances problem, and
2. Those environment variables are only available in the current process (TC) and its child processes (programs started from this TC instance). I think there is a way to propagate them to the system level (as Explorer does), but then still point 1 is intact.
I switched to Linux, bye and thanks for all the fish!
User avatar
ts4242
Power Member
Power Member
Posts: 2081
Joined: 2004-02-02, 20:08 UTC
Contact:

Post by *ts4242 »

SanskritFritz wrote:
I suggest that: if TC start with another configuration file it is create a registry value under "...\Software\Ghisler\Total Commander" named say "CurrentIniFileName" and store the path of this file and delete it if it used the default ini file or when it is closed. this will be very useful for any add-on work on the contents of TC configuration file.
Hmm, not im my case though, I have more instances of TC, one which I use, and one where I test my plugin I develop, and they have different ini paths. So if I start the second instance of TC, it overwrites the first instance's registry notes. And of course I want to use the first instance's ini settings...
this can be solved by TC on GotFocus event update this value so each time you swich from one instance to another an add-on can always find the correct configuration file in this value.
User avatar
SanskritFritz
Power Member
Power Member
Posts: 3693
Joined: 2003-07-24, 09:25 UTC
Location: Budapest, Hungary

Post by *SanskritFritz »

2ts4242
Hmm. I still think the best way for you is to explicitely ask the user for the ini path in your program.
I switched to Linux, bye and thanks for all the fish!
User avatar
norfie
Power Member
Power Member
Posts: 1194
Joined: 2003-02-18, 14:18 UTC

Post by *norfie »

Last edited by norfie on 2004-09-11, 11:51 UTC, edited 1 time in total.
User avatar
SanskritFritz
Power Member
Power Member
Posts: 3693
Joined: 2003-07-24, 09:25 UTC
Location: Budapest, Hungary

Post by *SanskritFritz »

2norfie
Yes, of course this will work only, if you start a program from TCmd (Are there other ways to start a program??? )
I'm humbled. You are totally right :-) Sounds good!
I switched to Linux, bye and thanks for all the fish!
Post Reply