BUG: SetNamedSecurityInfo Hangs When Called from DLLMain (207779)



The information in this article applies to:

  • Microsoft Win32 Application Programming Interface (API), when used with:
    • the operating system: Microsoft Windows NT 4.0
    • the operating system: Microsoft Windows 2000
    • the operating system: Microsoft Windows XP

This article was previously published under Q207779

SYMPTOMS

On Microsoft Windows NT 4.0 Service Pack 4, a process will enter a deadlock state if SetNamedSecurityInfo() is called from DLLMain.

CAUSE

The execution of DLLMain entry point function is serialized. Only one thread at a time can be executing inside DLLMain.

On Service Pack 4, the SetNamedSecurityInfo() API creates a worker thread to do its work and waits until the worker thread exits before returning to the caller. Because a worker thread is created, the system needs to call DLLMain function before executing its thread procedure. This deadlocks because the caller of SetNamedSecurityInfo() is still inside the DllMain function waiting for the API to return.

RESOLUTION

An application should not call the SetNamedSecurityInfo() API inside a DLLMain.

STATUS

This behavior is by design.

MORE INFORMATION

Please see the DLLMain documentation for details on implementing a DLL.

Modification Type:MajorLast Reviewed:12/17/2003
Keywords:kbACL kbAPI kbbug kbDLL kbKernBase kbSecurity KB207779