diff --git a/dlls/user/dde_misc.c b/dlls/user/dde_misc.c index 6becff79c9d..f2a907b9cb4 100644 --- a/dlls/user/dde_misc.c +++ b/dlls/user/dde_misc.c @@ -1742,6 +1742,7 @@ WDML_CONV* WDML_AddConv(WDML_INSTANCE* pInstance, WDML_SIDE side, pConv->instance = pInstance; WDML_IncHSZ(pInstance, pConv->hszService = hszService); WDML_IncHSZ(pInstance, pConv->hszTopic = hszTopic); + pConv->magic = WDML_CONV_MAGIC; pConv->hwndServer = hwndServer; pConv->hwndClient = hwndClient; pConv->transactions = NULL; @@ -1835,7 +1836,7 @@ void WDML_RemoveConv(WDML_CONV* pRef, WDML_SIDE side) { pPrev->next = pCurrent->next; } - + pCurrent->magic = 0; HeapFree(GetProcessHeap(), 0, pCurrent); break; } @@ -1913,7 +1914,7 @@ WDML_CONV* WDML_GetConv(HCONV hConv, BOOL checkConnected) WDML_CONV* pConv = (WDML_CONV*)hConv; /* FIXME: should do better checking */ - if (pConv == NULL) return NULL; + if (pConv == NULL || pConv->magic != WDML_CONV_MAGIC) return NULL; if (checkConnected && !(pConv->wStatus & ST_CONNECTED)) { diff --git a/dlls/user/dde_private.h b/dlls/user/dde_private.h index 1ae7f2f4f17..106df35fb70 100644 --- a/dlls/user/dde_private.h +++ b/dlls/user/dde_private.h @@ -127,6 +127,7 @@ typedef struct tagWDML_CONV struct tagWDML_INSTANCE* instance; HSZ hszService; /* pmt used for connection */ HSZ hszTopic; /* pmt used for connection */ + UINT magic; /* magic number to check validity */ UINT afCmd; /* service name flag */ CONVCONTEXT convContext; HWND hwndClient; /* source of conversation (ClientConvClass) */ @@ -137,6 +138,8 @@ typedef struct tagWDML_CONV DWORD wConvst; /* same values as convinfo.wConvst */ } WDML_CONV; +#define WDML_CONV_MAGIC 0xbabe1234 + /* DDE_LINK struct defines hot, warm, and cold links */ typedef struct tagWDML_LINK { struct tagWDML_LINK* next; /* to link all the active links */