[EXPLORER]
authorGiannis Adamopoulos <gadamopoulos@reactos.org>
Tue, 9 Dec 2014 21:37:59 +0000 (21:37 +0000)
committerGiannis Adamopoulos <gadamopoulos@reactos.org>
Tue, 9 Dec 2014 21:37:59 +0000 (21:37 +0000)
* Import some undocumented functions directly instead of using GetProcAddress

svn path=/trunk/; revision=65597

reactos/base/shell/explorer/explorer.cpp
reactos/base/shell/explorer/precomp.h
reactos/base/shell/explorer/startmnusite.cpp
reactos/base/shell/explorer/taskswnd.cpp
reactos/base/shell/explorer/traywnd.cpp

index 187201a..e96f632 100644 (file)
 #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);
-    }
 
+    LoadAdvancedSettings();
     InitCommonControls();
     OleInitialize(NULL);
 
index 15171ec..4c84118 100644 (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>
 
 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
index e7dc2ed..18198db 100644 (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;
     }
index 9701ab8..3eb55a2 100644 (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();
index 74a9068..378c4de 100644 (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;