Removed some of the calls to HEAP_strdup* functions.
diff --git a/windows/cursoricon.c b/windows/cursoricon.c
index df082e1..86a692c 100644
--- a/windows/cursoricon.c
+++ b/windows/cursoricon.c
@@ -37,7 +37,6 @@
#include "wine/winbase16.h"
#include "wine/winuser16.h"
#include "wine/exception.h"
-#include "heap.h"
#include "palette.h"
#include "bitmap.h"
#include "cursoricon.h"
@@ -2191,9 +2190,13 @@
HANDLE res;
LPWSTR u_name;
+ if (!HIWORD(name))
+ return LoadImageW(hinst, (LPWSTR)name, type, desiredx, desiredy, loadflags);
+
__TRY {
- if (HIWORD(name)) u_name = HEAP_strdupAtoW(GetProcessHeap(), 0, name);
- else u_name=(LPWSTR)name;
+ DWORD len = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 );
+ u_name = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
+ MultiByteToWideChar( CP_ACP, 0, name, -1, u_name, len );
}
__EXCEPT(page_fault) {
SetLastError( ERROR_INVALID_PARAMETER );
@@ -2201,7 +2204,7 @@
}
__ENDTRY
res = LoadImageW(hinst, u_name, type, desiredx, desiredy, loadflags);
- if (HIWORD(name)) HeapFree(GetProcessHeap(), 0, u_name);
+ HeapFree(GetProcessHeap(), 0, u_name);
return res;
}
diff --git a/windows/mdi.c b/windows/mdi.c
index db2137e..ba54a2b 100644
--- a/windows/mdi.c
+++ b/windows/mdi.c
@@ -77,7 +77,6 @@
#include "winuser.h"
#include "wine/unicode.h"
#include "win.h"
-#include "heap.h"
#include "nonclient.h"
#include "controls.h"
#include "user.h"
@@ -1459,7 +1458,9 @@
{
case WM_SETTEXT:
{
- LPWSTR text = HEAP_strdupAtoW( GetProcessHeap(), 0, (LPSTR)lParam );
+ DWORD len = MultiByteToWideChar( CP_ACP, 0, (LPSTR)lParam, -1, NULL, 0 );
+ LPWSTR text = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
+ MultiByteToWideChar( CP_ACP, 0, (LPSTR)lParam, -1, text, len );
MDI_UpdateFrameText(hwnd, hwndMDIClient, MDI_REPAINTFRAME, text );
HeapFree( GetProcessHeap(), 0, text );
}
diff --git a/windows/nonclient.c b/windows/nonclient.c
index ac89529..36bcc8f 100644
--- a/windows/nonclient.c
+++ b/windows/nonclient.c
@@ -11,7 +11,6 @@
#include "version.h"
#include "win.h"
#include "user.h"
-#include "heap.h"
#include "dce.h"
#include "controls.h"
#include "cursoricon.h"
@@ -259,22 +258,38 @@
/***********************************************************************
* DrawCaptionTempA (USER32.@)
- *
- * PARAMS
- *
- * RETURNS
- * Success:
- * Failure:
*/
+BOOL WINAPI DrawCaptionTempA (HWND hwnd, HDC hdc, const RECT *rect, HFONT hFont,
+ HICON hIcon, LPCSTR str, UINT uFlags)
+{
+ LPWSTR strW;
+ INT len;
+ BOOL ret = FALSE;
-BOOL WINAPI
-DrawCaptionTempA (HWND hwnd, HDC hdc, const RECT *rect, HFONT hFont,
- HICON hIcon, LPCSTR str, UINT uFlags)
+ if (!(uFlags & DC_TEXT) || !str)
+ return DrawCaptionTempW( hwnd, hdc, rect, hFont, hIcon, NULL, uFlags );
+
+ len = MultiByteToWideChar( CP_ACP, 0, str, -1, NULL, 0 );
+ if ((strW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) )))
+ {
+ MultiByteToWideChar( CP_ACP, 0, str, -1, strW, len );
+ ret = DrawCaptionTempW (hwnd, hdc, rect, hFont, hIcon, strW, uFlags);
+ HeapFree( GetProcessHeap (), 0, strW );
+ }
+ return ret;
+}
+
+
+/***********************************************************************
+ * DrawCaptionTempW (USER32.@)
+ */
+BOOL WINAPI DrawCaptionTempW (HWND hwnd, HDC hdc, const RECT *rect, HFONT hFont,
+ HICON hIcon, LPCWSTR str, UINT uFlags)
{
RECT rc = *rect;
- TRACE("(%08x,%08x,%p,%08x,%08x,\"%s\",%08x)\n",
- hwnd, hdc, rect, hFont, hIcon, str, uFlags);
+ TRACE("(%08x,%08x,%p,%08x,%08x,%s,%08x)\n",
+ hwnd, hdc, rect, hFont, hIcon, debugstr_w(str), uFlags);
/* drawing background */
if (uFlags & DC_INBUTTON) {
@@ -332,13 +347,13 @@
}
if (str)
- DrawTextA (hdc, str, -1, &rc,
+ DrawTextW (hdc, str, -1, &rc,
DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT);
else {
- CHAR szText[128];
+ WCHAR szText[128];
INT nLen;
- nLen = GetWindowTextA (hwnd, szText, 128);
- DrawTextA (hdc, szText, nLen, &rc,
+ nLen = GetWindowTextW (hwnd, szText, 128);
+ DrawTextW (hdc, szText, nLen, &rc,
DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_LEFT);
}
@@ -357,27 +372,6 @@
/***********************************************************************
- * DrawCaptionTempW (USER32.@)
- *
- * PARAMS
- *
- * RETURNS
- * Success:
- * Failure:
- */
-
-BOOL WINAPI
-DrawCaptionTempW (HWND hwnd, HDC hdc, const RECT *rect, HFONT hFont,
- HICON hIcon, LPCWSTR str, UINT uFlags)
-{
- LPSTR p = HEAP_strdupWtoA (GetProcessHeap (), 0, str);
- BOOL res = DrawCaptionTempA (hwnd, hdc, rect, hFont, hIcon, p, uFlags);
- HeapFree (GetProcessHeap (), 0, p);
- return res;
-}
-
-
-/***********************************************************************
* AdjustWindowRect (USER.102)
*/
BOOL16 WINAPI AdjustWindowRect16( LPRECT16 rect, DWORD style, BOOL16 menu )
diff --git a/windows/user.c b/windows/user.c
index 32441f5..7385dd0 100644
--- a/windows/user.c
+++ b/windows/user.c
@@ -12,7 +12,6 @@
#include "wingdi.h"
#include "winuser.h"
#include "wine/winuser16.h"
-#include "heap.h"
#include "user.h"
#include "win.h"
#include "controls.h"
@@ -364,21 +363,26 @@
/***********************************************************************
* EnumDisplaySettingsW (USER32.@)
*/
-BOOL WINAPI EnumDisplaySettingsW(LPCWSTR name,DWORD n,LPDEVMODEW devmode) {
- LPSTR nameA = HEAP_strdupWtoA(GetProcessHeap(),0,name);
- DEVMODEA devmodeA;
- BOOL ret = EnumDisplaySettingsA(nameA,n,&devmodeA);
+BOOL WINAPI EnumDisplaySettingsW(LPCWSTR name,DWORD n,LPDEVMODEW devmode)
+{
+ DEVMODEA devmodeA;
+ BOOL ret;
+ DWORD len = WideCharToMultiByte( CP_ACP, 0, name, -1, NULL, 0, NULL, NULL );
+ LPSTR nameA = HeapAlloc( GetProcessHeap(), 0, len );
- if (ret) {
- devmode->dmBitsPerPel = devmodeA.dmBitsPerPel;
- devmode->dmPelsHeight = devmodeA.dmPelsHeight;
- devmode->dmPelsWidth = devmodeA.dmPelsWidth;
- devmode->dmDisplayFlags = devmodeA.dmDisplayFlags;
- devmode->dmDisplayFrequency = devmodeA.dmDisplayFrequency;
- /* FIXME: convert rest too, if they are ever returned */
- }
- HeapFree(GetProcessHeap(),0,nameA);
- return ret;
+ WideCharToMultiByte( CP_ACP, 0, name, -1, nameA, len, NULL, NULL );
+ ret = EnumDisplaySettingsA(nameA,n,&devmodeA);
+ if (ret)
+ {
+ devmode->dmBitsPerPel = devmodeA.dmBitsPerPel;
+ devmode->dmPelsHeight = devmodeA.dmPelsHeight;
+ devmode->dmPelsWidth = devmodeA.dmPelsWidth;
+ devmode->dmDisplayFlags = devmodeA.dmDisplayFlags;
+ devmode->dmDisplayFrequency = devmodeA.dmDisplayFrequency;
+ /* FIXME: convert rest too, if they are ever returned */
+ }
+ HeapFree(GetProcessHeap(),0,nameA);
+ return ret;
}
/***********************************************************************
diff --git a/windows/win.c b/windows/win.c
index 8f84044..6348963 100644
--- a/windows/win.c
+++ b/windows/win.c
@@ -13,7 +13,6 @@
#include "wine/server.h"
#include "wine/unicode.h"
#include "win.h"
-#include "heap.h"
#include "user.h"
#include "dce.h"
#include "controls.h"
@@ -1602,6 +1601,7 @@
ATOM atom = 0;
LPWSTR buffer;
HWND hwnd;
+ INT len;
if (className)
{
@@ -1613,8 +1613,11 @@
return 0;
}
}
+ if (!title) return WIN_FindWindow( parent, child, atom, NULL );
- buffer = HEAP_strdupAtoW( GetProcessHeap(), 0, title );
+ len = MultiByteToWideChar( CP_ACP, 0, title, -1, NULL, 0 );
+ if (!(buffer = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return 0;
+ MultiByteToWideChar( CP_ACP, 0, title, -1, buffer, len );
hwnd = WIN_FindWindow( parent, child, atom, buffer );
HeapFree( GetProcessHeap(), 0, buffer );
return hwnd;
diff --git a/windows/winhelp.c b/windows/winhelp.c
index c0e2d66..009e21a 100644
--- a/windows/winhelp.c
+++ b/windows/winhelp.c
@@ -12,7 +12,6 @@
#include "wine/winuser16.h"
#include "wine/winbase16.h"
#include "win.h"
-#include "heap.h"
DEFAULT_DEBUG_CHANNEL(win);
@@ -144,11 +143,20 @@
/**********************************************************************
* WinHelpW (USER32.@)
*/
-BOOL WINAPI WinHelpW( HWND hWnd, LPCWSTR helpFile, UINT command,
- DWORD dwData )
+BOOL WINAPI WinHelpW( HWND hWnd, LPCWSTR helpFile, UINT command, DWORD dwData )
{
- LPSTR file = HEAP_strdupWtoA( GetProcessHeap(), 0, helpFile );
- BOOL ret = WinHelpA( hWnd, file, command, dwData );
- HeapFree( GetProcessHeap(), 0, file );
+ INT len;
+ LPSTR file;
+ BOOL ret = FALSE;
+
+ if (!helpFile) return WinHelpA( hWnd, NULL, command, dwData );
+
+ len = WideCharToMultiByte( CP_ACP, 0, helpFile, -1, NULL, 0, NULL, NULL );
+ if ((file = HeapAlloc( GetProcessHeap(), 0, len )))
+ {
+ WideCharToMultiByte( CP_ACP, 0, helpFile, -1, file, len, NULL, NULL );
+ ret = WinHelpA( hWnd, file, command, dwData );
+ HeapFree( GetProcessHeap(), 0, file );
+ }
return ret;
}