Author: gadamopoulos Date: Tue Dec 9 21:37:59 2014 New Revision: 65597 URL: http://svn.reactos.org/svn/reactos?rev=65597&view=rev Log: [EXPLORER] * Import some undocumented functions directly instead of using GetProcAddress
Modified: trunk/reactos/base/shell/explorer/explorer.cpp trunk/reactos/base/shell/explorer/precomp.h trunk/reactos/base/shell/explorer/startmnusite.cpp trunk/reactos/base/shell/explorer/taskswnd.cpp trunk/reactos/base/shell/explorer/traywnd.cpp Modified: trunk/reactos/base/shell/explorer/explorer.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/explorer.cpp?rev=65597&r1=65596&r2=65597&view=diff ============================================================================== --- trunk/reactos/base/shell/explorer/explorer.cpp [iso-8859-1] (original) +++ trunk/reactos/base/shell/explorer/explorer.cpp [iso-8859-1] Tue Dec 9 21:37:59 2014 @@ -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 @@ hExplorerInstance = hInstance; hProcessHeap = GetProcessHeap(); + LoadAdvancedSettings(); - - hUser32 = GetModuleHandle(TEXT("USER32.DLL")); - if (hUser32 != NULL) - { - DrawCapTemp = (DRAWCAPTEMP) GetProcAddress(hUser32, PROC_NAME_DRAWCAPTIONTEMP); - } - InitCommonControls(); OleInitialize(NULL); Modified: trunk/reactos/base/shell/explorer/precomp.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/precomp.h?rev=65597&r1=65596&r2=65597&view=diff ============================================================================== --- trunk/reactos/base/shell/explorer/precomp.h [iso-8859-1] (original) +++ trunk/reactos/base/shell/explorer/precomp.h [iso-8859-1] Tue Dec 9 21:37:59 2014 @@ -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> @@ -41,23 +42,6 @@ #include <wine/debug.h> 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)) { \ @@ -65,10 +49,8 @@ } while (0) extern HINSTANCE hExplorerInstance; -extern HMODULE hUser32; extern HANDLE hProcessHeap; extern HKEY hkExplorer; -extern DRAWCAPTEMP DrawCapTemp; /* * dragdrop.c Modified: trunk/reactos/base/shell/explorer/startmnusite.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/startmnusite.cpp?rev=65597&r1=65596&r2=65597&view=diff ============================================================================== --- trunk/reactos/base/shell/explorer/startmnusite.cpp [iso-8859-1] (original) +++ trunk/reactos/base/shell/explorer/startmnusite.cpp [iso-8859-1] Tue Dec 9 21:37:59 2014 @@ -83,26 +83,11 @@ 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; } Modified: trunk/reactos/base/shell/explorer/taskswnd.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/taskswnd.cpp?rev=65597&r1=65596&r2=65597&view=diff ============================================================================== --- trunk/reactos/base/shell/explorer/taskswnd.cpp [iso-8859-1] (original) +++ trunk/reactos/base/shell/explorer/taskswnd.cpp [iso-8859-1] Tue Dec 9 21:37:59 2014 @@ -1312,18 +1312,7 @@ 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 @@ 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(); Modified: trunk/reactos/base/shell/explorer/traywnd.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/traywnd.cpp?rev=65597&r1=65596&r2=65597&view=diff ============================================================================== --- trunk/reactos/base/shell/explorer/traywnd.cpp [iso-8859-1] (original) +++ trunk/reactos/base/shell/explorer/traywnd.cpp [iso-8859-1] Tue Dec 9 21:37:59 2014 @@ -1364,16 +1364,13 @@ 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 @@ DWORD WINAPI RunFileDlgThread() { - HINSTANCE hShell32; - RUNFILEDLG RunFileDlg; HWND hwnd; RECT posRect; @@ -1947,9 +1942,6 @@ NULL); hwndRunFileDlgOwner = hwnd; - - hShell32 = GetModuleHandle(TEXT("SHELL32.DLL")); - RunFileDlg = (RUNFILEDLG) GetProcAddress(hShell32, (LPCSTR) 61); RunFileDlg(hwnd, NULL, NULL, NULL, NULL, RFF_CALCDIRECTORY);