Microsoft KB Archive/207779

{|
 * width="100%"|

BUG: SetNamedSecurityInfo Hangs When Called from DLLMain

 * }

Q207779

-

The information in this article applies to:


 * Microsoft Win32 Application Programming Interface (API), included with:
 * Microsoft Windows NT Server version 4.0
 * Microsoft Windows NT Workstation version 4.0
 * the operating system: Microsoft Windows 2000

-

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.

Additional query words: kbdsupport kbdsh

Keywords : kbAccCtrl kbAPI kbDLL kbKernBase kbOSWinNT400 kbOSWin2000 kbSDKPlatform kbSecurity kbDSupport kbGrpDSKernBase

Issue type : kbbug

Technology : kbAudDeveloper kbWin32sSearch kbWin32API