Hi Allen. Apologies for the delayed reply. Taking some leave finally!

Here is some test code and the sample output from running on a Win7 Beta test machine and a WinXP machine. Hope this is useful. Cheers, Innes

Ini file used for testing:

 Code:
[TESTSECT1]
SOMEKEY1=ABCXYZ
[TESTSECT2]


Test script code:

 Code:
; **** Testing READPROFILESTRING in Windows 7 - Build 7000

? "ReadProfTest running on @PRODUCTTYPE"

$iniFile = "c:\scratch\Win7test.ini"

; Test 1 - Section and key present

$val = ReadProfileString($iniFile,"TESTSECT1","SOMEKEY1")
? "Test 1 Results - file, section, key present."
? "   Key Value = $val"
? "   ERROR:  @ERROR"
? "   SERROR: @SERROR"

; Test 2 - Section present but key absent

$val = ReadProfileString($iniFile,"TESTSECT2","NOKEYFND")
? "Test 2 Results - key absent."
? "   Key Value = $val"
? "   ERROR:  @ERROR"
? "   SERROR: @SERROR"

; Test 3 - Section and key absent

$val = ReadProfileString($iniFile,"NOSECTFND","NOKEYFND")
? "Test 3 Results -  Section and key absent."
? "   Key Value = $val"
? "   ERROR:  @ERROR"
? "   SERROR: @SERROR"

; Test 4 - No ini file found

$val = ReadProfileString("C:\NOSUCHFILE.INI","TESTSECT","TESTKEY")
? "Test 4 Results - INI file missing."
? "   Key Value = $val"
? "   ERROR:  @ERROR"
? "   SERROR: @SERROR"


Output from Win7 Beta - Bld 7000

ReadProfTest running on Windows Vista Ultimate Edition
Test 1 Results - file, section, key present.
Key Value = ABCXYZ
ERROR: 0
SERROR: The operation completed successfully.
Test 2 Results - key absent.
Key Value =
ERROR: 2
SERROR: The system cannot find the file specified.
Test 3 Results - Section and key absent.
Key Value =
ERROR: 2
SERROR: The system cannot find the file specified.
Test 4 Results - INI file missing.
Key Value =
ERROR: 2
SERROR: The system cannot find the file specified.


Output from WinXP SP3 Test:

ReadProfTest running on Windows XP Professional
Test 1 Results - file, section, key present.
Key Value = ABCXYZ
ERROR: 0
SERROR: The operation completed successfully.
Test 2 Results - key absent.
Key Value =
ERROR: 0
SERROR: The operation completed successfully.
Test 3 Results - Section and key absent.
Key Value =
ERROR: 0
SERROR: The operation completed successfully.
Test 4 Results - INI file missing.
Key Value =
ERROR: 0
SERROR: The operation completed successfully.