INI operations slow on win2K
Keywords: INI operations slow on win 2000
Question:
I experiencing a problem when using WinBatch to read information from an INI file and then write it to a second INI file. I've created a simple script to simplify the troubleshooting process. I am including my code and a copy on my INI file here for your reference. The problem I'm experiencing involves the amount of time the script takes to process the INI file. In Windows 9x, the program is able to complete the entire process in approximately 15 seconds, whereas in Windows NT/2K, it is taking in excess of 2 minutes. The example I'm including here is designed to do the exact same thing under Windows 9x as it does under Windows NT/2K. However, I'm at a loss in determining what is taking so long under the later versions.I am using:
Compiler - 2000C dll(3.0cbv)
WBDBV32I.DLL - 3.0.2.22 dated 5/3/200 4:17pm
Your assistance is appreciated,
DebugTrace(@On, ".\debugtrace.txt") ;Exclusive (@On) SOURCEINI = ".\SOURCEINI.INI" TARGETINI = ".\TARGET.INI" If FileExist(TARGETINI) then FileDelete(TARGETINI) STARTTIME=TimeYmdHms( ) UPDATE = 0 :LOOP UPDATE = UPDATE + 1 :READINI TITLE = IniReadPvt(UPDATE, "TITLE", "END", SOURCEINI) If TITLE != "END" DESC = IniReadPvt(UPDATE, "DESC", "", SOURCEINI) SOURCE = IniReadPvt(UPDATE, "SOURCE", "", SOURCEINI) TARGET = IniReadPvt(UPDATE, "TARGET", "", SOURCEINI) PREREQ = IniReadPvt(UPDATE, "PREREQ", "", SOURCEINI) TAG = IniReadPvt(UPDATE, "TAG", "", SOURCEINI) EXECOMMAND = IniReadPvt(UPDATE, "EXECOMMAND", "", SOURCEINI) EXEPARAMS = IniReadPvt(UPDATE, "EXEPARAMS", "", SOURCEINI) LANONLY = IniReadPvt(UPDATE, "LANONLY", "D", SOURCEINI) INFORM = IniReadPvt(UPDATE, "INFORM", "", SOURCEINI) CLEANUP = IniReadPvt(UPDATE, "CLEANUP", "", SOURCEINI) REPORT = IniReadPvt(UPDATE, "REPORT", "", SOURCEINI) APPOSVER = IniReadPvt(UPDATE, "OSVER", "", SOURCEINI) APPLOS = IniReadPvt(UPDATE, "LOS", "", SOURCEINI) APPREGION = IniReadPvt(UPDATE, "REGION", "", SOURCEINI) APPMACHINE = IniReadPvt(UPDATE, "MACHINE", "", SOURCEINI) APPCATEGORY = IniReadPvt(UPDATE, "CATEGORY", "", SOURCEINI) OPTIONALAPP = IniReadPvt(UPDATE, "OPTIONAL", "", SOURCEINI) ALLOWONHOMEPC = IniReadPvt(UPDATE, "ALLOWONHOMEPC", "", SOURCEINI) APPFREESPACE = IniReadPvt(UPDATE, "FREESPACE", "", SOURCEINI) Else goto END EndIf :WRITETOINI IniWritePvt(UPDATE, "TITLE", TITLE, TARGETINI) IniWritePvt(UPDATE, "DESC", DESC, TARGETINI) IniWritePvt(UPDATE, "SOURCE", SOURCE, TARGETINI) IniWritePvt(UPDATE, "TARGET", TARGET, TARGETINI) IniWritePvt(UPDATE, "PREREQ", PREREQ, TARGETINI) IniWritePvt(UPDATE, "TAG", TAG, TARGETINI) IniWritePvt(UPDATE, "EXECOMMAND", EXECOMMAND, TARGETINI) IniWritePvt(UPDATE, "EXEPARAMS", EXEPARAMS, TARGETINI) IniWritePvt(UPDATE, "LANONLY", LANONLY, TARGETINI) IniWritePvt(UPDATE, "INFORM", INFORM, TARGETINI) IniWritePvt(UPDATE, "CLEANUP", CLEANUP, TARGETINI) IniWritePvt(UPDATE, "REPORT", REPORT, TARGETINI) IniWritePvt(UPDATE, "OSVER", APPOSVER, TARGETINI) IniWritePvt(UPDATE, "LOS", APPLOS, TARGETINI) IniWritePvt(UPDATE, "REGION", APPREGION, TARGETINI) IniWritePvt(UPDATE, "MACHINE", APPMACHINE, TARGETINI) IniWritePvt(UPDATE, "CATEGORY", APPCATEGORY, TARGETINI) IniWritePvt(UPDATE, "OPTIONAL", OPTIONALAPP, TARGETINI) IniWritePvt(UPDATE, "ALLOWONHOMEPC", ALLOWONHOMEPC, TARGETINI) IniWritePvt(UPDATE, "FREESPACE", APPFREESPACE, TARGETINI) IniwritePvt ("", "", "", TARGETINI) ;<<<<<<<<
Answer:
Try adding Exclusive(@on), to the begininng of the script. I would guess it is taking a long time to execute each iniwritepvt. Something is interfering with the ini operations. Basically inifiles are treated specially by windows. Modifications to ini files are cached. The only way to immediate commit those changes to disk is to, include the line...
IniwritePvt ("", "", "", TARGETINI) ;<<<<<<<<Each time the cached ini is commited to disk, it takes up processing time. Maybe some utility is forcing these updates everytime????
Stumpped....
User reply:
I have found what we believe to be the cause of our problem. The machines experiencing the extremely slow INI processing times were found to be running McAfee AV 4.5. This version of the product is configured by McAfee to check INI files for viruses by default. After removing the INI extension form McAfee, we were able to attain times of approximately 6 seconds on machines (Compaq M700 700Mhz laptop) that had been taking approximately 2 minutes to complete previously. We have chosen to use a different extension for our INI files and that also seems to have resolved the problem without having to change the McAfee configuration. You may want to consider posting this information concerning INI files and AntiVirus software on your web site.
Article ID: W14735Filename: INI operations slow on win2K.txt