Jnuw
11th October 2004 19:48 UTC
Does WriteINIStr command work on Win98???
I was using the WriteINIStr command to add some text to an ini file on my Win2k machine. It was working great. However, when I tested my installer on a Win98 PC, the WriteINIStr command did absolutely nothing. In fact, it seems to prevent the next 1 or 2 commands from working. Here is the code:
WriteINIStr "$INSTDIR\ULogs\ULog.ini" "Info" "bla bla" "1"
Delete "$INSTDIR\ULogs\$ULogLM"
Rename "$INSTDIR\ULogs\ULog.ini" "$ULogLM"
The Rename command would rename the ini into the ULogLM string, but would leave the Ulog.ini file, as if it was locked by the failing WriteINIStr command. Any ideas?
Thanks much all!
scully13
11th October 2004 19:54 UTC
If you are copying the ULog.ini file from a CD make sure you remove it's read-only attribute before you use WriteINIStr. Win98 makes files read-only when they are copied from a CD. If you are not copying the file from a CD then ignore me.
Jnuw
11th October 2004 20:08 UTC
Not copying from a CD, and double checked the files, they are not read only, but thank you very much for the advice. When I comment out the WriteINIStr line, everything works fine, so I think it has something to do with the WriteINIStr command and Win98.
Afrow UK
11th October 2004 20:11 UTC
Maybe try FlushINI first.
-Stu
Jnuw
11th October 2004 20:38 UTC
Thanks Afrow UK, should I put the FlushINI command right before, or right after the WriteINIStr command? Thanks.
kichik
11th October 2004 21:10 UTC
Right after WriteINIStr.
Jnuw
11th October 2004 21:58 UTC
Nope, no luck with the FlushINI as far as actually writing to the ini, however the next commands (Delete and Rename) do work now.
deguix
11th October 2004 22:39 UTC
Every change you do to an INI file will only be updated when you use "FlushINI" (on Win9x). So if you write something to the INI file and you want to read it correctly you should use "FlushINI" before reading, deleting or renaming an INI file.
Logically, if you try to open an INI file after writting and before flushing it, you'll see that the INI file didn't change at all.
This sometimes should be looked as a feature, because with this you don't need to backup the file -> even when you try to write, you can still read the intact old version...:)