ReactOS  0.4.13-dev-479-gec9c8fd
explorer.cpp File Reference
#include "precomp.h"
#include <browseui_undoc.h>
Include dependency graph for explorer.cpp:

Go to the source code of this file.

Classes

class  CExplorerModule
 

Functions

static VOID InitializeAtlModule (HINSTANCE hInstance, BOOL bInitialize)
 
static BOOL SetShellReadyEvent (IN LPCWSTR lpEventName)
 
static VOID HideMinimizedWindows (IN BOOL bHide)
 
static INT StartWithCommandLine (IN HINSTANCE hInstance)
 
static INT StartWithDesktop (IN HINSTANCE hInstance)
 
INT WINAPI _tWinMain (IN HINSTANCE hInstance, IN HINSTANCE hPrevInstance, IN LPTSTR lpCmdLine, IN INT nCmdShow)
 

Variables

HINSTANCE hExplorerInstance
 
HANDLE hProcessHeap
 
HKEY hkExplorer = NULL
 
BOOL bExplorerIsShell = FALSE
 
CExplorerModule gModule
 
CAtlWinModule gWinModule
 

Function Documentation

◆ _tWinMain()

INT WINAPI _tWinMain ( IN HINSTANCE  hInstance,
IN HINSTANCE  hPrevInstance,
IN LPTSTR  lpCmdLine,
IN INT  nCmdShow 
)

Definition at line 196 of file explorer.cpp.

200 {
201  /*
202  * Set our shutdown parameters: we want to shutdown the very last,
203  * but before any TaskMgr instance (which has a shutdown level of 1).
204  */
206 
207  InitRSHELL();
208 
209  TRACE("Explorer starting... Command line: %S\n", lpCmdLine);
210 
211 #if !WIN7_COMPAT_MODE
212  if (GetShellWindow() == NULL)
214 
215  if (!bExplorerIsShell)
216  {
218  }
219 #else
221 #endif
222 
223  return StartWithDesktop(hInstance);
224 }
HWND WINAPI GetShellWindow(VOID)
Definition: desktop.c:651
#define TRUE
Definition: types.h:120
BOOL bExplorerIsShell
Definition: explorer.cpp:27
static INT StartWithDesktop(IN HINSTANCE hInstance)
Definition: explorer.cpp:114
VOID InitRSHELL(VOID)
Definition: rshell.cpp:27
BOOL WINAPI SetProcessShutdownParameters(IN DWORD dwLevel, IN DWORD dwFlags)
Definition: proc.c:979
HINSTANCE hInstance
Definition: charmap.c:20
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static INT StartWithCommandLine(IN HINSTANCE hInstance)
Definition: explorer.cpp:92

◆ HideMinimizedWindows()

static VOID HideMinimizedWindows ( IN BOOL  bHide)
static

Definition at line 71 of file explorer.cpp.

72 {
74 
75  mm.cbSize = sizeof(mm);
76  if (!SystemParametersInfoW(SPI_GETMINIMIZEDMETRICS, sizeof(mm), &mm, 0))
77  {
78  ERR("SystemParametersInfoW failed with %lu\n", GetLastError());
79  return;
80  }
81  if (bHide)
82  mm.iArrange |= ARW_HIDE;
83  else
84  mm.iArrange &= ~ARW_HIDE;
85  if (!SystemParametersInfoW(SPI_SETMINIMIZEDMETRICS, sizeof(mm), &mm, 0))
86  ERR("SystemParametersInfoW failed with %lu\n", GetLastError());
87 }
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI SystemParametersInfoW(_In_ UINT, _In_ UINT, _Inout_opt_ PVOID, _In_ UINT)
#define ERR(fmt,...)
Definition: debug.h:109
#define ARW_HIDE
Definition: winuser.h:1066

Referenced by StartWithDesktop().

◆ InitializeAtlModule()

static VOID InitializeAtlModule ( HINSTANCE  hInstance,
BOOL  bInitialize 
)
static

Definition at line 40 of file explorer.cpp.

41 {
42  if (bInitialize)
43  {
44  gModule.Init(ObjectMap, hInstance, NULL);
45  }
46  else
47  {
48  gModule.Term();
49  }
50 }
void Term()
Definition: atlbase.h:820
HRESULT Init(_ATL_OBJMAP_ENTRY *p, HINSTANCE, const GUID *plibid)
Definition: atlbase.h:797
HINSTANCE hInstance
Definition: charmap.c:20
smooth NULL
Definition: ftsmooth.c:416
CExplorerModule gModule
Definition: explorer.cpp:37

Referenced by StartWithDesktop().

◆ SetShellReadyEvent()

static BOOL SetShellReadyEvent ( IN LPCWSTR  lpEventName)
static

Definition at line 54 of file explorer.cpp.

55 {
56  HANDLE hEvent;
57 
58  hEvent = OpenEventW(EVENT_MODIFY_STATE, FALSE, lpEventName);
59  if (hEvent != NULL)
60  {
62 
64  return TRUE;
65  }
66 
67  return FALSE;
68 }
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:679
HANDLE WINAPI DECLSPEC_HOTPATCH OpenEventW(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN LPCWSTR lpName)
Definition: synch.c:628
static HANDLE hEvent
Definition: comm.c:54
smooth NULL
Definition: ftsmooth.c:416
#define EVENT_MODIFY_STATE
Definition: winbase.h:163

Referenced by StartWithDesktop().

◆ StartWithCommandLine()

static INT StartWithCommandLine ( IN HINSTANCE  hInstance)
static

Definition at line 92 of file explorer.cpp.

93 {
94  BOOL b = FALSE;
95  EXPLORER_CMDLINE_PARSE_RESULTS parseResults = { 0 };
96 
97  if (SHExplorerParseCmdLine(&parseResults))
98  b = SHCreateFromDesktop(&parseResults);
99 
100  if (parseResults.strPath)
101  SHFree(parseResults.strPath);
102 
103  if (parseResults.pidlPath)
104  ILFree(parseResults.pidlPath);
105 
106  if (parseResults.pidlRoot)
107  ILFree(parseResults.pidlRoot);
108 
109  return b;
110 }
void WINAPI ILFree(LPITEMIDLIST pidl)
Definition: pidl.c:925
unsigned int BOOL
Definition: ntddk_ex.h:94
#define b
Definition: ke_i.h:79
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
BOOL WINAPI SHCreateFromDesktop(ExplorerCommandLineParseResults *parseResults)
Definition: desktopipc.cpp:606
UINT_PTR WINAPI SHExplorerParseCmdLine(ExplorerCommandLineParseResults *pInfo)
void WINAPI SHFree(LPVOID pv)
Definition: shellole.c:331

Referenced by _tWinMain().

◆ StartWithDesktop()

static INT StartWithDesktop ( IN HINSTANCE  hInstance)
static

Definition at line 114 of file explorer.cpp.

115 {
117 
119  L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer",
121  {
122  WCHAR Message[256];
125  return 1;
126  }
127 
130 
132 
135 
136 #if !WIN7_COMPAT_MODE
137  /* Initialize shell dde support */
139 #endif
140 
141  /* Initialize shell icons */
143 
144  /* Initialize CLSID_ShellWindows class */
145  _WinList_Init();
146 
148  CreateTrayWindow(&Tray);
149 
150 #if !WIN7_DEBUG_MODE
151  /* This not only hides the minimized window captions in the bottom
152  left screen corner, but is also needed in order to receive
153  HSHELL_* notification messages (which are required for taskbar
154  buttons to work right) */
156 
157  HANDLE hShellDesktop = NULL;
158  if (Tray != NULL)
159  hShellDesktop = DesktopCreateWindow(Tray);
160 
161  /* WinXP: Notify msgina to hide the welcome screen */
162  if (!SetShellReadyEvent(L"msgina: ShellReadyEvent"))
163  SetShellReadyEvent(L"Global\\msgina: ShellReadyEvent");
164 
165  if (DoStartStartupItems(Tray))
166  {
169  }
170 #endif
171 
172  if (Tray != NULL)
173  {
174  TrayMessageLoop(Tray);
175 #if !WIN7_DEBUG_MODE
177 #endif
178  }
179 
180 #if !WIN7_DEBUG_MODE
181  if (hShellDesktop != NULL)
182  DesktopDestroyShellWindow(hShellDesktop);
183 #endif
184 
185  OleUninitialize();
186 
188  hkExplorer = NULL;
189 
191 
192  return 0;
193 }
#define TRUE
Definition: types.h:120
INT ProcessStartupItems(VOID)
Definition: startup.cpp:336
#define ERROR_SUCCESS
Definition: deptool.c:10
#define _countof(array)
Definition: fontsub.cpp:30
#define HKEY_CURRENT_USER
Definition: winreg.h:11
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
VOID TrayMessageLoop(IN OUT ITrayWindow *Tray)
static VOID HideMinimizedWindows(IN BOOL bHide)
Definition: explorer.cpp:71
VOID DesktopDestroyShellWindow(IN HANDLE hDesktop)
Definition: desktop.cpp:133
HKEY hkExplorer
Definition: explorer.cpp:26
HINSTANCE hInstance
Definition: charmap.c:20
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
static BOOL SetShellReadyEvent(IN LPCWSTR lpEventName)
Definition: explorer.cpp:54
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3296
smooth NULL
Definition: ftsmooth.c:416
TaskbarSettings g_TaskbarSettings
Definition: settings.cpp:23
BOOL WINAPI FileIconInit(BOOL bFullInit)
Definition: shellord.c:1298
#define GetProcessHeap()
Definition: compat.h:395
__wchar_t WCHAR
Definition: xmlstorage.h:180
HINSTANCE hExplorerInstance
Definition: explorer.cpp:24
HRESULT CreateTrayWindow(ITrayWindow **ppTray)
Definition: traywnd.cpp:3390
void WINAPI _ShellDDEInit(BOOL bInit)
Definition: rshell.cpp:139
CHAR Message[80]
Definition: alive.c:5
static const WCHAR L[]
Definition: oid.c:1250
static VOID InitializeAtlModule(HINSTANCE hInstance, BOOL bInitialize)
Definition: explorer.cpp:40
#define MB_ICONERROR
Definition: winuser.h:781
#define MessageBox
Definition: winuser.h:5688
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:172
HANDLE DesktopCreateWindow(IN OUT ITrayWindow *Tray)
Definition: desktop.cpp:118
BOOL DoFinishStartupItems(VOID)
Definition: startup.cpp:389
VOID WINAPI InitCommonControls(void)
Definition: commctrl.c:863
DWORD WINAPI _WinList_Init(void)
Definition: rshell.cpp:110
HANDLE hProcessHeap
Definition: explorer.cpp:25
#define IDS_STARTUP_ERROR
Definition: resource.h:97
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:233
BOOL DoStartStartupItems(ITrayWindow *Tray)
Definition: startup.cpp:400

Referenced by _tWinMain().

Variable Documentation

◆ bExplorerIsShell

BOOL bExplorerIsShell = FALSE

Definition at line 27 of file explorer.cpp.

Referenced by _tWinMain(), and DoStartStartupItems().

◆ gModule

CExplorerModule gModule

Definition at line 37 of file explorer.cpp.

Referenced by InitializeAtlModule().

◆ gWinModule

CAtlWinModule gWinModule

Definition at line 38 of file explorer.cpp.

◆ hExplorerInstance

◆ hkExplorer

◆ hProcessHeap

HANDLE hProcessHeap

Definition at line 25 of file explorer.cpp.

Referenced by StartWithDesktop().