Saturday, January 19, 2013

SUPPORT INI Files

The name "INI file" comes from the commonly used filename extension, .INI, which stands for "initialization". Other common extensions are .CFG, .conf, and .TXT.[citation needed]Linux and Unix systems also use a similar file format for system configuration. In addition, platform-agnostic software may use this file format for configuration. It is human-readable and simple to parse, so it is an ideal format for configuration files that do not require much complexity.

HideFormat

Keys (properties)

The basic element contained in an INI file is the key or property. Every key has a name and a value, delimited by an equals sign (=). The name appears to the left of the equals sign.name=value

Sections

Keys may be grouped into arbitrarily named sections. The section name appears on a line by itself, in square brackets ([ and ]). All keys after the section declaration are associated with that section. There is no explicit "end of section" delimiter; sections end at the next section declaration, or the end of the file. Sections may not be nested.[section]

Case insensitivity

Section and property names are not case sensitive in the Windows implementation.[1]

Comments

Semicolons (;) at the beginning of the line indicate a comment. Comment lines are ignored.; comment text

Varying features

This section needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challengedand removed. (April 2012)The INI file format is not well defined. Many programssupport features beyond the basics described above. The following is a list of some common features, which may or may not be implemented in any given program.

Blank lines

Some rudimentary programs do not allow blank lines. Every line must therefore be a section head, a property, or a comment.

Comments

Some software supports the use of the number sign (#) as an alternative to the semicolon for indicating comments.In some implementations, a comment may begin anywhere on a line, including on the same line after properties or section declarations. In others, including Windows' GetPrivateProfileString function, comments must occur on lines by themselves


The name "INI file" comes from the commonly used filename extension, .INI, which stands for "initialization". Other common extensions are .CFG, .conf, and .TXT.[citation needed]Linux and Unix systems also use a similar file format for system configuration. In addition, platform-agnostic software may use this file format for configuration. It is human-readable and simple to parse, so it is an ideal format for configuration files that do not require much complexity.

HideFormat

Keys (properties)

The basic element contained in an INI file is the key or property. Every key has a name and a value, delimited by an equals sign (=). The name appears to the left of the equals sign.name=value

Sections

Keys may be grouped into arbitrarily named sections. The section name appears on a line by itself, in square brackets ([ and ]). All keys after the section declaration are associated with that section. There is no explicit "end of section" delimiter; sections end at the next section declaration, or the end of the file. Sections may not be nested.[section]

Case insensitivity

Section and property names are not case sensitive in the Windows implementation.[1]

Comments

Semicolons (;) at the beginning of the line indicate a comment. Comment lines are ignored.; comment text

Varying features

This section needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challengedand removed. (April 2012)The INI file format is not well defined. Many programssupport features beyond the basics described above. The following is a list of some common features, which may or may not be implemented in any given program.

Blank lines

Some rudimentary programs do not allow blank lines. Every line must therefore be a section head, a property, or a comment.

Comments

Some software supports the use of the number sign (#) as an alternative to the semicolon for indicating comments.In some implementations, a comment may begin anywhere on a line, including on the same line after properties or section declarations. In others, including Windows' GetPrivateProfileString function, comments must occur on lines by themselves


Escape characters

Some implementations also offer varying support for an escape character, typically with the backslash (\). Some support "line continuation", where a backslash followed immediately by EOL (end-of-line) causes the line break to be ignored, and the "logical line" to be continued on the next actual line from the INI file. Implementation of various "special characters" with sequences escapes is also seen


Common escape sequencesSequenceMeaning
\\\ (a single backslash, escaping the escape character)\0Null character\aBell/Alert/Audible\bBackspace, Bell character for some applications\tTab character\rCarriage return\nNewline\;Semicolon\#Number sign\=Equals sign\:Colon\x????Unicode character with hexadecimal code pointcorresponding to ????

Global properties (implicit global section)

Optional "global" properties may also be allowed, that are declared before any section is declared.[2]

Hierarchy

Most commonly, INI files have no hierarchy of sections within sections. Some files appear to have a hierarchical naming convention, however.

For section A, subsection B, sub-subsection C, property P and value V, they may accept entries such as [A.B.C] and P=V (Windows' xstart.ini), [A\B\C]and P=V (the IBM Windows driver file devlist.ini), or [A] and B,C,P = V (Microsoft Visual Studio file AEMANAGR.INI).

It is unclear whether these are simply naming conventions that an application happens to use in order to give the appearance of a hierarchy, or whether the file is being read by a module that actually presents this hierarchy to the application programmer.

Name/value delimiter

Some implementations allow a colon (:) as the name/value delimiter (instead of the equals sign).

Quoted values

Some implementations allow values to be quoted, typically using double quotes and/or apostrophes. This allows for explicit declaration of whitespace, and/or for quoting of special characters (equals, semicolon, etc.). The standard Windows function GetPrivateProfileString supports this, and will remove quotation marks that surround the values.

Whitespace

Interpretation of whitespace varies. Most implementations ignore leading and trailing whitespace around the outside of the property name. Some even ignore whitespace within values (for example, making "host name" and "hostname" equivalent). Some implementations also ignore leading and trailing whitespace around the property value; others consider all characters following the equals sign (including whitespace) to be part of the value.

Order of sections and properties

In most cases the order of properties in a section and the order of sections in a file is irrelevant, but implementations may vary.Close this section

Accessing INI files

Under Windows, the Profile API is the programming interface used to read and write settings from classic Windows .ini files. For example, the 

GetPrivateProfileString function retrieves a string from the specified section in an initialization file.The following sample C program demonstrates reading property values from the above sample INI file (Let the name of configuration file be dbsettings.ini)#include <windows.h> int main(int argc, _TCHAR *argv[]) { _TCHAR dbserver[1000]; int dbport; GetPrivateProfileString("database", "server", "127.0.0.1", dbserver, sizeof dbserver, "dbsettings.ini"); dbport = GetPrivateProfileInt("database", "port", 143, "dbsettings.ini"); // N.B. WritePrivateProfileInt() does not exist return 0; } Python's standard library provides the configparsermodule for parsing INI-like configuration files.Close this section

HideFile mapping

Initialization File Mapping[3][4] creates a mapping between an INI file and the Registry. It was introduced with Windows NT and Windows 95 as a way to migrate from storing settings in classic .ini files to the new Windows Registry. File mapping traps the Profile API calls and, using settings from the IniFileMapping Registry section, directs reads and writes to appropriate places in the Registry.Using the Example above, a string call could be made to fetch the name key from the owner section from a settings file called, say, dbsettings.ini. The returned value should be the string "John Doe":GetPrivateProfileString("owner", "name", ... , "c:\\programs\\oldprogram\\dbsettings.ini"); INI mapping takes this Profile API call, ignores any path in the given filename and checks to see if there is a Registry key matching the filename under

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\   CurrentVersion\IniFileMappingIf this exists, it looks for an entry name matching the requested section.

If an entry is found, INI mapping uses its value as a pointer to another part of the Registry. It then looks up the requested INI setting in that part of the Registry.If no matching entry name is found and there is an entry under the (Default) entry name, INI mapping uses that instead. Thus each section name does not need its own entry.HKEY_LOCAL_MACHINE\Software\...\IniFileMapping\dbsettings.ini(Default)@USR:Software\oldprogs\inisettings\alldatabaseUSR:Software\oldprogs\inisettings\dbSo, in this case the profile call for the [owner] section is mapped through to:HKEY_CURRENT_USER\Software\oldprogs\inisettings\allnameJohn DoeorganizationAcme Productswhere the "name" Registry entry name is found to match the requested INI key. The value of "John Doe" is then returned to the Profile call. In this case, the @ prefix on the default prevents any reads from going to the dbsettings.ini file on disk. The result is that any settings not found in the Registry are not looked for in the INI file.The "database" Registry entry does not have the @ prefix on the value; thus, for the [database] section only, settings in the Registry are taken first followed by settings in the dbsettings.ini file on disk.Close this section

HideAlternatives

Starting with Windows 95, Microsoft began strongly promoting the use of Windows registry over the INI file.More recently, XML-based configuration files have become a popular choice for encoding configuration in text files.

XML allows arbitrarily complex levels and nesting, and has standard mechanisms for encoding binary data. INI files are typically limited to two levels (sections and properties) and do not handle binary data well. Additionally, data serialization formats, such as JSON and YAML can serve as configuration formats. These three alternative formats can nest arbitrarily, but have a more heavyweight syntax than the INI file.Close this section



EDITING INI FILES★★★★★★★


- What privilege does your normal Windows account have? User? Administrator?- What are the attributes of the problem file? Read-only? Windows Explorer will tell you.- What are the permissions for this file? Write access for everyone? Or only read access? Windows Explorer will tell you (Properties/Security).



Open notepad at an elevated level (right click on notepad and select Run as administrator)Then import the file you are editing, edit and then save



Also copying the file to the desktop, editing, saving and moving it back works. However, I didn't have to do any of that before. I could change and save the file directly in its native folder. Something has changed in my security settings apparently. I would like to sleuth it out if possible




5 comments:

  1. DISABLE WINDOWS STORE


    I COMPLETELY understand this "feature". It's Microsoft attempt at a multi-user environment, it's their attempt to protect program and system files from malicious code and incompetent users. Despite this and Microsoft best efforts, the bumbling morons we refer to as users, still manage to render equipment completely inoperable. Unfortunately I must support systems and customers that require live database files to be edited and not duplicated elsewhere. You see, a lot of these customers cannot afford fancy server machines with server operating systems. So one machine has to share the folder where the application and it's database resides. The "flexibility" and "compatibility" that virtual store provides is actually counter-productive to what I need to accomplish for the software

    ReplyDelete
  2. DISABLE WINDOWS STORE 2

    I must support. The fact that the system is self contained is more desirable than any thing we could gain with virtual store, as the systems operate in an environment where system theft and failure are constant issues. Being able to move the entire system, in its entirety, with out having to dig extraneous files out of the operating system is a priority as it minimizes downtime, which some times isn't possible if virtual store was running and the operating system is no longer boot-able. When you run it (the application in question) through the network on another machine, it works properly, as it reads and writes to the actual directory. (I understand why and how this works, thanks) However when run locally it writes to virtual store. This is not acceptable, because then all the "client" machines had actual data, and the "host" machine only sees virtual store data. Also many functions of the application do not work properly because they cannot locate the live files or cannot write to its own folder. Since changing the application to work with virtual store/uac properly is impossible, virtual store must be disabled. Since this work around is on a folder-by-folder basis, it still leaves virtual store for other folders, which I don't care about. What you don't understand or are not willing or capable of understanding is how deal with customers who think months worth of work is gone because the database they think they have backed up is in fact empty and their data is stuck some where in virtual store limbo. Or how to explain that now since they've been writing to two, separate, secure databases that the only way to reconcile one with the other is chose the one that is larger or more relavent and hand enter all the missing data. I never install vista/7 with UAC... and a host of other "features" Microsoft felt necessary to burden power users with.  I can understand there are instances where they would be desirable, but this is not one of them (neither is my personal machine).

    ReplyDelete
  3. DISABLE WINDOWS STORE


    It's a nuisance to have to hunt through hidden, locked, or encrypted folders to try and retrieve some ones work, to have to go through and take ownership of your own files, etc. I am completely against the operating system having higher privileges than the user or it deciding for the user what's best to do. It's an example of Microsoft snobbery, and their increasing desire and expression of controlling what you do with your PC, which you demonstrated here. In REAL LIFE , in the FIELD where the software is actually used, both systems (older security model VS new security model) will break, which one is faster and faster to fix? Time is paramount in this business.I guess they should have a "Professional" Professional version, that is sans the training wheels, or at least provides a user interface for disabling these "features". (As if the already far to diversified product line up isn't splintered enough.) Frankly, for all the things Microsoft has done right in vista and 7 I don't understand some of the ridiculousness they feel the need to inject into their product. Example: Vista Home Basic, Vista Home, Vista Home Premium, Vista Professional, Vista Business, Vista BusinessN and Vista Ultimate. Holy ____, no wonder people were scratching their heads with Vista. All you need is HOME, PRO, SERVER, and stop trying to create market segments that don't exist. I want an operating system that does what I tell it to and NOTHING else. When I write to file XYZ, it darn well better have wrote to file XYZ, and not C:\hiddenfolder\folderyoudon'thavepermisiontoopen\hiddencopy\xyz.







    ReplyDelete


  4. he way to disable it in vista and 7 (which doesn't require you to disable UAC in vista) is to use TAKE OWNERSHIP (google this and get the reg file to add it to your right click menu) to take ownership of the folder. Then give all desired users full access to the folder, windows will stop duplicating into and working out of virtual store. No thanks to all the users that came in and told me that I didn't know what I was doing/ didn't understand the feature (BUG) / shouldn't disable it. I am posting the answer to help those who agree with me that virtual store is non-sense. And that this move to a computing appliance rather than a computer is also ridiculous. I want an operating system, not a computing appliance. If I wanted a computing appliance I would buy a mac.



    ReplyDelete
  5.  will explain what the %localappdata%\VirtualStore is and how it works.From what I know, this path: %localappdata%\VirtualStore is part ofUser Account Control (UAC) virtualization that covers to things:File System VirtualizationWindows® Registry VirtualizationMoreover, the File System Virtualization is UAC's File Virtualization Filter Driver(%SystemRoot%\System32\Drivers\Luafv.sys) which implements file system virtualization.Figure 1: As we can see the %localappdata%\VirtualStore\ is often used forlegacy applications that run under restricted accounts, a Standard User that uses this legacy application will NOT know, because Standard Users sometimes think that it is a BUG, but it isn’t, it is part of UACs File SystemVirtualization Filter Driver. Figure 1: File System Virtualization. The application is denied access, it doesn't have full rights to write to that directoryand that *.ini, so File System Virtualization will redirect it to another path which isas shown in Figure 1 above. If you have UAC questions feel free to ask me, and if you want to control UAC better or have trusted apps and you do NOT want prompts, then I suggest you download my UAC Tools from my website: http://www.itknowledge24.com.I hope you find this information useful. If you need any further assistance,please feel free to contact me and let me know.I hope this information was helpful…Have a nice day…

    ReplyDelete