Take a look at .\test\src\UnitTests\dutil\IniUtilTest.cpp.
I think you are missing:
static HRESULT StandardIniFormat(__inout INI_HANDLE iniHandle)
{
HRESULT hr = S_OK;
hr = IniSetOpenTag(iniHandle, L"[", L"]");
ExitOnFailure(hr, "Failed to set open tag settings on ini handle");
hr = IniSetValueStyle(iniHandle, NULL, L"=");
ExitOnFailure(hr, "Failed to set value separator setting on ini
handle");
hr = IniSetCommentStyle(iniHandle, L";");
ExitOnFailure(hr, "Failed to set comment style setting on ini
handle");
LExit:
return hr;
}
-----Original Message-----
From: Sean Farrow [mailto:[email protected]]
Sent: Monday, April 07, 2014 10:22 PM
To: General discussion for Windows Installer XML toolset.
Subject: [WiX-users] issue when using IniUtil functions
Hi all,
I'm in the process of rewriting some ini handling to us the functions from
iniutil.h.
The following is the ini file I'm trying to parse:
[Environment]
CurrentlyActiveLanguage=enu
AppScriptFile=SurfaceReader.JSB
DefScriptFile=DEFAULT.JSB
ActiveSpotFile=C:\Users\tim\AppData\Roaming\Freedom
Scientific\JAWS\13.0\Settings\enu\PersonalizedSettings\SurfaceReader\SurfaceReader.hsc
CurrentUserSettingsFolder=C:\Users\tim\AppData\Roaming\Freedom
Scientific\JAWS\13.0\Settings\enu
SharedUsersSettingsFolder=C:\ProgramData\Freedom
Scientific\JAWS\13.0\Settings\enu
JawsSettingsFolder=C:\Users\tim\AppData\Roaming\Freedom
Scientific\JAWS\13.0\Settings\enu I'm testing this with a console application
that contains the following code:
#include <stdlib.h>
#include <Windows.h>
#include <dutil.h>
#include <fileutil.h>
#include <iniutil.h>
int main(int argc, char* argv[])
{
HRESULT hr;
INI_HANDLE handle;
INI_VALUE *rgValues = NULL;
DWORD cValues = 0;
hr =IniInitialize(&handle);
ExitOnFailure(hr, "Unable to initialize the ini handle.");
hr =FileExistsEx(L"c:\\work\\CurrentJawsEnvironment.ini",
NULL); ExitOnFailure(hr, "The dimension pro hsc set does not exist."); hr
=S_FALSE; hr =IniParse(handle, L"c:\\work\\CurrentJawsEnvironment.ini", NULL);
ExitOnFailure(hr, "unable to parse the ini."); hr =IniGetValueList(handle,
&rgValues, &cValues); ExitOnFailure(hr, "Unableto obtain the values.");
LExit:
ReleaseIni(handle);
return 0;
}
After the line that calls GetValueList, cValues still =0, and the rgValues
array doesn't contain any meaningful data.
Can somebody tell me what I'm doing wrong. I've looked at the unit tests for
iniutil and thought I'd followed them.
Any help appreciated.
Kind regards
Sean.
------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration Continuously Automate
Build, Test & Deployment Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users
------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
WiX-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wix-users