Wine compatibility changes
Modified: trunk/reactos/subsys/system/winefile/winefile.c

Modified: trunk/reactos/subsys/system/winefile/winefile.c
--- trunk/reactos/subsys/system/winefile/winefile.c	2005-05-13 05:41:24 UTC (rev 15256)
+++ trunk/reactos/subsys/system/winefile/winefile.c	2005-05-13 09:09:07 UTC (rev 15257)
@@ -187,6 +187,15 @@
 	return 0;
 }
 
+
+#define LOCAL_ALLOC(s) HeapAlloc(GetProcessHeap(), 0, s)
+#define LOCAL_FREE(p) HeapFree(GetProcessHeap(), 0, p)
+
+#else
+
+#define LOCAL_ALLOC(s) alloca(s)
+#define LOCAL_FREE(p)
+
 #endif
 
 
@@ -1199,7 +1208,7 @@
 		len++;
 
 	if (len) {
-		array = (Entry**) alloca(len*sizeof(Entry*));
+		array = (Entry**) LOCAL_ALLOC(len*sizeof(Entry*));
 
 		p = array;
 		for(entry=dir->down; entry; entry=entry->next)
@@ -1214,6 +1223,8 @@
 			p[0]->next = p[1];
 
 		(*p)->next = 0;
+
+		LOCAL_FREE(array);
 	}
 }
 
@@ -3415,7 +3426,7 @@
 
 static IContextMenu2* s_pctxmenu2 = NULL;
 
-#ifndef __MINGW32__	// IContextMenu3 missing in MinGW (as of 6.2.2005)
+#ifndef __MINGW32__	/* IContextMenu3 missing in MinGW (as of 6.2.2005) */
 static IContextMenu3* s_pctxmenu3 = NULL;
 #endif
 
@@ -3423,7 +3434,7 @@
 {
 	s_pctxmenu2 = NULL;
 
-#ifndef __MINGW32__	// IContextMenu3 missing in MinGW (as of 6.2.2005)
+#ifndef __MINGW32__	/* IContextMenu3 missing in MinGW (as of 6.2.2005) */
 	s_pctxmenu3 = NULL;
 #endif
 }
@@ -3434,7 +3445,7 @@
 
 	CtxMenu_reset();
 
-#ifndef __MINGW32__	// IContextMenu3 missing in MinGW (as of 6.2.2005)
+#ifndef __MINGW32__	/* IContextMenu3 missing in MinGW (as of 6.2.2005) */
 	if ((*pcm1->lpVtbl->QueryInterface)(pcm1, &IID_IContextMenu3, (void**)&pcm) == NOERROR)
 		s_pctxmenu3 = (LPCONTEXTMENU3)pcm;
 	else
@@ -3451,7 +3462,7 @@
 
 static BOOL CtxMenu_HandleMenuMsg(UINT nmsg, WPARAM wparam, LPARAM lparam)
 {
-#ifndef __MINGW32__	// IContextMenu3 missing in MinGW (as of 6.2.2005)
+#ifndef __MINGW32__	/* IContextMenu3 missing in MinGW (as of 6.2.2005) */
 	if (s_pctxmenu3) {
 		if (SUCCEEDED((*s_pctxmenu3->lpVtbl->HandleMenuMsg)(s_pctxmenu3, nmsg, wparam, lparam)))
 			return TRUE;
@@ -3811,7 +3822,7 @@
 
 		  case WM_MEASUREITEM:
 		  draw_menu_item:
-			if (!wparam)	// Is the message menu-related?
+			if (!wparam)	/* Is the message menu-related? */
 				if (CtxMenu_HandleMenuMsg(nmsg, wparam, lparam))
 					return TRUE;
 
@@ -3823,8 +3834,8 @@
 
 			break;
 
-#ifndef __MINGW32__	// IContextMenu3 missing in MinGW (as of 6.2.2005)
-		  case WM_MENUCHAR:	// only supported by IContextMenu3
+#ifndef __MINGW32__	/* IContextMenu3 missing in MinGW (as of 6.2.2005) */
+		  case WM_MENUCHAR:	/* only supported by IContextMenu3 */
 		   if (s_pctxmenu3) {
 			   LRESULT lResult = 0;