diff --git a/dlls/comctl32/propsheet.c b/dlls/comctl32/propsheet.c
index c4b1905d163132483851b69e63ed931cae4e1c95..4d2f692adb89f603d7efd6affac5d97641d41d75 100644
--- a/dlls/comctl32/propsheet.c
+++ b/dlls/comctl32/propsheet.c
@@ -153,9 +153,10 @@ static BOOL PROPSHEET_CollectSheetInfo(LPCPROPSHEETHEADERA lppsh,
   memcpy(&psInfo->ppshheader,lppsh,dwSize);
 
   if (HIWORD(lppsh->pszCaption))
-     psInfo->ppshheader.pszCaption = HEAP_strdupA( GetProcessHeap(),
-                                                 0, lppsh->pszCaption );
-
+  {
+     psInfo->ppshheader.pszCaption = HeapAlloc( GetProcessHeap(), 0, strlen(lppsh->pszCaption)+1 );
+     strcpy( (char *)psInfo->ppshheader.pszCaption, lppsh->pszCaption );
+  }
   psInfo->nPages = lppsh->nPages;
 
   if (dwFlags & PSH_USEPSTARTPAGE)
@@ -1964,14 +1965,21 @@ HPROPSHEETPAGE WINAPI CreatePropertySheetPageA(
   memcpy(ppsp,lpPropSheetPage,min(lpPropSheetPage->dwSize,sizeof(PROPSHEETPAGEA)));
 
   if ( !(ppsp->dwFlags & PSP_DLGINDIRECT) && HIWORD( ppsp->u.pszTemplate ) )
-    ppsp->u.pszTemplate = HEAP_strdupA( GetProcessHeap(), 0, lpPropSheetPage->u.pszTemplate );
-
+  {
+    ppsp->u.pszTemplate = HeapAlloc( GetProcessHeap(),0,strlen(lpPropSheetPage->u.pszTemplate)+1 );
+    strcpy( (char *)ppsp->u.pszTemplate, lpPropSheetPage->u.pszTemplate );
+  }
   if ( (ppsp->dwFlags & PSP_USEICONID) && HIWORD( ppsp->u2.pszIcon ) )
-      ppsp->u2.pszIcon = HEAP_strdupA( GetProcessHeap(), 0, lpPropSheetPage->u2.pszIcon );
-       
+  {
+      ppsp->u2.pszIcon = HeapAlloc( GetProcessHeap(), 0, strlen(lpPropSheetPage->u2.pszIcon)+1 );
+      strcpy( (char *)ppsp->u2.pszIcon, lpPropSheetPage->u2.pszIcon );
+  }
 
   if ((ppsp->dwFlags & PSP_USETITLE) && HIWORD( ppsp->pszTitle ))
-      ppsp->pszTitle = HEAP_strdupA( GetProcessHeap(), 0, lpPropSheetPage->pszTitle );
+  {
+      ppsp->pszTitle = HeapAlloc( GetProcessHeap(), 0, strlen(lpPropSheetPage->pszTitle)+1 );
+      strcpy( (char *)ppsp->pszTitle, lpPropSheetPage->pszTitle );
+  }
   else if ( !(ppsp->dwFlags & PSP_USETITLE) )
       ppsp->pszTitle = NULL;
 
diff --git a/dlls/gdi/printdrv.c b/dlls/gdi/printdrv.c
index e16652fca032a6a18229f0c20208b1a228cf4e26..c2909eeaa95031250175738b894e532b29373a47 100644
--- a/dlls/gdi/printdrv.c
+++ b/dlls/gdi/printdrv.c
@@ -570,9 +570,13 @@ HPJOB16 WINAPI OpenJob16(LPCSTR lpOutput, LPCSTR lpTitle, HDC16 hDC)
             
             hHandle = 1;
 
-	    pPrintJob->pszOutput = HEAP_strdupA(GetProcessHeap(), 0, lpOutput);
+	    pPrintJob->pszOutput = HeapAlloc(GetProcessHeap(), 0, strlen(lpOutput)+1);
+	    strcpy( pPrintJob->pszOutput, lpOutput );
 	    if(lpTitle)
-	        pPrintJob->pszTitle = HEAP_strdupA(GetProcessHeap(), 0, lpTitle);
+            {
+	        pPrintJob->pszTitle = HeapAlloc(GetProcessHeap(), 0, strlen(lpTitle)+1);
+	        strcpy( pPrintJob->pszTitle, lpTitle );
+            }
 	    pPrintJob->hDC = hDC;
 	    pPrintJob->fd = fd;
 	    pPrintJob->nIndex = 0;
diff --git a/dlls/kernel/format_msg.c b/dlls/kernel/format_msg.c
index 34a92898767c4e128d8804f9ffaba7887f6c4561..6eac0136de2785d43ace3e73ea0b3bdb63c95ca1 100644
--- a/dlls/kernel/format_msg.c
+++ b/dlls/kernel/format_msg.c
@@ -165,8 +165,10 @@ DWORD WINAPI FormatMessageA(
     if (width && width != FORMAT_MESSAGE_MAX_WIDTH_MASK) 
         FIXME("line wrapping (%lu) not supported.\n", width);
     from = NULL;
-    if (dwFlags & FORMAT_MESSAGE_FROM_STRING) {
-        from = HEAP_strdupA( GetProcessHeap(), 0, (LPSTR)lpSource);
+    if (dwFlags & FORMAT_MESSAGE_FROM_STRING)
+    {
+        from = HeapAlloc( GetProcessHeap(), 0, strlen((LPSTR)lpSource)+1 );
+        strcpy( from, (LPSTR)lpSource );
     }
     else {
         if (dwFlags & FORMAT_MESSAGE_FROM_SYSTEM)
@@ -257,10 +259,9 @@ DWORD WINAPI FormatMessageA(
                                 f+=strlen(f); /*at \0*/
                             }
                         } else {
-                            if(!args)
-                                break;
-                            else
-                                fmtstr=HEAP_strdupA(GetProcessHeap(),0,"%s");
+                            if(!args) break;
+                            fmtstr = HeapAlloc(GetProcessHeap(),0,3);
+                            strcpy( fmtstr, "%s" );
                         }
                         if (args) {
                             int sz;
@@ -482,10 +483,9 @@ DWORD WINAPI FormatMessageW(
                                 f+=strlen(f); /*at \0*/
                             }
                         } else {
-                            if(!args)
-                                break;
-                            else
-                                fmtstr=HEAP_strdupA( GetProcessHeap(),0,"%s");
+                            if(!args) break;
+                            fmtstr = HeapAlloc( GetProcessHeap(),0,3);
+                            strcpy( fmtstr, "%s" );
                         }
                         if (dwFlags & FORMAT_MESSAGE_ARGUMENT_ARRAY)
                             argliststart=args+insertnr-1;
diff --git a/dlls/setupapi/setupx_main.c b/dlls/setupapi/setupx_main.c
index df95b0d2bb841ed6f7fde64af86c95f18008ab07..953820edaa5505b4816598a8961f3d1cccc1cdf3 100644
--- a/dlls/setupapi/setupx_main.c
+++ b/dlls/setupapi/setupx_main.c
@@ -49,7 +49,6 @@
 #include "setupx16.h"
 #include "setupapi_private.h"
 #include "winerror.h"
-#include "heap.h"
 #include "debugtools.h"
 
 DEFAULT_DEBUG_CHANNEL(setupapi);
@@ -723,11 +722,20 @@ RETERR16 WINAPI CtlSetLdd16(LPLOGDISKDESC pldd)
     memcpy(pCurrLDD, pldd, sizeof(LOGDISKDESC_S));
 
     if (pldd->pszPath)
-        pCurrLDD->pszPath	= HEAP_strdupA(heap, 0, pldd->pszPath);
+    {
+        pCurrLDD->pszPath = HeapAlloc( heap, 0, strlen(pldd->pszPath)+1 );
+        strcpy( pCurrLDD->pszPath, pldd->pszPath );
+    }
     if (pldd->pszVolLabel)
-	pCurrLDD->pszVolLabel	= HEAP_strdupA(heap, 0, pldd->pszVolLabel);
+    {
+        pCurrLDD->pszVolLabel = HeapAlloc( heap, 0, strlen(pldd->pszVolLabel)+1 );
+        strcpy( pCurrLDD->pszVolLabel, pldd->pszVolLabel );
+    }
     if (pldd->pszDiskName)
-	pCurrLDD->pszDiskName	= HEAP_strdupA(heap, 0, pldd->pszDiskName);
+    {
+        pCurrLDD->pszDiskName = HeapAlloc( heap, 0, strlen(pldd->pszDiskName)+1 );
+        strcpy( pCurrLDD->pszDiskName, pldd->pszDiskName );
+    }
 
     if (is_new) /* link into list */
     {
diff --git a/dlls/shell32/iconcache.c b/dlls/shell32/iconcache.c
index 8291a7c5833db03ea89afd19aa8eacdae408647d..9fbef9c2c391537c4227ff293d0332cd730960ce 100644
--- a/dlls/shell32/iconcache.c
+++ b/dlls/shell32/iconcache.c
@@ -28,7 +28,8 @@ DEFAULT_DEBUG_CHANNEL(shell);
 #define INVALID_INDEX -1
 
 typedef struct
-{	LPCSTR sSourceFile;	/* file (not path!) containing the icon */
+{
+	LPSTR sSourceFile;	/* file (not path!) containing the icon */
 	DWORD dwSourceIndex;	/* index within the file, if it is a resoure ID it will be negated */
 	DWORD dwListIndex;	/* index within the iconlist */
 	DWORD dwFlags;		/* GIL_* flags */
@@ -64,12 +65,15 @@ INT CALLBACK SIC_CompareEntrys( LPVOID p1, LPVOID p2, LPARAM lparam)
 static INT SIC_IconAppend (LPCSTR sSourceFile, INT dwSourceIndex, HICON hSmallIcon, HICON hBigIcon)
 {	LPSIC_ENTRY lpsice;
 	INT ret, index, index1;
-	
+	char *path;
 	TRACE("%s %i %x %x\n", sSourceFile, dwSourceIndex, hSmallIcon ,hBigIcon);
 
 	lpsice = (LPSIC_ENTRY) SHAlloc (sizeof (SIC_ENTRY));
 
-	lpsice->sSourceFile = HEAP_strdupA (GetProcessHeap(), 0, PathFindFileNameA(sSourceFile));
+        path = PathFindFileNameA(sSourceFile);
+        lpsice->sSourceFile = HeapAlloc( GetProcessHeap(), 0, strlen(path)+1 );
+        strcpy( lpsice->sSourceFile, path );
+
 	lpsice->dwSourceIndex = dwSourceIndex;
 	
 	EnterCriticalSection(&SHELL32_SicCS);
diff --git a/dlls/shell32/shelllink.c b/dlls/shell32/shelllink.c
index 94d7e080e3837beb65ce4f4fe1a5e311c05632ab..e605ad88860ed77f548d46b453d959bdf7e43c40 100644
--- a/dlls/shell32/shelllink.c
+++ b/dlls/shell32/shelllink.c
@@ -153,6 +153,17 @@ typedef struct
 #define _ICOM_THIS_From_IPersistStream(class, name) class* This = (class*)(((char*)name)-_IPersistStream_Offset);
 #define _IPersistStream_From_ICOM_THIS(class, name) class* StreamThis = (class*)(((char*)name)+_IPersistStream_Offset);
 
+
+/* strdup on the process heap */
+inline static LPSTR heap_strdup( LPCSTR str )
+{
+    INT len = strlen(str) + 1;
+    LPSTR p = HeapAlloc( GetProcessHeap(), 0, len );
+    if (p) memcpy( p, str, len );
+    return p;
+}
+
+
 /**************************************************************************
  *  IPersistFile_QueryInterface
  */
@@ -481,7 +492,7 @@ inline static char *get_unix_file_name( const char *dos )
     char buffer[MAX_PATH];
 
     if (!wine_get_unix_file_name( dos, buffer, sizeof(buffer) )) return NULL;
-    return HEAP_strdupA( GetProcessHeap(), 0, buffer );
+    return heap_strdup( buffer );
 }
 
 static BOOL create_default_icon( const char *filename )
@@ -501,7 +512,7 @@ static BOOL create_default_icon( const char *filename )
 /* extract an icon from an exe or icon file; helper for IPersistFile_fnSave */
 static char *extract_icon( const char *path, int index )
 {
-    char *filename = HEAP_strdupA( GetProcessHeap(), 0, tmpnam(NULL) );
+    char *filename = heap_strdup( tmpnam(NULL) );
     if (ExtractFromEXEDLL( path, index, filename )) return filename;
     if (ExtractFromICO( path, filename )) return filename;
     if (create_default_icon( filename )) return filename;
@@ -545,12 +556,12 @@ static HRESULT WINAPI IPersistFile_fnSave(IPersistFile* iface, LPCOLESTR pszFile
         RegCloseKey( hkey );
     }
     if (!*buffer) return NOERROR;
-    shell_link_app = HEAP_strdupA( GetProcessHeap(), 0, buffer );
+    shell_link_app = heap_strdup( buffer );
 
     if (!WideCharToMultiByte( CP_ACP, 0, pszFileName, -1, buffer, sizeof(buffer), NULL, NULL))
         return ERROR_UNKNOWN;
     GetFullPathNameA( buffer, sizeof(buff2), buff2, NULL );
-    filename = HEAP_strdupA( GetProcessHeap(), 0, buff2 );
+    filename = heap_strdup( buff2 );
 
     if (SHGetSpecialFolderPathA( 0, buffer, CSIDL_STARTUP, FALSE ))
     {
@@ -797,7 +808,7 @@ static HRESULT WINAPI IPersistStream_fnLoad(
 	            This->pPidl = ILClone (&lpLinkHeader->Pidl);
 
 	            SHGetPathFromIDListA(&lpLinkHeader->Pidl, sTemp);
-	            This->sPath = HEAP_strdupA ( GetProcessHeap(), 0, sTemp);
+	            This->sPath = heap_strdup( sTemp );
 	          }
 		  This->wHotKey = lpLinkHeader->wHotKey;
 		  FileTimeToSystemTime (&lpLinkHeader->Time1, &This->time1);
@@ -1033,7 +1044,7 @@ static HRESULT WINAPI IShellLinkA_fnSetDescription(IShellLinkA * iface, LPCSTR p
 
 	if (This->sDescription)
 	    HeapFree(GetProcessHeap(), 0, This->sDescription);
-	if (!(This->sDescription = HEAP_strdupA(GetProcessHeap(), 0, pszName)))
+	if (!(This->sDescription = heap_strdup(pszName)))
 	    return E_OUTOFMEMORY;
 
 	return NOERROR;
@@ -1056,7 +1067,7 @@ static HRESULT WINAPI IShellLinkA_fnSetWorkingDirectory(IShellLinkA * iface, LPC
 
 	if (This->sWorkDir)
 	    HeapFree(GetProcessHeap(), 0, This->sWorkDir);
-	if (!(This->sWorkDir = HEAP_strdupA(GetProcessHeap(), 0, pszDir)))
+	if (!(This->sWorkDir = heap_strdup(pszDir)))
 	    return E_OUTOFMEMORY;
 
 	return NOERROR;
@@ -1079,7 +1090,7 @@ static HRESULT WINAPI IShellLinkA_fnSetArguments(IShellLinkA * iface, LPCSTR psz
 
 	if (This->sArgs)
 	    HeapFree(GetProcessHeap(), 0, This->sArgs);
-	if (!(This->sArgs = HEAP_strdupA(GetProcessHeap(), 0, pszArgs)))
+	if (!(This->sArgs = heap_strdup(pszArgs)))
 	    return E_OUTOFMEMORY;
 
 	return NOERROR;
@@ -1138,7 +1149,7 @@ static HRESULT WINAPI IShellLinkA_fnSetIconLocation(IShellLinkA * iface, LPCSTR
 	
 	if (This->sIcoPath)
 	    HeapFree(GetProcessHeap(), 0, This->sIcoPath);
-	if (!(This->sIcoPath = HEAP_strdupA(GetProcessHeap(), 0, pszIconPath)))
+	if (!(This->sIcoPath = heap_strdup(pszIconPath)))
 	    return E_OUTOFMEMORY;	
 	This->iIcoNdx = iIcon;
 	
@@ -1166,7 +1177,7 @@ static HRESULT WINAPI IShellLinkA_fnSetPath(IShellLinkA * iface, LPCSTR pszFile)
 
 	if (This->sPath)
 	    HeapFree(GetProcessHeap(), 0, This->sPath);
-	if (!(This->sPath = HEAP_strdupA(GetProcessHeap(), 0, pszFile)))
+	if (!(This->sPath = heap_strdup(pszFile)))
 	    return E_OUTOFMEMORY;
 	
 	return NOERROR;
diff --git a/dlls/user/lstr.c b/dlls/user/lstr.c
index cc8b2a13b46e62184557b49b5f17742ce0315933..74ce0f6defedb1910261a579cdb2dd534b93161c 100644
--- a/dlls/user/lstr.c
+++ b/dlls/user/lstr.c
@@ -22,7 +22,6 @@
 #include "wine/unicode.h"
 #include "wine/winbase16.h"
 #include "wine/winuser16.h"
-#include "heap.h"
 
 #include "debugtools.h"
 
@@ -602,7 +601,11 @@ DWORD WINAPI FormatMessage16(
         FIXME("line wrapping (%lu) not supported.\n", width);
     from = NULL;
     if (dwFlags & FORMAT_MESSAGE_FROM_STRING)
-        from = HEAP_strdupA( GetProcessHeap(), 0, MapSL(lpSource));
+    {
+        char *source = MapSL(lpSource);
+        from = HeapAlloc( GetProcessHeap(), 0, strlen(source)+1 );
+        strcpy( from, source );
+    }
     if (dwFlags & FORMAT_MESSAGE_FROM_SYSTEM) {
         from = HeapAlloc( GetProcessHeap(),0,200 );
 	sprintf(from,"Systemmessage, messageid = 0x%08x\n",dwMessageId);
@@ -673,11 +676,13 @@ DWORD WINAPI FormatMessage16(
 			    sprintf(fmtstr,"%%%s",f);
 			    f+=strlen(f); /*at \0*/
 			}
-		    } else
-		        if(!args) 
-			    break;
-			else
-			  fmtstr=HEAP_strdupA(GetProcessHeap(),0,"%s");
+		    }
+                    else
+                    {
+                        if(!args) break;
+                        fmtstr=HeapAlloc( GetProcessHeap(), 0, 3 );
+                        strcpy( fmtstr, "%s" );
+                    }
 		    if (args) {
 		        int	sz;
 			LPSTR	b = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sz = 100);
diff --git a/dlls/wineps/afm.c b/dlls/wineps/afm.c
index 6a8d08bd7dd99335fcce5979745b5f90a6906660..861ce3fc859bb6928e7c3edb10420b51db47c37d 100644
--- a/dlls/wineps/afm.c
+++ b/dlls/wineps/afm.c
@@ -20,7 +20,6 @@
 #include "winreg.h"
 #include "psdrv.h"
 #include "debugtools.h"
-#include "heap.h"
 
 DEFAULT_DEBUG_CHANNEL(psdrv);
 #include <ctype.h>
@@ -282,23 +281,23 @@ static const AFM *PSDRV_AFMParse(char const *file)
 	        value++;
 
 	if(!strncmp("FontName", buf, 8)) {
-	    afm->FontName = font_name = HEAP_strdupA(PSDRV_Heap, 0, value);
-	    if (afm->FontName == NULL)
+	    if (!(afm->FontName = font_name = HeapAlloc(PSDRV_Heap, 0, strlen(value)+1 )))
 		goto cleanup_fp;
+            strcpy( (char *)afm->FontName, value );
 	    continue;
 	}
 
 	if(!strncmp("FullName", buf, 8)) {
-	    afm->FullName = full_name = HEAP_strdupA(PSDRV_Heap, 0, value);
-	    if (afm->FullName == NULL)
+	    if (!(afm->FullName = full_name = HeapAlloc(PSDRV_Heap, 0, strlen(value)+1 )))
 		goto cleanup_fp;
+	    strcpy( (char *)afm->FullName, value );
 	    continue;
 	}
 
 	if(!strncmp("FamilyName", buf, 10)) {
-	    afm->FamilyName = family_name = HEAP_strdupA(PSDRV_Heap, 0, value);
-	    if (afm->FamilyName == NULL)
-	    	goto cleanup_fp;
+	    if (!(afm->FamilyName = family_name = HeapAlloc(PSDRV_Heap, 0, strlen(value)+1 )))
+		goto cleanup_fp;
+	    strcpy( (char *)afm->FamilyName, value );
 	    continue;
 	}
 	
@@ -381,10 +380,9 @@ static const AFM *PSDRV_AFMParse(char const *file)
 	}
 
 	if(!strncmp("EncodingScheme", buf, 14)) {
-	    afm->EncodingScheme = encoding_scheme =
-	    	    HEAP_strdupA(PSDRV_Heap, 0, value);
-	    if (afm->EncodingScheme == NULL)
-	    	goto cleanup_fp;
+            if (!(afm->EncodingScheme = encoding_scheme = HeapAlloc(PSDRV_Heap, 0, strlen(value)+1)))
+                goto cleanup_fp;
+            strcpy( (char *)afm->EncodingScheme, value );
 	    continue;
 	}
 
@@ -398,21 +396,23 @@ static const AFM *PSDRV_AFMParse(char const *file)
 
     if(afm->FontName == NULL) {
         WARN("%s contains no FontName.\n", file);
-	afm->FontName = font_name = HEAP_strdupA(PSDRV_Heap, 0, "nofont");
-	if (afm->FontName == NULL)
+	if (!(afm->FontName = font_name = HeapAlloc(PSDRV_Heap, 0, 7)))
 	    goto cleanup;
+	strcpy( (char *)afm->FontName, "nofont" );
     }
-    
     if(afm->FullName == NULL)
-        afm->FullName = full_name = HEAP_strdupA(PSDRV_Heap, 0, afm->FontName);
-	
+    {
+        if (!(afm->FullName = full_name = HeapAlloc(PSDRV_Heap, 0, strlen(afm->FontName)+1 )))
+            goto cleanup;
+        strcpy( (char *)afm->FullName, afm->FontName );
+    }
     if(afm->FamilyName == NULL)
-        afm->FamilyName = family_name =
-	    	HEAP_strdupA(PSDRV_Heap, 0, afm->FontName);
-		
-    if (afm->FullName == NULL || afm->FamilyName == NULL)
-    	goto cleanup;
-    
+    {
+        if (!(afm->FamilyName = family_name = HeapAlloc(PSDRV_Heap, 0, strlen(afm->FontName)+1 )))
+            goto cleanup;
+        strcpy( (char *)afm->FamilyName, afm->FontName );
+    }
+
     if(afm->Ascender == 0.0)
         afm->Ascender = afm->FontBBox.ury;
     if(afm->Descender == 0.0)
@@ -528,13 +528,12 @@ BOOL PSDRV_AddAFMtoList(FONTFAMILY **head, const AFM *afm)
 	    return FALSE;
 	}
 	*insert = family;
-	family->FamilyName = HEAP_strdupA(PSDRV_Heap, 0,
-					  afm->FamilyName);
-	if (family->FamilyName == NULL) {
+	if (!(family->FamilyName = HeapAlloc(PSDRV_Heap, 0, strlen(afm->FamilyName)+1 ))) {
 	    HeapFree(PSDRV_Heap, 0, family);
 	    HeapFree(PSDRV_Heap, 0, newafmle);
 	    return FALSE;
 	}
+	strcpy( family->FamilyName, afm->FamilyName );
 	family->afmlist = newafmle;
 	return TRUE;
     }
diff --git a/dlls/wineps/escape.c b/dlls/wineps/escape.c
index 2e1c680a6be4cbd5c0dd0252817bb49c09c45e14..8cdfab5c249bd2c81646c9caf71ef40cdf0a0720 100644
--- a/dlls/wineps/escape.c
+++ b/dlls/wineps/escape.c
@@ -9,7 +9,6 @@
 #include "psdrv.h"
 #include "debugtools.h"
 #include "winspool.h"
-#include "heap.h"
 
 DEFAULT_DEBUG_CHANNEL(psdrv);
 
@@ -403,7 +402,8 @@ INT PSDRV_StartDoc( DC *dc, const DOCINFOA *doc )
 
     if(doc->lpszOutput) {
         HeapFree( PSDRV_Heap, 0, physDev->job.output );
-	physDev->job.output = HEAP_strdupA( PSDRV_Heap, 0, doc->lpszOutput );
+	physDev->job.output = HeapAlloc( PSDRV_Heap, 0, strlen(doc->lpszOutput)+1 );
+	strcpy( physDev->job.output, doc->lpszOutput );
     }
     physDev->job.hJob = OpenJob16(physDev->job.output,  doc->lpszDocName,
 				  dc->hSelf);
diff --git a/dlls/wineps/init.c b/dlls/wineps/init.c
index 960073e460b9ec04231bf311b495a5c9de4067ee..0d45106b0160123cec6175bd741ec98ff71b716b 100644
--- a/dlls/wineps/init.c
+++ b/dlls/wineps/init.c
@@ -14,7 +14,6 @@
 #include "gdi.h"
 #include "psdrv.h"
 #include "debugtools.h"
-#include "heap.h"
 #include "winreg.h"
 #include "winspool.h"
 #include "winerror.h"
@@ -426,9 +425,10 @@ static BOOL PSDRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
     			    dc->devCaps->vertRes);
     
     dc->hFont = PSDRV_DefaultFont;
-    physDev->job.output = output ?
-      HEAP_strdupA( PSDRV_Heap, 0, output ) :
-      HEAP_strdupA( PSDRV_Heap, 0, "LPT1:" );  /* HACK */
+
+    if (!output) output = "LPT1:";  /* HACK */
+    physDev->job.output = HeapAlloc( PSDRV_Heap, 0, strlen(output)+1 );
+    strcpy( physDev->job.output, output );
     physDev->job.hJob = 0;
     return TRUE;
 }
@@ -481,11 +481,10 @@ PRINTERINFO *PSDRV_FindPrinterInfo(LPCSTR name)
     pi = *last = HeapAlloc( PSDRV_Heap, HEAP_ZERO_MEMORY, sizeof(*pi) );
     if (pi == NULL)
     	return NULL;
-	
-    pi->FriendlyName = HEAP_strdupA( PSDRV_Heap, 0, name );
-    if (pi->FriendlyName == NULL)
-    	goto fail;
-	
+
+    if (!(pi->FriendlyName = HeapAlloc( PSDRV_Heap, 0, strlen(name)+1 ))) goto fail;
+    strcpy( pi->FriendlyName, name );
+
     /* Use Get|SetPrinterDataExA instead? */
     
     res = DrvGetPrinterData16((LPSTR)name, (LPSTR)INT_PD_DEFAULT_DEVMODE, &type,
diff --git a/dlls/wineps/ppd.c b/dlls/wineps/ppd.c
index 8b4da098b26fcf90b80559d20b5a57b9a146af61..bf747023c32b0c41eca7d085be4e018458079eef 100644
--- a/dlls/wineps/ppd.c
+++ b/dlls/wineps/ppd.c
@@ -9,7 +9,6 @@
 #include <stdio.h>
 #include <ctype.h>
 #include "winnt.h" /* HEAP_ZERO_MEMORY */
-#include "heap.h"
 #include "debugtools.h"
 #include "psdrv.h"
 #include "winspool.h"
@@ -650,8 +649,10 @@ PPD *PSDRV_ParsePPD(char *fname)
 	        if(tuple.opttrans) {
 		    page->FullName = tuple.opttrans;
 		    tuple.opttrans = NULL;
-		} else {
-		    page->FullName = HEAP_strdupA( PSDRV_Heap, 0, page->Name );
+		} else
+                {
+                    page->FullName = HeapAlloc( PSDRV_Heap, 0, strlen(page->Name)+1 );
+                    strcpy( page->FullName, page->Name );
 		}
 	    }
 	    if(!page->InvocationString) {
diff --git a/dlls/wineps/truetype.c b/dlls/wineps/truetype.c
index 0cddce78c78f647393913fca84ca0f76ebcbd34e..fa3d5d08776ee3bae9d461257e4b1dd473f5c184 100644
--- a/dlls/wineps/truetype.c
+++ b/dlls/wineps/truetype.c
@@ -43,7 +43,6 @@
 #include "winreg.h"
 #include "psdrv.h"
 #include "debugtools.h"
-#include "heap.h"
 
 DEFAULT_DEBUG_CHANNEL(psdrv);
 
@@ -126,10 +125,10 @@ static BOOL FindCharMap(AFM *afm, AFMSTRINGS *str)
 	
     if (charmap->encoding_id < 7)
     {
-    	str->EncodingScheme = HEAP_strdupA(PSDRV_Heap, 0,
-	    	encoding_names[charmap->encoding_id]);
-	if (str->EncodingScheme == NULL)
+        if (!(str->EncodingScheme = HeapAlloc(PSDRV_Heap, 0,
+                                              strlen(encoding_names[charmap->encoding_id])+1 )))
 	    return FALSE;
+        strcpy( str->EncodingScheme, encoding_names[charmap->encoding_id] );
     }
     else
     {
diff --git a/dlls/winmm/mci.c b/dlls/winmm/mci.c
index 64c409db77ff55b32580cc57bf6611973d31542a..befb4c3be7aa8f4669275cdb1415be4ae0064369 100644
--- a/dlls/winmm/mci.c
+++ b/dlls/winmm/mci.c
@@ -44,6 +44,19 @@ static	MCI_MapType	MCI_UnMapMsg32ATo16(WORD uDevType, WORD wMsg, DWORD dwFlags,
 /* First MCI valid device ID (0 means error) */
 #define MCI_MAGIC 0x0001
 
+/* dup a string and uppercase it */
+inline static LPSTR str_dup_upper( LPCSTR str )
+{
+    INT len = strlen(str) + 1;
+    LPSTR p = HeapAlloc( GetProcessHeap(), 0, len );
+    if (p)
+    {
+        memcpy( p, str, len );
+        CharUpperA( p );
+    }
+    return p;
+}
+
 /**************************************************************************
  * 				MCI_GetDriver			[internal]
  */
@@ -464,7 +477,7 @@ static	BOOL	MCI_OpenMciDriver(LPWINE_MCIDRIVER wmd, LPCSTR drvTyp, LPARAM lp)
 static	DWORD	MCI_LoadMciDriver(LPWINE_MM_IDATA iData, LPCSTR _strDevTyp, 
 				  LPWINE_MCIDRIVER* lpwmd)
 {
-    LPSTR			strDevTyp = CharUpperA(HEAP_strdupA(GetProcessHeap(), 0, _strDevTyp));
+    LPSTR			strDevTyp = str_dup_upper(_strDevTyp);
     LPWINE_MCIDRIVER		wmd = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*wmd));
     MCI_OPEN_DRIVER_PARMSA	modp;
     DWORD			dwRet = 0;
@@ -538,12 +551,15 @@ static	DWORD	MCI_FinishOpen(LPWINE_MCIDRIVER wmd, LPMCI_OPEN_PARMSA lpParms,
 			       DWORD dwParam)
 {
     if (dwParam & MCI_OPEN_ELEMENT)
-	wmd->lpstrElementName = HEAP_strdupA(GetProcessHeap(), 0, 
-					     lpParms->lpstrElementName);
-
+    {
+        wmd->lpstrElementName = HeapAlloc(GetProcessHeap(),0,strlen(lpParms->lpstrElementName)+1);
+        strcpy( wmd->lpstrElementName, lpParms->lpstrElementName );
+    }
     if (dwParam & MCI_OPEN_ALIAS)
-	wmd->lpstrAlias = HEAP_strdupA(GetProcessHeap(), 0, lpParms->lpstrAlias);
-
+    {
+        wmd->lpstrAlias = HeapAlloc(GetProcessHeap(), 0, strlen(lpParms->lpstrAlias)+1);
+        strcpy( wmd->lpstrAlias, lpParms->lpstrAlias);
+    }
     lpParms->wDeviceID = wmd->wDeviceID;
 
     return MCI_SendCommandFrom32(wmd->wDeviceID, MCI_OPEN_DRIVER, dwParam, 
@@ -855,8 +871,9 @@ DWORD WINAPI mciSendStringA(LPCSTR lpstrCommand, LPSTR lpstrRet,
     TRACE("('%s', %p, %d, %X)\n", lpstrCommand, lpstrRet, uRetLen, hwndCallback);
 
     /* format is <command> <device> <optargs> */
-    if (!(verb = HEAP_strdupA(GetProcessHeap(), 0, lpstrCommand)))
+    if (!(verb = HeapAlloc(GetProcessHeap(), 0, strlen(lpstrCommand)+1)))
 	return MCIERR_OUT_OF_MEMORY;
+    strcpy( verb, lpstrCommand );
 
     memset(data, 0, sizeof(data));
 
@@ -886,14 +903,14 @@ DWORD WINAPI mciSendStringA(LPCSTR lpstrCommand, LPSTR lpstrRet,
 
 	    dwFlags |= MCI_OPEN_TYPE;
 	    data[2] = (DWORD)devType;
-	    devType = CharUpperA(HEAP_strdupA(GetProcessHeap(), 0, devType));
+	    devType = str_dup_upper(devType);
 	    dwFlags |= MCI_OPEN_ELEMENT;
 	    data[3] = (DWORD)dev;
 	} else if (strchr(dev, '.') == NULL) {
 	    tmp = strchr(dev,' ');
 	    if (tmp) *tmp = '\0';
 	    data[2] = (DWORD)dev;
-	    devType = CharUpperA(HEAP_strdupA(GetProcessHeap(), 0, dev));
+	    devType = str_dup_upper(dev);
 	    if (tmp) *tmp = ' ';
 	    dwFlags |= MCI_OPEN_TYPE;
 	} else {
@@ -901,7 +918,7 @@ DWORD WINAPI mciSendStringA(LPCSTR lpstrCommand, LPSTR lpstrRet,
 		devType += 5;
 		tmp = strchr(devType, ' ');
 		if (tmp) *tmp = '\0';
-		devType = CharUpperA(HEAP_strdupA(GetProcessHeap(), 0, devType));
+		devType = str_dup_upper(devType);
 		if (tmp) *tmp = ' ';
 		/* dwFlags and data[2] will be correctly set in ParseOpt loop */
 	    } else {
@@ -909,17 +926,20 @@ DWORD WINAPI mciSendStringA(LPCSTR lpstrCommand, LPSTR lpstrRet,
 		if ((dwRet = MCI_GetDevTypeFromFileName(dev, buf, sizeof(buf))))
 		    goto errCleanUp;
 
-		devType = CharUpperA(HEAP_strdupA(GetProcessHeap(), 0, buf));
+		devType = str_dup_upper(buf);
 	    }
 	    dwFlags |= MCI_OPEN_ELEMENT;
 	    data[3] = (DWORD)dev;
 	}
 	if ((devAlias = strstr(args," alias "))) {
+            char *tmp2;
 	    devAlias += 7;
-	    tmp = strchr(devAlias,' ');
+	    if (!(tmp = strchr(devAlias,' '))) tmp = devAlias + strlen(devAlias);
 	    if (tmp) *tmp = '\0';
-	    data[4] = (DWORD)HEAP_strdupA(GetProcessHeap(), 0, devAlias);
-	    if (tmp) *tmp = ' ';
+            tmp2 = HeapAlloc(GetProcessHeap(), 0, tmp - devAlias + 1 );
+            memcpy( tmp2, devAlias, tmp - devAlias );
+            tmp2[tmp - devAlias] = 0;
+            data[4] = (DWORD)tmp2;
 	    /* should be done in regular options parsing */
 	    /* dwFlags |= MCI_OPEN_ALIAS; */
 	}
diff --git a/dlls/winmm/mmsystem.c b/dlls/winmm/mmsystem.c
index 5f6a3452fbe2f985cc215026b252cb1e2bce28d6..f8b5d7dbd38a5314f893d3ad842e15bafaeb1087 100644
--- a/dlls/winmm/mmsystem.c
+++ b/dlls/winmm/mmsystem.c
@@ -536,8 +536,10 @@ BOOL WINAPI PlaySoundA(LPCSTR pszSound, HMODULE hmod, DWORD fdwSound)
 	    StrDup = NULL;
 	}
 	if (!((fdwSound & SND_MEMORY) || ((fdwSound & SND_RESOURCE) && 
-					  !((DWORD)pszSound >> 16)) || !pszSound)) {
-	    StrDup = HEAP_strdupA(GetProcessHeap(), 0,pszSound);
+					  !((DWORD)pszSound >> 16)) || !pszSound))
+        {
+	    StrDup = HeapAlloc(GetProcessHeap(), 0, strlen(pszSound)+1 );
+	    strcpy( StrDup, pszSound );
 	    PlaySound_pszSound = StrDup;
 	} else PlaySound_pszSound = pszSound;
 	PlaySound_Loop = fdwSound & SND_LOOP;
diff --git a/files/dos_fs.c b/files/dos_fs.c
index e73fddc1fa7acb4a095c28ed1cf197058b6f1d79..9a05b321ec7356f001b745efdbf906d297c72f1d 100644
--- a/files/dos_fs.c
+++ b/files/dos_fs.c
@@ -1607,7 +1607,8 @@ HANDLE WINAPI FindFirstFileExA(
           if (!DOSFS_GetFullName( lpFileName, FALSE, &full_name )) break;
           if (!(handle = GlobalAlloc(GMEM_MOVEABLE, sizeof(FIND_FIRST_INFO)))) break;
           info = (FIND_FIRST_INFO *)GlobalLock( handle );
-          info->path = HEAP_strdupA( GetProcessHeap(), 0, full_name.long_name );
+          info->path = HeapAlloc( GetProcessHeap(), 0, strlen(full_name.long_name)+1 );
+          strcpy( info->path, full_name.long_name );
           info->long_mask = strrchr( info->path, '/' );
           *(info->long_mask++) = '\0';
           info->short_mask = NULL;
@@ -2294,7 +2295,8 @@ HANDLE16 WINAPI FindFirstFile16( LPCSTR path, WIN32_FIND_DATAA *data )
     if (!(handle = GlobalAlloc16( GMEM_MOVEABLE, sizeof(FIND_FIRST_INFO) )))
         return INVALID_HANDLE_VALUE16;
     info = (FIND_FIRST_INFO *)GlobalLock16( handle );
-    info->path = HEAP_strdupA( GetProcessHeap(), 0, full_name.long_name );
+    info->path = HeapAlloc( GetProcessHeap(), 0, strlen(full_name.long_name)+1 );
+    strcpy( info->path, full_name.long_name );
     info->long_mask = strrchr( info->path, '/' );
     if (info->long_mask )
         *(info->long_mask++) = '\0';
diff --git a/files/drive.c b/files/drive.c
index 0c34655b7a50450d237e3674154a54e4c7505c09..b294389c514101fda8aca49ee4b608d8ffe3207b 100644
--- a/files/drive.c
+++ b/files/drive.c
@@ -108,6 +108,14 @@ static int DRIVE_CurDrive = -1;
 
 static HTASK16 DRIVE_LastTask = 0;
 
+/* strdup on the process heap */
+inline static char *heap_strdup( const char *str )
+{
+    INT len = strlen(str) + 1;
+    LPSTR p = HeapAlloc( GetProcessHeap(), 0, len );
+    if (p) memcpy( p, str, len );
+    return p;
+}
 
 /***********************************************************************
  *           DRIVE_GetDriveType
@@ -179,9 +187,9 @@ int DRIVE_Init(void)
                 continue;
             }
 
-            drive->root = HEAP_strdupA( GetProcessHeap(), 0, path );
-            drive->dos_cwd  = HEAP_strdupA( GetProcessHeap(), 0, "" );
-            drive->unix_cwd = HEAP_strdupA( GetProcessHeap(), 0, "" );
+            drive->root     = heap_strdup( path );
+            drive->dos_cwd  = heap_strdup( "" );
+            drive->unix_cwd = heap_strdup( "" );
             drive->type     = DRIVE_GetDriveType( name );
             drive->device   = NULL;
             drive->flags    = 0;
@@ -212,7 +220,7 @@ int DRIVE_Init(void)
                                       buffer, sizeof(buffer) );
             if (buffer[0])
 	    {
-                drive->device = HEAP_strdupA( GetProcessHeap(), 0, buffer );
+                drive->device = heap_strdup( buffer );
 		if (PROFILE_GetWineIniBool( name, "ReadVolInfo", 1))
                     drive->flags |= DRIVE_READ_VOL_INFO;
 	    }
@@ -239,9 +247,9 @@ int DRIVE_Init(void)
     {
         MESSAGE("Warning: no valid DOS drive found, check your configuration file.\n" );
         /* Create a C drive pointing to Unix root dir */
-        DOSDrives[2].root     = HEAP_strdupA( GetProcessHeap(), 0, "/" );
-        DOSDrives[2].dos_cwd  = HEAP_strdupA( GetProcessHeap(), 0, "" );
-        DOSDrives[2].unix_cwd = HEAP_strdupA( GetProcessHeap(), 0, "" );
+        DOSDrives[2].root     = heap_strdup( "/" );
+        DOSDrives[2].dos_cwd  = heap_strdup( "" );
+        DOSDrives[2].unix_cwd = heap_strdup( "" );
         strcpy( DOSDrives[2].label_conf, "Drive C    " );
         DOSDrives[2].serial_conf   = 12345678;
         DOSDrives[2].type     = DRIVE_FIXED;
@@ -694,9 +702,8 @@ int DRIVE_Chdir( int drive, const char *path )
 
     HeapFree( GetProcessHeap(), 0, DOSDrives[drive].dos_cwd );
     HeapFree( GetProcessHeap(), 0, DOSDrives[drive].unix_cwd );
-    DOSDrives[drive].dos_cwd  = HEAP_strdupA( GetProcessHeap(), 0,
-                                              full_name.short_name + 3 );
-    DOSDrives[drive].unix_cwd = HEAP_strdupA( GetProcessHeap(), 0, unix_cwd );
+    DOSDrives[drive].dos_cwd  = heap_strdup( full_name.short_name + 3 );
+    DOSDrives[drive].unix_cwd = heap_strdup( unix_cwd );
 
     if (pTask && (pTask->curdrive & 0x80) && 
         ((pTask->curdrive & ~0x80) == drive))
@@ -771,10 +778,10 @@ int DRIVE_SetLogicalMapping ( int existing_drive, int new_drive )
 	return 0;
     }
 
-    new->root = HEAP_strdupA( GetProcessHeap(), 0, old->root );
-    new->dos_cwd = HEAP_strdupA( GetProcessHeap(), 0, old->dos_cwd );
-    new->unix_cwd = HEAP_strdupA( GetProcessHeap(), 0, old->unix_cwd );
-    new->device = HEAP_strdupA( GetProcessHeap(), 0, old->device );
+    new->root     = heap_strdup( old->root );
+    new->dos_cwd  = heap_strdup( old->dos_cwd );
+    new->unix_cwd = heap_strdup( old->unix_cwd );
+    new->device   = heap_strdup( old->device );
     memcpy ( new->label_conf, old->label_conf, 12 );
     memcpy ( new->label_read, old->label_read, 12 );
     new->serial_conf = old->serial_conf;
diff --git a/files/profile.c b/files/profile.c
index 109e1bfab97d83fab82e2a5dba2eb4855450906d..f984058a8c90d38673ee27a15077e31d313e4794 100644
--- a/files/profile.c
+++ b/files/profile.c
@@ -32,17 +32,17 @@ DEFAULT_DEBUG_CHANNEL(profile);
 
 typedef struct tagPROFILEKEY
 {
-    char                  *name;
     char                  *value;
     struct tagPROFILEKEY  *next;
+    char                   name[1];
 } PROFILEKEY;
 
 typedef struct tagPROFILESECTION
 {
-    char                       *name;
     struct tagPROFILEKEY       *key;
     struct tagPROFILESECTION   *next;
-} PROFILESECTION; 
+    char                        name[1];
+} PROFILESECTION;
 
 
 typedef struct
@@ -168,11 +168,9 @@ static void PROFILE_Free( PROFILESECTION *section )
 
     for ( ; section; section = next_section)
     {
-        if (section->name) HeapFree( GetProcessHeap(), 0, section->name );
         for (key = section->key; key; key = next_key)
         {
             next_key = key->next;
-            if (key->name) HeapFree( GetProcessHeap(), 0, key->name );
             if (key->value) HeapFree( GetProcessHeap(), 0, key->value );
             HeapFree( GetProcessHeap(), 0, key );
         }
@@ -205,8 +203,8 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
     PROFILEKEY *key, *prev_key, **next_key;
 
     first_section = HeapAlloc( GetProcessHeap(), 0, sizeof(*section) );
-    if(first_section == NULL) return NULL; 
-    first_section->name = NULL;
+    if(first_section == NULL) return NULL;
+    first_section->name[0] = 0;
     first_section->key  = NULL;
     first_section->next = NULL;
     next_section = &first_section->next;
@@ -229,9 +227,9 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
             {
                 *p2 = '\0';
                 p++;
-                section = HeapAlloc( GetProcessHeap(), 0, sizeof(*section) );
-		if(section == NULL) break;
-                section->name = HEAP_strdupA( GetProcessHeap(), 0, p );
+                if (!(section = HeapAlloc( GetProcessHeap(), 0, sizeof(*section) + strlen(p) )))
+                    break;
+                strcpy( section->name, p );
                 section->key  = NULL;
                 section->next = NULL;
                 *next_section = section;
@@ -258,10 +256,15 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
 
         if(*p || !prev_key || *prev_key->name)
         {
-           key = HeapAlloc( GetProcessHeap(), 0, sizeof(*key) );
-	   if(key == NULL) break;
-           key->name  = HEAP_strdupA( GetProcessHeap(), 0, p );
-           key->value = p2 ? HEAP_strdupA( GetProcessHeap(), 0, p2 ) : NULL;
+            if (!(key = HeapAlloc( GetProcessHeap(), 0, sizeof(*key) + strlen(p) ))) break;
+            strcpy( key->name, p );
+            if (p2)
+            {
+                key->value = HeapAlloc( GetProcessHeap(), 0, strlen(p2)+1 );
+                strcpy( key->value, p2 );
+            }
+            else key->value = NULL;
+
            key->next  = NULL;
            *next_key  = key;
            next_key   = &key->next;
@@ -361,7 +364,7 @@ static BOOL PROFILE_DeleteSection( PROFILESECTION **section, LPCSTR name )
 {
     while (*section)
     {
-        if ((*section)->name && !strcasecmp( (*section)->name, name ))
+        if ((*section)->name[0] && !strcasecmp( (*section)->name, name ))
         {
             PROFILESECTION *to_del = *section;
             *section = to_del->next;
@@ -385,7 +388,7 @@ static BOOL PROFILE_DeleteKey( PROFILESECTION **section,
 {
     while (*section)
     {
-        if ((*section)->name && !strcasecmp( (*section)->name, section_name ))
+        if ((*section)->name[0] && !strcasecmp( (*section)->name, section_name ))
         {
             PROFILEKEY **key = &(*section)->key;
             while (*key)
@@ -394,7 +397,6 @@ static BOOL PROFILE_DeleteKey( PROFILESECTION **section,
                 {
                     PROFILEKEY *to_del = *key;
                     *key = to_del->next;
-                    if (to_del->name) HeapFree( GetProcessHeap(), 0, to_del->name );
                     if (to_del->value) HeapFree( GetProcessHeap(), 0, to_del->value);
                     HeapFree( GetProcessHeap(), 0, to_del );
                     return TRUE;
@@ -418,14 +420,13 @@ void PROFILE_DeleteAllKeys( LPCSTR section_name)
     PROFILESECTION **section= &CurProfile->section;
     while (*section)
     {
-        if ((*section)->name && !strcasecmp( (*section)->name, section_name ))
+        if ((*section)->name[0] && !strcasecmp( (*section)->name, section_name ))
         {
             PROFILEKEY **key = &(*section)->key;
             while (*key)
             {
                 PROFILEKEY *to_del = *key;
 		*key = to_del->next;
-		if (to_del->name) HeapFree( GetProcessHeap(), 0, to_del->name );
 		if (to_del->value) HeapFree( GetProcessHeap(), 0, to_del->value);
 		HeapFree( GetProcessHeap(), 0, to_del );
 		CurProfile->changed =TRUE;
@@ -460,7 +461,7 @@ static PROFILEKEY *PROFILE_Find( PROFILESECTION **section,
 
     while (*section)
     {
-        if ( ((*section)->name)
+        if ( ((*section)->name[0])
 	  && (!(strncasecmp( (*section)->name, section_name, seclen )))
 	  && (((*section)->name)[seclen] == '\0') )
         {
@@ -473,9 +474,9 @@ static PROFILEKEY *PROFILE_Find( PROFILESECTION **section,
                 key = &(*key)->next;
             }
             if (!create) return NULL;
-            *key = HeapAlloc( GetProcessHeap(), 0, sizeof(PROFILEKEY) );
-	    if(*key == NULL) return NULL;
-            (*key)->name  = HEAP_strdupA( GetProcessHeap(), 0, key_name );
+            if (!(*key = HeapAlloc( GetProcessHeap(), 0, sizeof(PROFILEKEY) + strlen(key_name) )))
+                return NULL;
+            strcpy( (*key)->name, key_name );
             (*key)->value = NULL;
             (*key)->next  = NULL;
             return *key;
@@ -483,17 +484,17 @@ static PROFILEKEY *PROFILE_Find( PROFILESECTION **section,
         section = &(*section)->next;
     }
     if (!create) return NULL;
-    *section = HeapAlloc( GetProcessHeap(), 0, sizeof(PROFILESECTION) );
+    *section = HeapAlloc( GetProcessHeap(), 0, sizeof(PROFILESECTION) + strlen(section_name) );
     if(*section == NULL) return NULL;
-    (*section)->name = HEAP_strdupA( GetProcessHeap(), 0, section_name );
+    strcpy( (*section)->name, section_name );
     (*section)->next = NULL;
-    (*section)->key  = HeapAlloc( GetProcessHeap(), 0, sizeof(PROFILEKEY) );
-    if((*section)->key  == NULL)
+    if (!((*section)->key  = HeapAlloc( GetProcessHeap(), 0,
+                                        sizeof(PROFILEKEY) + strlen(key_name) )))
     {
-	    HeapFree(GetProcessHeap(), 0, *section);
-	    return NULL;
+        HeapFree(GetProcessHeap(), 0, *section);
+        return NULL;
     }
-    (*section)->key->name  = HEAP_strdupA( GetProcessHeap(), 0, key_name );
+    strcpy( (*section)->key->name, key_name );
     (*section)->key->value = NULL;
     (*section)->key->next  = NULL;
     return (*section)->key;
@@ -651,9 +652,11 @@ static BOOL PROFILE_Open( LPCSTR filename )
     if(CurProfile->filename) PROFILE_ReleaseFile();
 
     /* OK, now that CurProfile is definitely free we assign it our new file */
-    newdos_name = HEAP_strdupA( GetProcessHeap(), 0, full_name.short_name );
+    newdos_name = HeapAlloc( GetProcessHeap(), 0, strlen(full_name.short_name)+1 );
+    strcpy( newdos_name, full_name.short_name );
     CurProfile->dos_name  = newdos_name;
-    CurProfile->filename  = HEAP_strdupA( GetProcessHeap(), 0, filename );
+    CurProfile->filename  = HeapAlloc( GetProcessHeap(), 0, strlen(filename)+1 );
+    strcpy( CurProfile->filename, filename );
 
     /* Try to open the profile file, first in $HOME/.wine */
 
@@ -667,13 +670,14 @@ static BOOL PROFILE_Open( LPCSTR filename )
     {
         TRACE("(%s): found it in %s\n",
               filename, buffer );
-        CurProfile->unix_name = HEAP_strdupA( GetProcessHeap(), 0, buffer );
+        CurProfile->unix_name = HeapAlloc( GetProcessHeap(), 0, strlen(buffer)+1 );
+        strcpy( CurProfile->unix_name, buffer );
     }
 
     if (!file)
     {
-        CurProfile->unix_name = HEAP_strdupA( GetProcessHeap(), 0,
-                                             full_name.long_name );
+        CurProfile->unix_name = HeapAlloc( GetProcessHeap(), 0, strlen(full_name.long_name)+1 );
+        strcpy( CurProfile->unix_name, full_name.long_name );
         if ((file = fopen( full_name.long_name, "r" )))
             TRACE("(%s): found it in %s\n",
                              filename, full_name.long_name );
@@ -711,7 +715,7 @@ static INT PROFILE_GetSection( PROFILESECTION *section, LPCSTR section_name,
 
     while (section)
     {
-        if (section->name && !strcasecmp( section->name, section_name ))
+        if (section->name[0] && !strcasecmp( section->name, section_name ))
         {
             UINT oldlen = len;
             for (key = section->key; key; key = key->next)
@@ -761,7 +765,7 @@ static INT PROFILE_GetSectionNames( LPSTR buffer, UINT len )
     if(!buffer) return 0;
 
     for (section = CurProfile->section; section; section = section->next)
-	if (section->name) {
+	if (section->name[0]) {
 	    l = strlen(section->name);
 	    cursize += l+1;
 	    if (cursize > len+1)
@@ -873,7 +877,8 @@ static BOOL PROFILE_SetString( LPCSTR section_name, LPCSTR key_name,
             HeapFree( GetProcessHeap(), 0, key->value );
         }
         else TRACE("  creating key\n" );
-        key->value = HEAP_strdupA( GetProcessHeap(), 0, value );
+        key->value = HeapAlloc( GetProcessHeap(), 0, strlen(value)+1 );
+        strcpy( key->value, value );
         CurProfile->changed = TRUE;
     }
     return TRUE;
@@ -1517,7 +1522,8 @@ BOOL WINAPI WritePrivateProfileSectionA( LPCSTR section,
 	    PROFILE_DeleteAllKeys(section);
 	    ret = TRUE;
 	    while(*string) {
-	        LPSTR buf=HEAP_strdupA( GetProcessHeap(), 0, string );
+	        LPSTR buf = HeapAlloc( GetProcessHeap(), 0, strlen(string)+1 );
+                strcpy( buf, string );
                 if((p=strchr( buf, '='))){
                     *p='\0';
                     ret = PROFILE_SetString( section, buf, p+1 );
diff --git a/graphics/driver.c b/graphics/driver.c
index 3ace2b932b625ed8f651d851940c09bf59e7fed1..c44c4b31e7e92ab9355db8cf559db2503051ac7b 100644
--- a/graphics/driver.c
+++ b/graphics/driver.c
@@ -6,7 +6,6 @@
 
 #include <string.h>
 #include "gdi.h"
-#include "heap.h"
 #include "debugtools.h"
 
 DEFAULT_DEBUG_CHANNEL(driver);
@@ -18,8 +17,8 @@ typedef struct tagGRAPHICS_DRIVER
     const DC_FUNCTIONS        *funcs;
 } GRAPHICS_DRIVER;
 
-static GRAPHICS_DRIVER *firstDriver = NULL;
-static GRAPHICS_DRIVER *genericDriver = NULL;
+static GRAPHICS_DRIVER *firstDriver;
+static GRAPHICS_DRIVER *genericDriver;
 
 /**********************************************************************
  *	     DRIVER_RegisterDriver
@@ -31,8 +30,9 @@ BOOL DRIVER_RegisterDriver( LPCSTR name, const DC_FUNCTIONS *funcs )
     driver->funcs = funcs;
     if (name)
     {
-        driver->name  = HEAP_strdupA( GetProcessHeap(), 0, name );
+        driver->name  = HeapAlloc( GetProcessHeap(), 0, strlen(name)+1 );
         driver->next  = firstDriver;
+        strcpy( driver->name, name );
         firstDriver = driver;
         return TRUE;
     }
diff --git a/graphics/env.c b/graphics/env.c
index 85ab775558e1674c8bad5f29daa6712079ada875..d42f5f09c1fd1f3b70f9b3da1d08b97aaf047828 100644
--- a/graphics/env.c
+++ b/graphics/env.c
@@ -11,7 +11,6 @@
 #include "config.h"
 #include "gdi.h"
 #include "debugtools.h"
-#include "heap.h"
 
 DEFAULT_DEBUG_CHANNEL(gdi);
 
@@ -49,26 +48,17 @@ static ATOM GDI_GetNullPortAtom(void)
 
 static ATOM PortNameToAtom(LPCSTR lpPortName, BOOL16 add)
 {
-    char *p;
-    BOOL needfree = FALSE;
-    ATOM ret;
-
-    if (lpPortName[strlen(lpPortName) - 1] == ':') {
-        p = HEAP_strdupA(GetProcessHeap(), 0, lpPortName);
-        p[strlen(lpPortName) - 1] = '\0';
-        needfree = TRUE;
-    }
-    else
-        p = (char *)lpPortName;
+    char buffer[256];
 
-    if (add)
-        ret = AddAtomA(p);
-    else
-        ret =  FindAtomA(p);
+    strncpy( buffer, lpPortName, sizeof(buffer) );
+    buffer[sizeof(buffer)-1] = 0;
 
-    if(needfree) HeapFree(GetProcessHeap(), 0, p);
+    if (buffer[0] && buffer[strlen(buffer)-1] == ':') buffer[strlen(buffer)-1] = 0;
 
-    return ret;
+    if (add)
+        return AddAtomA(buffer);
+    else
+        return FindAtomA(buffer);
 }
 
 
diff --git a/graphics/win16drv/prtdrv.c b/graphics/win16drv/prtdrv.c
index 20e8b9af0927fc1935519db4d5fc7cd3541ba964..1366f56f4e67103d70610d7ee84fcc5164c815ee 100644
--- a/graphics/win16drv/prtdrv.c
+++ b/graphics/win16drv/prtdrv.c
@@ -187,7 +187,8 @@ LOADED_PRINTER_DRIVER *LoadPrinterDriver(const char *pszDriver)
 	memset(pLPD, 0 , sizeof(LOADED_PRINTER_DRIVER));
 	
 	pLPD->hInst	= hInst;
-	pLPD->szDriver	= HEAP_strdupA(GetProcessHeap(),0,pszDriver);
+	pLPD->szDriver = HeapAlloc(GetProcessHeap(),0,strlen(pszDriver)+1);
+	strcpy( pLPD->szDriver, pszDriver );
 
 	/* Get DS for the printer module */
 	pLPD->ds_reg	= hInst;
diff --git a/graphics/x11drv/xfont.c b/graphics/x11drv/xfont.c
index 5dc4bf289fd3c96d69eb2b7a671c97382b29cc50..86a56e48293da2dcaaff3a028b9b5ac30e443805 100644
--- a/graphics/x11drv/xfont.c
+++ b/graphics/x11drv/xfont.c
@@ -26,12 +26,12 @@
 #include "wingdi.h"
 #include "winnls.h"
 #include "winreg.h"
-#include "heap.h"
 #include "font.h"
 #include "debugtools.h"
 #include "user.h" /* for TWEAK_WineLook (FIXME) */
 #include "x11font.h"
 #include "wine/server.h"
+#include "wine/unicode.h"
 
 DEFAULT_DEBUG_CHANNEL(font);
 
@@ -1519,7 +1519,10 @@ static void XFONT_LoadAlias(const LFD* lfd, LPCSTR lpAlias, BOOL bSubst)
 
 		/* Update any references to the substituted font in aliasTable */
 		if(!strcmp(frMatch->lfFaceName, pfa->faTypeFace))
-		    pfa->faTypeFace = HEAP_strdupA( GetProcessHeap(), 0, lpAlias );
+                {
+                    pfa->faTypeFace = HeapAlloc( GetProcessHeap(), 0, strlen(lpAlias)+1 );
+                    strcpy( pfa->faTypeFace, lpAlias );
+                }
 		prev = pfa;
 	    }
 						
@@ -1959,9 +1962,8 @@ static int XFONT_BuildMetrics(char** x_pattern, int res, unsigned x_checksum, in
 	XFontStruct*  x_fs;
 	fontInfo*    pfi;
 
-	typeface = HEAP_strdupA(GetProcessHeap(), 0, x_pattern[i]);
-	if (!typeface)
-	    break;
+	if (!(typeface = HeapAlloc(GetProcessHeap(), 0, strlen(x_pattern[i])+1))) break;
+	strcpy( typeface, x_pattern[i] );
 
 	lfd = LFD_Parse(typeface);
 	if (!lfd)
@@ -1996,8 +1998,10 @@ static int XFONT_BuildMetrics(char** x_pattern, int res, unsigned x_checksum, in
 		memset(fr->resource, 0, sizeof(LFD));
 	      
 		TRACE("family: -%s-%s-\n", lfd->foundry, lfd->family );
-		fr->resource->foundry = HEAP_strdupA(GetProcessHeap(), 0, lfd->foundry);
-		fr->resource->family = HEAP_strdupA(GetProcessHeap(), 0, lfd->family);
+		fr->resource->foundry = HeapAlloc(GetProcessHeap(), 0, strlen(lfd->foundry)+1);
+		strcpy( (char *)fr->resource->foundry, lfd->foundry );
+		fr->resource->family = HeapAlloc(GetProcessHeap(), 0, strlen(lfd->family)+1);
+		strcpy( (char *)fr->resource->family, lfd->family );
 		fr->resource->weight = "";
 
 		if( pfr ) pfr->next = fr;
diff --git a/if1632/snoop.c b/if1632/snoop.c
index 08e35641bb1766751aa7a06a5c443c04710f4f0a..cf7616b72cc96107c5faa1b3fa7ae7ee5337abe8 100644
--- a/if1632/snoop.c
+++ b/if1632/snoop.c
@@ -12,7 +12,6 @@
 #include "winnt.h"
 #include "wine/winbase16.h"
 #include "wine/library.h"
-#include "heap.h"
 #include "global.h"
 #include "stackframe.h"
 #include "builtin16.h"
@@ -43,8 +42,8 @@ typedef struct tagSNOOP16_DLL {
 	HMODULE16	hmod;
 	HANDLE16	funhandle;
 	SNOOP16_FUN	*funs;
-	LPCSTR		name;
 	struct tagSNOOP16_DLL	*next;
+	char name[1];
 } SNOOP16_DLL;
 
 typedef struct tagSNOOP16_RETURNENTRY {
@@ -118,12 +117,12 @@ SNOOP16_RegisterDLL(NE_MODULE *pModule,LPCSTR name) {
 			return; /* already registered */
 		dll = &((*dll)->next);
 	}
-	*dll = (SNOOP16_DLL*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(SNOOP16_DLL));
+	*dll = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(SNOOP16_DLL)+strlen(name));
 	(*dll)->next	= NULL;
 	(*dll)->hmod	= pModule->self;
 	if ((s=strrchr(name,'\\')))
 		name = s+1;
-	(*dll)->name	= HEAP_strdupA(GetProcessHeap(),0,name);
+	strcpy( (*dll)->name, name );
 	if ((s=strrchr((*dll)->name,'.')))
 		*s='\0';
 	(*dll)->funhandle = GlobalHandleToSel16(GLOBAL_Alloc(GMEM_ZEROINIT,65535,0,WINE_LDT_FLAGS_CODE));
@@ -184,9 +183,13 @@ SNOOP16_GetProcAddress16(HMODULE16 hmod,DWORD ordinal,FARPROC16 origfun) {
 		}
 	}
 	if (*cpnt)
-		fun->name = HEAP_strdupA(GetProcessHeap(),0,name);
+        {
+            fun->name = HeapAlloc(GetProcessHeap(),0,strlen(name)+1);
+            strcpy( fun->name, name );
+        }
 	else
-		fun->name = HEAP_strdupA(GetProcessHeap(),0,"");
+            fun->name = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,1); /* empty string */
+
 	if (!SNOOP_ShowDebugmsgSnoop(dll->name, ordinal, fun->name))
 		return origfun;
 
diff --git a/include/heap.h b/include/heap.h
index bfab67bef7989247d80d238ec6cff771502e7419..112eecb21b159e3f702e8f55f43ca10c14407449 100644
--- a/include/heap.h
+++ b/include/heap.h
@@ -23,26 +23,27 @@ extern SEGPTR HEAP_GetSegptr( HANDLE heap, DWORD flags, LPCVOID ptr );
      (HeapAlloc( GetProcessHeap(), HEAP_WINE_SEGPTR, (size) ))
 #define SEGPTR_NEW(type) \
      ((type *)HeapAlloc( GetProcessHeap(), HEAP_WINE_SEGPTR, sizeof(type) ))
-#define SEGPTR_STRDUP(str) \
-     (HIWORD(str) ? HEAP_strdupA( GetProcessHeap(), HEAP_WINE_SEGPTR, (str) ) : (LPSTR)(str))
 #define SEGPTR_STRDUP_WtoA(str) \
      (HIWORD(str) ? HEAP_strdupWtoA( GetProcessHeap(), HEAP_WINE_SEGPTR, (str) ) : (LPSTR)(str))
 #define SEGPTR_FREE(ptr) \
      (HIWORD(ptr) ? HeapFree( GetProcessHeap(), HEAP_WINE_SEGPTR, (ptr) ) : 0)
 #define SEGPTR_GET(ptr) MapLS(ptr)
 
+inline static LPSTR SEGPTR_STRDUP( LPCSTR str )
+{
+    if (HIWORD(str))
+    {
+        INT len = strlen(str) + 1;
+        LPSTR p = HeapAlloc( GetProcessHeap(), HEAP_WINE_SEGPTR, len );
+        if (p) memcpy( p, str, len );
+        return p;
+    }
+    return (LPSTR)str;
+}
 
 /* strdup macros */
 /* DO NOT USE THEM!!  they will go away soon */
 
-inline static LPSTR HEAP_strdupA( HANDLE heap, DWORD flags, LPCSTR str )
-{
-    INT len = strlen(str) + 1;
-    LPSTR p = HeapAlloc( heap, flags, len );
-    if (p) memcpy( p, str, len );
-    return p;
-}
-
 inline static LPWSTR HEAP_strdupAtoW( HANDLE heap, DWORD flags, LPCSTR str )
 {
     LPWSTR ret;
diff --git a/include/module.h b/include/module.h
index 006a8b3c4a0e667535049d7205e570b1bef24cc6..27f6efd68efffb2126cf0cfe458281f2475ac763 100644
--- a/include/module.h
+++ b/include/module.h
@@ -132,6 +132,8 @@ typedef struct _wine_modref
 	char			*modname;
 	char			*short_filename;
 	char			*short_modname;
+
+    char data[1];  /* space for storing filename and short_filename */
 } WINE_MODREF;
 
 #define WINE_MODREF_INTERNAL              0x00000001
diff --git a/loader/elf.c b/loader/elf.c
index ed7ac6a97ce7b1b35ac67e8bea15eaf4800db1fd..aa864acbd049affb84b82e3a06e1648217c1c0ef 100644
--- a/loader/elf.c
+++ b/loader/elf.c
@@ -17,7 +17,6 @@
 #include <sys/types.h>
 
 #include "snoop.h"
-#include "heap.h"
 #include "file.h"
 #include "module.h"
 #include "debugtools.h"
@@ -193,16 +192,17 @@ static FARPROC ELF_FindExportedFunction( WINE_MODREF *wm, LPCSTR funcName, BOOL
 		/* Function@nrofargs usually marks a stdcall function 
 		 * with nrofargs bytes that are popped at the end
 		 */
-		if (strchr(funcName,'@')) {
-			LPSTR	t,fn = HEAP_strdupA( GetProcessHeap(), 0, funcName );
-
-			t = strchr(fn,'@');
-			*t = '\0';
-			nrofargs = 0;
-			sscanf(t+1,"%d",&nrofargs);
-			fun = wine_dlsym(wm->dlhandle,fn,error,sizeof(error));
-			HeapFree( GetProcessHeap(), 0, fn );
-		}
+            LPCSTR t;
+            if ((t = strchr(funcName,'@')))
+            {
+                LPSTR fn = HeapAlloc( GetProcessHeap(), 0, t - funcName + 1 );
+                memcpy( fn, funcName, t - funcName );
+                fn[t - funcName] = 0;
+                nrofargs = 0;
+                sscanf(t+1,"%d",&nrofargs);
+                fun = wine_dlsym(wm->dlhandle,fn,error,sizeof(error));
+                HeapFree( GetProcessHeap(), 0, fn );
+            }
 	}
 	/* We sometimes have Win32 dlls implemented using stdcall but UNIX 
 	 * dlls using cdecl. If we find out the number of args the function
diff --git a/loader/loadorder.c b/loader/loadorder.c
index c15b31544d987dfbef219b2386743f96e581c9a2..f6e79a8693ce148a45684db77ca8ce880ec5081d 100644
--- a/loader/loadorder.c
+++ b/loader/loadorder.c
@@ -13,7 +13,6 @@
 #include "winreg.h"
 #include "winerror.h"
 #include "options.h"
-#include "heap.h"
 #include "file.h"
 #include "module.h"
 #include "debugtools.h"
@@ -119,7 +118,8 @@ static char *get_tok(const char *str, const char *delim)
 
 	if(str && !buf)
 	{
-		buf = HEAP_strdupA(GetProcessHeap(), 0, str);
+		buf = HeapAlloc(GetProcessHeap(), 0, strlen(str)+1);
+		strcpy( buf, str );
 		cptr = strtok(buf, delim);
 	}
 	else
@@ -220,7 +220,8 @@ static BOOL AddLoadOrder(module_loadorder_t *plo)
 		}
 	}
 	memcpy(cmdline_list.order[i].loadorder, plo->loadorder, sizeof(plo->loadorder));
-	cmdline_list.order[i].modulename = HEAP_strdupA(GetProcessHeap(), 0, plo->modulename);
+	cmdline_list.order[i].modulename = HeapAlloc(GetProcessHeap(), 0, strlen(plo->modulename)+1);
+	strcpy( (char *)cmdline_list.order[i].modulename, plo->modulename );
 	cmdline_list.count++;
 	return TRUE;
 }
@@ -267,10 +268,10 @@ static BOOL AddLoadOrderSet(char *key, char *order)
  */
 void MODULE_AddLoadOrderOption( const char *option )
 {
-    char *key = HEAP_strdupA(GetProcessHeap(), 0, option);
-    char *value = strchr(key, '=');
+    char *value, *key = HeapAlloc(GetProcessHeap(), 0, strlen(option)+1);
 
-    if (!value) goto error;
+    strcpy( key, option );
+    if (!(value = strchr(key, '='))) goto error;
     *value++ = '\0';
 
     TRACE("Commandline override '%s' = '%s'\n", key, value);
diff --git a/loader/module.c b/loader/module.c
index 6b8c23502294311d77a5b0c3204900e087989abd..fcc0eea2169004078ba4b8673a52aa7095551918 100644
--- a/loader/module.c
+++ b/loader/module.c
@@ -63,20 +63,23 @@ static WINE_MODREF *MODULE32_LookupHMODULE( HMODULE hmod )
 WINE_MODREF *MODULE_AllocModRef( HMODULE hModule, LPCSTR filename )
 {
     WINE_MODREF *wm;
-    DWORD len;
 
-    if ((wm = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*wm) )))
+    DWORD long_len = strlen( filename );
+    DWORD short_len = GetShortPathNameA( filename, NULL, 0 );
+
+    if ((wm = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
+                         sizeof(*wm) + long_len + short_len + 1 )))
     {
         wm->module = hModule;
         wm->tlsindex = -1;
 
-        wm->filename = HEAP_strdupA( GetProcessHeap(), 0, filename );
+        wm->filename = wm->data;
+        memcpy( wm->filename, filename, long_len + 1 );
         if ((wm->modname = strrchr( wm->filename, '\\' ))) wm->modname++;
         else wm->modname = wm->filename;
 
-        len = GetShortPathNameA( wm->filename, NULL, 0 );
-        wm->short_filename = (char *)HeapAlloc( GetProcessHeap(), 0, len+1 );
-        GetShortPathNameA( wm->filename, wm->short_filename, len+1 );
+        wm->short_filename = wm->filename + long_len + 1;
+        GetShortPathNameA( wm->filename, wm->short_filename, short_len + 1 );
         if ((wm->short_modname = strrchr( wm->short_filename, '\\' ))) wm->short_modname++;
         else wm->short_modname = wm->short_filename;
 
@@ -842,7 +845,8 @@ HINSTANCE WINAPI WinExec( LPCSTR lpCmdLine, UINT nCmdShow )
     startup.wShowWindow = nCmdShow;
 
     /* cmdline needs to be writeable for CreateProcess */
-    if (!(cmdline = HEAP_strdupA( GetProcessHeap(), 0, lpCmdLine ))) return 0;
+    if (!(cmdline = HeapAlloc( GetProcessHeap(), 0, strlen(lpCmdLine)+1 ))) return 0;
+    strcpy( cmdline, lpCmdLine );
 
     if (CreateProcessA( NULL, cmdline, NULL, NULL, FALSE,
                         0, NULL, NULL, &startup, &info ))
@@ -1527,8 +1531,6 @@ static void MODULE_FlushModrefs(void)
                 else UnmapViewOfFile( (LPVOID)wm->module );
                 FreeLibrary16(wm->hDummyMod);
                 HeapFree( GetProcessHeap(), 0, wm->deps );
-                HeapFree( GetProcessHeap(), 0, wm->filename );
-                HeapFree( GetProcessHeap(), 0, wm->short_filename );
                 HeapFree( GetProcessHeap(), 0, wm );
 	}
 }
diff --git a/msdos/int21.c b/msdos/int21.c
index 703b0154854b7f93034cbf9eabd88fbe60fc1ef3..60ceb371f437b8ab620ca0900b8fe6e1a63ddfc0 100644
--- a/msdos/int21.c
+++ b/msdos/int21.c
@@ -26,7 +26,6 @@
 #include "winerror.h"
 #include "drive.h"
 #include "file.h"
-#include "heap.h"
 #include "msdos.h"
 #include "options.h"
 #include "miscemu.h"
@@ -615,7 +614,8 @@ static int INT21_FindFirst( CONTEXT86 *context )
         SET_CFLAG(context);
         return 0;
     }
-    dta->unixPath = HEAP_strdupA( GetProcessHeap(), 0, full_name.long_name );
+    dta->unixPath = HeapAlloc( GetProcessHeap(), 0, strlen(full_name.long_name)+1 );
+    strcpy( dta->unixPath, full_name.long_name );
     p = strrchr( dta->unixPath, '/' );
     *p = '\0';
 
diff --git a/relay32/snoop.c b/relay32/snoop.c
index 6e016a5a871008491d801b78919d4a0028cee0d8..30e5f42d1a077c9471cd66fbdfb21d5a161fce3c 100644
--- a/relay32/snoop.c
+++ b/relay32/snoop.c
@@ -11,7 +11,6 @@
 #include <string.h>
 #include "winbase.h"
 #include "winnt.h"
-#include "heap.h"
 #include "snoop.h"
 #include "stackframe.h"
 #include "debugtools.h"
@@ -58,11 +57,12 @@ typedef	struct tagSNOOP_FUN {
 typedef struct tagSNOOP_DLL {
 	HMODULE	hmod;
 	SNOOP_FUN	*funs;
-	LPCSTR		name;
 	DWORD		ordbase;
 	DWORD		nrofordinals;
 	struct tagSNOOP_DLL	*next;
+	char name[1];
 } SNOOP_DLL;
+
 typedef struct tagSNOOP_RETURNENTRY {
 	/* code part */
 	BYTE		lcall;		/* 0xe8 call snoopret relative*/
@@ -137,12 +137,12 @@ SNOOP_RegisterDLL(HMODULE hmod,LPCSTR name,DWORD ordbase,DWORD nrofordinals) {
 			return; /* already registered */
 		dll = &((*dll)->next);
 	}
-	*dll = (SNOOP_DLL*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(SNOOP_DLL));
+	*dll = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(SNOOP_DLL)+strlen(name));
 	(*dll)->next	= NULL;
 	(*dll)->hmod	= hmod;
 	(*dll)->ordbase = ordbase;
 	(*dll)->nrofordinals = nrofordinals;
-	(*dll)->name	= HEAP_strdupA(GetProcessHeap(),0,name);
+	strcpy( (*dll)->name, name );
 	if ((s=strrchr((*dll)->name,'.')))
 		*s='\0';
 	(*dll)->funs = VirtualAlloc(NULL,nrofordinals*sizeof(SNOOP_FUN),MEM_COMMIT|MEM_RESERVE,PAGE_EXECUTE_READWRITE);
@@ -196,7 +196,8 @@ SNOOP_GetProcAddress(HMODULE hmod,LPCSTR name,DWORD ordinal,FARPROC origfun) {
 	fun = dll->funs+ordinal;
 	if (!fun->name) 
 	  {
-	    fun->name = HEAP_strdupA(GetProcessHeap(),0,name);
+	    fun->name = HeapAlloc(GetProcessHeap(),0,strlen(name)+1);
+	    strcpy( fun->name, name );
 	    fun->lcall	= 0xe8;
 	    /* NOTE: origreturn struct member MUST come directly after snoopentry */
 	    fun->snoopentry	= (char*)SNOOP_Entry-((char*)(&fun->nrofargs));
diff --git a/windows/clipboard.c b/windows/clipboard.c
index 76e113baf011fccb4f26dc87169c57f23ac02bcb..af2f7983e9e7d9d3b52f693f60b672006e3e421c 100644
--- a/windows/clipboard.c
+++ b/windows/clipboard.c
@@ -1217,12 +1217,13 @@ UINT WINAPI RegisterClipboardFormatA( LPCSTR FormatName )
     lpNewFormat->wFormatID = LastRegFormat;
     lpNewFormat->wRefCount = 1;
 
-    lpNewFormat->Name = (LPSTR)HEAP_strdupA(GetProcessHeap(), 0, FormatName);
-    if(lpNewFormat->Name == NULL) {
+    if (!(lpNewFormat->Name = HeapAlloc(GetProcessHeap(), 0, strlen(FormatName)+1 )))
+    {
         WARN("No more memory for the new format name!\n");
         HeapFree(GetProcessHeap(), 0, lpNewFormat);
         return 0;
     }
+    strcpy( lpNewFormat->Name, FormatName );
 
     lpNewFormat->wDataPresent = 0;
     lpNewFormat->hData16 = 0;