Comments about TCmd's configuration files (INIs)

English support forum

Moderators: white, Hacker, petermad, Stefan2

jb
Senior Member
Senior Member
Posts: 412
Joined: 2003-02-09, 22:56 UTC
Location: Switzerland

Post by *jb »

VadiMGP wrote:I don't think backup of registry much more complicatd then backup of tens files.
In my opinion a backup of specific portions of the registiry is much more complicated than a configuration directory (regardless how many .ini files it contains) that is located within the user data. In the latter case the configuration data is automatically backed up whenever the user data is backed up. There is just no extra work!
VadiMGP wrote:Let compare ini files with registry:
1. Ini files limited by size
Wrong.
VadiMGP wrote:2. ini files doesn't allows to store multilingual data (unicode)
Unicode is long-awaited feature. So this point is just one more reason to implement unicode support.
VadiMGP wrote:3. ini files allows to enter nonsens data( strings instead of digits, p.e)
Wrong. Although the Windows registry has a few data types, also the registry allows you to enter nonsense data.
VadiMGP wrote:4. all above requires much more programmer's effort to provide data integrity.
The goal is to make programs more user-friendly, not more programmer-friendly.
VadiMGP wrote:5. ini files cannot be protected from unauthorized access.
Wrong.
User avatar
djk
Power Member
Power Member
Posts: 1651
Joined: 2003-03-17, 11:33 UTC
Location: Poland
Contact:

Post by *djk »

Lefteous wrote:Nested informations like [DirMenu] should better be stored in a XML file.
I think it would be also a good solution for fsplugin.ini and lsplugin.ini
jb wrote:I can't believe that somebody puts MS-DOS on the same quality level as TC. :shock:
It was a little bit a joke and I don't meant quality but rather frequency of using. I as often use DOS as TC ;-)

I don't now how old are you but I've been working with DOS for a such long time now that I can't imagine world without DOS :-) Our company still develop DOS software so I use it really often.
DJK
Totally addicted to Total Commander
totalcmd.pl
en.totalcmd.pl
VadiMGP
Power Member
Power Member
Posts: 672
Joined: 2003-04-05, 12:11 UTC
Location: Israel

Post by *VadiMGP »

2jb All items above are correct. And i know companies who paid very high price for their delusions.

But i didn't understand something:
2. ini files doesn't allows to store multilingual data (unicode)
Unicode is long-awaited feature. So this point is just one more reason to implement unicode support.
Can you explain, please, what do you mean?
User avatar
Lefteous
Power Member
Power Member
Posts: 9535
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

VadiMGP wrote:2jb All items above are correct. And i know companies who paid very high price for their delusions.

But i didn't understand something:
2. ini files doesn't allows to store multilingual data (unicode)
Unicode is long-awaited feature. So this point is just one more reason to implement unicode support.
Can you explain, please, what do you mean?
0000B1A8h 413 GetProfileIntA
0000A56Ch 414 GetProfileIntW
000502FBh 415 GetProfileSectionA
00034A3Ch 416 GetProfileSectionW
000092F4h 417 GetProfileStringA
00009593h 418 GetProfileStringW
00031399h 904 WritePrivateProfileSectionA
004FF93h 905 WritePrivateProfileSectionW
00008D7Eh 906 WritePrivateProfileStringA
00008DC5h 907 WritePrivateProfileStringW
000500F3h 908 WritePrivateProfileStructA
000501EEh 909 WritePrivateProfileStructW

and so on

(extracted using the excellent FileInfo plugin :D )

do you still beleave INI-files cannot be writen in Unicode mode:?:
And even if there would't be any native support for storing/loading INI files in Unicode mode, it would be possible to write these functions to support Unicode mode.
jb
Senior Member
Senior Member
Posts: 412
Joined: 2003-02-09, 22:56 UTC
Location: Switzerland

Post by *jb »

See next post. Sorry, I clicked quote instead of edit. :oops:
Last edited by jb on 2003-07-13, 16:35 UTC, edited 1 time in total.
jb
Senior Member
Senior Member
Posts: 412
Joined: 2003-02-09, 22:56 UTC
Location: Switzerland

Post by *jb »

VadiMGP wrote:All items above are correct. And i know companies who paid very high price for their delusions.
Please tell me more about these delusions. I would really like to learn what is correct in all your items above, provided it is related to Windows built on NT Technology (NT 4, NT 5 = Windows 2000, NT 6 = Windows XP). Stuff concerning Windows 9x (based on messy old DOS) is quite irrelevant or will be soon.
VadiMGP wrote:Can you explain, please, what do you mean?
Many posts in this forum already addressed (directly or indirectly) the lack of Unicode support by TC. As far as I remember also Christian wrote that Unicode support is on his wish list (partly already announced for TC V6.0!). Full Unicode support would mean that every string can (or even must?) be a Unicode string. So every TC-related text file (such as .ini, .bar and .mnu files) could consist of Unicode characters.
Last edited by jb on 2003-07-13, 16:35 UTC, edited 1 time in total.
VadiMGP
Power Member
Power Member
Posts: 672
Joined: 2003-04-05, 12:11 UTC
Location: Israel

Post by *VadiMGP »

jb wrote: Please tell me more about these delusions. I would really like to learn what is correct in all your items above...
Sorry, explanation of all of them could be really long story and not related to this forum. But anyway i'll give you one short example about "unicode support" in INI fiels. Many programmers think that exists correlation between unicode function interface and file content. Wrong! Compile code below and execute it on Windows 2000. After this check if file test.ini contains unicode text or not. If you think this file will be unicode, surprise awaiting you.

Code: Select all

int main(int argc, char* argv[])
{
	HANDLE hf;

	hf=CreateFile("c:\\test.ini",
	GENERIC_WRITE,
	FILE_SHARE_WRITE,
	NULL,
	OPEN_ALWAYS,
	FILE_ATTRIBUTE_NORMAL,
	NULL);

	CloseHandle(hf);

	WritePrivateProfileStringW(
	L"section",
	L"key",
	L"value",
	L"c:\\test.ini");
	return 0;
}
Experience is the best teacher. :)

Sorry but it is really impossible in one short post write all incompatibilities and Windows pitfalls detected during many years. And keyword there is detected.

Well, returning back to the start. What you think about Registry as place to store settings? And about XML? I think XML even more dangerous for unexperienced user than ini files.
User avatar
Lefteous
Power Member
Power Member
Posts: 9535
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

VadiMGP wrote:
jb wrote: Please tell me more about these delusions. I would really like to learn what is correct in all your items above...
Sorry, explanation of all of them could be really long story and not related to this forum. But anyway i'll give you one short example about "unicode support" in INI fiels. Many programmers think that exists correlation between unicode function interface and file content. Wrong! Compile code below and execute it on Windows 2000. After this check if file test.ini contains unicode text or not. If you think this file will be unicode, surprise awaiting you.

Code: Select all

int main(int argc, char* argv[])
{
	HANDLE hf;

	hf=CreateFile("c:\\test.ini",
	GENERIC_WRITE,
	FILE_SHARE_WRITE,
	NULL,
	OPEN_ALWAYS,
	FILE_ATTRIBUTE_NORMAL,
	NULL);

	CloseHandle(hf);

	WritePrivateProfileStringW(
	L"section",
	L"key",
	L"value",
	L"c:\\test.ini");
	return 0;
}
Experience is the best teacher. :)

Sorry but it is really impossible in one short post write all incompatibilities and Windows pitfalls detected during many years. And keyword there is detected.

Well, returning back to the start. What you think about Registry as place to store settings? And about XML? I think XML even more dangerous for unexperienced user than ini files.

Code: Select all

#define UNICODE
#include <windows.h>
#include <tchar.h>

int _tmain (int argc, LPTSTR argv [])
{
	DWORD nOut;
	TCHAR uBuffer [1];
	HANDLE handle;
	handle=CreateFile(
		TEXT("c:\\test.ini"), 
		GENERIC_WRITE, 
		FILE_SHARE_WRITE, 
		NULL,
		OPEN_ALWAYS, 
		FILE_ATTRIBUTE_NORMAL, 
		NULL);
	uBuffer[0] = 0xFEFF;
	WriteFile (handle, uBuffer, 2, &nOut, NULL);
	CloseHandle(handle); 
	WritePrivateProfileString(
		TEXT("section"), 
		TEXT("key"), 
		TEXT("value"), 
		TEXT("c:\\test.ini")); 
	return 0;
}


:wink:
Last edited by Lefteous on 2003-07-13, 17:43 UTC, edited 1 time in total.
jb
Senior Member
Senior Member
Posts: 412
Joined: 2003-02-09, 22:56 UTC
Location: Switzerland

Post by *jb »

VadiMGP wrote:If you think this file will be unicode, surprise awaiting you.
Thank you for the tip! As Lefteous has shown there is a simple workaround. Furthermore in the company I work for we use our own IniFile class which is more flexible than the corresponding Win32-API functions and which is part of a multi-platform library. Now you gave us one more reason that we do the right thing, although Unicode is not yet a requirement for our .ini files.
VadiMGP wrote:Well, returning back to the start. What you think about Registry as place to store settings? And about XML? I think XML even more dangerous for unexperienced user than ini files.
I clearly prefer .ini files to the Windows registry mainly because .ini files are more user-friendly (easier to edit, backup, copy, move, ...) and they work on any platform (makes porting TC to Linux easier).

I don't know XML well, but it seems to be attractive. For instance my favorite editor saves its settings in XML. A drawback is that XML files are not that easy to edit with a normal editor.
VadiMGP
Power Member
Power Member
Posts: 672
Joined: 2003-04-05, 12:11 UTC
Location: Israel

Post by *VadiMGP »

jb wrote:Thank you for the tip!
Not at all. :) You are welcome!
As Lefteous has shown there is a simple workaround.
Unfortunately this partially workaround applicable only for this small and absolutely useless program. In the real life it doesn't solve any problem.
Furthermore in the company I work for we use our own IniFile class which is more flexible than the corresponding Win32-API functions and which is part of a multi-platform library. Now you gave us one more reason that we do the right thing, although Unicode is not yet a requirement for our .ini files.
Without any doubth it is right decision! If this issue interesting for you, i recommend to take a look at High Performance Solution Ini File Class with MMF from Codeguru site.
User avatar
Lefteous
Power Member
Power Member
Posts: 9535
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

VadiMGP wrote: Unfortunately this partially workaround applicable only for this small and absolutely useless program. In the real life it doesn't solve any problem.
It seems to me as if you don't have any idea at all. Every valid unicode text file needs a BOM (byte order mask) at the beginnend.
:arrow: Use notepad to verify! :evil:
All of your statements about Unicode were wrong... :evil:
And of course my solution can be used in a real life application, why not?
It just shows you were wrong. I added 2 lines of code to make it work... so it's a little bit stupid to say it's a partially workaround :evil:
jb
Senior Member
Senior Member
Posts: 412
Joined: 2003-02-09, 22:56 UTC
Location: Switzerland

Post by *jb »

VadiMGP wrote:Unfortunately this partially workaround applicable only for this small and absolutely useless program. In the real life it doesn't solve any problem.
I think that's not fair. After all it is the basis of a solution. It's up to the reader to refine it, for instance by encapsulating the TEXT() calls.
Furthermore it proves that your objection

"2. ini files doesn't allows to store multilingual data (unicode)"

is untenable.
VadiMGP wrote:If this issue interesting for you, i recommend to take a look at High Performance Solution Ini File Class with MMF from Codeguru site.
Thanks! :) Seems interesting. I will look at it in details before the next revision of our IniFile class.
User avatar
Lefteous
Power Member
Power Member
Posts: 9535
Joined: 2003-02-09, 01:18 UTC
Location: Germany
Contact:

Post by *Lefteous »

jb wrote:
VadiMGP wrote:Unfortunately this partially workaround applicable only for this small and absolutely useless program. In the real life it doesn't solve any problem.
I think that's not fair. After all it is the basis of a solution. It's up to the reader to refine it, for instance by encapsulating the TEXT() calls.
Furthermore it proves that your objection

"2. ini files doesn't allows to store multilingual data (unicode)"

is untenable.
VadiMGP wrote:If this issue interesting for you, i recommend to take a look at High Performance Solution Ini File Class with MMF from Codeguru site.
Thanks! :) Seems interesting. I will look at it in details before the next revision of our IniFile class.
The "TEXT" or "L" macro is used to make a hard-coded Unicode string. It's unlikely to see to it in an Application were string are read from language files. The example is just to demonstrate WritePrivateProfileStringW works fine for Unicode, if you know how to use it and what Unicode is.

Well, of course there are many advanced INI file solutions out there. But I really don't think it's necessary and has a disadvantage. My Wincmd.ini has 600 lines the Winftp.ini has 200 lines. ...
When using an alternative solution Totalcmd.exe grows. To call the existing windows functions should be absolutely sufficient for the task.
jb
Senior Member
Senior Member
Posts: 412
Joined: 2003-02-09, 22:56 UTC
Location: Switzerland

Post by *jb »

Sorry I was too fast. My post was completely wrong.
Last edited by jb on 2003-07-14, 09:19 UTC, edited 2 times in total.
User avatar
wanderer
Power Member
Power Member
Posts: 1578
Joined: 2003-03-28, 14:35 UTC
Location: Sol

Post by *wanderer »

Geez! I don't take a look at the forum for a weekend and the thread becomes 3 pages long! Too many opinions posted here so far so commenting on specific posts is pointless. I would like to clarify a couple of things though.

First of all, everything i proposed about the locations of things stands for the initial installation. If the first time you install TCmd you place it on "Q:\TheBestProgramOutThere", when you reinstall it, it remembers the path so setting the initial path to "C:\Program Files\TotalCmd" doesn't really stop anyone from placing it in another dir and it makes it more standard. Ok norfie, perhaps it was not very wise to say that MS people stick to the standards they set but look at the "Program Files" thing. More than 95% of the programs out there have their initial installation path set to "C:\Program Files". That should say something. Look at the "My Documents" path. It hasn't changed it's logic since Win95. Maybe the location has changed (because WinNT is a real OS, unlike the Win9x series which was a poor emulation of an OS) but all programs use a standard Windows API function to find the "My Documents" path, which hasn't changed though Windows versions.

As for the "C:\Documents and Settings\<USER>\Application Data\TotalCmd", whoever has used this dir and has seen how other applications store their files there, he will understand my point. No application stores its data files in "C:\Documents and Settings\<USER>" dir (or at least no one should). If you wish to store the toolbars or other things too, where shoud you put them? Under "C:\Documents and Settings\<USER>" too? Do you know what would happen if every application did that? A great mess like the "C:\WinNT\System32" dir where every application stores their DLLs there and when you try to find anything, you need 3 maps and a guide to show you the way! :)

Registry: yes it has become the trashbin of modern PCs (as was correctly mentioned by JackFoo) but i believe it's helpful (occasionally). In addition to all pros VadiMGP mentioned, it provides an organized way to store settings (when properly used) regardles of the installation location of the program. I like it because it gives the ability to logically organize things in folders (unlike the ini files), which is visually more understandable than a flat INI file. One could say that INIs are sort-of one-dimensional while registry is two-dimensional. That doesn't mean that INIs are bad. On the contrary, in programs like TCmd, its best to store everything in an INI rather than the registry. As a conclusion, i too believe the best way to go with TCmd's settings are the ini files.
- Wanderer -

¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Normally using latest TC on:
x32: WinXPx32 SP3
x64: Clients/Servers from Win7 to Win11 and Win2K12Srv to Win2K22Srv, mainly Win10 though.
Post Reply