Commit 60009b9a authored by Matthew Davison's avatar Matthew Davison Committed by Alexandre Julliard

Removed calls to HEAP_strdupAtoW.

parent f63e5b64
...@@ -881,7 +881,7 @@ LsaQueryInformationPolicy( ...@@ -881,7 +881,7 @@ LsaQueryInformationPolicy(
SID_IDENTIFIER_AUTHORITY localSidAuthority = {SECURITY_NT_AUTHORITY}; SID_IDENTIFIER_AUTHORITY localSidAuthority = {SECURITY_NT_AUTHORITY};
struct di * xdi = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(xdi)); 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->ppdi.Sid = &(xdi->sid);
xdi->sid.Revision = SID_REVISION; xdi->sid.Revision = SID_REVISION;
xdi->sid.SubAuthorityCount = 1; xdi->sid.SubAuthorityCount = 1;
......
...@@ -543,6 +543,7 @@ StartServiceA( SC_HANDLE hService, DWORD dwNumServiceArgs, ...@@ -543,6 +543,7 @@ StartServiceA( SC_HANDLE hService, DWORD dwNumServiceArgs,
LPCSTR *lpServiceArgVectors ) LPCSTR *lpServiceArgVectors )
{ {
LPWSTR *lpwstr=NULL; LPWSTR *lpwstr=NULL;
UNICODE_STRING usBuffer;
int i; int i;
TRACE("(%p,%ld,%p)\n",hService,dwNumServiceArgs,lpServiceArgVectors); TRACE("(%p,%ld,%p)\n",hService,dwNumServiceArgs,lpServiceArgVectors);
...@@ -554,7 +555,10 @@ StartServiceA( SC_HANDLE hService, DWORD dwNumServiceArgs, ...@@ -554,7 +555,10 @@ StartServiceA( SC_HANDLE hService, DWORD dwNumServiceArgs,
lpwstr = NULL; lpwstr = NULL;
for(i=0; i<dwNumServiceArgs; i++) for(i=0; i<dwNumServiceArgs; i++)
lpwstr[i]=HEAP_strdupAtoW(GetProcessHeap(), 0, lpServiceArgVectors[i]); {
RtlCreateUnicodeStringFromAsciiz (&usBuffer,lpServiceArgVectors[i]);
lpwstr[i]=usBuffer.Buffer;
}
StartServiceW(hService, dwNumServiceArgs, (LPCWSTR *)lpwstr); StartServiceW(hService, dwNumServiceArgs, (LPCWSTR *)lpwstr);
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "commdlg.h" #include "commdlg.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "cderr.h" #include "cderr.h"
#include "winternl.h"
WINE_DEFAULT_DEBUG_CHANNEL(commdlg); WINE_DEFAULT_DEBUG_CHANNEL(commdlg);
...@@ -1100,6 +1101,7 @@ LPWSTR FILEDLG_DupToW(LPCSTR str, DWORD size) ...@@ -1100,6 +1101,7 @@ LPWSTR FILEDLG_DupToW(LPCSTR str, DWORD size)
void FILEDLG_MapOfnStructA(LPOPENFILENAMEA ofnA, LPOPENFILENAMEW ofnW, BOOL open) void FILEDLG_MapOfnStructA(LPOPENFILENAMEA ofnA, LPOPENFILENAMEW ofnW, BOOL open)
{ {
LPCSTR str; LPCSTR str;
UNICODE_STRING usBuffer;
ofnW->lStructSize = sizeof(OPENFILENAMEW); ofnW->lStructSize = sizeof(OPENFILENAMEW);
ofnW->hwndOwner = ofnA->hwndOwner; ofnW->hwndOwner = ofnA->hwndOwner;
...@@ -1116,13 +1118,17 @@ void FILEDLG_MapOfnStructA(LPOPENFILENAMEA ofnA, LPOPENFILENAMEW ofnW, BOOL open ...@@ -1116,13 +1118,17 @@ void FILEDLG_MapOfnStructA(LPOPENFILENAMEA ofnA, LPOPENFILENAMEW ofnW, BOOL open
ofnW->nMaxFileTitle = ofnA->nMaxFileTitle; ofnW->nMaxFileTitle = ofnA->nMaxFileTitle;
ofnW->lpstrFileTitle = FILEDLG_DupToW(ofnA->lpstrFileTitle, ofnW->nMaxFileTitle); ofnW->lpstrFileTitle = FILEDLG_DupToW(ofnA->lpstrFileTitle, ofnW->nMaxFileTitle);
if (ofnA->lpstrInitialDir) if (ofnA->lpstrInitialDir)
ofnW->lpstrInitialDir = HEAP_strdupAtoW(GetProcessHeap(),0,ofnA->lpstrInitialDir); {
RtlCreateUnicodeStringFromAsciiz (&usBuffer,ofnA->lpstrInitialDir);
ofnW->lpstrInitialDir = usBuffer.Buffer;
}
if (ofnA->lpstrTitle) if (ofnA->lpstrTitle)
str = ofnA->lpstrTitle; str = ofnA->lpstrTitle;
else else
/* Allocates default title (FIXME : get it from resource) */ /* Allocates default title (FIXME : get it from resource) */
str = open ? defaultopen:defaultsave; str = open ? defaultopen:defaultsave;
ofnW->lpstrTitle = HEAP_strdupAtoW(GetProcessHeap(),0, str); RtlCreateUnicodeStringFromAsciiz (&usBuffer,ofnA->lpstrTitle);
ofnW->lpstrTitle = usBuffer.Buffer;
ofnW->Flags = ofnA->Flags; ofnW->Flags = ofnA->Flags;
ofnW->nFileOffset = ofnA->nFileOffset; ofnW->nFileOffset = ofnA->nFileOffset;
ofnW->nFileExtension = ofnA->nFileExtension; ofnW->nFileExtension = ofnA->nFileExtension;
...@@ -1130,7 +1136,10 @@ void FILEDLG_MapOfnStructA(LPOPENFILENAMEA ofnA, LPOPENFILENAMEW ofnW, BOOL open ...@@ -1130,7 +1136,10 @@ void FILEDLG_MapOfnStructA(LPOPENFILENAMEA ofnA, LPOPENFILENAMEW ofnW, BOOL open
if ((ofnA->Flags & OFN_ENABLETEMPLATE) && (ofnA->lpTemplateName)) if ((ofnA->Flags & OFN_ENABLETEMPLATE) && (ofnA->lpTemplateName))
{ {
if (HIWORD(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 */ else /* numbered resource */
ofnW->lpTemplateName = (LPWSTR) ofnA->lpTemplateName; ofnW->lpTemplateName = (LPWSTR) ofnA->lpTemplateName;
} }
......
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
#include "winerror.h" #include "winerror.h"
#include "parsedt.h" #include "parsedt.h"
#include "typelib.h" #include "typelib.h"
#include "winternl.h"
WINE_DEFAULT_DEBUG_CHANNEL(ole); WINE_DEFAULT_DEBUG_CHANNEL(ole);
...@@ -667,9 +668,13 @@ static BSTR StringDupAtoBstr( char* strIn ) ...@@ -667,9 +668,13 @@ static BSTR StringDupAtoBstr( char* strIn )
{ {
BSTR bstr = NULL; BSTR bstr = NULL;
OLECHAR* pNewString = NULL; OLECHAR* pNewString = NULL;
pNewString = HEAP_strdupAtoW( GetProcessHeap(), 0, strIn ); UNICODE_STRING usBuffer;
RtlCreateUnicodeStringFromAsciiz( &usBuffer, strIn );
pNewString = usBuffer.Buffer;
bstr = SysAllocString( pNewString ); bstr = SysAllocString( pNewString );
HeapFree( GetProcessHeap(), 0, pNewString ); RtlFreeUnicodeString( &usBuffer );
return bstr; return bstr;
} }
......
...@@ -71,6 +71,7 @@ ...@@ -71,6 +71,7 @@
#include "wine/server.h" #include "wine/server.h"
#include "wine/unicode.h" #include "wine/unicode.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "winternl.h"
WINE_DEFAULT_DEBUG_CHANNEL(hook); WINE_DEFAULT_DEBUG_CHANNEL(hook);
WINE_DECLARE_DEBUG_CHANNEL(relay); WINE_DECLARE_DEBUG_CHANNEL(relay);
...@@ -156,7 +157,7 @@ static HHOOK set_windows_hook( INT id, HOOKPROC proc, HINSTANCE inst, DWORD tid, ...@@ -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 ) static LRESULT call_hook_AtoW( HOOKPROC proc, INT id, INT code, WPARAM wparam, LPARAM lparam )
{ {
LRESULT ret; LRESULT ret;
UNICODE_STRING usBuffer;
if (id != WH_CBT || code != HCBT_CREATEWND) ret = proc( code, wparam, lparam ); if (id != WH_CBT || code != HCBT_CREATEWND) ret = proc( code, wparam, lparam );
else else
{ {
...@@ -169,9 +170,15 @@ static LRESULT call_hook_AtoW( HOOKPROC proc, INT id, INT code, WPARAM wparam, L ...@@ -169,9 +170,15 @@ static LRESULT call_hook_AtoW( HOOKPROC proc, INT id, INT code, WPARAM wparam, L
csW = *(CREATESTRUCTW *)cbtcwA->lpcs; csW = *(CREATESTRUCTW *)cbtcwA->lpcs;
if (HIWORD(cbtcwA->lpcs->lpszName)) 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)) 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 ); ret = proc( code, wparam, (LPARAM)&cbtcwW );
cbtcwA->hwndInsertAfter = cbtcwW.hwndInsertAfter; cbtcwA->hwndInsertAfter = cbtcwW.hwndInsertAfter;
if (HIWORD(csW.lpszName)) HeapFree( GetProcessHeap(), 0, (LPWSTR)csW.lpszName ); if (HIWORD(csW.lpszName)) HeapFree( GetProcessHeap(), 0, (LPWSTR)csW.lpszName );
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#define NONAMELESSSTRUCT #define NONAMELESSSTRUCT
#include "mmsystem.h" #include "mmsystem.h"
#include "winbase.h" #include "winbase.h"
#include "winternl.h"
#include "wine/winuser16.h" #include "wine/winuser16.h"
#include "winemm.h" #include "winemm.h"
...@@ -2553,9 +2554,11 @@ DWORD WINAPI mciSendString16(LPCSTR lpstrCommand, LPSTR lpstrRet, ...@@ -2553,9 +2554,11 @@ DWORD WINAPI mciSendString16(LPCSTR lpstrCommand, LPSTR lpstrRet,
*/ */
UINT16 WINAPI mciLoadCommandResource16(HINSTANCE16 hInst, LPCSTR resname, UINT16 type) UINT16 WINAPI mciLoadCommandResource16(HINSTANCE16 hInst, LPCSTR resname, UINT16 type)
{ {
LPCWSTR ptr = HEAP_strdupAtoW(GetProcessHeap(), 0, resname); UNICODE_STRING ptr;
UINT ret = mciLoadCommandResource(HINSTANCE_32(hInst), ptr, type); UINT ret;
HeapFree(GetProcessHeap(), 0, (LPWSTR)ptr); RtlCreateUnicodeStringFromAsciiz(&ptr, resname);
ret = mciLoadCommandResource(HINSTANCE_32(hInst), ptr.Buffer, type);
RtlFreeUnicodeString(&ptr);
return ret; return ret;
} }
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "heap.h" #include "heap.h"
#include "winreg.h" #include "winreg.h"
#include "winemm.h" #include "winemm.h"
#include "winternl.h"
#include "wine/debug.h" #include "wine/debug.h"
...@@ -218,7 +219,9 @@ static WINE_PLAYSOUND* PlaySound_Alloc(const void* pszSound, HMODULE hmod, ...@@ -218,7 +219,9 @@ static WINE_PLAYSOUND* PlaySound_Alloc(const void* pszSound, HMODULE hmod,
} }
else else
{ {
wps->pszSound = HEAP_strdupAtoW(GetProcessHeap(), 0, pszSound); UNICODE_STRING usBuffer;
RtlCreateUnicodeStringFromAsciiz(&usBuffer, pszSound);
wps->pszSound = usBuffer.Buffer;
if (!wps->pszSound) goto oom_error; if (!wps->pszSound) goto oom_error;
wps->bAlloc = TRUE; wps->bAlloc = TRUE;
} }
......
...@@ -548,21 +548,35 @@ static LPDEVMODEA DEVMODEdupWtoA(HANDLE heap, const DEVMODEW *dmW) ...@@ -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) static LPPRINTER_INFO_2W PRINTER_INFO_2AtoW(HANDLE heap, LPPRINTER_INFO_2A piA)
{ {
LPPRINTER_INFO_2W piW; LPPRINTER_INFO_2W piW;
UNICODE_STRING usBuffer;
if(!piA) return NULL; if(!piA) return NULL;
piW = HeapAlloc(heap, 0, sizeof(*piW)); piW = HeapAlloc(heap, 0, sizeof(*piW));
memcpy(piW, piA, sizeof(*piW)); /* copy everything first */ memcpy(piW, piA, sizeof(*piW)); /* copy everything first */
piW->pServerName = HEAP_strdupAtoW(heap, 0, piA->pServerName);
piW->pPrinterName = HEAP_strdupAtoW(heap, 0, piA->pPrinterName); RtlCreateUnicodeStringFromAsciiz(&usBuffer,piA->pServerName);
piW->pShareName = HEAP_strdupAtoW(heap, 0, piA->pShareName); piW->pServerName = usBuffer.Buffer;
piW->pPortName = HEAP_strdupAtoW(heap, 0, piA->pPortName); RtlCreateUnicodeStringFromAsciiz(&usBuffer,piA->pPrinterName);
piW->pDriverName = HEAP_strdupAtoW(heap, 0, piA->pDriverName); piW->pPrinterName = usBuffer.Buffer;
piW->pComment = HEAP_strdupAtoW(heap, 0, piA->pComment); RtlCreateUnicodeStringFromAsciiz(&usBuffer,piA->pShareName);
piW->pLocation = HEAP_strdupAtoW(heap, 0, piA->pLocation); 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->pDevMode = DEVMODEdupAtoW(heap, piA->pDevMode);
piW->pSepFile = HEAP_strdupAtoW(heap, 0, piA->pSepFile); RtlCreateUnicodeStringFromAsciiz(&usBuffer,piA->pSepFile);
piW->pPrintProcessor = HEAP_strdupAtoW(heap, 0, piA->pPrintProcessor); piW->pSepFile = usBuffer.Buffer;
piW->pDatatype = HEAP_strdupAtoW(heap, 0, piA->pDatatype); RtlCreateUnicodeStringFromAsciiz(&usBuffer,piA->pPrintProcessor);
piW->pParameters = HEAP_strdupAtoW(heap, 0, piA->pParameters); piW->pPrintProcessor = usBuffer.Buffer;
RtlCreateUnicodeStringFromAsciiz(&usBuffer,piA->pDatatype);
piW->pDatatype = usBuffer.Buffer;
RtlCreateUnicodeStringFromAsciiz(&usBuffer,piA->pParameters);
piW->pParameters = usBuffer.Buffer;
return piW; return piW;
} }
...@@ -760,24 +774,27 @@ LONG WINAPI DocumentPropertiesW(HWND hWnd, HANDLE hPrinter, ...@@ -760,24 +774,27 @@ LONG WINAPI DocumentPropertiesW(HWND hWnd, HANDLE hPrinter,
BOOL WINAPI OpenPrinterA(LPSTR lpPrinterName,HANDLE *phPrinter, BOOL WINAPI OpenPrinterA(LPSTR lpPrinterName,HANDLE *phPrinter,
LPPRINTER_DEFAULTSA pDefault) LPPRINTER_DEFAULTSA pDefault)
{ {
LPWSTR lpPrinterNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpPrinterName); UNICODE_STRING lpPrinterNameW;
UNICODE_STRING usBuffer;
PRINTER_DEFAULTSW DefaultW, *pDefaultW = NULL; PRINTER_DEFAULTSW DefaultW, *pDefaultW = NULL;
BOOL ret; BOOL ret;
RtlCreateUnicodeStringFromAsciiz(&lpPrinterNameW,lpPrinterName);
if(pDefault) { if(pDefault) {
DefaultW.pDatatype = HEAP_strdupAtoW(GetProcessHeap(), 0, RtlCreateUnicodeStringFromAsciiz(&usBuffer,pDefault->pDatatype);
pDefault->pDatatype); DefaultW.pDatatype = usBuffer.Buffer;
DefaultW.pDevMode = DEVMODEdupAtoW(GetProcessHeap(), DefaultW.pDevMode = DEVMODEdupAtoW(GetProcessHeap(),
pDefault->pDevMode); pDefault->pDevMode);
DefaultW.DesiredAccess = pDefault->DesiredAccess; DefaultW.DesiredAccess = pDefault->DesiredAccess;
pDefaultW = &DefaultW; pDefaultW = &DefaultW;
} }
ret = OpenPrinterW(lpPrinterNameW, phPrinter, pDefaultW); ret = OpenPrinterW(lpPrinterNameW.Buffer, phPrinter, pDefaultW);
if(pDefault) { if(pDefault) {
HeapFree(GetProcessHeap(), 0, DefaultW.pDatatype); RtlFreeUnicodeString(&usBuffer);
HeapFree(GetProcessHeap(), 0, DefaultW.pDevMode); HeapFree(GetProcessHeap(), 0, DefaultW.pDevMode);
} }
HeapFree(GetProcessHeap(), 0, lpPrinterNameW); RtlFreeUnicodeString(&lpPrinterNameW);
return ret; return ret;
} }
...@@ -1165,7 +1182,7 @@ HANDLE WINAPI AddPrinterW(LPWSTR pName, DWORD Level, LPBYTE pPrinter) ...@@ -1165,7 +1182,7 @@ HANDLE WINAPI AddPrinterW(LPWSTR pName, DWORD Level, LPBYTE pPrinter)
*/ */
HANDLE WINAPI AddPrinterA(LPSTR 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_2W *piW;
PRINTER_INFO_2A *piA = (PRINTER_INFO_2A*)pPrinter; PRINTER_INFO_2A *piA = (PRINTER_INFO_2A*)pPrinter;
HANDLE ret; HANDLE ret;
...@@ -1176,13 +1193,13 @@ HANDLE WINAPI AddPrinterA(LPSTR pName, DWORD Level, LPBYTE pPrinter) ...@@ -1176,13 +1193,13 @@ HANDLE WINAPI AddPrinterA(LPSTR pName, DWORD Level, LPBYTE pPrinter)
SetLastError(ERROR_INVALID_LEVEL); SetLastError(ERROR_INVALID_LEVEL);
return 0; return 0;
} }
pNameW = HEAP_strdupAtoW(GetProcessHeap(), 0, pName); RtlCreateUnicodeStringFromAsciiz(&pNameW,pName);
piW = PRINTER_INFO_2AtoW(GetProcessHeap(), piA); 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); FREE_PRINTER_INFO_2W(GetProcessHeap(), piW);
HeapFree(GetProcessHeap(),0,pNameW); RtlFreeUnicodeString(&pNameW);
return ret; return ret;
} }
...@@ -2148,11 +2165,11 @@ BOOL WINAPI EnumPrintersA(DWORD dwType, LPSTR lpszName, ...@@ -2148,11 +2165,11 @@ BOOL WINAPI EnumPrintersA(DWORD dwType, LPSTR lpszName,
LPDWORD lpdwReturned) LPDWORD lpdwReturned)
{ {
BOOL ret; BOOL ret;
LPWSTR lpszNameW = HEAP_strdupAtoW(GetProcessHeap(),0,lpszName); UNICODE_STRING lpszNameW;
RtlCreateUnicodeStringFromAsciiz(&lpszNameW,lpszName);
ret = WINSPOOL_EnumPrinters(dwType, lpszNameW, dwLevel, lpbPrinters, cbBuf, ret = WINSPOOL_EnumPrinters(dwType, lpszNameW.Buffer, dwLevel, lpbPrinters, cbBuf,
lpdwNeeded, lpdwReturned, FALSE); lpdwNeeded, lpdwReturned, FALSE);
HeapFree(GetProcessHeap(),0,lpszNameW); RtlFreeUnicodeString(&lpszNameW);
return ret; return ret;
} }
...@@ -2422,10 +2439,11 @@ BOOL WINAPI GetPrinterDriverA(HANDLE hPrinter, LPSTR pEnvironment, ...@@ -2422,10 +2439,11 @@ BOOL WINAPI GetPrinterDriverA(HANDLE hPrinter, LPSTR pEnvironment,
DWORD cbBuf, LPDWORD pcbNeeded) DWORD cbBuf, LPDWORD pcbNeeded)
{ {
BOOL ret; BOOL ret;
LPWSTR pEnvW = HEAP_strdupAtoW(GetProcessHeap(),0,pEnvironment); UNICODE_STRING pEnvW;
ret = WINSPOOL_GetPrinterDriver(hPrinter, pEnvW, Level, pDriverInfo, RtlCreateUnicodeStringFromAsciiz(&pEnvW, pEnvironment);
ret = WINSPOOL_GetPrinterDriver(hPrinter, pEnvW.Buffer, Level, pDriverInfo,
cbBuf, pcbNeeded, FALSE); cbBuf, pcbNeeded, FALSE);
HeapFree(GetProcessHeap(),0,pEnvW); RtlFreeUnicodeString(&pEnvW);
return ret; return ret;
} }
/***************************************************************************** /*****************************************************************************
...@@ -2797,19 +2815,20 @@ BOOL WINAPI EnumPrinterDriversA(LPSTR pName, LPSTR pEnvironment, DWORD Level, ...@@ -2797,19 +2815,20 @@ BOOL WINAPI EnumPrinterDriversA(LPSTR pName, LPSTR pEnvironment, DWORD Level,
LPBYTE pDriverInfo, DWORD cbBuf, LPBYTE pDriverInfo, DWORD cbBuf,
LPDWORD pcbNeeded, LPDWORD pcReturned) LPDWORD pcbNeeded, LPDWORD pcReturned)
{ BOOL ret; { BOOL ret;
WCHAR *pNameW = NULL, *pEnvironmentW = NULL; UNICODE_STRING pNameW, pEnvironmentW;
if(pName)
RtlCreateUnicodeStringFromAsciiz(&pNameW, pName);
if(pEnvironment)
RtlCreateUnicodeStringFromAsciiz(&pEnvironmentW, pEnvironment);
ret = WINSPOOL_EnumPrinterDrivers(pNameW.Buffer, pEnvironmentW.Buffer,
Level, pDriverInfo, cbBuf, pcbNeeded,
pcReturned, FALSE);
if(pName) if(pName)
pNameW = HEAP_strdupAtoW(GetProcessHeap(), 0, pName); RtlFreeUnicodeString(&pNameW);
if(pEnvironment) if(pEnvironment)
pEnvironmentW = HEAP_strdupAtoW(GetProcessHeap(), 0, pEnvironment); RtlFreeUnicodeString(&pEnvironmentW);
ret = WINSPOOL_EnumPrinterDrivers(pNameW, pEnvironmentW, Level, pDriverInfo,
cbBuf, pcbNeeded, pcReturned, FALSE);
if(pNameW)
HeapFree(GetProcessHeap(), 0, pNameW);
if(pEnvironmentW)
HeapFree(GetProcessHeap(), 0, pEnvironmentW);
return ret; return ret;
} }
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include "winerror.h" #include "winerror.h"
#include "winnls.h" #include "winnls.h"
#include "excpt.h" #include "excpt.h"
#include "winternl.h"
WINE_DEFAULT_DEBUG_CHANNEL(resource); WINE_DEFAULT_DEBUG_CHANNEL(resource);
...@@ -206,11 +207,19 @@ static HRSRC RES_FindResource2( HMODULE hModule, LPCSTR type, ...@@ -206,11 +207,19 @@ static HRSRC RES_FindResource2( HMODULE hModule, LPCSTR type,
LPWSTR typeStr, nameStr; LPWSTR typeStr, nameStr;
if ( HIWORD( type ) && !bUnicode ) if ( HIWORD( type ) && !bUnicode )
typeStr = HEAP_strdupAtoW( GetProcessHeap(), 0, type ); {
UNICODE_STRING usBuffer;
RtlCreateUnicodeStringFromAsciiz(&usBuffer,type);
typeStr = usBuffer.Buffer;
}
else else
typeStr = (LPWSTR)type; typeStr = (LPWSTR)type;
if ( HIWORD( name ) && !bUnicode ) if ( HIWORD( name ) && !bUnicode )
nameStr = HEAP_strdupAtoW( GetProcessHeap(), 0, name ); {
UNICODE_STRING usBuffer;
RtlCreateUnicodeStringFromAsciiz(&usBuffer,name);
nameStr = usBuffer.Buffer;
}
else else
nameStr = (LPWSTR)name; nameStr = (LPWSTR)name;
......
...@@ -810,6 +810,7 @@ VOID WINAPI GetStartupInfoA( LPSTARTUPINFOA info ) ...@@ -810,6 +810,7 @@ VOID WINAPI GetStartupInfoA( LPSTARTUPINFOA info )
*/ */
VOID WINAPI GetStartupInfoW( LPSTARTUPINFOW info ) VOID WINAPI GetStartupInfoW( LPSTARTUPINFOW info )
{ {
UNICODE_STRING usBuffer;
info->cb = sizeof(STARTUPINFOW); info->cb = sizeof(STARTUPINFOW);
info->dwX = current_startupinfo.dwX; info->dwX = current_startupinfo.dwX;
info->dwY = current_startupinfo.dwY; info->dwY = current_startupinfo.dwY;
...@@ -824,7 +825,10 @@ VOID WINAPI GetStartupInfoW( LPSTARTUPINFOW info ) ...@@ -824,7 +825,10 @@ VOID WINAPI GetStartupInfoW( LPSTARTUPINFOW info )
info->hStdInput = current_startupinfo.hStdInput; info->hStdInput = current_startupinfo.hStdInput;
info->hStdOutput = current_startupinfo.hStdOutput; info->hStdOutput = current_startupinfo.hStdOutput;
info->hStdError = current_startupinfo.hStdError; info->hStdError = current_startupinfo.hStdError;
info->lpReserved = HEAP_strdupAtoW (GetProcessHeap(), 0, current_startupinfo.lpReserved ); RtlCreateUnicodeStringFromAsciiz (&usBuffer,current_startupinfo.lpReserved);
info->lpDesktop = HEAP_strdupAtoW (GetProcessHeap(), 0, current_startupinfo.lpDesktop ); info->lpReserved = usBuffer.Buffer;
info->lpTitle = HEAP_strdupAtoW (GetProcessHeap(), 0, current_startupinfo.lpTitle ); RtlCreateUnicodeStringFromAsciiz (&usBuffer,current_startupinfo.lpDesktop);
info->lpDesktop = usBuffer.Buffer;
RtlCreateUnicodeStringFromAsciiz (&usBuffer,current_startupinfo.lpTitle);
info->lpTitle = usBuffer.Buffer;
} }
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include "message.h" #include "message.h"
#include "thread.h" #include "thread.h"
#include "dde.h" #include "dde.h"
#include "winternl.h"
WINE_DECLARE_DEBUG_CHANNEL(msg); WINE_DECLARE_DEBUG_CHANNEL(msg);
WINE_DECLARE_DEBUG_CHANNEL(relay); WINE_DECLARE_DEBUG_CHANNEL(relay);
...@@ -593,9 +594,13 @@ INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM *pwparam, LPARAM *plpara ...@@ -593,9 +594,13 @@ INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM *pwparam, LPARAM *plpara
case LB_DIR: case LB_DIR:
case LB_ADDFILE: case LB_ADDFILE:
case EM_REPLACESEL: case EM_REPLACESEL:
{
UNICODE_STRING usBuffer;
if(!*plparam) return 0; if(!*plparam) return 0;
*plparam = (LPARAM)HEAP_strdupAtoW( GetProcessHeap(), 0, (LPCSTR)*plparam ); RtlCreateUnicodeStringFromAsciiz(&usBuffer,(LPCSTR)*plparam);
*plparam = (LPARAM)usBuffer.Buffer;
return (*plparam ? 1 : -1); return (*plparam ? 1 : -1);
}
case WM_GETTEXTLENGTH: case WM_GETTEXTLENGTH:
case CB_GETLBTEXTLEN: case CB_GETLBTEXTLEN:
case LB_GETTEXTLEN: case LB_GETTEXTLEN:
...@@ -603,6 +608,7 @@ INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM *pwparam, LPARAM *plpara ...@@ -603,6 +608,7 @@ INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM *pwparam, LPARAM *plpara
case WM_NCCREATE: case WM_NCCREATE:
case WM_CREATE: case WM_CREATE:
{ {
UNICODE_STRING usBuffer;
struct s struct s
{ CREATESTRUCTW cs; /* new structure */ { CREATESTRUCTW cs; /* new structure */
LPCWSTR lpszName; /* allocated Name */ LPCWSTR lpszName; /* allocated Name */
...@@ -613,11 +619,15 @@ INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM *pwparam, LPARAM *plpara ...@@ -613,11 +619,15 @@ INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM *pwparam, LPARAM *plpara
if (!xs) return -1; if (!xs) return -1;
xs->cs = *(CREATESTRUCTW *)*plparam; xs->cs = *(CREATESTRUCTW *)*plparam;
if (HIWORD(xs->cs.lpszName)) 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)) 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; *plparam = (LPARAM)xs;
} }
return 1; return 1;
...@@ -628,11 +638,17 @@ INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM *pwparam, LPARAM *plpara ...@@ -628,11 +638,17 @@ INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM *pwparam, LPARAM *plpara
if (!cs) return -1; if (!cs) return -1;
*cs = *(MDICREATESTRUCTW *)*plparam; *cs = *(MDICREATESTRUCTW *)*plparam;
if (HIWORD(cs->szClass)) 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)) 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; *plparam = (LPARAM)cs;
} }
return 1; return 1;
...@@ -645,7 +661,11 @@ INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM *pwparam, LPARAM *plpara ...@@ -645,7 +661,11 @@ INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM *pwparam, LPARAM *plpara
case LB_SELECTSTRING: case LB_SELECTSTRING:
if(!*plparam) return 0; if(!*plparam) return 0;
if ( WINPROC_TestLBForStr( hwnd )) 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); return (*plparam ? 1 : -1);
case LB_GETTEXT: /* FIXME: fixed sized buffer */ case LB_GETTEXT: /* FIXME: fixed sized buffer */
...@@ -666,7 +686,11 @@ INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM *pwparam, LPARAM *plpara ...@@ -666,7 +686,11 @@ INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM *pwparam, LPARAM *plpara
case CB_SELECTSTRING: case CB_SELECTSTRING:
if(!*plparam) return 0; if(!*plparam) return 0;
if ( WINPROC_TestCBForStr( hwnd )) 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); return (*plparam ? 1 : -1);
case CB_GETLBTEXT: /* FIXME: fixed sized buffer */ case CB_GETLBTEXT: /* FIXME: fixed sized buffer */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment