shell32 patch 20

Martin Fuchs martin-fuchs at gmx.net
Fri Jan 23 16:20:41 CST 2004


Changelog:
- don't link directly to NTDLL; use MultiByteToWideChar() instead of RtlCreateUnicodeStringFromAsciiz()
- directly call InitCommonControlsEx() - we already link direclty to COMCTL32


Index: Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/shell32/Makefile.in,v
retrieving revision 1.76
diff -u -p -d -r1.76 Makefile.in
--- Makefile.in	6 Jan 2004 20:40:10 -0000	1.76
+++ Makefile.in	23 Jan 2004 22:13:31 -0000
@@ -5,7 +5,7 @@ SRCDIR    = @srcdir@
 VPATH     = @srcdir@
 MODULE    = shell32.dll
 # 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
 EXTRALIBS = $(LIBUUID) $(LIBUNICODE)
 
Index: shell32_main.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shell32_main.c,v
retrieving revision 1.128
diff -u -p -d -r1.128 shell32_main.c
--- shell32_main.c	21 Jan 2004 22:15:09 -0000	1.128
+++ shell32_main.c	23 Jan 2004 22:13:40 -0000
@@ -798,14 +798,33 @@ INT_PTR CALLBACK AboutDlgProc( HWND hWnd
  */
 BOOL WINAPI ShellAboutA( HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIcon )
 {
-    UNICODE_STRING appW, otherW;
     BOOL ret;
 
-    RtlCreateUnicodeStringFromAsciiz( &appW, szApp );
-    RtlCreateUnicodeStringFromAsciiz( &otherW, szOtherStuff );
-    ret = ShellAboutW( hWnd, appW.Buffer, otherW.Buffer, hIcon );
-    RtlFreeUnicodeString( &appW );
-    RtlFreeUnicodeString( &otherW );
+    LPWSTR appW, otherW;
+    int len;
+
+	if (szApp) {
+		len = MultiByteToWideChar(CP_ACP, 0, szApp, -1, NULL, 0);
+		appW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+		MultiByteToWideChar(CP_ACP, 0, szApp, -1, appW, len);
+	} else
+		appW = NULL;
+
+	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);
+	} else
+		otherW = NULL;
+
+    ret = ShellAboutW(hWnd, appW, otherW, hIcon);
+
+	if (otherW)
+		HeapFree(GetProcessHeap(), 0, otherW);
+
+	if (appW)
+		HeapFree(GetProcessHeap(), 0, appW);
+
     return ret;
 }
 
@@ -880,9 +899,6 @@ HRESULT WINAPI SHELL32_DllGetVersion (DL
  * all are once per process
  *
  */
-void   (WINAPI *pDLLInitComctl)(LPVOID);
-
-static HINSTANCE       hComctl32;

 HINSTANCE      shell32_hInstance = 0;
 HIMAGELIST     ShellSmallIconList = 0;
@@ -905,26 +922,11 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, 
 	  case DLL_PROCESS_ATTACH:
 	    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);
-
-	    if (!hComctl32)
-	    {
-	      ERR("P A N I C SHELL32 loading failed\n");
-	      return FALSE;
-	    }
+	    /* 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);
 
-	    /* comctl32 */
-	    pDLLInitComctl=(void*)GetProcAddress(hComctl32,"InitCommonControlsEx");
-	    /* initialize the common controls */
-	    if (pDLLInitComctl)
-	    {
-	      pDLLInitComctl(NULL);
-	    }
+		InitCommonControlsEx(NULL);
 
 	    SIC_Initialize();
 	    SYSTRAY_Init();
Index: pidl.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/pidl.c,v
retrieving revision 1.99
diff -u -p -d -r1.99 pidl.c
--- pidl.c	21 Jan 2004 23:50:26 -0000	1.99
+++ pidl.c	23 Jan 2004 22:18:40 -0000
@@ -1042,14 +1042,22 @@ static HRESULT WINAPI _ILParsePathW(LPCW
 LPITEMIDLIST WINAPI SHSimpleIDListFromPathA(LPCSTR lpszPath)
 {
 	LPITEMIDLIST pidl = NULL;
-	UNICODE_STRING wPath;
+    LPWSTR wPath;
+    int len;
 
 	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);
+	} else
+		wPath = NULL;
 
-	_ILParsePathW(wPath.Buffer, NULL, TRUE, &pidl, NULL);
-	RtlFreeUnicodeString(&wPath);
+    _ILParsePathW(wPath, NULL, TRUE, &pidl, NULL);
+
+	if (wPath)
+		HeapFree(GetProcessHeap(), 0, wPath);
 
 	TRACE("%s %p\n", debugstr_a(lpszPath), pidl);
 	return pidl;
Index: shell32_main.h
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shell32_main.h,v
retrieving revision 1.79
diff -u -p -d -r1.79 shell32_main.h
--- shell32_main.h	21 Jan 2004 22:15:09 -0000	1.79
+++ shell32_main.h	23 Jan 2004 22:25:29 -0000
@@ -46,11 +46,6 @@ extern HIMAGELIST	ShellSmallIconList;
 extern HIMAGELIST	ShellBigIconList;
 extern HDPA		sic_hdpa;
 
-/*******************************************
-* pointer to functions dynamically loaded
-*/
-extern void	(WINAPI *pDLLInitComctl)(LPVOID);
-
 BOOL WINAPI Shell_GetImageList(HIMAGELIST * lpBigList, HIMAGELIST * lpSmallList);
 
 /* Iconcache */





More information about the wine-patches mailing list