This is the mail archive of the
cygwin-developers
mailing list for the Cygwin project.
Re: strange crashes on invocation
On Sep 26 16:38, Corinna Vinschen wrote:
> Btw., with horror I realized that our dependency to advapi32.dll also
> adds an indirect dependency to msvcrt.dll. For some reason I don't
> understand yet, it's not possible to convert the advapi32 entry points
> to all autoloaded entry points. Many Cygwin applications don't start
> anymore, for instance mintty or gdb.
I found the reason why it's not possible to convert advapi32 to a
autoload DLL. The problem is a SEGV in the advapi32 function
GetUserNameW. For some reason advapi32 crashes in that function if the
application is loadtime linked against advapi32. Cygwin calls
GetUserNameW in cygheap_user::init, which is called during Cygwin DLL
initialization. Apparently there's some sort of synchronization
problem.
Our problem is that we need the username, at least if we can't grab
the username from /etc/passwd. If /etc/passwd doesn't exist, or if
the user SID can't be found in /etc/passwd, the user name is set to
the Windows username.
Unfortunately there's no replacement function in another DLL. Even the
LookupAccountSid and LsaLookupSids functions are advapi32 functions and
both crash when I try to replace GetUserNameW with them. I admit that I
expected that, but it's still annoying
However, if I replace the GetUserNameW call with a call to
GetEnvironmentVariableW (L"USERNAME", ...), then all applications start
normally. I'm wondering if that's a sufficient solution. Call me
pessimistic, but somehow I doubt that we would be happy with it...
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat