From 60009b9a562a68993ad6ead27129afec50dd71e3 Mon Sep 17 00:00:00 2001 From: Matthew Davison Date: Thu, 23 Jan 2003 23:07:38 +0000 Subject: [PATCH] Removed calls to HEAP_strdupAtoW. --- dlls/advapi32/security.c | 2 +- dlls/advapi32/service.c | 6 ++- dlls/commdlg/filedlg.c | 15 +++++-- dlls/oleaut32/variant.c | 9 +++- dlls/user/hook.c | 13 ++++-- dlls/winmm/mmsystem.c | 9 ++-- dlls/winmm/playsound.c | 5 ++- dlls/winspool/info.c | 93 ++++++++++++++++++++++++---------------- loader/resource.c | 13 +++++- memory/environ.c | 10 +++-- windows/winproc.c | 46 +++++++++++++++----- 11 files changed, 154 insertions(+), 67 deletions(-) diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c index e0470ce2546..a6dbcddacf2 100644 --- a/dlls/advapi32/security.c +++ b/dlls/advapi32/security.c @@ -881,7 +881,7 @@ LsaQueryInformationPolicy( 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; diff --git a/dlls/advapi32/service.c b/dlls/advapi32/service.c index 7d15da28dc4..b7ffc4757b4 100644 --- a/dlls/advapi32/service.c +++ b/dlls/advapi32/service.c @@ -543,6 +543,7 @@ StartServiceA( SC_HANDLE hService, DWORD dwNumServiceArgs, LPCSTR *lpServiceArgVectors ) { LPWSTR *lpwstr=NULL; + UNICODE_STRING usBuffer; int i; TRACE("(%p,%ld,%p)\n",hService,dwNumServiceArgs,lpServiceArgVectors); @@ -554,7 +555,10 @@ StartServiceA( SC_HANDLE hService, DWORD dwNumServiceArgs, lpwstr = NULL; for(i=0; ilStructSize = sizeof(OPENFILENAMEW); ofnW->hwndOwner = ofnA->hwndOwner; @@ -1116,13 +1118,17 @@ void FILEDLG_MapOfnStructA(LPOPENFILENAMEA ofnA, LPOPENFILENAMEW ofnW, BOOL open 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 @@ void FILEDLG_MapOfnStructA(LPOPENFILENAMEA ofnA, LPOPENFILENAMEW ofnW, BOOL open 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; } diff --git a/dlls/oleaut32/variant.c b/dlls/oleaut32/variant.c index c874101d6ea..b215367b868 100644 --- a/dlls/oleaut32/variant.c +++ b/dlls/oleaut32/variant.c @@ -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 @@ static BSTR StringDupAtoBstr( char* strIn ) { 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; } diff --git a/dlls/user/hook.c b/dlls/user/hook.c index 01b35fc889a..6d237ffe441 100644 --- a/dlls/user/hook.c +++ b/dlls/user/hook.c @@ -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 HHOOK set_windows_hook( INT id, HOOKPROC proc, HINSTANCE inst, DWORD tid, 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 @@ static LRESULT call_hook_AtoW( HOOKPROC proc, INT id, INT code, WPARAM wparam, L 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 ); diff --git a/dlls/winmm/mmsystem.c b/dlls/winmm/mmsystem.c index f25b6204637..3c038f3f1ad 100644 --- a/dlls/winmm/mmsystem.c +++ b/dlls/winmm/mmsystem.c @@ -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 @@ DWORD WINAPI mciSendString16(LPCSTR lpstrCommand, LPSTR lpstrRet, */ 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; } diff --git a/dlls/winmm/playsound.c b/dlls/winmm/playsound.c index 2f497148699..52ffca16387 100644 --- a/dlls/winmm/playsound.c +++ b/dlls/winmm/playsound.c @@ -30,6 +30,7 @@ #include "heap.h" #include "winreg.h" #include "winemm.h" +#include "winternl.h" #include "wine/debug.h" @@ -218,7 +219,9 @@ static WINE_PLAYSOUND* PlaySound_Alloc(const void* pszSound, HMODULE hmod, } 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; } diff --git a/dlls/winspool/info.c b/dlls/winspool/info.c index 1c33bee518a..094102f4ab6 100644 --- a/dlls/winspool/info.c +++ b/dlls/winspool/info.c @@ -548,21 +548,35 @@ static LPDEVMODEA DEVMODEdupWtoA(HANDLE heap, const DEVMODEW *dmW) 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,27 @@ LONG WINAPI DocumentPropertiesW(HWND hWnd, HANDLE hPrinter, BOOL WINAPI OpenPrinterA(LPSTR lpPrinterName,HANDLE *phPrinter, LPPRINTER_DEFAULTSA pDefault) { - LPWSTR lpPrinterNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpPrinterName); + UNICODE_STRING lpPrinterNameW; + UNICODE_STRING usBuffer; PRINTER_DEFAULTSW DefaultW, *pDefaultW = NULL; BOOL ret; + RtlCreateUnicodeStringFromAsciiz(&lpPrinterNameW,lpPrinterName); + 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 +1182,7 @@ HANDLE WINAPI AddPrinterW(LPWSTR pName, DWORD Level, LPBYTE pPrinter) */ 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 +1193,13 @@ HANDLE WINAPI AddPrinterA(LPSTR pName, DWORD Level, LPBYTE pPrinter) 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 +2165,11 @@ BOOL WINAPI EnumPrintersA(DWORD dwType, LPSTR lpszName, 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 +2439,11 @@ BOOL WINAPI GetPrinterDriverA(HANDLE hPrinter, LPSTR pEnvironment, 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 +2815,20 @@ BOOL WINAPI EnumPrinterDriversA(LPSTR pName, LPSTR pEnvironment, DWORD Level, 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; } diff --git a/loader/resource.c b/loader/resource.c index 07ab9d5ed9c..5b8f9a1d3a0 100644 --- a/loader/resource.c +++ b/loader/resource.c @@ -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 @@ static HRSRC RES_FindResource2( HMODULE hModule, LPCSTR type, 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; diff --git a/memory/environ.c b/memory/environ.c index e5f6630f5f6..51c7f966c71 100644 --- a/memory/environ.c +++ b/memory/environ.c @@ -810,6 +810,7 @@ VOID WINAPI GetStartupInfoA( LPSTARTUPINFOA info ) */ 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 @@ VOID WINAPI GetStartupInfoW( LPSTARTUPINFOW info ) 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; } diff --git a/windows/winproc.c b/windows/winproc.c index fe0f7efaac0..d20a4603cd5 100644 --- a/windows/winproc.c +++ b/windows/winproc.c @@ -41,6 +41,7 @@ #include "message.h" #include "thread.h" #include "dde.h" +#include "winternl.h" WINE_DECLARE_DEBUG_CHANNEL(msg); WINE_DECLARE_DEBUG_CHANNEL(relay); @@ -593,9 +594,13 @@ INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM *pwparam, LPARAM *plpara case LB_DIR: case LB_ADDFILE: case EM_REPLACESEL: + { + UNICODE_STRING usBuffer; if(!*plparam) return 0; - *plparam = (LPARAM)HEAP_strdupAtoW( GetProcessHeap(), 0, (LPCSTR)*plparam ); + RtlCreateUnicodeStringFromAsciiz(&usBuffer,(LPCSTR)*plparam); + *plparam = (LPARAM)usBuffer.Buffer; return (*plparam ? 1 : -1); + } case WM_GETTEXTLENGTH: case CB_GETLBTEXTLEN: case LB_GETTEXTLEN: @@ -603,6 +608,7 @@ INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM *pwparam, LPARAM *plpara case WM_NCCREATE: case WM_CREATE: { + UNICODE_STRING usBuffer; struct s { CREATESTRUCTW cs; /* new structure */ LPCWSTR lpszName; /* allocated Name */ @@ -613,11 +619,15 @@ INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM *pwparam, LPARAM *plpara if (!xs) return -1; xs->cs = *(CREATESTRUCTW *)*plparam; if (HIWORD(xs->cs.lpszName)) - xs->lpszName = xs->cs.lpszName = HEAP_strdupAtoW( GetProcessHeap(), 0, - (LPCSTR)xs->cs.lpszName ); + { + RtlCreateUnicodeStringFromAsciiz(&usBuffer,(LPCSTR)xs->cs.lpszName); + xs->lpszName = xs->cs.lpszName = usBuffer.Buffer; + } if (HIWORD(xs->cs.lpszClass)) - xs->lpszClass = xs->cs.lpszClass = HEAP_strdupAtoW( GetProcessHeap(), 0, - (LPCSTR)xs->cs.lpszClass ); + { + RtlCreateUnicodeStringFromAsciiz(&usBuffer,(LPCSTR)xs->cs.lpszClass); + xs->lpszClass = xs->cs.lpszClass = usBuffer.Buffer; + } *plparam = (LPARAM)xs; } return 1; @@ -628,11 +638,17 @@ INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM *pwparam, LPARAM *plpara if (!cs) return -1; *cs = *(MDICREATESTRUCTW *)*plparam; if (HIWORD(cs->szClass)) - cs->szClass = HEAP_strdupAtoW( GetProcessHeap(), 0, - (LPCSTR)cs->szClass ); + { + UNICODE_STRING usBuffer; + RtlCreateUnicodeStringFromAsciiz(&usBuffer,(LPCSTR)cs->szClass); + cs->szClass = usBuffer.Buffer; + } if (HIWORD(cs->szTitle)) - cs->szTitle = HEAP_strdupAtoW( GetProcessHeap(), 0, - (LPCSTR)cs->szTitle ); + { + UNICODE_STRING usBuffer; + RtlCreateUnicodeStringFromAsciiz(&usBuffer,(LPCSTR)cs->szTitle); + cs->szTitle = usBuffer.Buffer; + } *plparam = (LPARAM)cs; } return 1; @@ -645,7 +661,11 @@ INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM *pwparam, LPARAM *plpara case LB_SELECTSTRING: if(!*plparam) return 0; if ( WINPROC_TestLBForStr( hwnd )) - *plparam = (LPARAM)HEAP_strdupAtoW( GetProcessHeap(), 0, (LPCSTR)*plparam ); + { + UNICODE_STRING usBuffer; + RtlCreateUnicodeStringFromAsciiz(&usBuffer,(LPCSTR)*plparam); + *plparam = (LPARAM)usBuffer.Buffer; + } return (*plparam ? 1 : -1); case LB_GETTEXT: /* FIXME: fixed sized buffer */ @@ -666,7 +686,11 @@ INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM *pwparam, LPARAM *plpara case CB_SELECTSTRING: if(!*plparam) return 0; if ( WINPROC_TestCBForStr( hwnd )) - *plparam = (LPARAM)HEAP_strdupAtoW( GetProcessHeap(), 0, (LPCSTR)*plparam ); + { + UNICODE_STRING usBuffer; + RtlCreateUnicodeStringFromAsciiz(&usBuffer,(LPCSTR)*plparam); + *plparam = (LPARAM)usBuffer.Buffer; + } return (*plparam ? 1 : -1); case CB_GETLBTEXT: /* FIXME: fixed sized buffer */