L
L
[DllImport("kernel32.dll")]
static extern uint GetPrivateProfileString(
string lpAppName,
string lpKeyName,
string lpDefault,
StringBuilder lpReturnedString,
uint nSize,
string lpFileName);
Interoping GetPrivateProfileString is giving me this Exception in
certain cases:
StringBuilder buffer has been overflowed by unmanaged code. The
process may become unstable. Insufficient capacity allocated to the
StringBuilder before marshaling it."
public void ReadINIFile()
{
try
{
GetPrivateProfileString("Directories" , "In" , "(rg)data/xml",
_strInDir,80, _strINIFile);
GetPrivateProfileString("Directories" , "Out", "c:\\xmldata" ,
_strOutDir,80, _strINIFile);
GetPrivateProfileString("System" , "IPAddress", "198.190.229.101" ,
_strIP,80, _strINIFile);
GetPrivateProfileString("System" , "UserID", "jw" , _strUser,80,
_strINIFile);
GetPrivateProfileString("System" , "Password", "jason" ,
_strPwd,80, _strINIFile);
GetPrivateProfileString("Time" , "BusyTimeStart", "14:30" ,
_strBusyTimeStart,80, _strINIFile);
GetPrivateProfileString("Time" , "BusyTimeEnd", "15:30" ,
_strBusyTimeEnd,80, _strINIFile);
GetPrivateProfileString("Time" , "BusyTimeIntervalInMin", "1" ,
_strBusyTimeIntervalInMin,80, _strINIFile);
GetPrivateProfileString("Time" , "RegTimeIntervalInMin", "5" ,
_strRegTimeIntervalInMin,80, _strINIFile);
GetPrivateProfileString("File" , "MainFrame to PC File extension",
"false" , _strFile,80, _strINIFile);
}
catch (Exception ex)
{
throw ex;
}
}
Does anybody have a solution to this?
Thanks,
Lalasa.
static extern uint GetPrivateProfileString(
string lpAppName,
string lpKeyName,
string lpDefault,
StringBuilder lpReturnedString,
uint nSize,
string lpFileName);
Interoping GetPrivateProfileString is giving me this Exception in
certain cases:
StringBuilder buffer has been overflowed by unmanaged code. The
process may become unstable. Insufficient capacity allocated to the
StringBuilder before marshaling it."
public void ReadINIFile()
{
try
{
GetPrivateProfileString("Directories" , "In" , "(rg)data/xml",
_strInDir,80, _strINIFile);
GetPrivateProfileString("Directories" , "Out", "c:\\xmldata" ,
_strOutDir,80, _strINIFile);
GetPrivateProfileString("System" , "IPAddress", "198.190.229.101" ,
_strIP,80, _strINIFile);
GetPrivateProfileString("System" , "UserID", "jw" , _strUser,80,
_strINIFile);
GetPrivateProfileString("System" , "Password", "jason" ,
_strPwd,80, _strINIFile);
GetPrivateProfileString("Time" , "BusyTimeStart", "14:30" ,
_strBusyTimeStart,80, _strINIFile);
GetPrivateProfileString("Time" , "BusyTimeEnd", "15:30" ,
_strBusyTimeEnd,80, _strINIFile);
GetPrivateProfileString("Time" , "BusyTimeIntervalInMin", "1" ,
_strBusyTimeIntervalInMin,80, _strINIFile);
GetPrivateProfileString("Time" , "RegTimeIntervalInMin", "5" ,
_strRegTimeIntervalInMin,80, _strINIFile);
GetPrivateProfileString("File" , "MainFrame to PC File extension",
"false" , _strFile,80, _strINIFile);
}
catch (Exception ex)
{
throw ex;
}
}
Does anybody have a solution to this?
Thanks,
Lalasa.