Do not forget to allocate internal OPENFILENAMEW structure for 16-bit

GetOpenFileName, initialize it by zeros for 16/A cases.
This commit is contained in:
Dmitry Timoshkov 2005-02-10 17:10:01 +00:00 committed by Alexandre Julliard
parent c7e88e0820
commit 781b451a70
2 changed files with 3 additions and 1 deletions

View File

@ -3456,7 +3456,7 @@ static BOOL CALLBACK FD32_Init(LPARAM lParam, PFD31_DATA lfs, DWORD data)
if (priv->ofnA->Flags & OFN_ENABLEHOOK) if (priv->ofnA->Flags & OFN_ENABLEHOOK)
if (priv->ofnA->lpfnHook) if (priv->ofnA->lpfnHook)
lfs->hook = TRUE; lfs->hook = TRUE;
lfs->ofnW = HeapAlloc(GetProcessHeap(), 0, sizeof(*lfs->ofnW)); lfs->ofnW = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*lfs->ofnW));
FD31_MapOfnStructA(priv->ofnA, lfs->ofnW, lfs->open); FD31_MapOfnStructA(priv->ofnA, lfs->ofnW, lfs->open);
} }

View File

@ -170,6 +170,7 @@ static BOOL CALLBACK FD16_Init(LPARAM lParam, PFD31_DATA lfs, DWORD data)
if (priv->ofn16->lpfnHook) if (priv->ofn16->lpfnHook)
lfs->hook = TRUE; lfs->hook = TRUE;
lfs->ofnW = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*lfs->ofnW));
FD16_MapOfnStruct16(priv->ofn16, lfs->ofnW, lfs->open); FD16_MapOfnStruct16(priv->ofn16, lfs->ofnW, lfs->open);
if (! FD16_GetTemplate(lfs)) return FALSE; if (! FD16_GetTemplate(lfs)) return FALSE;
@ -280,6 +281,7 @@ static void CALLBACK FD16_Destroy(PFD31_DATA lfs)
GlobalFree16(priv->hGlobal16); GlobalFree16(priv->hGlobal16);
} }
FD31_FreeOfnW(lfs->ofnW); FD31_FreeOfnW(lfs->ofnW);
HeapFree(GetProcessHeap(), 0, lfs->ofnW);
} }
} }