Skip to content
Snippets Groups Projects
Commit c17ddc86 authored by Juergen Schmied's avatar Juergen Schmied Committed by Alexandre Julliard
Browse files

Fixes.

Use GetModuleHandleA instead of LoadLibrary for dlls imported by
the spec file.
parent 3853f0f0
No related branches found
No related tags found
No related merge requests found
...@@ -24,11 +24,11 @@ ...@@ -24,11 +24,11 @@
#include "shellapi.h" #include "shellapi.h"
#include "pidl.h" #include "pidl.h"
#include "shlobj.h"
#include "shell32_main.h" #include "shell32_main.h"
#include "shlguid.h"
#include "wine/undocshell.h" #include "wine/undocshell.h"
#include "shpolicy.h" #include "shlobj.h"
#include "shlguid.h"
#include "shlwapi.h"
DEFAULT_DEBUG_CHANNEL(shell); DEFAULT_DEBUG_CHANNEL(shell);
...@@ -97,7 +97,7 @@ void WINAPI Control_RunDLL( HWND hwnd, LPCVOID code, LPCSTR cmd, DWORD arg4 ) ...@@ -97,7 +97,7 @@ void WINAPI Control_RunDLL( HWND hwnd, LPCVOID code, LPCSTR cmd, DWORD arg4 )
} }
/************************************************************************* /*************************************************************************
* SHGetFileInfoA [SHELL32.254] * SHGetFileInfoA [SHELL32.@]
*/ */
DWORD WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes, DWORD WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes,
...@@ -109,15 +109,12 @@ DWORD WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes, ...@@ -109,15 +109,12 @@ DWORD WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes,
DWORD ret = TRUE, dwAttributes = 0; DWORD ret = TRUE, dwAttributes = 0;
IShellFolder * psfParent = NULL; IShellFolder * psfParent = NULL;
IExtractIconA * pei = NULL; IExtractIconA * pei = NULL;
LPITEMIDLIST pidlLast, pidl = NULL; LPITEMIDLIST pidlLast = NULL, pidl = NULL;
HRESULT hr = S_OK; HRESULT hr = S_OK;
TRACE("(%s,0x%lx,%p,0x%x,0x%x)\n", TRACE("(%s fattr=0x%lx sfi=%p(attr=0x%08lx) size=0x%x flags=0x%x)\n",
(flags & SHGFI_PIDL)? "pidl" : path, dwFileAttributes, psfi, sizeofpsfi, flags); (flags & SHGFI_PIDL)? "pidl" : path, dwFileAttributes, psfi, psfi->dwAttributes, sizeofpsfi, flags);
#ifdef MORE_DEBUG
ZeroMemory(psfi, sizeof(SHFILEINFOA));
#endif
if ((flags & SHGFI_USEFILEATTRIBUTES) && (flags & (SHGFI_ATTRIBUTES|SHGFI_EXETYPE|SHGFI_PIDL))) if ((flags & SHGFI_USEFILEATTRIBUTES) && (flags & (SHGFI_ATTRIBUTES|SHGFI_EXETYPE|SHGFI_PIDL)))
return FALSE; return FALSE;
...@@ -159,7 +156,7 @@ DWORD WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes, ...@@ -159,7 +156,7 @@ DWORD WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes,
{ {
if (flags & SHGFI_USEFILEATTRIBUTES) if (flags & SHGFI_USEFILEATTRIBUTES)
{ {
strcpy (psfi->szDisplayName, PathFindFilenameA(path)); strcpy (psfi->szDisplayName, PathFindFileNameA(path));
} }
else else
{ {
...@@ -264,6 +261,7 @@ DWORD WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes, ...@@ -264,6 +261,7 @@ DWORD WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes,
if (hr != S_OK) if (hr != S_OK)
ret = FALSE; ret = FALSE;
if(pidlLast) SHFree(pidlLast);
#ifdef MORE_DEBUG #ifdef MORE_DEBUG
TRACE ("icon=0x%08x index=0x%08x attr=0x%08lx name=%s type=%s ret=0x%08lx\n", TRACE ("icon=0x%08x index=0x%08x attr=0x%08lx name=%s type=%s ret=0x%08lx\n",
psfi->hIcon, psfi->iIcon, psfi->dwAttributes, psfi->szDisplayName, psfi->szTypeName, ret); psfi->hIcon, psfi->iIcon, psfi->dwAttributes, psfi->szDisplayName, psfi->szTypeName, ret);
...@@ -272,7 +270,7 @@ DWORD WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes, ...@@ -272,7 +270,7 @@ DWORD WINAPI SHGetFileInfoA(LPCSTR path,DWORD dwFileAttributes,
} }
/************************************************************************* /*************************************************************************
* SHGetFileInfoW [SHELL32.255] * SHGetFileInfoW [SHELL32.@]
*/ */
DWORD WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes, DWORD WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
...@@ -283,6 +281,21 @@ DWORD WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes, ...@@ -283,6 +281,21 @@ DWORD WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
return 0; return 0;
} }
/*************************************************************************
* SHGetFileInfoAW [SHELL32.@]
*/
DWORD WINAPI SHGetFileInfoAW(
LPCVOID path,
DWORD dwFileAttributes,
LPVOID psfi,
UINT sizeofpsfi,
UINT flags)
{
if(VERSION_OsIsUnicode())
return SHGetFileInfoW(path, dwFileAttributes, psfi, sizeofpsfi, flags );
return SHGetFileInfoA(path, dwFileAttributes, psfi, sizeofpsfi, flags );
}
/************************************************************************* /*************************************************************************
* ExtractIconA [SHELL32.133] * ExtractIconA [SHELL32.133]
*/ */
...@@ -755,7 +768,7 @@ HICON (WINAPI *pCreateIconFromResourceEx)(LPBYTE bits,UINT cbSize, BOOL bIcon, D ...@@ -755,7 +768,7 @@ HICON (WINAPI *pCreateIconFromResourceEx)(LPBYTE bits,UINT cbSize, BOOL bIcon, D
static HINSTANCE hComctl32; static HINSTANCE hComctl32;
static INT shell32_RefCount = 0; static INT shell32_RefCount = 0;
INT shell32_ObjCount = 0; LONG shell32_ObjCount = 0;
HINSTANCE shell32_hInstance; HINSTANCE shell32_hInstance;
HIMAGELIST ShellSmallIconList = 0; HIMAGELIST ShellSmallIconList = 0;
HIMAGELIST ShellBigIconList = 0; HIMAGELIST ShellBigIconList = 0;
...@@ -777,16 +790,12 @@ BOOL WINAPI Shell32LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad) ...@@ -777,16 +790,12 @@ BOOL WINAPI Shell32LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
{ {
case DLL_PROCESS_ATTACH: case DLL_PROCESS_ATTACH:
shell32_RefCount++; shell32_RefCount++;
if (shell32_hInstance) if (shell32_hInstance) return TRUE;
{
ERR("shell32.dll instantiated twice in one address space!\n");
break;
}
shell32_hInstance = hinstDLL; shell32_hInstance = hinstDLL;
hComctl32 = GetModuleHandleA("COMCTL32.DLL");
hComctl32 = LoadLibraryA("COMCTL32.DLL");
hUser32 = GetModuleHandleA("USER32"); hUser32 = GetModuleHandleA("USER32");
DisableThreadLibraryCalls(shell32_hInstance);
if (!hComctl32 || !hUser32) if (!hComctl32 || !hUser32)
{ {
...@@ -855,13 +864,11 @@ BOOL WINAPI Shell32LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad) ...@@ -855,13 +864,11 @@ BOOL WINAPI Shell32LibMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
/* this one is here to check if AddRef/Release is balanced */ /* this one is here to check if AddRef/Release is balanced */
if (shell32_ObjCount) if (shell32_ObjCount)
{ {
WARN("leaving with %u objects left (memory leak)\n", shell32_ObjCount); WARN("leaving with %lu objects left (memory leak)\n", shell32_ObjCount);
} }
} }
FreeLibrary(hComctl32); TRACE("refcount=%u objcount=%lu \n", shell32_RefCount, shell32_ObjCount);
TRACE("refcount=%u objcount=%u \n", shell32_RefCount, shell32_ObjCount);
break; break;
} }
return TRUE; return TRUE;
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
* global SHELL32.DLL variables * global SHELL32.DLL variables
*/ */
extern HINSTANCE shell32_hInstance; extern HINSTANCE shell32_hInstance;
extern INT shell32_ObjCount; extern LONG shell32_ObjCount;
extern HIMAGELIST ShellSmallIconList; extern HIMAGELIST ShellSmallIconList;
extern HIMAGELIST ShellBigIconList; extern HIMAGELIST ShellBigIconList;
extern HDPA sic_hdpa; extern HDPA sic_hdpa;
...@@ -82,11 +82,6 @@ BOOL HCR_GetFolderAttributes (REFIID riid, LPDWORD szDest); ...@@ -82,11 +82,6 @@ BOOL HCR_GetFolderAttributes (REFIID riid, LPDWORD szDest);
DWORD WINAPI ParseFieldA(LPCSTR src,DWORD field,LPSTR dst,DWORD len); DWORD WINAPI ParseFieldA(LPCSTR src,DWORD field,LPSTR dst,DWORD len);
HGLOBAL WINAPI SHAllocShared(LPVOID psrc, DWORD size, DWORD procID);
LPVOID WINAPI SHLockShared(HANDLE hmem, DWORD procID);
BOOL WINAPI SHUnlockShared(HANDLE pmem);
HANDLE WINAPI SHFreeShared(HANDLE hmem, DWORD procID);
/**************************************************************************** /****************************************************************************
* Class constructors * Class constructors
*/ */
...@@ -114,7 +109,6 @@ HRESULT CreateStreamOnFile (LPCSTR pszFilename, IStream ** ppstm); ...@@ -114,7 +109,6 @@ HRESULT CreateStreamOnFile (LPCSTR pszFilename, IStream ** ppstm);
/* fixme: rename the functions when the shell32.dll has it's own exports namespace */ /* fixme: rename the functions when the shell32.dll has it's own exports namespace */
HRESULT WINAPI SHELL32_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID * ppv); HRESULT WINAPI SHELL32_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID * ppv);
HRESULT WINAPI SHELL32_DllCanUnloadNow(void); HRESULT WINAPI SHELL32_DllCanUnloadNow(void);
LRESULT WINAPI SHCoCreateInstance(LPSTR,REFCLSID,LPUNKNOWN,REFIID,LPVOID *);
/* fixme: move away */ /* fixme: move away */
#define ResultFromShort(i) MAKE_SCODE(SEVERITY_SUCCESS, 0, (USHORT)(i)) #define ResultFromShort(i) MAKE_SCODE(SEVERITY_SUCCESS, 0, (USHORT)(i))
...@@ -169,5 +163,5 @@ void InitChangeNotifications(void); ...@@ -169,5 +163,5 @@ void InitChangeNotifications(void);
void FreeChangeNotifications(void); void FreeChangeNotifications(void);
/* file operation */ /* file operation */
BOOL SHELL_DeleteDirectoryA(LPCSTR pszDir); BOOL SHELL_DeleteDirectoryA(LPCSTR pszDir, BOOL bShowUI);
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment