Click here to Skip to main content
15,889,096 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: ERROR_INVALID_HANDLE returned From WaitForSingleObject after CreateMutex Pin
ForNow10-Nov-16 3:29
ForNow10-Nov-16 3:29 
AnswerRe: ERROR_INVALID_HANDLE returned From WaitForSingleObject after CreateMutex Pin
Randor 10-Nov-16 4:32
professional Randor 10-Nov-16 4:32 
GeneralRe: ERROR_INVALID_HANDLE returned From WaitForSingleObject after CreateMutex Pin
ForNow10-Nov-16 4:40
ForNow10-Nov-16 4:40 
GeneralRe: ERROR_INVALID_HANDLE returned From WaitForSingleObject after CreateMutex Pin
Richard MacCutchan10-Nov-16 4:50
mveRichard MacCutchan10-Nov-16 4:50 
GeneralRe: ERROR_INVALID_HANDLE returned From WaitForSingleObject after CreateMutex Pin
ForNow10-Nov-16 5:02
ForNow10-Nov-16 5:02 
GeneralRe: ERROR_INVALID_HANDLE returned From WaitForSingleObject after CreateMutex Pin
leon de boer10-Nov-16 8:25
leon de boer10-Nov-16 8:25 
GeneralRe: ERROR_INVALID_HANDLE returned From WaitForSingleObject after CreateMutex Pin
ForNow10-Nov-16 8:50
ForNow10-Nov-16 8:50 
GeneralRe: ERROR_INVALID_HANDLE returned From WaitForSingleObject after CreateMutex Pin
Randor 10-Nov-16 5:06
professional Randor 10-Nov-16 5:06 
ForNow wrote:
It's the handle I guess the next step is to go to disassembly mode and see


Since you are such an expert at x86/x64 assembler perhaps you should utilize WinDbg:

Common WinDBG Commands Reference[^]

!handle	displays information about a handle or handles that one or all processes in the target system own.


0:000> !handle c0dedbad f
Handle 38
 Type Mutant
 Attributes 0
 GrantedAccess 0x1f0001:
 Delete,ReadControl,WriteDac,WriteOwner,Synch
 QueryState
 HandleCount 1
 PointerCount 96605
 Name <none>
 Object Specific Information
 Mutex is Owned
 Mutant Owner 11bc.1418


Here are some other ideas in case you don't know how to use WinDbg:

C++
//Windows 8.1 and below:
BOOL IsValidHandle(HANDLE h)
{
	DWORD dwFlags = 0;
	return GetHandleInformation(h,&dwFlags);
}


C++
//Windows 10 and above:
BOOL IsValidHandle(HANDLE h)
{
	return CompareObjectHandles(h,h);
}



use it like this to debug your code:

C++
if (IsValidHandle(h))
{
	DWORD dwResult = ::WaitForSingleObject(h, INFINITE);
	DWORD dwError = GetLastError();
}


Best Wishes,
-David Delaune
AnswerRe: ERROR_INVALID_HANDLE returned From WaitForSingleObject after CreateMutex Pin
Albert Holguin10-Nov-16 7:32
professionalAlbert Holguin10-Nov-16 7:32 
GeneralRe: ERROR_INVALID_HANDLE returned From WaitForSingleObject after CreateMutex Pin
ForNow10-Nov-16 7:50
ForNow10-Nov-16 7:50 
GeneralRe: ERROR_INVALID_HANDLE returned From WaitForSingleObject after CreateMutex Pin
Albert Holguin10-Nov-16 7:58
professionalAlbert Holguin10-Nov-16 7:58 
GeneralRe: ERROR_INVALID_HANDLE returned From WaitForSingleObject after CreateMutex Pin
leon de boer10-Nov-16 8:38
leon de boer10-Nov-16 8:38 
GeneralRe: ERROR_INVALID_HANDLE returned From WaitForSingleObject after CreateMutex Pin
ForNow10-Nov-16 8:53
ForNow10-Nov-16 8:53 
QuestionDebug Assertion Failed error by WaitForMultipleObjectsEx in 64 bit application Pin
Member 123356959-Nov-16 20:27
Member 123356959-Nov-16 20:27 
AnswerRe: Debug Assertion Failed error by WaitForMultipleObjectsEx in 64 bit application Pin
Richard MacCutchan9-Nov-16 22:54
mveRichard MacCutchan9-Nov-16 22:54 
AnswerRe: Debug Assertion Failed error by WaitForMultipleObjectsEx in 64 bit application Pin
Randor 10-Nov-16 2:00
professional Randor 10-Nov-16 2:00 
GeneralRe: Debug Assertion Failed error by WaitForMultipleObjectsEx in 64 bit application Pin
Member 1233569510-Nov-16 22:44
Member 1233569510-Nov-16 22:44 
GeneralRe: Debug Assertion Failed error by WaitForMultipleObjectsEx in 64 bit application Pin
Member 1233569510-Nov-16 22:51
Member 1233569510-Nov-16 22:51 
AnswerRe: Debug Assertion Failed error by WaitForMultipleObjectsEx in 64 bit application Pin
Randor 11-Nov-16 4:06
professional Randor 11-Nov-16 4:06 
AnswerRe: Debug Assertion Failed error by WaitForMultipleObjectsEx in 64 bit application Pin
Albert Holguin10-Nov-16 7:36
professionalAlbert Holguin10-Nov-16 7:36 
QuestionHow to design pure C style APIs for a framework which include a core exe and plugin dlls Pin
bestbear9-Nov-16 19:59
bestbear9-Nov-16 19:59 
AnswerRe: How to design pure C style APIs for a framework which include a core exe and plugin dlls Pin
Richard MacCutchan9-Nov-16 22:52
mveRichard MacCutchan9-Nov-16 22:52 
AnswerRe: How to design pure C style APIs for a framework which include a core exe and plugin dlls Pin
leon de boer10-Nov-16 9:06
leon de boer10-Nov-16 9:06 
GeneralRe: How to design pure C style APIs for a framework which include a core exe and plugin dlls Pin
bestbear10-Nov-16 18:11
bestbear10-Nov-16 18:11 
QuestionC programming Determine Students grade Pin
Member 128422149-Nov-16 12:37
Member 128422149-Nov-16 12:37 

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.