3GL   4GL   5GL  

  1. DeadlockDetection
  2. DeadlockDetection
  3. DeadlockDetection
  4. DeadlockDetection
  5. DeadlockDetection?

, (multithreaded deadlocks). , , , . , , , .

, . DeadlockDetection, , . , , , , . DeadlockDetection .

 

. , . : ; 

, . , , , . , .

, , onidie- MFC . , , , .

, . (UI). , - UI-. , , UI , .

. , EnterCriticalSection LeaveCriticalSection . , , , . . , - , .

, . , . "" .

, , CPU. " " , , , , . , " " " ". " " , " " . , , , , .

, , , , . , " . " , 16- Windows 98 , . , . UI-, , , HWND- SendMessage, . , .

(miitex object) , , - . .

 

, . . ; . , , . 

, , . , QA- ! , !

 

DeadlockDetection

, , , . , , , , . , , , . DeadlockDetection.

, DeadlockDetection:

1. , . , , EnterCriticaiSection , . , , , , , .

2. , .

3. , Windows- . -, , .

4. , .

5. "", . . .

6. , , . , , , ( ) .

7. .

, DeadlockDetection , . DeadlockDetection , , , , . , , , , . , , , .

 

, , . ( , ) .

, , . , , , (DLL). , WaitForSingleObject, .

, . , , , , .

, , 5 . , Call Stack , DllMain. DLL, , DLL, WaitForSingleObject , , DllMain.

, , . , , " " . , , 1 DllMain : DLL_PROCESS_ATTACH ( DLL-), DLL_THREAD_ATTACH ( DLL-), DLL_THREAD_ DETACH ( DLL-) DLL_PROCESS_DETACH ( DLL-). DliMain .

  . .

, , LoadLibrary , DliMain DLL_PROCESS_ATTACH. DliMain . , , , DliMain DLL DLLJTHREAEKATTACH. , . , WaitForSingleObject, , . , , , .

: (Wait*-) DliMain. 11:*-. (CreateProcess, GetModuleFileName, GetProcAddress, LoadLibrary FreeLibrary), DliMain. DliMain , .

, , , , .

 

DeadlockDetection

DeadlockDetection, . -, , , . . 12.1 ( ) , , , DeadlockDetection.

, , , , ( 1) , 12.1, () . ( " " ). DeadlockDetection : DLL, , . , DLL DeadlockDetection . . DLL, (. , . 7 ).

, 14, " " (in-process function hooking approach). , DeadlockDetection .

12.1. , DeadlockDetection

                             

,

CreateThread                                                      ExitThread                                                             SuspendThread                                                         ResumeThread                                                 TerminateThread

Initial izeCr it icalSection

InitializeCriticalSectionAndSpinCount                              

DeleteCr it icalSection                                                       

EnterCr it icalSection                                                      

LeaveCr it icalSection                                

SetCriticalSectionSpinCount                      

TryEnterCriticalSection

CreateMutexA                                                       CreateMutexW                                                       OpenMutexA                                                       OpenMutexW                                                      ReleaseMutex

CreateSemaphoreA                                  CreateSemaphoreW                                             OpenSemaphoreA                                               OpenSemaphoreW                                           ReleaseSemaphore

CreateEventA                                                                 CreateEventW                                                             OpenEventA                                                                  OpenEventW                                                                        PulseEvent                                                                      ResetEvent                                                                       SetEvent

WaitForSingleObject                                   WaitForSingleObjectEx                             WaitForMultipleObjects                       WaitForMultipleObjectsEx                   MsgWaitForMultipleObjects    MsgWaitForMultipleObjectsEx                                 SignalOb j ectAndWait

CloseHandle                                                                ExitProcess                                                         GetProcAddress

DeadlockDetection (. 5 ) . , , , , , . , , -.

DeadlockDetection, " ", . DeadlockDetection , . , DeadlockDetection- . . 5 . 7.

. 6 , , . , , , . DeadlockDetection ( DeadDetExi). DeadDetExt DLL, . DeadlockDetection , .

, DeadlockDetection. , .

 

DeadlockDetection

DeadlockDetection DEADLOCKDETECTION.DLL DeadDetExt DLL , . INI-, , , ( DeadDetExt), . DEADLOCKDETECTION.INI, TEXTFILEDDEXT.DLL

[Initialization]

DeadDetExt,

 ExtDll = "TextFileDDExt.dll"

StartlnDllMain 1, DeadlockDetection

DllMain,

.

 StartlnDllMain =

StartlnDllMain 1, InitialOpts

DeadlockDetection.

DDOPT_*-.

InitialOpts = 0

, DeadlockDetection , LoadLibrary. () "" , LoadLibrary DLL , . , , DLL- . , , DLL, , "", DiiMain- DLL.

INI- , DEADLOCKDETECTION.H DEADLOCKDETECTION.LIB. DeadlockDetection , openDeadiockDetection, (initial reporting options). DDOPT_*- . 12.2. () , OpenDeadiockDetection , .

12.2. DeadlockDetection

DDOPT_THREADS

,

DDOPT CRITSEC

DDOPT_MUTEX

DDOPT SEMAPHORE

DDOPT_EVENT

DDOPT ALL

, SetDeadiockDetectionOptions. ( OR), OpenDeadiockDetection. , GetDeadlockDetectionOptions. . , ResumeDeadlockDetection SuspendDeadlockDetection.

DeadlockDetection, - DLL- DeadDetExt (TEXTFILEDDEXT.DLL). . DeadlockDetection TEXTFILEDDEXT.DLL, , . .DD. , SIMPTEST.EXE, SIMPTEST.DD. 12-1 TEXTFILEDDEXT.DLL.

  12-1. DeadlockDetection TEXTFILEDDEXT.DLL 

TID Ret Addr C/R Ret Value Function & Params 

0x000000F? [Ox004011AC] (R) 0x00000000 InitializeCriticalSection

0x00403110

 0x000000F7 [0x00401106] (R) 0x00000290 CreateEventA 0x00000000, 1, 0,

0x004030F0 [The event name] 

0x000000F? [Ox004011E9] (R) 0x00000294 CreateThread 0x00000000,

0x00000000, 0x00401000,

0x00000000, 0x00000000,

0x0012FF68 

0x000000F7 [0x0040120C] (R) 0x00000298 CreateThread 0x00000000,

0x00000000, 0x004010BC,

0x00000000, 0x00000000,

0x0012FF68

0x000000FV [0x00401223] (C) EnterCriticalSection 0x00403110 

0x000000F7 [0x00401223] (R) 0x00000000 EnterCriticalSection 0x00403110 0x000000F? [0x00401238] (C) WaitForSingleObject 0x00000290,

INFINITE

0x000000FF [Oxl020B973] (C) EnterCriticalSection 0xl025CE90

 0x000000FF [Oxl020B973] (R) 0x00000000 EnterCriticalSection 0xl025CE90

 0x00000l0C [Ox004010F3] (R) 0x000002A4 OpenEventA 0x001F0003, 0,

0x004030BC

[The event name]

, ( Function & Params) 12-1 ( ). :

1. (ID) .

2. , , . CrashFinder, 8, , .

3. / (Call/Return C/R), , .

4. , .

5. .

6. . , . , , .

, , . TEXTFILEDDEXT.DLL , , WaitFor*, EnterCriticalSection TryEnterCriticalSection.

( ), . Visual ++- MTGDI, 11 , .

 

DeadlockDetection

, DeadlockDetection . , , . , .

. : CALL- . . , DeadlockDetection , , , CALL-.

, DLL. , outputoebugstring, , KERNEL32.DLL. Microsoft Win32, , , : CALL . , , DLL. , , .

, , API-, . OutputDebugstring, , . , , OutputDebugstring , .

, ? . , OutputDebugstring, , OutputDebugstring . , , OutputDebugstring . DLL- , , OutputDebugstring. , , . (.idata1) . _declspec(dllimport), , , , .

Idata (i) , import (). .

: , , , ( ). , 2- Win32.

- Portable Executable. - .

10 " Windows" (Matt Pietrek. System Programming Secrets, IDG Books, 1995) . , , GetProcAddress, . , .

. -, , -. , , ( "read-only"), . "read-write" ( ). , , - , Windows 98 .

DeadlockDetection , . , , . Windows 2000 Windows 98 , GetProcAddress, , , , . Windows 98, GetProcAddress , . GetProcAddress " " (debug thunk1) .

Thunk "" ( , (., ) 32- 16- ). , . .

4, Windows 98 "--". , , , Windows 98 , 2 . , "--" . , , .

, , GetProcAddress. IMAGE_IMPORT_ DESCRIPTOR -, , DLL, . (Import Address Tables IAT) , , (thunk data arrays). IAT, , .

IAT, , . , IAT, , . IAT, . , .

12-2 HookimportedFunctionsByName, . . 12.3 . , , , DLL. (HookimportedFunctionsByName), , . 14 , ( LIMODS).

12.3. HookimportedFunctionsByName

hModule

,

szImportMod

,

Count

. paHookArray paOrigFuncs

paHookArray

, , . szFunc- ( , ). , - NULL (), HookimportedFunctionsByName . paHookArray : . , HookimportedFunctionsByName

paOrigFuncs

, HookimportedFunctionsByName. ,

NULL

pdwHooked

( paHookArray)

12-2.   HookImportedFunctionsByNaine  

                                 HOOKIMPORTEDFUNCTIONSBYNAME.CPP . 

 

BOOL BUGSUTIL_DLLINTERFACE _stdcall

HooklmportedFunctionsByName ( HMODULE hModule ,

LPCSTR szImportMod,

 UINT uiCount 

LPHOOKFUNCDESCA paHookArray, 

PROC * paOrigFuncs, 

LPDWORD pdwHooked )

 {

// .

ASSERT ( FALSE == IsBadReadPtr ( hModule

sizeof ( IMAGE_DOS_HEADER) ));

ASSERT ( FALSE == IsBadStringPtr ( szImportMod, MAX_PATH)); 

ASSERT ( 0 != uiCount); 

ASSERT ( NULL != paHookArray);

 ASSERT ( FALSE == IsBadReadPtr ( paHookArray,

sizeof (HOOKFUNCDESC) * uiCount));

// paHookArray.

 #ifdef _DEBUG

if ( NULL != paOrigFuncs)

 {

ASSERT ( FALSE == IsBadWritePtr ( paOrigFuncs,

sizeof ( PROC) * uiCount)); 

}

if ( NULL != pdwHooked)

 {

ASSERT ( FALSE == IsBadWritePtr ( pdwHooked, sizeof ( UINT)));

}

// .

 {

for ( UINT i = 0; i < uiCount; i++) 

{

ASSERT ( NULL != paHookArray[ i ].szFunc );

ASSERT ( '\0' != *paHookArray[ i ].szFunc);

// If the function address isn't NULL, it is validated.

if ( NULL != paHookArray[ i ].pProc)

{

ASSERT ( FALSE == IsBadCodePtr ( paHookArray[i].pProc)); 

}

 } 

#endif

// .  

if ( ( 0 == uiCount ) | | 

( NULL == szIinportMod ) | | 

( TRUE == IsBadReadPtr ( paHookArray,

sizeof ( HOOKFUNCDESC) * uiCount))) 

{

SetLastErrorEx ( ERROR_INVALID_PARAMETER, SLE_ERROR);

return ( FALSE);

 }

if ( ( NULL != paOrigFuncs) && 

( TRUE == IsBadWritePtr ( paOrigFuncs,

sizeof ( PROC) * uiCount)) ) 

{

SetLastErrorEx ( ERROR_INVALID_PARAMETER, SLE_ERROR);

return ( FALSE); 

}

 if ( ( NULL != pdwHooked) &&

( TRUE == IsBadWritePtr ( pdwHooked, sizeof ( UINT))) )

 {

SetLastErrorEx ( ERROR_INVALID_PARAMETER, SLE_ERROR);

return ( FALSE); 

}

// DLL, Windows 98

// (- , >2 )? 

if ( ( FALSE == IsNT .()) && ( (DWORD)hModule >= 0x80000000)) 

{

SetLastErrorEx ( ERROR_INVALID_HANDLE, SLE_ERROR);

return ( FALSE); 

}

// .

 // ?

 if ( NULL != paOrigFuncs) 

// paOrigFuncs NULL.

memset ( paOrigFuncs, NULL, sizeof ( PROC) * uiCount);

 }

if ( NULL != pdwHooked) 

{

// , 0.

*pdwHooked = 0; 

}

// .

PIMAGE_IMPORT_DESCRIPTOR plmportDesc =

GetNamedlmportDescriptor ( hModule, szImportMod); 

if ( NULL == plmportDesc)

{

// .

 // .

 return ( TRUE); 

}

// DLL. 

// ,  

// p!mportDesc->FirstThunk, . .

 // .

 // .

 PIMAGE_THUNK_DATA pOrigThunk =

MakePtr ( PIMAGE_THUNK_DATA

hModule , 

plmportDesc-XDriginalFirstThunk );

// p!mportDesc->FirstThunk,

// .

 PIMAGE_THUNK_DATA pRealThunk = MakePtr { PIMAGE_THUNK_DATA

hModule , pImportDesc->FirstThunk ); 

// ,

 while ( NULL != pOrigThunk->ul.Function) 

{

// , , 

// , .

 if ( IMAGE_ORDINAL_FLAG !=

( pOrigThunk->ul.Ordinal & IMAGE_ORDINAL_FLAG)) 

{

// .

PIMAGE_IMPORT_BY_NAME pByName;

pByName = MakePtr ( PIMAGE_IMPORT_BY_NAME,

hModule ,

 pOrigThunk->ul.AddressOfData );

// NULL, ,

 if ( '\0' == pByName->Name[ 0 ]) 

{

continue; 

}

// ,

 BOOL bDoHook = FALSE;

// . 

// ,

 // . paHookArray  

// , -

// , .

 // uiCount,

// ,

 // paHookArray ,

 // szImportMod.

 for ( DINT i = 0; i < uiCount; i++) 

{

if ( ( paHookArray[i].szFunc[0] ==

pByName->Name [0]) & & 

( 0 == strcmpi ( paHookArray[i].szFunc,

(char*)pByName->Name ) ) )

 {

// NULL,

 // ; .

 if ( NULL != paHookArray[ i ].pProc) 

{

bDoHook = TRUE; 

}

break; 

}

 }

if ( TRUE == bDoHook}

 {

// .

 // "read-write" ( ), 

// . ,

 //  

// !

MEMORY_BASIC_INFORMATION mbi_thunk;

 VirtualQuery ( pRealThunk , 

&mbi_thunk  ,

 sizeof ( MEMORY_BASIC_INFORMATION));

if ( FALSE VirtualProtect ( mbi_thunk.BaseAddress,

mbi_thunk.RegionSize , 

PAGE_READWRITE , 

&mbi_thunk.Protect )) 

{

ASSERT ( !"VirtualProtect failed!");

 SetLastErrorEx ( ERROR_INVALID_HANDLE, SLE_ERROR);

 return ( FALSE); 

}

// , .

 if ( NULL != paOrigFuncs)

 {

paOrigFuncs[i] = (PROC)pRealThunk->ul.Function; 

}

// Microsoft

 // I__- Win64.

 //

 // W2K RC2 Platform SDK,

 // Visual C++ 6 Service Pack 3. 

// .

DWORD * pTemp = (DWORD*)&pRealThunk->ul.Function;

 *pTemp = (DWORD)(paHookArray[i].pProc); 

DWORD dwOldProtect;

// ,  

// . 

VERIFY ( VirtualProtect ( mbi_thunk.BaseAddress,

mbi_thunk.RegionSize , mbi_thunk.Protect , SdwOldProtect )) ;

 if ( NULL != pdwHooked)

 {

// .

 *pdwHooked += 1; 

}

 }

}

// . pOrigThunk++; pRealThunk++; 

}

// OK, Jumpmaster! 

SetLastError ( ERROR_SUCCESS);

 return ( TRUE); 

}

HooklmportedFunctionsByName   . ( ) GetNamedimportDescriptor, IMAGE_IMPORT_DESCRIPTOR . IAT- IAT-, , paHookArray. , PAGE_READWRITE   IAT-, , . , , HookimportedFunctionsByName ( BUGSLAYERUTIL.DLL -).

, , DeadlockDetection.

 

DeadlockDetection , . , DLL , , . 12.1 . , , , ( ) , . , . .

, , DeadDetExt DLL. DeadDetExt DLL . DeadDetExtOpen DeadDetExtClose . DeadDet, , . DeadDetProcessEvent DDEVENTINFO:

typedef struct tagDDEVENTINFO 

{

// , ,

//

eFuncEnum eFunc ;

// pre- post- 

ePrePostEnum ePrePost ;

// .

// .

DWORD dwAddr;

// ID

DWORD dwThreadld;

// post-.

DWORD dwRetValue ;

// .

// ( ).

// read-only

// (--).

DWORD dwParams 

} DDEVENTINFO-, * LPDDEVENTINFO;

, 12-1, DDEVENTINFO. , dwParams . DwParams , .

6 . , _stdcaii- , . DwParams DDEVENTINFO , . dwParams, .

DEADLOCKDETECTION.H typedef, . , eFunc eWaitForSingieObjectEx, dwParams LPWAITFORSINGLEOBJECTEX_PARAMS. , TEXTFILEDDEXT.DLL -.

, . , DeadlockDetection . 12.1, , . , C/C++. , .

, . . . , , , , /++- . (DWORD) . , , , C/C++ , , .

, , . Visual C++ , . , , , .

, . , _decispec (naked) . ESP , . , ESP (. . +04H ESP+08H, ). , : PUSH EBP MOV EBP, ESP MOV ESP, EBP POP EBP .

ESP 32- . .

_decispec (naked), HOOKFN_PROLOG HOOKFN_EPILOG. HOOKFN_PROLOG , . (dwLastError) (stEvtinfo), DeadDetExt.DLL. , dwLastError , .

Windows API setLastError, . , , API-. , GetLastError 122, , . WINERROR.H , . , . , .

createEvent , , , , , ERROR_ALREADY_EXISTS ( ).   , , GetLastError , , . GetLastError , setLastError .

, : ESI EDI , , . ESI/EDI , DeadlockDetection, , . , , , , , , , EDX, , . , , , , , , . REGSTATE , . , REAL_FUNC_PRE_CALL REAL_FUNC_POST_CALL, , .

: . , . , , . . ,

MOV DWORD PTR [EBP-018h], 00000002h 

MOV DWORD PTR [EBP-014h], 00000002h

PUSH 002h

POP EBX

MOV DWORD PTR [EBP-OlCh], EBX

MOV DWORD PTR [EBP-018h], EBX

, POP EBX . , ,

#pragma optimize("", off)

. , , , , .

12-3 DD_FUNCS.H , . , , . SimpTest ( ) . , , .

12-3. DD_FUNCS.H

 /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - 

"Debugging Applications" (Microsoft Press)

Copyright (c) 1997-2000 John Robbins All rights reserved.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

/

- - - - - - - - - - - - - - - - - - - - - - - - - - - - -

#ifndef J3D_FUNCS_H 

#define _DD_FUNCS__H 

/*//////////////////////////////////////////////////////////////

_declspec (naked),                 .         :

1. , , , . , . DeadlockDetection .

2. DLL .

3. , , .

4.

, GetLastError. , . , .

HANDLE NAKEDDEF DD_OpenEventA ( DWORD dwDesiredAccess,

BOOL blnheritHandle , 

LPCSTR IpNarne )

{

//

// .

// HOOKFN_PROLOG

// .

HOOKFN_PROLOG ();

// ?

if ( TRUE == DoLogging ( DDOPT_EVENT))

{

// FILL_EVENTINFO,  

// stEvtlnfo, HOOKFN_PROLOG.

 //

 // , .

 FILL_EVENTINFO ( eOpenEventA);

// REAL_FUNC_PRE_CALL

 // , ESI EDI  

// . 

REAL_FUNC_PRE_CALL ();

// . ,

 // , REAL_FUNC_POST_CALL. 

OpenEventA ( dwDesiredAccess, blnheritHandle , IpName );

// REAL_FUNC_POST_CALL  

// .  

// REAL_FUNC_POST_CALL. 

REAL_FUNC_POST_CALL ();

// . 

ProcessEvent ( sstEvtlnfo); 

}

else 

{

// . . else ,

 // .

 REAL_FUNC_PRE_CALL (); 

OpenEventA ( dwDesiredAccess, blnheritHandle , IpName ); 

REAL_FUNC_POST_CALL (); 

}

// HOOKFN_EPILOG .

 // , .

// HOOKFN_EPILOG

// ,

// .

HOOKFN_EPILOG ( 3) ; 

}

//////////////////////////////////////////////////////////////////*/ 

/*//////////////////////////////////////////////////////////////

. , , , . 

, ESP .

////////////////////////////////////////////////*/ 

typedef struct tag__REGSTATE 

{

DWORD dwEAX;

DWORD dwEBX;

DWORD dwECX;

DWORD dwEDX;

DWORD dwEDI;

DWORD dwESI;

DWORD dwEFL;

 } REGSTATE, * PREGSTATE;

/*//////////////////////////////////////////////////////////

DD_*-

//////////////////////////////////////////////////////////*/

 #define HOOKFN_PROLOG() \ 

/* */\ 

/* . */\ 

DDEVENTINFO stEvtlnfo ; /* */\ 

DWORD dwLastError; /* */\

 REGSTATE stRegState ; /* */\ 

{ \ 

_asm PUSH EBP /* . */\ 

_asm MOV EBP, ESP /* */\ 

_asm MOV EAX, ESP /* /\

/* . */\

_asm SUB ESP, _LOCAL_SIZE /* */\

/ * * / \ 

_asm ADD EAX, 04h + 04h /* PUSH EBP . */\

/* . */\

_asm MOV [stEvtlnfo.dwParams], EAX \ 

_asm SUB EAX, 04h /* . */\ 

_asm MOV EAX, [EAX] /* EAX . */\

/* . */\

_asm MOV [stEvtlnfo.dwAddr], EAX. \

 _asm MOV dwLastError, 0 /* dwLastError. */\

/* . */\

_asm MOV [stEvtlnfo.eFunc], eUNINITIALIZEDFE \

 _asm MOV [stRegState.dwEDI], EDI /* /\

 _asm MOV [stRegState.dwESI], ESI /* . */\ 

}

 /*///////////////////////////////////////////////////////////

00_*-. INumParams - , .

//////////////////////////////////////////////////////////*/

 #define HOOKFN_EPILOG(iNumParams) \ 

{ \ 

SetLastError ( dwLastError); /* */\

/* . */\

 _asm ADD ESP, _LOCAL_SIZE /* */\

/* . */\

_asm MOV EBX, [StRegState.dwEBX]/* , */\

 _asm MOV ECX, [stRegState.dwECX]/* */\

 _asm MOV EDX, [stRegState.dwEDX]/* */\ 

_asm MOV EDI, [stRegState.dwEDI]/*. */\

 _asm MOV ESI, [StRegState.dwESI] \ 

_asm MOV EAX, [StRegState.dwEFL] \ 

_asm SAHF . \ 

_asm MOV EAX, [stRegState.dwEAX] \ 

_asm MOV ESP, EBP /* ESP. */\

_asm POP EBP /* EBP. */\ 

_asm RET iNumParams * 4 /* stdcall */\ 

}

 /*///////////////////////////////////////////////////////

, REAL_FUNC_PRE_CALL , . , EDI ESI , .

//////////////////////////////////////////////////////////////////*/

 #define REAL_FUNC_PRE_CALL() \ 

{ \ 

_asm MOV EDI, [stRegState.dwEDI] /* EDI. /\

 _asm MOV ESI, [stRegState.dwESI] /* ESI. */\ 

/*//////////////////////////////////////////////////////////////

, REAL_FUNC_POST_CALL , . , .

//////////////////////////////////////////////////////////////////*/

 #define REAL_FUNC_POST_CALL(} \ 

{ \ 

_asm MOV [stRegState.dwEAX], EAX /* EAX. */\ 

_asm MOV [stRegState.dwEBX], EBX /* . */\

_asm MOV [stRegState.dwECX], ECX /* . */\ 

_asm MOV [stRegState.dwEDX], EDX /* EDX. */\

 _asm MOV [stRegState.dwEDI], EDI /* EDI. */\ 

_asm MOV [stRegState.dwESI], ESI /* ESI. */\

 _asm XOR . EAX, EAX /* . */\ 

_asm LAHF /* .*/\

_asm MOV [stRegState.dwEFL], EAX /* . */\ 

} \ 

dwLastError = GetLastError (); /* */\

/* . */\

{ \ 

_asm MOV EAX, [stRegState.dwEAX] /* */\

/* . */\ 

/* */\ 

/* . */\

_asm MOV [stEvtlnfo.dwRetValue] , \ 

}

/*////////////////////////////////////////////////////////////

 /////////////////////////////////////////////////////////////////*/

 #define FILL__EVENTINFO(eFn) \

stEvtlnfo.eFunc = eFn ; \

stEvtlnfo.ePrePost = ePostCall; \

stEvtlnfo.dwThreadld = GetCurrentThreadld ()

 /*///////////////////////////////////////////////////////////////

DD_*-

////////////////////////////////////////////////////////////////*/

#define NAKEDDEF _declspec(naked)

/*/////////////////////////////////////////////////////////////// 

cdecl-. stdcall-! , !

////////////////////////////////////////////////////////////////*/

////////////////////////////////////////////////////////////////*/

// , ,

//

HMODULE DD_LoadLibraryA ( LPCSTR IpLibFileName);

HMODULE DD_LoadLibraryW ( LPCWSTR IpLibFileName);

HMODULE DD_LoadLibraryExA ( LPCSTR IpLibFileName,

HANDLE hFile , 

DWORD dwFlags );

HMODULE DD_LoadLibraryExW ( LPCWSTR IpLibFileName,

HANDLE hFile , DWORD dwFlags );

 VOID DD_ExitPr

FARPROC DD_GetProcAddress ( HMODULE hModule, LPCSTR IpProcName);

 //////////////////////////////////////////////////////////  

,

HANDLE DD_CreateThread (LPSECURITY_ATTRIBUTES IpThreadAttributes ,

DWORD dwStackSize , 

LPTHREAD_START_ROUTINE IpStartAddress ,

 LPVOID IpParameter , 

DWORD dwCreationFlags ,

 LPDWORD IpThreadld );

 VOID DD_ExitThread ( DWORD dwExitCode); 

DWORD DD_SuspendThread ( HANDLE hThread);

 DWORD DD_ResumeThread ( HANDLE hThread);

BOOL DDjrerminateThread ( HANDLE hThread, DWORD dwExitCode);

 //////////////////////////////////////////////////////////

DWORD DD_WaitForSingleObject ( HANDLE hHandle ,

DWORD dwMilliseconds );

DWORD DD_WaitForSingleObjectEx ( HANDLE hHandle ,

DWORD dwMilliseconds, 

BOOL bAlertable );

DWORD DD_WaitForMultipleObjects( DWORD nCount ,

CONST HANDLE * IpHandles , 

BOOL bWaitAll , 

DWORD dwMilliseconds );

DWORD DD_WaitForMultipleObjectsEx( DWORD nCount ,

CONST HANDLE * IpHandles ,

BOOL bWaitAll ,

 DWORD dwMilliseconds,

BOOL bAlertable };

DWORD DD_MsgWaitForMultipleObjects ( DWORD nCount ,

LPHANDLE pHandles , 

BOOL fWaitAll ,

 DWORD dwMilliseconds,

 DWORD dwWakeMask );

DWORD DD_MsgWaitForMultipleObjectsEx ( DWORD nCount ,

LPHANDLE pHandles , 

DWORD dwMilliseconds , 

DWORD dwWakeMask , 

DWORD dwFlags );

DWORD DD_SignalObjectAndWait ( HANDLE hObjectToSignal,

HANDLE hObjectToWaitOn, 

DWORD dwMilliseconds ,

 BOOL bAlertable );

BOOL DD_CloseHandle ( HANDLE hObject);

///////////////////////////////////////////////////////

//

VOID DD_InitializeCriticalSection(LPCRITICAL_SECTION IpCriticalSection);

BOOL DD_InitializeCriticalSectionAndSpinCount (

LPCRITICAL_SECTION IpCriticalSection, 

DWORD dwSpinCount );

VOID DD_DeleteCriticalSection(LPCRITICAL_SECTION IpCriticalSection); 

VOID DD_EnterCriticalSection ( LPCRITICAL_SECTION IpCriticalSection); 

VOID DD_LeaveCriticalSection ( LPCRITICAL_SECTION IpCriticalSection); 

DWORD DD__SetCriticalSectionSpinCount (

LPCRITICAL_SECTION IpCriticalSection, 

DWORD dwSpinCount );

BOOL DD_TryEnterCriticalSection ( LPCRITICAL_SECTION IpCriticalSection); 

//////////////////////////////////////////////////////

//

HANDLE DD_CreateMutexA ( LPSECURITY_ATTRIBUTES IpMutexAttributes,

BOOL blnitialOwner , 

LPCSTR IpName ) ;

HANDLE DD_CreateMutexW ( LPSECURITY_ATTRIBUTES IpMutexAttributes,

BOOL blnitialOwner ,

 LPCWSTR IpName );

 HANDLE DD_OpenMutexA ( DWORD dwDesiredAccess,

BOOL blnheritHandle ,

 LPCSTR IpName ) ;

HANDLE DD_OpenMutexW ( DWORD dwDesiredAccess,

BOOL blnheritHandle , 

LPCWSTR IpName ); 

BOOL DD_ReleaseMutex ( HANDLE hMutex);

////////////////////////////////////////////////////////////

 //

DD_CreateSemaphoreA ( LPSECURITY_ATTRIBUTES IpSemaphoreAttributes,

LONG UnitialCount , 

LONG IMaximumCount , 

LPCSTR IpName ); 

HANDLE

DD_CreateSemaphoreW ( LPSECURITY_ATTRIBUTES IpSemaphoreAttributes,

LONG UnitialCount , 

LONG IMaximumCount , 

LPCWSTR IpName );

HANDLE DD_OpenSemaphoreA ( DWORD dwDesiredAccess,

BOOL blnheritHandle , 

LPCSTR IpNaroe );

HANDLE DD_OpenSemaphoreW ( DWORD dwDesiredAccess,

BOOL blnheritHandle , 

LPCWSTR IpNarae );

BOOL DD_ReleaseSemaphore ( HANDLE hSemaphore ,

LONG IReleaseCount ,

 LPLONG IpPreviousCount );

////////////////////////////////////////////////////////////////// 

//

HANDLE DD__CreateEventA ( LPSECURITY_ATTRIBUTES IpEventAttributes,

BOOL bManualReset ,

 BOOL blnitialState , 

LPCSTR IpName );

HANDLE DD_CreateEventW ( LPSECURITY_ATTRIBUTES IpEventAttributes,

BOOL bManualReset ,

 BOOL blnitialState , 

LPCWSTR IpName ); 

HANDLE DD_OpenEventA ( DWORD dwDesiredAccess,

BOOL blnheritHandle , 

LPCSTR IpName );

HANDLE DDjOpenEventW ( DWORD dwDesiredAccess,

BOOL blnheritHandle , LPCWSTR IpName ); 

BOOL DD_PulseEvent ( HANDLE hEvent); 

BOOL DD_ResetEvent ( HANDLE hEvent); 

BOOL DD_SetEvent ( HANDLE hEvent); 

#endif // _DD_FUNCS_H

 

DeadlockDetection. -, DeadlpckDetection , . , , , , . , . , " " DeadlockDetection.

-, DeadlockDetection DLL, LoadLibrary. , DllMain DLL, - DllMain, DeadlockDetection .

-, DeadlockDetection GetProcAddress ExitProcess. GetProcAddress , GetProcAddress, ( ) .

ExitProcess, , , DeadlockDetection , . DLL , , DLL, DeadlockDetection (, DeadDetExt), DeadlockDetection. , , ExitProcess.

, - DeadlockDetection . DeadlockDetection DEADLOCKDETECTION.DLL , DeadlockDetection.

 

DeadlockDetection?

DeadlockDetection , . , , DeadlockDetection, . : 

-

(Peter lerardi) , . DCOM-, DCOM- . DCOM- , - -, , (RDBMS). Microsoft (Microsoft Message Queue (MSMQ) Server). , , . 35- , , , . , , , .

, DCOM- , . , - . , . Event Log ( ).

, , , , , . , , MSMQ- , , .

, : / MSMQ , . - , , , .

 

. , . , . , , , . , , : DeadlockDetection, , .

, , , , . , , , , .

        3GL   4GL   5GL  

, - , , . , , size.




 10.11.2021 - 12:37: - Personalias -> WHO IS WHO - - _.
10.11.2021 - 12:36: - Conscience -> . ? - _.
10.11.2021 - 12:36: , , - Upbringing, Inlightening, Education -> ... - _.
10.11.2021 - 12:35: - Ecology -> - _.
10.11.2021 - 12:34: , - War, Politics and Science -> - _.
10.11.2021 - 12:34: , - War, Politics and Science -> . - _.
10.11.2021 - 12:34: , , - Upbringing, Inlightening, Education -> , - _.
10.11.2021 - 09:18: - New Technologies -> , 5G- - _.
10.11.2021 - 09:18: - Ecology -> - _.
10.11.2021 - 09:16: - Ecology -> - _.
10.11.2021 - 09:15: , , - Upbringing, Inlightening, Education -> - _.
10.11.2021 - 09:13: , , - Upbringing, Inlightening, Education -> - _.
Bourabai Research -  XXI Bourabai Research Institution