[EXPLORER] Simplify the current-shell-is-explorer check when trying to start the auto-start programs, by using the existing code.

This commit is contained in:
Hermès Bélusca-Maïto 2018-06-22 16:34:16 +02:00
parent 0a8cd95cad
commit 12de9654b0
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
3 changed files with 11 additions and 23 deletions

View file

@ -24,7 +24,7 @@
HINSTANCE hExplorerInstance; HINSTANCE hExplorerInstance;
HANDLE hProcessHeap; HANDLE hProcessHeap;
HKEY hkExplorer = NULL; HKEY hkExplorer = NULL;
BOOL IsSelfTheShell = FALSE; BOOL bExplorerIsShell = FALSE;
class CExplorerModule : public CComModule class CExplorerModule : public CComModule
{ {
@ -34,8 +34,8 @@ public:
BEGIN_OBJECT_MAP(ObjectMap) BEGIN_OBJECT_MAP(ObjectMap)
END_OBJECT_MAP() END_OBJECT_MAP()
CExplorerModule gModule; CExplorerModule gModule;
CAtlWinModule gWinModule; CAtlWinModule gWinModule;
static VOID InitializeAtlModule(HINSTANCE hInstance, BOOL bInitialize) static VOID InitializeAtlModule(HINSTANCE hInstance, BOOL bInitialize)
{ {
@ -206,16 +206,18 @@ _tWinMain(IN HINSTANCE hInstance,
InitRSHELL(); InitRSHELL();
TRACE("Explorer starting... Command line: %S\n", lpCmdLine);
#if !WIN7_COMPAT_MODE #if !WIN7_COMPAT_MODE
TRACE("Explorer starting... Commandline: %S\n", lpCmdLine);
if (GetShellWindow() == NULL) if (GetShellWindow() == NULL)
IsSelfTheShell = TRUE; bExplorerIsShell = TRUE;
if (!IsSelfTheShell) if (!bExplorerIsShell)
{ {
return StartWithCommandLine(hInstance); return StartWithCommandLine(hInstance);
} }
#else
bExplorerIsShell = TRUE;
#endif #endif
return StartWithDesktop(hInstance); return StartWithDesktop(hInstance);

View file

@ -61,6 +61,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(explorernew);
extern HINSTANCE hExplorerInstance; extern HINSTANCE hExplorerInstance;
extern HANDLE hProcessHeap; extern HANDLE hProcessHeap;
extern HKEY hkExplorer; extern HKEY hkExplorer;
extern BOOL bExplorerIsShell;
#define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp)) #define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
#define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp)) #define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))

View file

@ -386,21 +386,6 @@ INT ProcessStartupItems(VOID)
return res ? 0 : 101; 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) BOOL DoFinishStartupItems(VOID)
{ {
if (s_hStartupMutex) if (s_hStartupMutex)
@ -416,7 +401,7 @@ BOOL DoStartStartupItems(ITrayWindow *Tray)
{ {
DWORD dwWait; DWORD dwWait;
if (!IsSelfExplorer()) if (!bExplorerIsShell)
return FALSE; return FALSE;
if (!s_hStartupMutex) if (!s_hStartupMutex)