Click here to Skip to main content
15,893,266 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
QuestionHow can program tell that itself is running as admin? Pin
Brandon-X120001-Oct-11 5:40
Brandon-X120001-Oct-11 5:40 
AnswerRe: How can program tell that itself is running as admin? Pin
Luc Pattyn1-Oct-11 5:58
sitebuilderLuc Pattyn1-Oct-11 5:58 
GeneralRe: How can program tell that itself is running as admin? Pin
Brandon-X120001-Oct-11 6:13
Brandon-X120001-Oct-11 6:13 
AnswerRe: How can program tell that itself is running as admin? Pin
Luc Pattyn1-Oct-11 6:31
sitebuilderLuc Pattyn1-Oct-11 6:31 
AnswerRe: How can program tell that itself is running as admin? Pin
Richard MacCutchan1-Oct-11 6:02
mveRichard MacCutchan1-Oct-11 6:02 
GeneralRe: How can program tell that itself is running as admin? Pin
Brandon-X120001-Oct-11 6:13
Brandon-X120001-Oct-11 6:13 
GeneralRe: How can program tell that itself is running as admin? Pin
Richard MacCutchan1-Oct-11 6:36
mveRichard MacCutchan1-Oct-11 6:36 
GeneralHandle Leak when Compiling with /clr Option, and _beginthread. Pin
Mike Doner29-Sep-11 6:49
Mike Doner29-Sep-11 6:49 
Hi all,

Hoping you can help me out. I've been trying to track down a handle leak in our product for the last few days, and I've gotten to the point where I suspect something is happening outside of our code. It seems that everytime my application calls _beginthread, there is 5 handles that leak. This happens to be our Server application, which receives many requests and calls to _beginthread, so after a period of time, this gets ugly.

This application is compiled with /clr to use code written in a .DLL for LDAP Authentication. But regardless of whether nor not any C#/DLL code gets ran, we're still leaking. I commented EVERYTHING out, except a call to _beginthread. Inside the thread proc, all I do is call _endthread... And the problem still occurs - 5 handles on every call.. This is verified using Process Explorer and the WinDbg tool.

If I turn off the /clr flag, and the problem goes away...

I did a !htrace in WinDbg, and this is what its showing me..

Outstanding handles opened since the previous snapshot:
--------------------------------------
Handle = 0x00000240 - OPEN
Thread ID = 0x00003754, Process ID = 0x000038a4

0x77cb4210: ntdll!ZwCreateEvent+0x0000000c
0x7796b857: KERNEL32!CreateEventExW+0x0000006e
0x7796b8a6: KERNEL32!CreateEventW+0x00000027
0x72b86fdf: mscorwks!CLREvent::CreateManualEvent+0x00000027
0x72b21575: mscorwks!Thread::AllocHandles+0x0000009b
0x72b235e2: mscorwks!Thread::InitThread+0x000001a4
0x72b21f21: mscorwks!SetupThread+0x000002b2
0x72bf9aac: mscorwks!IJWNOADThunk::FindThunkTarget+0x00000019
0x72bf9f39: mscorwks!IJWNOADThunkJumpTargetHelper+0x0000000b
0x72a21ae1: mscorwks!IJWNOADThunkJumpTarget+0x00000048
0x0f59dbd3: MSVCR90D!_beginthread+0x00000233
0x0f59db6e: MSVCR90D!_beginthread+0x000001ce
0x7796d309: KERNEL32!BaseThreadInitThunk+0x0000000e
--------------------------------------
Handle = 0x0000023c - OPEN
Thread ID = 0x00003754, Process ID = 0x000038a4

0x77cb4210: ntdll!ZwCreateEvent+0x0000000c
0x7796b857: KERNEL32!CreateEventExW+0x0000006e
0x7796b8a6: KERNEL32!CreateEventW+0x00000027
0x72b86fdf: mscorwks!CLREvent::CreateManualEvent+0x00000027
0x72b21569: mscorwks!Thread::AllocHandles+0x0000008f
0x72b235e2: mscorwks!Thread::InitThread+0x000001a4
0x72b21f21: mscorwks!SetupThread+0x000002b2
0x72bf9aac: mscorwks!IJWNOADThunk::FindThunkTarget+0x00000019
0x72bf9f39: mscorwks!IJWNOADThunkJumpTargetHelper+0x0000000b
0x72a21ae1: mscorwks!IJWNOADThunkJumpTarget+0x00000048
0x0f59dbd3: MSVCR90D!_beginthread+0x00000233
0x0f59db6e: MSVCR90D!_beginthread+0x000001ce
0x7796d309: KERNEL32!BaseThreadInitThunk+0x0000000e
--------------------------------------
Handle = 0x00000238 - OPEN
Thread ID = 0x00003754, Process ID = 0x000038a4

0x77cb4210: ntdll!ZwCreateEvent+0x0000000c
0x7796b857: KERNEL32!CreateEventExW+0x0000006e
0x7796b8a6: KERNEL32!CreateEventW+0x00000027
0x72b86fdf: mscorwks!CLREvent::CreateManualEvent+0x00000027
0x72b2155d: mscorwks!Thread::AllocHandles+0x00000083
0x72b235e2: mscorwks!Thread::InitThread+0x000001a4
0x72b21f21: mscorwks!SetupThread+0x000002b2
0x72bf9aac: mscorwks!IJWNOADThunk::FindThunkTarget+0x00000019
0x72bf9f39: mscorwks!IJWNOADThunkJumpTargetHelper+0x0000000b
0x72a21ae1: mscorwks!IJWNOADThunkJumpTarget+0x00000048
0x0f59dbd3: MSVCR90D!_beginthread+0x00000233
0x0f59db6e: MSVCR90D!_beginthread+0x000001ce
0x7796d309: KERNEL32!BaseThreadInitThunk+0x0000000e
--------------------------------------
Handle = 0x00000234 - OPEN
Thread ID = 0x00003754, Process ID = 0x000038a4

0x77cb4210: ntdll!ZwCreateEvent+0x0000000c
0x7796b857: KERNEL32!CreateEventExW+0x0000006e
0x7796b8a6: KERNEL32!CreateEventW+0x00000027
0x72b86fdf: mscorwks!CLREvent::CreateManualEvent+0x00000027
0x72b21551: mscorwks!Thread::AllocHandles+0x00000077
0x72b235e2: mscorwks!Thread::InitThread+0x000001a4
0x72b21f21: mscorwks!SetupThread+0x000002b2
0x72bf9aac: mscorwks!IJWNOADThunk::FindThunkTarget+0x00000019
0x72bf9f39: mscorwks!IJWNOADThunkJumpTargetHelper+0x0000000b
0x72a21ae1: mscorwks!IJWNOADThunkJumpTarget+0x00000048
0x0f59dbd3: MSVCR90D!_beginthread+0x00000233
0x0f59db6e: MSVCR90D!_beginthread+0x000001ce
0x7796d309: KERNEL32!BaseThreadInitThunk+0x0000000e
--------------------------------------
Handle = 0x0000022c - OPEN
Thread ID = 0x00003754, Process ID = 0x000038a4

0x77cb4680: ntdll!ZwDuplicateObject+0x0000000c
0x77963d92: KERNEL32!DuplicateHandle+0x0000012b
0x72b2365f: mscorwks!Thread::InitThread+0x00000174
0x72b21f21: mscorwks!SetupThread+0x000002b2
0x72bf9aac: mscorwks!IJWNOADThunk::FindThunkTarget+0x00000019
0x72bf9f39: mscorwks!IJWNOADThunkJumpTargetHelper+0x0000000b
0x72a21ae1: mscorwks!IJWNOADThunkJumpTarget+0x00000048
0x0f59dbd3: MSVCR90D!_beginthread+0x00000233
0x0f59db6e: MSVCR90D!_beginthread+0x000001ce
0x7796d309: KERNEL32!BaseThreadInitThunk+0x0000000e
0x77c916c3: ntdll!__RtlUserThreadStart+0x00000023
0x77c91696: ntdll!_RtlUserThreadStart+0x0000001b
--------------------------------------


I've exhausted everything I can - have you seen this before? What do you recommend in further debugging the problem? I'm using VS.2008. I don't believe you can specify in the C++ Project the .NET version (thought perhaps it was fixed in a later version) ..



Any help and or suggestions you may have would be greatly appreciated, thanks.

Mike
QuestionShow text after press a button Pin
antonio34327-Sep-11 8:27
antonio34327-Sep-11 8:27 
AnswerRe: Show text after press a button Pin
Albert Holguin29-Sep-11 10:59
professionalAlbert Holguin29-Sep-11 10:59 
Questioncreatefile() API fail for mapped/shared network drives Pin
s v joshi25-Sep-11 23:28
s v joshi25-Sep-11 23:28 
Questioncreate wrapper class in vc ++ Pin
vitthal0902197722-Sep-11 4:31
vitthal0902197722-Sep-11 4:31 
QuestionDifference between a User dump and Kernel dump Pin
rupeshkp72822-Sep-11 0:17
rupeshkp72822-Sep-11 0:17 
AnswerRe: Difference between a User dump and Kernel dump Pin
Richard MacCutchan22-Sep-11 2:52
mveRichard MacCutchan22-Sep-11 2:52 
Questionora-12541 in c++/cli project.. Pin
aupres12-Sep-11 19:02
aupres12-Sep-11 19:02 
Questionproblem communicating between managed and unmanaged code inside a dll Pin
mtestt8-Sep-11 5:32
mtestt8-Sep-11 5:32 
AnswerRe: problem communicating between managed and unmanaged code inside a dll Pin
Richard Andrew x649-Sep-11 13:56
professionalRichard Andrew x649-Sep-11 13:56 
Questionhooking winsock send function Pin
vkgktm24-Aug-11 1:31
vkgktm24-Aug-11 1:31 
QuestionWeird problem using C++ dll from vb6 Pin
lenourien22-Aug-11 15:57
lenourien22-Aug-11 15:57 
AnswerRe: Weird problem using C++ dll from vb6 Pin
Richard Andrew x6422-Aug-11 16:22
professionalRichard Andrew x6422-Aug-11 16:22 
GeneralRe: Weird problem using C++ dll from vb6 Pin
lenourien22-Aug-11 17:35
lenourien22-Aug-11 17:35 
GeneralRe: Weird problem using C++ dll from vb6 Pin
Richard MacCutchan22-Aug-11 23:06
mveRichard MacCutchan22-Aug-11 23:06 
GeneralRe: Weird problem using C++ dll from vb6 Pin
lenourien22-Aug-11 23:23
lenourien22-Aug-11 23:23 
GeneralRe: Weird problem using C++ dll from vb6 Pin
Richard MacCutchan23-Aug-11 0:05
mveRichard MacCutchan23-Aug-11 0:05 
GeneralRe: Weird problem using C++ dll from vb6 Pin
lenourien23-Aug-11 0:10
lenourien23-Aug-11 0:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.