#194512 - 2009-07-01 01:44 AM
Re: Windows 7 Beta - ReadProfileString
[Re: Allen]
|
NZBluefish
Just in Town
Registered: 2009-06-23
Posts: 3
Loc: NZ
|
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:
[TESTSECT1]
SOMEKEY1=ABCXYZ
[TESTSECT2]
Test script 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.
|
Top
|
|
|
|
#194513 - 2009-07-01 04:14 AM
Re: Windows 7 Beta - ReadProfileString
[Re: NZBluefish]
|
Allen
KiX Supporter
   
Registered: 2003-04-19
Posts: 4557
Loc: USA
|
I'm getting the same results as you (on XP 32bit and Win7 RC1 64bit)... however, I have to say, unless I am completely overlooking something, I think the XP results are completely off, and the Win 7 are better, but the errors are not very specific. I tested this with 4.22 and the results were like this way back then too.
There are a number of EnumINIs in the UDF forum, one in particular Glenn wrote... http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=135385 I notice the way he wrote it, it completely works around this behavior AND actually gives a meaningful error.
I rarely use INI files... but Glenn uses them all the time. I'd be interested in hearing his thoughts.
|
Top
|
|
|
|
#202352 - 2011-05-26 04:53 PM
Re: Windows 7 Beta - ReadProfileString
[Re: Glenn Barnas]
|
Ruud van Velsen
Developer
   
Registered: 1999-05-06
Posts: 391
Loc: Amsterdam, The Netherlands
|
Phhh... just saw this one. Yes, good one... this is, for lack of a better description, a "progression" in Windows 7 (as opposed to a regression...).
W7 contains a fix for the age-old issue in the GetPrivateProfileString() API that it never sets the error code as documented in the specifications.
In theory, I could make KiX act on W7 like it was on XP, and drop the error code on the floor, but that does not sound like the right thing to do.
So, yes, this is an unexpected side-effect when running KiX on Windows 7, and I suggest to handle it in the scripts where appropriate.
Thanks for the report!
Ruud
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 676 anonymous users online.
|
|
|