[EXPLORER]

* Import some undocumented functions directly instead of using GetProcAddress

svn path=/trunk/; revision=65597
This commit is contained in:
Giannis Adamopoulos 2014-12-09 21:37:59 +00:00
parent 5503ce60e6
commit 8264611855
5 changed files with 12 additions and 87 deletions

View file

@ -22,10 +22,8 @@
#include <browseui_undoc.h>
HINSTANCE hExplorerInstance;
HMODULE hUser32;
HANDLE hProcessHeap;
HKEY hkExplorer = NULL;
DRAWCAPTEMP DrawCapTemp = NULL;
class CExplorerModule : public CComModule
{
@ -137,14 +135,8 @@ StartWithDesktop(IN HINSTANCE hInstance)
hExplorerInstance = hInstance;
hProcessHeap = GetProcessHeap();
LoadAdvancedSettings();
hUser32 = GetModuleHandle(TEXT("USER32.DLL"));
if (hUser32 != NULL)
{
DrawCapTemp = (DRAWCAPTEMP) GetProcAddress(hUser32, PROC_NAME_DRAWCAPTIONTEMP);
}
InitCommonControls();
OleInitialize(NULL);

View file

@ -28,6 +28,7 @@
#include <strsafe.h>
#include <undocuser.h>
#include <shlwapi_undoc.h>
#include <shlobj_undoc.h>
#include <shlguid_undoc.h>
#include <undocshell.h>
@ -42,33 +43,14 @@
WINE_DEFAULT_DEBUG_CHANNEL(explorernew);
/* dynamic imports due to lack of support in msvc linker libs */
typedef INT(APIENTRY *REGSHELLHOOK)(HWND, DWORD);
#ifdef UNICODE
#define PROC_NAME_DRAWCAPTIONTEMP "DrawCaptionTempW"
typedef BOOL(APIENTRY *DRAWCAPTEMP)(HWND, HDC, const RECT*, HFONT, HICON, LPCWSTR, UINT);
#else
#define PROC_NAME_DRAWCAPTIONTEMP "DrawCaptionTempA"
typedef BOOL (APIENTRY *DRAWCAPTEMP)(HWND, HDC, const RECT*, HFONT, HICON, LPCSTR, UINT);
#endif
typedef HRESULT(APIENTRY *SHINVDEFCMD)(HWND, IShellFolder*, LPCITEMIDLIST);
typedef void (APIENTRY *RUNFILEDLG)(HWND, HICON, LPCWSTR, LPCWSTR, LPCWSTR, UINT);
typedef void (APIENTRY *EXITWINDLG)(HWND);
typedef HRESULT(APIENTRY *SHWINHELP)(HWND, LPWSTR, UINT, DWORD);
/* Constants for RunFileDlg */
#define RFF_CALCDIRECTORY 0x04 /* Calculates the working directory from the file name. */
#define ASSERT(cond) \
do if (!(cond)) { \
Win32DbgPrint(__FILE__, __LINE__, "ASSERTION %s FAILED!\n", #cond); \
} while (0)
extern HINSTANCE hExplorerInstance;
extern HMODULE hUser32;
extern HANDLE hProcessHeap;
extern HKEY hkExplorer;
extern DRAWCAPTEMP DrawCapTemp;
/*
* dragdrop.c

View file

@ -83,26 +83,11 @@ public:
IN IShellFolder *pShellFolder,
IN LPCITEMIDLIST pidl)
{
HMODULE hShlwapi;
HRESULT ret = S_FALSE;
TRACE("ITrayPriv::Execute\n");
hShlwapi = GetModuleHandle(TEXT("SHLWAPI.DLL"));
if (hShlwapi != NULL)
{
SHINVDEFCMD SHInvokeDefCmd;
/* SHInvokeDefaultCommand */
SHInvokeDefCmd = (SHINVDEFCMD) GetProcAddress(hShlwapi,
(LPCSTR) ((LONG) 279));
if (SHInvokeDefCmd != NULL)
{
ret = SHInvokeDefCmd(Tray->GetHWND(),
pShellFolder,
pidl);
}
}
ret = SHInvokeDefaultCommand(Tray->GetHWND(), pShellFolder, pidl);
return ret;
}

View file

@ -1312,18 +1312,7 @@ public:
TRACE("ShellHookMsg got assigned number %d\n", ShellHookMsg);
HMODULE hShell32 = GetModuleHandle(TEXT("SHELL32.DLL"));
if (hShell32 != NULL)
{
REGSHELLHOOK RegShellHook;
/* RegisterShellHook */
RegShellHook = (REGSHELLHOOK) GetProcAddress(hShell32, (LPCSTR) ((LONG) 181));
if (RegShellHook != NULL)
{
RegShellHook(m_hWnd, 3); /* 1 if no NT! We're targeting NT so we don't care! */
}
}
RegisterShellHook(m_hWnd, 3); /* 1 if no NT! We're targeting NT so we don't care! */
RefreshWindowList();
@ -1338,25 +1327,10 @@ public:
LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
HMODULE hShell32;
IsDestroying = TRUE;
/* Unregister the shell hook */
hShell32 = GetModuleHandle(TEXT("SHELL32.DLL"));
if (hShell32 != NULL)
{
REGSHELLHOOK RegShellHook;
/* RegisterShellHook */
RegShellHook = (REGSHELLHOOK) GetProcAddress(hShell32,
(LPCSTR) ((LONG) 181));
if (RegShellHook != NULL)
{
RegShellHook(m_hWnd,
FALSE);
}
}
RegisterShellHook(m_hWnd, FALSE);
CloseThemeData(TaskBandTheme);
DeleteAllTasks();

View file

@ -1364,16 +1364,13 @@ DefSize:
if (hIconStart != NULL)
Flags |= DC_ICON;
if (DrawCapTemp != NULL)
{
Ret = DrawCapTemp(NULL,
hDC,
&rcButton,
hStartBtnFont,
hIconStart,
szStartCaption,
Flags);
}
DrawCaptionTemp(NULL,
hDC,
&rcButton,
hStartBtnFont,
hIconStart,
szStartCaption,
Flags);
SelectObject(hDC,
hbmpOld);
@ -1926,8 +1923,6 @@ SetStartBtnImage:
DWORD WINAPI RunFileDlgThread()
{
HINSTANCE hShell32;
RUNFILEDLG RunFileDlg;
HWND hwnd;
RECT posRect;
@ -1948,9 +1943,6 @@ SetStartBtnImage:
hwndRunFileDlgOwner = hwnd;
hShell32 = GetModuleHandle(TEXT("SHELL32.DLL"));
RunFileDlg = (RUNFILEDLG) GetProcAddress(hShell32, (LPCSTR) 61);
RunFileDlg(hwnd, NULL, NULL, NULL, NULL, RFF_CALCDIRECTORY);
hwndRunFileDlgOwner = NULL;