Handle NULL filename in MCIWndCreateA

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Tue Apr 9 05:48:08 CDT 2002


Hallo,

xnview creates a MCIWnd with szFile empty. With native msvfw32, wine
survives this situation, with builtin the strcpy crashes. Appended patch
catches this situation. Now with builtin msvfw32, wine brings up a message
about the empty filename in MCIWND_Create, native does not. Should we
silence this message too?

Changelog:
	dlls/msvideo/mciwnd.c: MCIWndCreateA
	Check for NULL filename
-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Index: wine/dlls/msvideo/mciwnd.c
===================================================================
RCS file: /home/wine/wine/dlls/msvideo/mciwnd.c,v
retrieving revision 1.3
diff -u -r1.3 mciwnd.c
--- wine/dlls/msvideo/mciwnd.c	9 Mar 2002 23:39:09 -0000	1.3
+++ wine/dlls/msvideo/mciwnd.c	9 Apr 2002 10:47:21 -0000
@@ -90,7 +90,10 @@
    if (!mwi) return 0;
 
    mwi->dwStyle = dwStyle;
-   mwi->lpName = strcpy(HeapAlloc(GetProcessHeap(), 0, strlen(szFile) + 1), szFile);
+   if (szFile)
+     mwi->lpName = strcpy(HeapAlloc(GetProcessHeap(), 0, strlen(szFile) + 1), szFile);
+   else
+     mwi->lpName = NULL;
    mwi->uTimer = 0;
 
    wndStyle = ((hwndParent) ? (WS_CHILD|WS_BORDER) : WS_OVERLAPPEDWINDOW) |
@@ -102,7 +105,7 @@
 		       hwndParent, (HMENU)0, hInstance, mwi))
       return mwi->hWnd;
    
-   HeapFree(GetProcessHeap(), 0, mwi->lpName);
+   if(mwi->lpName) HeapFree(GetProcessHeap(), 0, mwi->lpName);
    HeapFree(GetProcessHeap(), 0, mwi);
    return 0;
 }



More information about the wine-patches mailing list