more HEAP_strdupAtoW removals.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Changelog
	Remove some more calls to HEAP_strdupWtoA

-- 
Matthew Davison <m.davison@virgin.net>
Index: dlls/advapi32/security.c
===================================================================
RCS file: /home/wine/wine/dlls/advapi32/security.c,v
retrieving revision 1.49
diff -u -r1.49 security.c
--- dlls/advapi32/security.c	20 Jan 2003 23:23:12 -0000	1.49
+++ dlls/advapi32/security.c	22 Jan 2003 20:26:09 -0000
@@ -881,7 +881,7 @@
 	      SID_IDENTIFIER_AUTHORITY localSidAuthority = {SECURITY_NT_AUTHORITY};
 
 	      struct di * xdi = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(xdi));
-	      RtlInitUnicodeString(&(xdi->ppdi.Name), HEAP_strdupAtoW(GetProcessHeap(),0,"DOMAIN"));
+	      RtlCreateUnicodeStringFromAsciiz(&(xdi->ppdi.Name), "DOMAIN");
 	      xdi->ppdi.Sid = &(xdi->sid);
 	      xdi->sid.Revision = SID_REVISION;
 	      xdi->sid.SubAuthorityCount = 1;
Index: dlls/advapi32/service.c
===================================================================
RCS file: /home/wine/wine/dlls/advapi32/service.c,v
retrieving revision 1.34
diff -u -r1.34 service.c
--- dlls/advapi32/service.c	20 Jan 2003 23:23:12 -0000	1.34
+++ dlls/advapi32/service.c	22 Jan 2003 20:26:10 -0000
@@ -543,6 +543,7 @@
                  LPCSTR *lpServiceArgVectors )
 {
     LPWSTR *lpwstr=NULL;
+    UNICODE_STRING usBuffer;
     int i;
 
     TRACE("(%p,%ld,%p)\n",hService,dwNumServiceArgs,lpServiceArgVectors);
@@ -554,7 +555,11 @@
         lpwstr = NULL;
 
     for(i=0; i<dwNumServiceArgs; i++)
-        lpwstr[i]=HEAP_strdupAtoW(GetProcessHeap(), 0, lpServiceArgVectors[i]);
+    {
+        RtlCreateUnicodeStringFromAsciiz (&usBuffer,lpServiceArgVectors[i]);
+        lpwstr[i]=usBuffer.Buffer;
+        RtlFreeUnicodeString(&usBuffer);
+    }
 
     StartServiceW(hService, dwNumServiceArgs, (LPCWSTR *)lpwstr);
 
Index: dlls/commdlg/filedlg.c
===================================================================
RCS file: /home/wine/wine/dlls/commdlg/filedlg.c,v
retrieving revision 1.58
diff -u -r1.58 filedlg.c
--- dlls/commdlg/filedlg.c	21 Nov 2002 23:55:10 -0000	1.58
+++ dlls/commdlg/filedlg.c	22 Jan 2003 20:26:16 -0000
@@ -33,6 +33,7 @@
 #include "commdlg.h"
 #include "wine/debug.h"
 #include "cderr.h"
+#include "winternl.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(commdlg);
 
@@ -1100,6 +1101,7 @@
 void FILEDLG_MapOfnStructA(LPOPENFILENAMEA ofnA, LPOPENFILENAMEW ofnW, BOOL open)
 {
     LPCSTR str;
+    UNICODE_STRING usBuffer;
 
     ofnW->lStructSize = sizeof(OPENFILENAMEW);
     ofnW->hwndOwner = ofnA->hwndOwner;
@@ -1116,13 +1118,17 @@
     ofnW->nMaxFileTitle = ofnA->nMaxFileTitle;
     ofnW->lpstrFileTitle = FILEDLG_DupToW(ofnA->lpstrFileTitle, ofnW->nMaxFileTitle);
     if (ofnA->lpstrInitialDir)
-        ofnW->lpstrInitialDir = HEAP_strdupAtoW(GetProcessHeap(),0,ofnA->lpstrInitialDir);
+    {
+        RtlCreateUnicodeStringFromAsciiz (&usBuffer,ofnA->lpstrInitialDir);
+        ofnW->lpstrInitialDir = usBuffer.Buffer;
+    }
     if (ofnA->lpstrTitle)
         str = ofnA->lpstrTitle;
     else
         /* Allocates default title (FIXME : get it from resource) */
         str = open ? defaultopen:defaultsave;
-    ofnW->lpstrTitle = HEAP_strdupAtoW(GetProcessHeap(),0, str);
+    RtlCreateUnicodeStringFromAsciiz (&usBuffer,ofnA->lpstrTitle);
+    ofnW->lpstrTitle = usBuffer.Buffer;
     ofnW->Flags = ofnA->Flags;
     ofnW->nFileOffset = ofnA->nFileOffset;
     ofnW->nFileExtension = ofnA->nFileExtension;
@@ -1130,7 +1136,10 @@
     if ((ofnA->Flags & OFN_ENABLETEMPLATE) && (ofnA->lpTemplateName))
     {
         if (HIWORD(ofnA->lpTemplateName))
-            ofnW->lpTemplateName = HEAP_strdupAtoW(GetProcessHeap(), 0, ofnA->lpTemplateName);
+        {
+            RtlCreateUnicodeStringFromAsciiz (&usBuffer,ofnA->lpTemplateName);
+            ofnW->lpTemplateName = usBuffer.Buffer;
+        }
         else /* numbered resource */
             ofnW->lpTemplateName = (LPWSTR) ofnA->lpTemplateName;
     }
Index: dlls/oleaut32/variant.c
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/variant.c,v
retrieving revision 1.55
diff -u -r1.55 variant.c
--- dlls/oleaut32/variant.c	13 Jan 2003 18:30:18 -0000	1.55
+++ dlls/oleaut32/variant.c	22 Jan 2003 20:26:43 -0000
@@ -55,6 +55,7 @@
 #include "winerror.h"
 #include "parsedt.h"
 #include "typelib.h"
+#include "winternl.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(ole);
 
@@ -667,9 +668,13 @@
 {
 	BSTR bstr = NULL;
 	OLECHAR* pNewString = NULL;
-	pNewString = HEAP_strdupAtoW( GetProcessHeap(), 0, strIn );
+	UNICODE_STRING usBuffer;
+	
+	RtlCreateUnicodeStringFromAsciiz( &usBuffer, strIn );
+	pNewString = usBuffer.Buffer;
+	
 	bstr = SysAllocString( pNewString );
-	HeapFree( GetProcessHeap(), 0, pNewString );
+	RtlFreeUnicodeString( &usBuffer );
 	return bstr;
 }
 
Index: dlls/user/hook.c
===================================================================
RCS file: /home/wine/wine/dlls/user/hook.c,v
retrieving revision 1.5
diff -u -r1.5 hook.c
--- dlls/user/hook.c	3 Dec 2002 23:34:54 -0000	1.5
+++ dlls/user/hook.c	22 Jan 2003 20:26:48 -0000
@@ -71,6 +71,7 @@
 #include "wine/server.h"
 #include "wine/unicode.h"
 #include "wine/debug.h"
+#include "winternl.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(hook);
 WINE_DECLARE_DEBUG_CHANNEL(relay);
@@ -156,7 +157,7 @@
 static LRESULT call_hook_AtoW( HOOKPROC proc, INT id, INT code, WPARAM wparam, LPARAM lparam )
 {
     LRESULT ret;
-
+    UNICODE_STRING usBuffer;
     if (id != WH_CBT || code != HCBT_CREATEWND) ret = proc( code, wparam, lparam );
     else
     {
@@ -169,9 +170,15 @@
         csW = *(CREATESTRUCTW *)cbtcwA->lpcs;
 
         if (HIWORD(cbtcwA->lpcs->lpszName))
-            csW.lpszName = HEAP_strdupAtoW( GetProcessHeap(), 0, cbtcwA->lpcs->lpszName );
+        {
+            RtlCreateUnicodeStringFromAsciiz(&usBuffer,cbtcwA->lpcs->lpszName);
+            csW.lpszName = usBuffer.Buffer;
+        }
         if (HIWORD(cbtcwA->lpcs->lpszClass))
-            csW.lpszClass = HEAP_strdupAtoW( GetProcessHeap(), 0, cbtcwA->lpcs->lpszClass );
+        {
+            RtlCreateUnicodeStringFromAsciiz(&usBuffer,cbtcwA->lpcs->lpszName);
+            csW.lpszClass = usBuffer.Buffer;
+        }
         ret = proc( code, wparam, (LPARAM)&cbtcwW );
         cbtcwA->hwndInsertAfter = cbtcwW.hwndInsertAfter;
         if (HIWORD(csW.lpszName)) HeapFree( GetProcessHeap(), 0, (LPWSTR)csW.lpszName );
Index: dlls/winmm/mmsystem.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/mmsystem.c,v
retrieving revision 1.89
diff -u -r1.89 mmsystem.c
--- dlls/winmm/mmsystem.c	7 Jan 2003 20:36:23 -0000	1.89
+++ dlls/winmm/mmsystem.c	22 Jan 2003 20:27:01 -0000
@@ -36,6 +36,7 @@
 #define NONAMELESSSTRUCT
 #include "mmsystem.h"
 #include "winbase.h"
+#include "winternl.h"
 
 #include "wine/winuser16.h"
 #include "winemm.h"
@@ -2553,9 +2554,11 @@
  */
 UINT16 WINAPI mciLoadCommandResource16(HINSTANCE16 hInst, LPCSTR resname, UINT16 type)
 {
-    LPCWSTR     ptr = HEAP_strdupAtoW(GetProcessHeap(), 0, resname);
-    UINT        ret = mciLoadCommandResource(HINSTANCE_32(hInst), ptr, type);
-    HeapFree(GetProcessHeap(), 0, (LPWSTR)ptr);
+    UNICODE_STRING ptr;
+    UINT          ret;
+    RtlCreateUnicodeStringFromAsciiz(&ptr, resname);
+    ret = mciLoadCommandResource(HINSTANCE_32(hInst), ptr.Buffer, type);
+    RtlFreeUnicodeString(&ptr);
     return ret;
 }
 
Index: dlls/winmm/playsound.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/playsound.c,v
retrieving revision 1.4
diff -u -r1.4 playsound.c
--- dlls/winmm/playsound.c	31 Oct 2002 01:02:41 -0000	1.4
+++ dlls/winmm/playsound.c	22 Jan 2003 20:27:03 -0000
@@ -30,6 +30,7 @@
 #include "heap.h"
 #include "winreg.h"
 #include "winemm.h"
+#include "winternl.h"
 
 #include "wine/debug.h"
 
@@ -218,7 +219,9 @@
         }
         else
         {
-            wps->pszSound = HEAP_strdupAtoW(GetProcessHeap(), 0, pszSound);
+            UNICODE_STRING usBuffer;
+            RtlCreateUnicodeStringFromAsciiz(&usBuffer, pszSound);
+            wps->pszSound = usBuffer.Buffer;
             if (!wps->pszSound) goto oom_error;
             wps->bAlloc = TRUE;
         }
Index: dlls/winspool/info.c
===================================================================
RCS file: /home/wine/wine/dlls/winspool/info.c,v
retrieving revision 1.69
diff -u -r1.69 info.c
--- dlls/winspool/info.c	15 Jan 2003 00:51:16 -0000	1.69
+++ dlls/winspool/info.c	22 Jan 2003 20:27:19 -0000
@@ -548,21 +548,35 @@
 static LPPRINTER_INFO_2W PRINTER_INFO_2AtoW(HANDLE heap, LPPRINTER_INFO_2A piA)
 {
     LPPRINTER_INFO_2W piW;
+    UNICODE_STRING usBuffer;
+
     if(!piA) return NULL;
     piW = HeapAlloc(heap, 0, sizeof(*piW));
     memcpy(piW, piA, sizeof(*piW)); /* copy everything first */
-    piW->pServerName = HEAP_strdupAtoW(heap, 0, piA->pServerName);
-    piW->pPrinterName = HEAP_strdupAtoW(heap, 0, piA->pPrinterName);
-    piW->pShareName = HEAP_strdupAtoW(heap, 0, piA->pShareName);
-    piW->pPortName = HEAP_strdupAtoW(heap, 0, piA->pPortName);
-    piW->pDriverName = HEAP_strdupAtoW(heap, 0, piA->pDriverName);
-    piW->pComment = HEAP_strdupAtoW(heap, 0, piA->pComment);
-    piW->pLocation = HEAP_strdupAtoW(heap, 0, piA->pLocation);
+    
+    RtlCreateUnicodeStringFromAsciiz(&usBuffer,piA->pServerName);
+    piW->pServerName = usBuffer.Buffer;
+    RtlCreateUnicodeStringFromAsciiz(&usBuffer,piA->pPrinterName);
+    piW->pPrinterName = usBuffer.Buffer;
+    RtlCreateUnicodeStringFromAsciiz(&usBuffer,piA->pShareName);
+    piW->pShareName = usBuffer.Buffer;
+    RtlCreateUnicodeStringFromAsciiz(&usBuffer,piA->pPortName);
+    piW->pPortName = usBuffer.Buffer;
+    RtlCreateUnicodeStringFromAsciiz(&usBuffer,piA->pDriverName);
+    piW->pDriverName = usBuffer.Buffer;
+    RtlCreateUnicodeStringFromAsciiz(&usBuffer,piA->pComment);
+    piW->pComment = usBuffer.Buffer;
+    RtlCreateUnicodeStringFromAsciiz(&usBuffer,piA->pLocation);
+    piW->pLocation = usBuffer.Buffer;
     piW->pDevMode = DEVMODEdupAtoW(heap, piA->pDevMode);
-    piW->pSepFile = HEAP_strdupAtoW(heap, 0, piA->pSepFile);
-    piW->pPrintProcessor = HEAP_strdupAtoW(heap, 0, piA->pPrintProcessor);
-    piW->pDatatype = HEAP_strdupAtoW(heap, 0, piA->pDatatype);
-    piW->pParameters = HEAP_strdupAtoW(heap, 0, piA->pParameters);
+    RtlCreateUnicodeStringFromAsciiz(&usBuffer,piA->pSepFile);
+    piW->pSepFile = usBuffer.Buffer;
+    RtlCreateUnicodeStringFromAsciiz(&usBuffer,piA->pPrintProcessor);
+    piW->pPrintProcessor = usBuffer.Buffer;
+    RtlCreateUnicodeStringFromAsciiz(&usBuffer,piA->pDatatype);
+    piW->pDatatype = usBuffer.Buffer;
+    RtlCreateUnicodeStringFromAsciiz(&usBuffer,piA->pParameters);
+    piW->pParameters = usBuffer.Buffer;
     return piW;
 }
 
@@ -760,24 +774,26 @@
 BOOL WINAPI OpenPrinterA(LPSTR lpPrinterName,HANDLE *phPrinter,
 			 LPPRINTER_DEFAULTSA pDefault)
 {
-    LPWSTR lpPrinterNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpPrinterName);
+    UNICODE_STRING lpPrinterNameW;
+    UNICODE_STRING usBuffer;
+    RtlCreateUnicodeStringFromAsciiz(&lpPrinterNameW,lpPrinterName);
     PRINTER_DEFAULTSW DefaultW, *pDefaultW = NULL;
     BOOL ret;
 
     if(pDefault) {
-        DefaultW.pDatatype = HEAP_strdupAtoW(GetProcessHeap(), 0,
-					     pDefault->pDatatype);
+        RtlCreateUnicodeStringFromAsciiz(&usBuffer,pDefault->pDatatype);
+        DefaultW.pDatatype = usBuffer.Buffer;
 	DefaultW.pDevMode = DEVMODEdupAtoW(GetProcessHeap(),
 					   pDefault->pDevMode);
 	DefaultW.DesiredAccess = pDefault->DesiredAccess;
 	pDefaultW = &DefaultW;
     }
-    ret = OpenPrinterW(lpPrinterNameW, phPrinter, pDefaultW);
+    ret = OpenPrinterW(lpPrinterNameW.Buffer, phPrinter, pDefaultW);
     if(pDefault) {
-        HeapFree(GetProcessHeap(), 0, DefaultW.pDatatype);
+        RtlFreeUnicodeString(&usBuffer);
 	HeapFree(GetProcessHeap(), 0, DefaultW.pDevMode);
     }
-    HeapFree(GetProcessHeap(), 0, lpPrinterNameW);
+    RtlFreeUnicodeString(&lpPrinterNameW);
     return ret;
 }
 
@@ -1165,7 +1181,7 @@
  */
 HANDLE WINAPI AddPrinterA(LPSTR pName, DWORD Level, LPBYTE pPrinter)
 {
-    WCHAR *pNameW;
+    UNICODE_STRING pNameW;
     PRINTER_INFO_2W *piW;
     PRINTER_INFO_2A *piA = (PRINTER_INFO_2A*)pPrinter;
     HANDLE ret;
@@ -1176,13 +1192,13 @@
 	SetLastError(ERROR_INVALID_LEVEL);
 	return 0;
     }
-    pNameW = HEAP_strdupAtoW(GetProcessHeap(), 0, pName);
+    RtlCreateUnicodeStringFromAsciiz(&pNameW,pName);
     piW = PRINTER_INFO_2AtoW(GetProcessHeap(), piA);
 
-    ret = AddPrinterW(pNameW, Level, (LPBYTE)piW);
+    ret = AddPrinterW(pNameW.Buffer, Level, (LPBYTE)piW);
 
     FREE_PRINTER_INFO_2W(GetProcessHeap(), piW);
-    HeapFree(GetProcessHeap(),0,pNameW);
+    RtlFreeUnicodeString(&pNameW);
     return ret;
 }
 
@@ -2148,11 +2164,11 @@
 			  LPDWORD lpdwReturned)
 {
     BOOL ret;
-    LPWSTR lpszNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpszName);
-
-    ret = WINSPOOL_EnumPrinters(dwType, lpszNameW, dwLevel, lpbPrinters, cbBuf,
+    UNICODE_STRING lpszNameW;
+    RtlCreateUnicodeStringFromAsciiz(&lpszNameW,lpszName);
+    ret = WINSPOOL_EnumPrinters(dwType, lpszNameW.Buffer, dwLevel, lpbPrinters, cbBuf,
 				lpdwNeeded, lpdwReturned, FALSE);
-    HeapFree(GetProcessHeap(),0,lpszNameW);
+    RtlFreeUnicodeString(&lpszNameW);
     return ret;
 }
 
@@ -2422,10 +2438,11 @@
 			      DWORD cbBuf, LPDWORD pcbNeeded)
 {
     BOOL ret;
-    LPWSTR pEnvW = HEAP_strdupAtoW(GetProcessHeap(),0,pEnvironment);
-    ret = WINSPOOL_GetPrinterDriver(hPrinter, pEnvW, Level, pDriverInfo,
+    UNICODE_STRING pEnvW;
+    RtlCreateUnicodeStringFromAsciiz(&pEnvW, pEnvironment);
+    ret = WINSPOOL_GetPrinterDriver(hPrinter, pEnvW.Buffer, Level, pDriverInfo,
 				    cbBuf, pcbNeeded, FALSE);
-    HeapFree(GetProcessHeap(),0,pEnvW);
+    RtlFreeUnicodeString(&pEnvW);
     return ret;
 }
 /*****************************************************************************
@@ -2797,19 +2814,20 @@
                                 LPBYTE pDriverInfo, DWORD cbBuf,
                                 LPDWORD pcbNeeded, LPDWORD pcReturned)
 {   BOOL ret;
-    WCHAR *pNameW = NULL, *pEnvironmentW = NULL;
+    UNICODE_STRING pNameW, pEnvironmentW;
 
     if(pName)
-        pNameW = HEAP_strdupAtoW(GetProcessHeap(), 0, pName);
+        RtlCreateUnicodeStringFromAsciiz(&pNameW, pName);
     if(pEnvironment)
-        pEnvironmentW = HEAP_strdupAtoW(GetProcessHeap(), 0, pEnvironment);
+        RtlCreateUnicodeStringFromAsciiz(&pEnvironmentW, pEnvironment);
 
-    ret = WINSPOOL_EnumPrinterDrivers(pNameW, pEnvironmentW, Level, pDriverInfo,
-                                      cbBuf, pcbNeeded, pcReturned, FALSE);
-    if(pNameW)
-        HeapFree(GetProcessHeap(), 0, pNameW);
-    if(pEnvironmentW)
-        HeapFree(GetProcessHeap(), 0, pEnvironmentW);
+    ret = WINSPOOL_EnumPrinterDrivers(pNameW.Buffer, pEnvironmentW.Buffer,
+                                      Level, pDriverInfo, cbBuf, pcbNeeded,
+                                      pcReturned, FALSE);
+    if(pName)
+        RtlFreeUnicodeString(&pNameW);
+    if(pEnvironment)
+        RtlFreeUnicodeString(&pEnvironmentW);
 
     return ret;
 }
Index: loader/resource.c
===================================================================
RCS file: /home/wine/wine/loader/resource.c,v
retrieving revision 1.65
diff -u -r1.65 resource.c
--- loader/resource.c	12 Dec 2002 23:34:01 -0000	1.65
+++ loader/resource.c	22 Jan 2003 20:27:24 -0000
@@ -43,6 +43,7 @@
 #include "winerror.h"
 #include "winnls.h"
 #include "excpt.h"
+#include "winternl.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(resource);
 
@@ -206,11 +207,19 @@
         LPWSTR typeStr, nameStr;
 
         if ( HIWORD( type ) && !bUnicode )
-            typeStr = HEAP_strdupAtoW( GetProcessHeap(), 0, type );
+        {
+            UNICODE_STRING usBuffer;
+            RtlCreateUnicodeStringFromAsciiz(&usBuffer,type);
+            typeStr = usBuffer.Buffer;
+        }
         else
             typeStr = (LPWSTR)type;
         if ( HIWORD( name ) && !bUnicode )
-            nameStr = HEAP_strdupAtoW( GetProcessHeap(), 0, name );
+        {
+            UNICODE_STRING usBuffer;
+            RtlCreateUnicodeStringFromAsciiz(&usBuffer,name);
+            nameStr = usBuffer.Buffer;
+        }
         else
             nameStr = (LPWSTR)name;
 
Index: memory/environ.c
===================================================================
RCS file: /home/wine/wine/memory/environ.c,v
retrieving revision 1.38
diff -u -r1.38 environ.c
--- memory/environ.c	9 Oct 2002 18:35:02 -0000	1.38
+++ memory/environ.c	22 Jan 2003 20:27:30 -0000
@@ -810,6 +810,7 @@
  */
 VOID WINAPI GetStartupInfoW( LPSTARTUPINFOW info )
 {
+    UNICODE_STRING      usBuffer;
     info->cb              = sizeof(STARTUPINFOW);
     info->dwX             = current_startupinfo.dwX;
     info->dwY             = current_startupinfo.dwY;
@@ -824,7 +825,10 @@
     info->hStdInput       = current_startupinfo.hStdInput;
     info->hStdOutput      = current_startupinfo.hStdOutput;
     info->hStdError       = current_startupinfo.hStdError;
-    info->lpReserved = HEAP_strdupAtoW (GetProcessHeap(), 0, current_startupinfo.lpReserved );
-    info->lpDesktop  = HEAP_strdupAtoW (GetProcessHeap(), 0, current_startupinfo.lpDesktop );
-    info->lpTitle    = HEAP_strdupAtoW (GetProcessHeap(), 0, current_startupinfo.lpTitle );
+    RtlCreateUnicodeStringFromAsciiz (&usBuffer,current_startupinfo.lpReserved);
+    info->lpReserved = usBuffer.Buffer;
+    RtlCreateUnicodeStringFromAsciiz (&usBuffer,current_startupinfo.lpDesktop);
+    info->lpDesktop  = usBuffer.Buffer;
+    RtlCreateUnicodeStringFromAsciiz (&usBuffer,current_startupinfo.lpTitle);
+    info->lpTitle    = usBuffer.Buffer;
 }

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux