Article View: borland.public.cppbuilder.nativeapi
Article #2606TLanguage & EAccessViolation
From: Mike Collins
Date: Fri, 02 Feb 2007 21:37
Date: Fri, 02 Feb 2007 21:37
52 lines
2604 bytes
2604 bytes
Hay all, posted a message the other day regarding a bug I was chasing that I
though was cause by a call to CoInitialize. Tracked it down and it has
nothing to do with it.
After careful delving, I found that the EAccessViolation error is stemming
from some code used to display the default system language. The exception
is raised when I either try to get a point to the global TLanguage object or
dynamically creating a new one. It currently only seem to occur when the
code / GINA is run on Windows systems that has English (United States), LCID
0x0409, as there default system language. It does not happen on English
(UK) or any other European locales.
Please note that the GINA / my code is running under the winlogon desktop
and LOCAL_SYSTEM.
The other anomaly is that if I extract the below code, and sick it in a demo
application and run that on the users desktop, it functions correctly:
TLanguages *lang = NULL;
try
{
try
{
lang = new TLanguages(); //*******<- point of exception
//lang = Languages(); //****** either option cause
excpetion
LCID udlc = GetSystemDefaultLCID();
for (short i=0; i<lang->Count; ++i)
{
if (lang->LocaleID[i] == udlc)
{
panSysLang->Caption = lang->Ext[i].SubString(0, 2);
panSysLang->Hint =
GinaStub->RtnSz(HELP_OPT_CONFIG_HEADER_SYS_LANG_HINT);
panSysLang->Hint =
AnsiString().sprintf(panSysLang->Hint.c_str(), lang->Name[i].c_str());
}
}
}
catch (std::bad_alloc)
{
}
}
__finally
{
if (lang)
{
delete lang;
lang = NULL;
}
}
Technical Details
Message-ID:
<45c3aed7@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,952f68fac08d67cc,start X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Mike Collins" <its@TheBottomOfThePost.com> Newsgroups: borland.public.cppbuilder.nativeapi Subject: TLanguage & EAccessViolation Date: Fri, 2 Feb 2007 21:37:22 -0000 Lines: 54 Organization: SDA Ltd X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.3790.2826 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2826 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 89.240.116.21 Message-ID: <45c3aed7@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1170452183 89.240.116.21 (2 Feb 2007 13:36:23 -0800) Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail