Index: trunk/src/kernel32/KERNEL32.DEF
===================================================================
--- trunk/src/kernel32/KERNEL32.DEF	(revision 760)
+++ trunk/src/kernel32/KERNEL32.DEF	(revision 761)
@@ -1,3 +1,3 @@
-; $Id: KERNEL32.DEF,v 1.33 1999-08-31 14:36:44 sandervl Exp $
+; $Id: KERNEL32.DEF,v 1.34 1999-08-31 17:15:29 sandervl Exp $
 
 ;Created by BLAST for IBM's compiler
@@ -1014,4 +1014,4 @@
     __ct__12Win32MenuResFP10Win32ImageUlN22                       @1260
     __ct__12Win32MenuResFP10Win32ImageUlN22Pc			  @1261
-    __ct__12Win32MenuResFPvi					  @1262
-    __ct__12Win32MenuResFUl					  @1263
+    __ct__12Win32MenuResFUl					  @1262
+    __ct__12Win32MenuResFPv                                       @1263
Index: trunk/src/kernel32/cvtmenu.cpp
===================================================================
--- trunk/src/kernel32/cvtmenu.cpp	(revision 760)
+++ trunk/src/kernel32/cvtmenu.cpp	(revision 761)
@@ -1,3 +1,3 @@
-/* $Id: cvtmenu.cpp,v 1.1 1999-08-19 14:19:14 sandervl Exp $ */
+/* $Id: cvtmenu.cpp,v 1.2 1999-08-31 17:15:29 sandervl Exp $ */
 
 /*
@@ -28,6 +28,33 @@
 
 static int  ProcessSubMenu(PopupMenuItem *popupitem, MT_OS2 *os2menu, MTI_OS2 *menuitem, int size, int cp);
+static int  QuerySubMenuSize(PopupMenuItem *popupitem);
 static int  ProcessMenuItem(NormalMenuItem *popupitem, MT_OS2 *os2menu, MTI_OS2 *menuitem, int size, int cp);
+static int  QueryMenuItemSize(NormalMenuItem *normalitem);
 static void menustrcpy(char *dest, char *src);
+//******************************************************************************
+//******************************************************************************
+static int QueryMenuSize(MenuHeader *menu)
+{
+  PopupMenuItem  *popupitem = (PopupMenuItem *)((char *)menu + sizeof(MenuHeader));
+  NormalMenuItem *normalitem = (NormalMenuItem *)((char *)menu + sizeof(MenuHeader));
+  int size = sizeof(MenuHeader);
+  int increment;
+
+  while(TRUE) 
+  {
+    	if(popupitem->fItemFlags & POPUP) {
+         	increment = QuerySubMenuSize(popupitem);
+    	}
+    	else 	increment = QueryMenuItemSize(normalitem);
+
+	size += increment;
+
+    	if(popupitem->fItemFlags & ENDMENU) break;
+
+    	popupitem  = (PopupMenuItem *)((char *)popupitem + increment);
+    	normalitem = (NormalMenuItem *)((char *)normalitem + increment);
+  }
+  return size;  
+}
 //******************************************************************************
 //******************************************************************************
@@ -41,4 +68,7 @@
   ULONG   ulCpSize, ulCP;
 
+  if(size == 0) {
+	size = QueryMenuSize(menu);
+  }
   os2menu           = (MT_OS2 *)malloc(size*4); //should always be sufficient
   os2menu->len      = sizeof(MT_OS2) - sizeof(MTI_OS2);
@@ -182,4 +212,35 @@
 //******************************************************************************
 //******************************************************************************
+static int QuerySubMenuSize(PopupMenuItem *popupitem)
+{
+ NormalMenuItem *normalitem;
+ int             len = 0, size, increment;
+
+  if(!(popupitem->fItemFlags & MENUBARBREAK)) {
+    	len = (UniStrlen(popupitem->szItemText)+1)*2;
+  }
+
+  size = (sizeof(PopupMenuItem)-2 + len);  /*PLF Sat  97-06-21 22:17:51*/
+
+  normalitem = (NormalMenuItem *)((char*)popupitem + sizeof(PopupMenuItem)-2);  /*PLF Sat  97-06-21 23:54:50*/
+  normalitem = (NormalMenuItem *)((int)normalitem + len);
+
+  while(TRUE) {
+        if(normalitem->fItemFlags & POPUP) {
+            	increment = QuerySubMenuSize((PopupMenuItem *)normalitem);
+        }
+        else    increment = QueryMenuItemSize(normalitem);
+
+        size += increment;
+
+        if(normalitem->fItemFlags & ENDMENU) {
+            	return(size);
+        }
+        normalitem = (NormalMenuItem *)((char *)normalitem + increment);
+  }
+  return(size);
+}
+//******************************************************************************
+//******************************************************************************
 static int ProcessMenuItem(NormalMenuItem *normalitem, MT_OS2 *os2menu, MTI_OS2 *menuitem, int size, int cp)
 {
@@ -267,4 +328,16 @@
 //******************************************************************************
 //******************************************************************************
+static int QueryMenuItemSize(NormalMenuItem *normalitem)
+{
+ int    len = 0;
+
+  if(!(normalitem->fItemFlags & MENUBARBREAK)) {
+    	len = (UniStrlen(normalitem->szItemText)+1)*2;
+  }
+
+  return(sizeof(NormalMenuItem)-2 + len);
+}
+//******************************************************************************
+//******************************************************************************
 static void menustrcpy(char *dest, char *src)
 {
Index: trunk/src/kernel32/kernel32exp.def
===================================================================
--- trunk/src/kernel32/kernel32exp.def	(revision 760)
+++ trunk/src/kernel32/kernel32exp.def	(revision 761)
@@ -1,3 +1,3 @@
-; $Id: kernel32exp.def,v 1.18 1999-08-31 14:36:45 sandervl Exp $
+; $Id: kernel32exp.def,v 1.19 1999-08-31 17:15:30 sandervl Exp $
 
 ;Created by BLAST for IBM's compiler
@@ -868,4 +868,4 @@
     __ct__12Win32MenuResFP10Win32ImageUlN22                       @1260
     __ct__12Win32MenuResFP10Win32ImageUlN22Pc			  @1261
-    __ct__12Win32MenuResFPvi					  @1262
-    __ct__12Win32MenuResFUl					  @1263
+    __ct__12Win32MenuResFUl					  @1262
+    __ct__12Win32MenuResFPv                                       @1263
Index: trunk/src/kernel32/winres.cpp
===================================================================
--- trunk/src/kernel32/winres.cpp	(revision 760)
+++ trunk/src/kernel32/winres.cpp	(revision 761)
@@ -1,3 +1,3 @@
-/* $Id: winres.cpp,v 1.13 1999-08-31 14:36:46 sandervl Exp $ */
+/* $Id: winres.cpp,v 1.14 1999-08-31 17:15:30 sandervl Exp $ */
 
 /*
@@ -103,4 +103,7 @@
   orgos2type = -1;
   OS2ResHandle = 0;
+  //resources are in Unicode format by default; indirectly created resources
+  //can also be in ascii format
+  isUnicode  = TRUE; 
 }
 //******************************************************************************
@@ -160,4 +163,6 @@
     ressize = 0;
   }
+  //resources are in Unicode format by default
+  isUnicode  = TRUE; 
 }
 //******************************************************************************
@@ -189,4 +194,7 @@
   }
   else	memcpy(winresdata, resdata, size);
+
+  //resources are in Unicode format by default
+  isUnicode  = TRUE; 
 }
 //******************************************************************************
@@ -197,5 +205,5 @@
 
   //returned by DosGetResource, so we don't (and mustn't) free it
-  if(os2resdata && resType == RSRC_PELOADER)    
+  if(os2resdata && (resType == RSRC_PELOADER || resType == RSRC_CUSTOMINDIRECT))
 	free(os2resdata);
 
@@ -350,5 +358,5 @@
     case NTRT_NEWMENU:
     case NTRT_MENU:
-	return ConvertMenu((MenuHeader *)win32res, ressize);
+	return ConvertMenu((MenuHeader *)win32res, ressize, isUnicode);
 
     case NTRT_NEWDIALOG:
Index: trunk/src/kernel32/winresmenu.cpp
===================================================================
--- trunk/src/kernel32/winresmenu.cpp	(revision 760)
+++ trunk/src/kernel32/winresmenu.cpp	(revision 761)
@@ -1,3 +1,3 @@
-/* $Id: winresmenu.cpp,v 1.1 1999-08-31 14:36:46 sandervl Exp $ */
+/* $Id: winresmenu.cpp,v 1.2 1999-08-31 17:15:30 sandervl Exp $ */
 
 /*
@@ -49,9 +49,13 @@
 }
 //******************************************************************************
+//Template always contains Unicode strings
 //******************************************************************************
-Win32MenuRes::Win32MenuRes(LPVOID menutemplate, BOOL isUnicode)
+Win32MenuRes::Win32MenuRes(LPVOID menutemplate)
       : Win32Resource()
 {
-  resType      = RSRC_CUSTOMINDIRECT;
+  resType         = RSRC_CUSTOMINDIRECT;
+
+  os2resdata      = ConvertMenu((MenuHeader *)menutemplate, 0);
+  OS2ResHandle    = 0;
 }
 //******************************************************************************
@@ -59,5 +63,4 @@
 Win32MenuRes::~Win32MenuRes()
 {
-
 }
 //******************************************************************************
