Click here to Skip to main content
Licence 
First Posted 25 May 2000
Views 50,904
Bookmarked 20 times

Scan and Merge INI Files

By | 25 May 2000 | Article
A free tool to merge INI files, check for common INI file mistakes, and quickly determine how two INI files differ.
  • Download source files - 21 Kb
  • Introduction

    This utility was written late at night at a customer site to help me determine the difference between INI settings on a machine that was configured correctly and a machine that was not executing an application correctly. Originally, it just sorted two INI files so that they could easily be compared using Windiff.exe.

    It has been expanded to do the following additional tasks:

    • Find syntax errors related to comment fields in an INI file.
    • Find duplicate section blocks in an INI file.
    • Find duplicate keys within section blocks of an INI file.
    • Sort INI files so that you can use Windiff.exe to see how they differ.
    • Merge two INI files into a third.
    • Replace system paths like "C:\Windows\" with "C:\Winnt\" when it is appropriate.


    How to use it

    Just run the exe from a command line to see example usage and documentation. The basic format is as follows:

    C:\Mytools\MergeINIFiles.exe "C:\DominantFile.INI C:\Suplimental.INI C:\Merged.INI"
    

    Because we mostly launch this tool via InstallShield, there is no GUI, unless the files contain errors or the parameters are incorrect.


    Technology used

    The INI files are read as text files so that comments are included in the result set. The program is a simple, CFile reads the text, CArray holds the text and CMap compares the text.


    Summary

    I maintain no rights or restrictions on this code. It was not plagiarized from any other source. This utility was written using a Wizard generated SDI framework. It was created using VC 5.0.


    License

    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here

    About the Author

    Phil McGahan



    United States United States

    Member



    Sign Up to vote   Poor Excellent
    Add a reason or comment to your vote: x
    Votes of 3 or less require a comment

    Comments and Discussions

     
    You must Sign In to use this message board. (secure sign-in)
     
    Search this forum  
     FAQ
        Noise  Layout  Per page   
      Refresh
    GeneralMy vote of 1 Pinmemberaenagy10:21 9 Jan '09  
    GeneralThe system cannot execute the specified program. Pinmemberaenagy10:17 9 Jan '09  
    QuestionHow to compile? Pinmemberaenagy3:16 9 Jan '09  
    I am using VisualStudio 2005 to compile this source code. I am following a colleague's recommendation to use the VS2005 command prompt and the following command:
     
    cl MainFrm.cpp Warnings.cpp StdAfx.cpp MergeInifilesView.cpp MergeInifilesDoc.cpp MergeInifiles.cpp
     
    I get a bunch of errors:
     
    ----- start -----
    Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86
     
    Copyright (C) Microsoft Corporation. All rights reserved.
     
    MainFrm.cpp
    WINVER not defined. Defaulting to 0x0502 (Windows Server 2003)
    C:\Program Files\Microsoft Visual Studio 8\VC\ATLMFC\INCLUDE\afxwin1.inl(105) :
    warning C4530: C++ exception handler used, but unwind semantics are not enabled.
    Specify /EHsc
    Warnings.cpp
    WINVER not defined. Defaulting to 0x0502 (Windows Server 2003)
    C:\Program Files\Microsoft Visual Studio 8\VC\ATLMFC\INCLUDE\afxwin1.inl(105) :
    warning C4530: C++ exception handler used, but unwind semantics are not enabled.
    Specify /EHsc
    StdAfx.cpp
    WINVER not defined. Defaulting to 0x0502 (Windows Server 2003)
    C:\Program Files\Microsoft Visual Studio 8\VC\ATLMFC\INCLUDE\afxwin1.inl(105) :
    warning C4530: C++ exception handler used, but unwind semantics are not enabled.
    Specify /EHsc
    MergeInifilesView.cpp
    WINVER not defined. Defaulting to 0x0502 (Windows Server 2003)
    C:\Program Files\Microsoft Visual Studio 8\VC\ATLMFC\INCLUDE\afxwin1.inl(105) :
    warning C4530: C++ exception handler used, but unwind semantics are not enabled.
    Specify /EHsc
    MergeInifilesDoc.cpp
    WINVER not defined. Defaulting to 0x0502 (Windows Server 2003)
    C:\Program Files\Microsoft Visual Studio 8\VC\ATLMFC\INCLUDE\afxwin1.inl(105) :
    warning C4530: C++ exception handler used, but unwind semantics are not enabled.
    Specify /EHsc
    MergeInifiles.cpp
    WINVER not defined. Defaulting to 0x0502 (Windows Server 2003)
    C:\Program Files\Microsoft Visual Studio 8\VC\ATLMFC\INCLUDE\afxwin1.inl(105) :
    warning C4530: C++ exception handler used, but unwind semantics are not enabled.
    Specify /EHsc
    Generating Code...
    Microsoft (R) Incremental Linker Version 8.00.50727.762
    Copyright (C) Microsoft Corporation. All rights reserved.
     
    /out:MainFrm.exe
    MainFrm.obj
    Warnings.obj
    StdAfx.obj
    MergeInifilesView.obj
    MergeInifilesDoc.obj
    MergeInifiles.obj
    libcmt.lib(crt0.obj) : error LNK2019: unresolved external symbol _main reference
    d in function ___tmainCRTStartup
    MainFrm.exe : fatal error LNK1120: 1 unresolved externals
     
    Z:\work\IniUtils_src\MergeINIfiles>
    ----- end -----
     
    How do I fix this?
    AnswerRe: How to compile? Pinmemberaenagy9:54 9 Jan '09  
    QuestionEXE Download? Pinmembergrantwic18:42 10 Sep '06  
    AnswerRe: EXE Download? Pinmemberdllmrobinson21:42 9 Dec '08  

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

    Permalink | Advertise | Privacy | Mobile
    Web02 | 2.5.120529.1 | Last Updated 26 May 2000
    Article Copyright 2000 by Phil McGahan
    Everything else Copyright © CodeProject, 1999-2012
    Terms of Use
    Layout: fixed | fluid