From c61f11eadf2c6497af84631a5ba491e8ae7721f7 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 20 Sep 2005 11:39:19 +0000 Subject: [PATCH] Added a magic number to the WDML_CONV structure to fix some failing tests. --- dlls/user/dde_misc.c | 5 +++-- dlls/user/dde_private.h | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) 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 */