Commit 516b50f3 authored by Martin Fuchs's avatar Martin Fuchs Committed by Alexandre Julliard

- don't link directly to NTDLL; use MultiByteToWideChar() instead of

RtlCreateUnicodeStringFromAsciiz() - directly call InitCommonControlsEx()
parent 703676f5
...@@ -5,7 +5,7 @@ SRCDIR = @srcdir@ ...@@ -5,7 +5,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
MODULE = shell32.dll MODULE = shell32.dll
# fixme: avoid ole32.dll import # fixme: avoid ole32.dll import
IMPORTS = ole32 shlwapi comctl32 user32 gdi32 advapi32 kernel32 ntdll IMPORTS = ole32 shlwapi comctl32 user32 gdi32 advapi32 kernel32
ALTNAMES = shell.dll ALTNAMES = shell.dll
EXTRALIBS = $(LIBUUID) $(LIBUNICODE) EXTRALIBS = $(LIBUUID) $(LIBUNICODE)
......
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
#include "shlguid.h" #include "shlguid.h"
#include "winerror.h" #include "winerror.h"
#include "winnls.h" #include "winnls.h"
#include "winternl.h"
#include "undocshell.h" #include "undocshell.h"
#include "shell32_main.h" #include "shell32_main.h"
#include "shellapi.h" #include "shellapi.h"
...@@ -1041,18 +1040,24 @@ static HRESULT WINAPI _ILParsePathW(LPCWSTR path, LPWIN32_FIND_DATAW lpFindFile, ...@@ -1041,18 +1040,24 @@ static HRESULT WINAPI _ILParsePathW(LPCWSTR path, LPWIN32_FIND_DATAW lpFindFile,
*/ */
LPITEMIDLIST WINAPI SHSimpleIDListFromPathA(LPCSTR lpszPath) LPITEMIDLIST WINAPI SHSimpleIDListFromPathA(LPCSTR lpszPath)
{ {
LPITEMIDLIST pidl = NULL; LPITEMIDLIST pidl = NULL;
UNICODE_STRING wPath; LPWSTR wPath = NULL;
int len;
TRACE("%s\n", debugstr_a(lpszPath)); TRACE("%s\n", debugstr_a(lpszPath));
RtlCreateUnicodeStringFromAsciiz(&wPath, lpszPath); if (lpszPath)
{
len = MultiByteToWideChar(CP_ACP, 0, lpszPath, -1, NULL, 0);
wPath = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, lpszPath, -1, wPath, len);
}
_ILParsePathW(wPath.Buffer, NULL, TRUE, &pidl, NULL); _ILParsePathW(wPath, NULL, TRUE, &pidl, NULL);
RtlFreeUnicodeString(&wPath);
TRACE("%s %p\n", debugstr_a(lpszPath), pidl); if (wPath) HeapFree(GetProcessHeap(), 0, wPath);
return pidl; TRACE("%s %p\n", debugstr_a(lpszPath), pidl);
return pidl;
} }
LPITEMIDLIST WINAPI SHSimpleIDListFromPathW(LPCWSTR lpszPath) LPITEMIDLIST WINAPI SHSimpleIDListFromPathW(LPCWSTR lpszPath)
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include "winbase.h" #include "winbase.h"
#include "winerror.h" #include "winerror.h"
#include "winreg.h" #include "winreg.h"
#include "winternl.h"
#include "dlgs.h" #include "dlgs.h"
#include "shellapi.h" #include "shellapi.h"
#include "winuser.h" #include "winuser.h"
...@@ -798,14 +797,27 @@ INT_PTR CALLBACK AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam, ...@@ -798,14 +797,27 @@ INT_PTR CALLBACK AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
*/ */
BOOL WINAPI ShellAboutA( HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIcon ) BOOL WINAPI ShellAboutA( HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIcon )
{ {
UNICODE_STRING appW, otherW;
BOOL ret; BOOL ret;
LPWSTR appW = NULL, otherW = NULL;
int len;
RtlCreateUnicodeStringFromAsciiz( &appW, szApp ); if (szApp)
RtlCreateUnicodeStringFromAsciiz( &otherW, szOtherStuff ); {
ret = ShellAboutW( hWnd, appW.Buffer, otherW.Buffer, hIcon ); len = MultiByteToWideChar(CP_ACP, 0, szApp, -1, NULL, 0);
RtlFreeUnicodeString( &appW ); appW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
RtlFreeUnicodeString( &otherW ); MultiByteToWideChar(CP_ACP, 0, szApp, -1, appW, len);
}
if (szOtherStuff)
{
len = MultiByteToWideChar(CP_ACP, 0, szOtherStuff, -1, NULL, 0);
otherW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, szOtherStuff, -1, otherW, len);
}
ret = ShellAboutW(hWnd, appW, otherW, hIcon);
if (otherW) HeapFree(GetProcessHeap(), 0, otherW);
if (appW) HeapFree(GetProcessHeap(), 0, appW);
return ret; return ret;
} }
...@@ -880,10 +892,6 @@ HRESULT WINAPI SHELL32_DllGetVersion (DLLVERSIONINFO *pdvi) ...@@ -880,10 +892,6 @@ HRESULT WINAPI SHELL32_DllGetVersion (DLLVERSIONINFO *pdvi)
* all are once per process * all are once per process
* *
*/ */
void (WINAPI *pDLLInitComctl)(LPVOID);
static HINSTANCE hComctl32;
HINSTANCE shell32_hInstance = 0; HINSTANCE shell32_hInstance = 0;
HIMAGELIST ShellSmallIconList = 0; HIMAGELIST ShellSmallIconList = 0;
HIMAGELIST ShellBigIconList = 0; HIMAGELIST ShellBigIconList = 0;
...@@ -904,27 +912,13 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad) ...@@ -904,27 +912,13 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
{ {
case DLL_PROCESS_ATTACH: case DLL_PROCESS_ATTACH:
shell32_hInstance = hinstDLL; shell32_hInstance = hinstDLL;
/* get full path to this DLL for IExtractIconW_fnGetIconLocation() */
GetModuleFileNameW(hinstDLL, swShell32Name, MAX_PATH);
WideCharToMultiByte(CP_ACP, 0, swShell32Name, -1, sShell32Name, MAX_PATH, NULL, NULL);
hComctl32 = GetModuleHandleA("COMCTL32.DLL");
DisableThreadLibraryCalls(shell32_hInstance); DisableThreadLibraryCalls(shell32_hInstance);
if (!hComctl32) /* get full path to this DLL for IExtractIconW_fnGetIconLocation() */
{ GetModuleFileNameW(hinstDLL, swShell32Name, MAX_PATH);
ERR("P A N I C SHELL32 loading failed\n"); WideCharToMultiByte(CP_ACP, 0, swShell32Name, -1, sShell32Name, MAX_PATH, NULL, NULL);
return FALSE;
}
/* comctl32 */ InitCommonControlsEx(NULL);
pDLLInitComctl=(void*)GetProcAddress(hComctl32,"InitCommonControlsEx");
/* initialize the common controls */
if (pDLLInitComctl)
{
pDLLInitComctl(NULL);
}
SIC_Initialize(); SIC_Initialize();
SYSTRAY_Init(); SYSTRAY_Init();
......
...@@ -46,11 +46,6 @@ extern HIMAGELIST ShellSmallIconList; ...@@ -46,11 +46,6 @@ extern HIMAGELIST ShellSmallIconList;
extern HIMAGELIST ShellBigIconList; extern HIMAGELIST ShellBigIconList;
extern HDPA sic_hdpa; extern HDPA sic_hdpa;
/*******************************************
* pointer to functions dynamically loaded
*/
extern void (WINAPI *pDLLInitComctl)(LPVOID);
BOOL WINAPI Shell_GetImageList(HIMAGELIST * lpBigList, HIMAGELIST * lpSmallList); BOOL WINAPI Shell_GetImageList(HIMAGELIST * lpBigList, HIMAGELIST * lpSmallList);
/* Iconcache */ /* Iconcache */
......
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