From: Hermès Bélusca-Maïto Date: Fri, 22 Jun 2018 14:34:16 +0000 (+0200) Subject: [EXPLORER] Simplify the current-shell-is-explorer check when trying to start the... X-Git-Tag: 0.4.11-dev~390 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=12de9654b05d0777451a43e75b640058d7d26440 [EXPLORER] Simplify the current-shell-is-explorer check when trying to start the auto-start programs, by using the existing code. --- diff --git a/base/shell/explorer/explorer.cpp b/base/shell/explorer/explorer.cpp index d6962903228..78c308839c9 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 9369106728f..914add0a3ed 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 125bc0c39f2..b8e048df413 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)