https://git.reactos.org/?p=reactos.git;a=commitdiff;h=12de9654b05d0777451a43e75b640058d7d26440

commit 12de9654b05d0777451a43e75b640058d7d26440
Author:     Hermès Bélusca-Maïto <[email protected]>
AuthorDate: Fri Jun 22 16:34:16 2018 +0200
Commit:     Hermès Bélusca-Maïto <[email protected]>
CommitDate: Fri Jun 22 16:34:16 2018 +0200

    [EXPLORER] Simplify the current-shell-is-explorer check when trying to 
start the auto-start programs, by using the existing code.
---
 base/shell/explorer/explorer.cpp | 16 +++++++++-------
 base/shell/explorer/precomp.h    |  1 +
 base/shell/explorer/startup.cpp  | 17 +----------------
 3 files changed, 11 insertions(+), 23 deletions(-)

diff --git a/base/shell/explorer/explorer.cpp b/base/shell/explorer/explorer.cpp
index d696290322..78c308839c 100644
--- a/base/shell/explorer/explorer.cpp
+++ b/base/shell/explorer/explorer.cpp
@@ -24,7 +24,7 @@
 HINSTANCE hExplorerInstance;
 HANDLE hProcessHeap;
 HKEY hkExplorer = NULL;
-BOOL IsSelfTheShell = FALSE;
+BOOL bExplorerIsShell = FALSE;
 
 class CExplorerModule : public CComModule
 {
@@ -34,8 +34,8 @@ public:
 BEGIN_OBJECT_MAP(ObjectMap)
 END_OBJECT_MAP()
 
-CExplorerModule                             gModule;
-CAtlWinModule                               gWinModule;
+CExplorerModule gModule;
+CAtlWinModule   gWinModule;
 
 static VOID InitializeAtlModule(HINSTANCE hInstance, BOOL bInitialize)
 {
@@ -206,16 +206,18 @@ _tWinMain(IN HINSTANCE hInstance,
 
     InitRSHELL();
 
-#if !WIN7_COMPAT_MODE
-    TRACE("Explorer starting... Commandline: %S\n", lpCmdLine);
+    TRACE("Explorer starting... Command line: %S\n", lpCmdLine);
 
+#if !WIN7_COMPAT_MODE
     if (GetShellWindow() == NULL)
-        IsSelfTheShell = TRUE;
+        bExplorerIsShell = TRUE;
 
-    if (!IsSelfTheShell)
+    if (!bExplorerIsShell)
     {
         return StartWithCommandLine(hInstance);
     }
+#else
+    bExplorerIsShell = TRUE;
 #endif
 
     return StartWithDesktop(hInstance);
diff --git a/base/shell/explorer/precomp.h b/base/shell/explorer/precomp.h
index 9369106728..914add0a3e 100644
--- a/base/shell/explorer/precomp.h
+++ b/base/shell/explorer/precomp.h
@@ -61,6 +61,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(explorernew);
 extern HINSTANCE hExplorerInstance;
 extern HANDLE hProcessHeap;
 extern HKEY hkExplorer;
+extern BOOL bExplorerIsShell;
 
 #define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
 #define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
diff --git a/base/shell/explorer/startup.cpp b/base/shell/explorer/startup.cpp
index 125bc0c39f..b8e048df41 100644
--- a/base/shell/explorer/startup.cpp
+++ b/base/shell/explorer/startup.cpp
@@ -386,21 +386,6 @@ INT ProcessStartupItems(VOID)
     return res ? 0 : 101;
 }
 
-static BOOL IsSelfExplorer(VOID)
-{
-    WCHAR szPath[MAX_PATH], *pch;
-    static const WCHAR szExplorer[] = L"explorer.exe";
-
-    GetModuleFileName(NULL, szPath, _countof(szPath));
-
-    pch = PathFindFileNameW(szPath);
-    if (pch)
-    {
-        return (StrCmpIW(pch, szExplorer) == 0);
-    }
-    return (StrCmpIW(szPath, szExplorer) == 0);
-}
-
 BOOL DoFinishStartupItems(VOID)
 {
     if (s_hStartupMutex)
@@ -416,7 +401,7 @@ BOOL DoStartStartupItems(ITrayWindow *Tray)
 {
     DWORD dwWait;
 
-    if (!IsSelfExplorer())
+    if (!bExplorerIsShell)
         return FALSE;
 
     if (!s_hStartupMutex)

Reply via email to