launch all registered Shell Service Objects (Systray, network icons,
...)
Modified: trunk/reactos/subsys/system/explorer/Makefile
Modified: trunk/reactos/subsys/system/explorer/Makefile.MinGW
Modified: trunk/reactos/subsys/system/explorer/Makefile.PCH
Modified: trunk/reactos/subsys/system/explorer/Makefile.Wine
Modified: trunk/reactos/subsys/system/explorer/explorer.cpp
Modified: trunk/reactos/subsys/system/explorer/explorer.dsp
Modified: trunk/reactos/subsys/system/explorer/externals.h
Added: trunk/reactos/subsys/system/explorer/services/
Added: trunk/reactos/subsys/system/explorer/services/shellservices.cpp
Added: trunk/reactos/subsys/system/explorer/services/shellservices.h
Added: trunk/reactos/subsys/system/explorer/services/startup.c
Modified: trunk/reactos/subsys/system/explorer/shell/pane.cpp
Modified: trunk/reactos/subsys/system/explorer/shell/regfs.cpp
Deleted: trunk/reactos/subsys/system/explorer/shell/startup.c
Modified: trunk/reactos/subsys/system/explorer/taskbar/desktopbar.cpp
Modified: trunk/reactos/subsys/system/explorer/taskbar/desktopbar.h
Modified: trunk/reactos/subsys/system/explorer/taskbar/taskbar.cpp
Modified: trunk/reactos/subsys/system/explorer/taskbar/traynotify.cpp
Modified: trunk/reactos/subsys/system/explorer/taskbar/traynotify.h
Modified: trunk/reactos/subsys/system/explorer/utility/utility.cpp
Modified: trunk/reactos/subsys/system/explorer/utility/utility.h
Modified: trunk/reactos/subsys/system/explorer/utility/window.cpp
_____
Modified: trunk/reactos/subsys/system/explorer/Makefile
--- trunk/reactos/subsys/system/explorer/Makefile 2005-03-28
02:50:23 UTC (rev 14360)
+++ trunk/reactos/subsys/system/explorer/Makefile 2005-03-28
09:16:50 UTC (rev 14361)
@@ -45,10 +45,11 @@
shell/pane.o \
shell/regfs.o \
shell/shellbrowser.o \
- shell/startup.o \
shell/unixfs.o \
shell/webchild.o \
shell/winfs.o \
+ services/startup.o \
+ services/shellservices.o \
taskbar/desktopbar.o \
taskbar/taskbar.o \
taskbar/startmenu.o \
_____
Modified: trunk/reactos/subsys/system/explorer/Makefile.MinGW
--- trunk/reactos/subsys/system/explorer/Makefile.MinGW 2005-03-28
02:50:23 UTC (rev 14360)
+++ trunk/reactos/subsys/system/explorer/Makefile.MinGW 2005-03-28
09:16:50 UTC (rev 14361)
@@ -38,7 +38,7 @@
EXEC_SUFFIX = .exe
RES_SUFFIX = .coff
-VPATH = shell utility taskbar desktop dialogs
+VPATH = shell utility taskbar desktop dialogs services
PROGRAM = explorer
@@ -51,6 +51,7 @@
window.o \
dragdropimpl.o \
shellbrowserimpl.o \
+ shellservices.o \
explorer.o \
entries.o \
winfs.o \
_____
Modified: trunk/reactos/subsys/system/explorer/Makefile.PCH
--- trunk/reactos/subsys/system/explorer/Makefile.PCH 2005-03-28
02:50:23 UTC (rev 14360)
+++ trunk/reactos/subsys/system/explorer/Makefile.PCH 2005-03-28
09:16:50 UTC (rev 14361)
@@ -39,7 +39,7 @@
EXEC_SUFFIX = .exe
RES_SUFFIX = .coff
-VPATH = shell utility taskbar desktop dialogs
+VPATH = shell utility taskbar desktop dialogs services
PROGRAM = explorer
@@ -69,6 +69,7 @@
desktopbar.o \
taskbar.o \
startmenu.o \
+ shellservices.o \
traynotify.o \
quicklaunch.o \
favorites.o \
_____
Modified: trunk/reactos/subsys/system/explorer/Makefile.Wine
--- trunk/reactos/subsys/system/explorer/Makefile.Wine 2005-03-28
02:50:23 UTC (rev 14360)
+++ trunk/reactos/subsys/system/explorer/Makefile.Wine 2005-03-28
09:16:50 UTC (rev 14361)
@@ -10,7 +10,7 @@
EXTRALIBS = $(LIBUUID)
C_SRCS = \
- shell/startup.c \
+ services/startup.c \
utility/splitpath.c
CPP_SRCS = \
@@ -34,6 +34,7 @@
shell/regfs.cpp \
shell/fatfs.cpp \
shell/webchild.cpp \
+ services/shellservices.cpp \
taskbar/desktopbar.cpp \
taskbar/taskbar.cpp \
taskbar/startmenu.cpp \
_____
Modified: trunk/reactos/subsys/system/explorer/explorer.cpp
--- trunk/reactos/subsys/system/explorer/explorer.cpp 2005-03-28
02:50:23 UTC (rev 14360)
+++ trunk/reactos/subsys/system/explorer/explorer.cpp 2005-03-28
09:16:50 UTC (rev 14361)
@@ -41,7 +41,9 @@
#include "dialogs/settings.h" // for MdiSdiDlg
+#include "services/shellservices.h"
+
extern "C" int initialize_gdb_stub(); // start up GDB stub
@@ -829,7 +831,9 @@
// another undocumented event: "Global\\msgina:
ReturnToWelcome"
if (!SetShellReadyEvent(TEXT("msgina:
ShellReadyEvent")))
SetShellReadyEvent(TEXT("Global\\msgina:
ShellReadyEvent"));
+ }
+ if (!any_desktop_running) {
// launch the shell DDE server
if (g_SHDOCVW_ShellDDEInit)
(*g_SHDOCVW_ShellDDEInit)(TRUE);
@@ -868,37 +872,54 @@
g_Globals.read_persistent();
if (startup_desktop) {
+ WaitCursor wait;
+
g_Globals._desktops.init();
g_Globals._hwndDesktop = DesktopWindow::Create();
#ifdef _USE_HDESK
g_Globals._desktops.get_current_Desktop()->_hwndDesktop
= g_Globals._hwndDesktop;
#endif
+ }
- /**TODO launching autostart programs can be moved into a
background thread. */
- if (autostart) {
- char* argv[] = {"", "s"}; // call startup
routine in SESSION_START mode
- startup(2, argv);
- }
+ if (g_Globals._hwndDesktop)
+ g_Globals._desktop_mode = true;
+
+ Thread* pSSOThread = NULL;
+
+ if (startup_desktop) {
+ // launch SSO thread to allow message processing
independent from the explorer main thread
+ pSSOThread = new SSOThread;
+ pSSOThread->Start();
}
+ /**TODO launching autostart programs can be moved into a
background thread. */
+ if (autostart) {
+ char* argv[] = {"", "s"}; // call startup routine
in SESSION_START mode
+ startup(2, argv);
+ }
+
/**TODO fix command line handling */
if (*lpCmdLine=='"' &&
lpCmdLine[_tcslen(lpCmdLine)-1]=='"') {
++lpCmdLine;
lpCmdLine[_tcslen(lpCmdLine)-1] = '\0';
}
- if (g_Globals._hwndDesktop)
- g_Globals._desktop_mode = true;
-
int ret = explorer_main(hInstance, lpCmdLine, nShowCmd);
// write configuration file
g_Globals.write_persistent();
- // shutdown the shell DDE server
- if (g_SHDOCVW_ShellDDEInit)
- (*g_SHDOCVW_ShellDDEInit)(FALSE);
+ if (pSSOThread) {
+ pSSOThread->Stop();
+ delete pSSOThread;
+ }
+ if (!any_desktop_running) {
+ // shutdown the shell DDE server
+ if (g_SHDOCVW_ShellDDEInit)
+ (*g_SHDOCVW_ShellDDEInit)(FALSE);
+ }
+
return ret;
}
_____
Modified: trunk/reactos/subsys/system/explorer/explorer.dsp
--- trunk/reactos/subsys/system/explorer/explorer.dsp 2005-03-28
02:50:23 UTC (rev 14360)
+++ trunk/reactos/subsys/system/explorer/explorer.dsp 2005-03-28
09:16:50 UTC (rev 14361)
@@ -702,11 +702,6 @@
# End Source File
# Begin Source File
-SOURCE=.\shell\startup.c
-# SUBTRACT CPP /YX /Yc /Yu
-# End Source File
-# Begin Source File
-
SOURCE=.\shell\unixfs.cpp
# PROP Exclude_From_Build 1
# End Source File
@@ -785,5 +780,22 @@
SOURCE=.\precomp.h
# End Source File
# End Group
+# Begin Group "services"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE=.\services\shellservices.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\services\shellservices.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\services\startup.c
+# SUBTRACT CPP /YX /Yc /Yu
+# End Source File
+# End Group
# End Target
# End Project
_____
Modified: trunk/reactos/subsys/system/explorer/externals.h
--- trunk/reactos/subsys/system/explorer/externals.h 2005-03-28
02:50:23 UTC (rev 14360)
+++ trunk/reactos/subsys/system/explorer/externals.h 2005-03-28
09:16:50 UTC (rev 14361)
@@ -31,9 +31,6 @@
#endif
- // launch start programs
-extern int startup(int argc, char *argv[]);
-
// explorer main routine
extern int explorer_main(HINSTANCE hinstance, LPTSTR lpCmdLine, int
cmdshow);
_____
Added: trunk/reactos/subsys/system/explorer/services/shellservices.cpp
--- trunk/reactos/subsys/system/explorer/services/shellservices.cpp
2005-03-28 02:50:23 UTC (rev 14360)
+++ trunk/reactos/subsys/system/explorer/services/shellservices.cpp
2005-03-28 09:16:50 UTC (rev 14361)
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2005 Martin Fuchs
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
+ */
+
+
+ //
+ // Explorer clone
+ //
+ // shellservices.cpp
+ //
+ // Martin Fuchs, 28.03.2005
+ //
+
+
+#include "precomp.h"
+
+#include "shellservices.h"
+
+
+int SSOThread::Run()
+{
+ ComInit
usingCOM(COINIT_APARTMENTTHREADED|COINIT_DISABLE_OLE1DDE|COINIT_SPEED_OV
ER_MEMORY);
+
+ HKEY hkey;
+ CLSID clsid;
+ WCHAR name[MAX_PATH], value[MAX_PATH];
+
+ typedef vector<SIfacePtr<IOleCommandTarget>*> SSOVector;
+ SSOVector sso_ptrs;
+
+ if (!RegOpenKey(HKEY_LOCAL_MACHINE,
TEXT("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\ShellServiceObjectDe
layLoad"), &hkey)) {
+ for(int idx=0; ; ++idx) {
+ DWORD name_len = MAX_PATH;
+ DWORD value_len = sizeof(value);
+
+ if (RegEnumValueW(hkey, idx, name, &name_len, 0,
NULL, (LPBYTE)&value, &value_len))
+ break;
+
+ if (!_alive)
+ break;
+
+ SIfacePtr<IOleCommandTarget>* sso_ptr = new
SIfacePtr<IOleCommandTarget>;
+
+ if (CLSIDFromString(value, &clsid) == NOERROR) {
+ if
(SUCCEEDED(sso_ptr->CreateInstance(clsid, IID_IOleCommandTarget))) {
+ if
(SUCCEEDED((*sso_ptr)->Exec(&CGID_ShellServiceObject, OLECMDID_NEW,
OLECMDEXECOPT_DODEFAULT, NULL, NULL)))
+
sso_ptrs.push_back(sso_ptr);
+ }
+ }
+ }
+
+ RegCloseKey(hkey);
+ }
+
+ MSG msg;
+
+ while(_alive) {
+ if (MsgWaitForMultipleObjects(1, &_evtFinish, FALSE,
INFINITE, QS_ALLINPUT) == WAIT_OBJECT_0+0)
+ break; // _evtFinish has been set.
+
+ while(_alive) {
+ if (!PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
+ break;
+
+ if (msg.message == WM_QUIT)
+ break;
+
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+ }
+
+ // shutdown all running Shell Service Objects
+ for(SSOVector::iterator it=sso_ptrs.begin(); it!=sso_ptrs.end();
++it) {
+ SIfacePtr<IOleCommandTarget>* sso_ptr = *it;
+ (*sso_ptr)->Exec(&CGID_ShellServiceObject,
OLECMDID_SAVE, OLECMDEXECOPT_DODEFAULT, NULL, NULL);
+ delete sso_ptr;
+ }
+
+ return 0;
+}
Property changes on:
trunk/reactos/subsys/system/explorer/services/shellservices.cpp
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
_____
Added: trunk/reactos/subsys/system/explorer/services/shellservices.h
--- trunk/reactos/subsys/system/explorer/services/shellservices.h
2005-03-28 02:50:23 UTC (rev 14360)
+++ trunk/reactos/subsys/system/explorer/services/shellservices.h
2005-03-28 09:16:50 UTC (rev 14361)
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2005 Martin Fuchs
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
+ */
+
+
+ //
+ // Explorer clone
+ //
+ // shellservices.h
+ //
+ // Martin Fuchs, 28.03.2005
+ //
+
+
+ // launch start programs
+extern "C" int startup(int argc, char *argv[]);
+
+ // load Shell Service Objects (volume control, printer/network icons,
...)
+struct SSOThread : public Thread
+{
+ int Run();
+};
Property changes on:
trunk/reactos/subsys/system/explorer/services/shellservices.h
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
_____
Copied: trunk/reactos/subsys/system/explorer/services/startup.c (from
rev 14354, trunk/reactos/subsys/system/explorer/shell/startup.c)
_____
Modified: trunk/reactos/subsys/system/explorer/shell/pane.cpp
--- trunk/reactos/subsys/system/explorer/shell/pane.cpp 2005-03-28
02:50:23 UTC (rev 14360)
+++ trunk/reactos/subsys/system/explorer/shell/pane.cpp 2005-03-28
09:16:50 UTC (rev 14361)
@@ -163,7 +163,7 @@
HKEY hkeyExplorer = 0;
DWORD len = sizeof(_clrCompressed);
- if (RegOpenKey(HKEY_CURRENT_USER,
TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer"),
&hkeyExplorer) ||
+ if (RegOpenKey(HKEY_CURRENT_USER,
TEXT("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer"),
&hkeyExplorer) ||
RegQueryValueEx(hkeyExplorer, TEXT("AltColor"), 0, NULL,
(LPBYTE)&_clrCompressed, &len) || len!=sizeof(_clrCompressed))
_clrCompressed = RGB(0,0,255);
_____
Modified: trunk/reactos/subsys/system/explorer/shell/regfs.cpp
--- trunk/reactos/subsys/system/explorer/shell/regfs.cpp
2005-03-28 02:50:23 UTC (rev 14360)
+++ trunk/reactos/subsys/system/explorer/shell/regfs.cpp
2005-03-28 09:16:50 UTC (rev 14361)
@@ -43,9 +43,9 @@
_tcscpy(buffer, (LPCTSTR)_path);
LPTSTR pname = buffer + _tcslen(buffer);
- HKEY hKey;
+ HKEY hkey;
- if (!RegOpenKeyEx(_hKeyRoot, *buffer=='\\'?buffer+1:buffer, 0,
STANDARD_RIGHTS_READ|KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS, &hKey)) {
+ if (!RegOpenKeyEx(_hKeyRoot, *buffer=='\\'?buffer+1:buffer, 0,
STANDARD_RIGHTS_READ|KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS, &hkey)) {
if (pname[-1] != '\\')
*pname++ = '\\';
@@ -60,7 +60,7 @@
DWORD name_len = MAX_PATH;
DWORD class_len = MAX_PATH;
- if (RegEnumKeyEx(hKey, idx, name, &name_len, 0,
class_name, &class_len, &w32fd.ftLastWriteTime))
+ if (RegEnumKeyEx(hkey, idx, name, &name_len, 0,
class_name, &class_len, &w32fd.ftLastWriteTime))
break;
w32fd.dwFileAttributes |=
FILE_ATTRIBUTE_DIRECTORY;
@@ -88,7 +88,7 @@
TCHAR value[MAX_PATH];
LONG value_len = sizeof(value);
- if (!RegQueryValue(hKey, NULL, value, &value_len) &&
value_len>1) {
+ if (!RegQueryValue(hkey, NULL, value, &value_len) &&
value_len>1) {
memset(&w32fd, 0, sizeof(WIN32_FIND_DATA));
lstrcpy(w32fd.cFileName, TEXT("(Default)"));
@@ -114,7 +114,7 @@
for(int idx=0; ; ++idx) {
DWORD name_len = MAX_PATH;
- if (RegEnumValue(hKey, idx, name, &name_len, 0,
&type, NULL, NULL))
+ if (RegEnumValue(hkey, idx, name, &name_len, 0,
&type, NULL, NULL))
break;
memset(&w32fd, 0, sizeof(WIN32_FIND_DATA));
@@ -147,7 +147,7 @@
TCHAR value[MAX_PATH];
DWORD value_len = sizeof(value);
- if (!RegQueryValueEx(hKey, name, NULL, NULL,
(LPBYTE)value, &value_len)) {
+ if (!RegQueryValueEx(hkey, name, NULL, NULL,
(LPBYTE)value, &value_len)) {
if (type==REG_SZ || type==REG_EXPAND_SZ
|| type==REG_LINK)
entry->_content =
_tcsdup(value);
else if (type == REG_DWORD) {
@@ -171,7 +171,7 @@
if (last)
last->_next = NULL;
- RegCloseKey(hKey);
+ RegCloseKey(hkey);
}
_down = first_entry;
_____
Deleted: trunk/reactos/subsys/system/explorer/shell/startup.c
--- trunk/reactos/subsys/system/explorer/shell/startup.c
2005-03-28 02:50:23 UTC (rev 14360)
+++ trunk/reactos/subsys/system/explorer/shell/startup.c
2005-03-28 09:16:50 UTC (rev 14361)
@@ -1,485 +0,0 @@
-/*
- * Copyright (C) 2002 Andreas Mohr
- * Copyright (C) 2002 Shachar Shemesh
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
- */
-
-/* Based on the Wine "bootup" handler application
- *
- * This app handles the various "hooks" windows allows for applications
to perform
- * as part of the bootstrap process. Theses are roughly devided into
three types.
- * Knowledge base articles that explain this are 137367, 179365, 232487
and 232509.
- * Also, 119941 has some info on grpconv.exe
- * The operations performed are (by order of execution):
- *
- * Preboot (prior to fully loading the Windows kernel):
- * - wininit.exe (rename operations left in wininit.ini - Win 9x only)
- * - PendingRenameOperations (rename operations left in the registry -
Win NT+ only)
- *
- * Startup (before the user logs in)
- * - Services (NT, ?semi-synchronous?, not implemented yet)
- * -
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServices
Once (9x, asynch)
- * -
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunServices
(9x, asynch)
- *
- * After log in
- * -
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce
(all, synch)
- * - HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
(all, asynch)
- * - HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
(all, asynch)
- * - Startup folders (all, ?asynch?, no imp)
- * -
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce
(all, asynch)
- *
- * Somewhere in there is processing the RunOnceEx entries (also no imp)
- *
- * Bugs:
- * - If a pending rename registry does not start with \??\ the entry is
- * processed anyways. I'm not sure that is the Windows behaviour.
- * - Need to check what is the windows behaviour when trying to delete
files
- * and directories that are read-only
- * - In the pending rename registry processing - there are no traces of
the files
- * processed (requires translations from Unicode to Ansi).
- */
-
-#include <stdio.h>
-#include <windows.h>
-#include <ctype.h>
-
-/**
- * Performs the rename operations dictated in %SystemRoot%\Wininit.ini.
- * Returns FALSE if there was an error, or otherwise if all is ok.
- */
-static BOOL wininit()
-{
- return TRUE;
-}
-
-static BOOL pendingRename()
-{
- static const WCHAR ValueName[] =
{'P','e','n','d','i','n','g',
-
'F','i','l','e','R','e','n','a','m','e',
-
'O','p','e','r','a','t','i','o','n','s',0};
- static const WCHAR SessionW[] = {
'S','y','s','t','e','m','\\',
-
'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\'
,
-
'C','o','n','t','r','o','l','\\',
-
'S','e','s','s','i','o','n','
','M','a','n','a','g','e','r',0};
- WCHAR *buffer=NULL;
- const WCHAR *src=NULL, *dst=NULL;
- DWORD dataLength=0;
- HKEY hSession=NULL;
- DWORD res;
-
- printf("Entered\n");
-
- if ((res=RegOpenKeyExW(HKEY_LOCAL_MACHINE, SessionW, 0,
KEY_ALL_ACCESS, &hSession))
- !=ERROR_SUCCESS)
- {
- if (res==ERROR_FILE_NOT_FOUND)
- {
- printf("The key was not found - skipping\n");
- res=TRUE;
- }
- else
- {
- printf("Couldn't open key, error %ld\n", res);
- res=FALSE;
- }
-
- goto end;
- }
-
- res=RegQueryValueExW(hSession, ValueName, NULL, NULL /* The value
type does not really interest us, as it is not
- truely a
REG_MULTI_SZ anyways */,
- NULL, &dataLength);
- if (res==ERROR_FILE_NOT_FOUND)
- {
- /* No value - nothing to do. Great! */
- printf("Value not present - nothing to rename\n");
- res=TRUE;
- goto end;
- }
-
- if (res!=ERROR_SUCCESS)
- {
- printf("Couldn't query value's length (%ld)\n", res);
- res=FALSE;
- goto end;
- }
-
- buffer=malloc(dataLength);
- if (buffer==NULL)
- {
- printf("Couldn't allocate %lu bytes for the value\n",
dataLength);
- res=FALSE;
- goto end;
- }
-
- res=RegQueryValueExW(hSession, ValueName, NULL, NULL,
(LPBYTE)buffer, &dataLength);
- if (res!=ERROR_SUCCESS)
- {
- printf("Couldn't query value after successfully querying before
(%lu),\n"
- "please report to wine-devel(a)winehq.org\n"quot;, res);
- res=FALSE;
- goto end;
- }
-
- /* Make sure that the data is long enough and ends with two NULLs.
This
- * simplifies the code later on.
- */
- if (dataLength<2*sizeof(buffer[0]) ||
- buffer[dataLength/sizeof(buffer[0])-1]!='\0' ||
- buffer[dataLength/sizeof(buffer[0])-2]!='\0')
- {
- printf("Improper value format - doesn't end with NULL\n");
- res=FALSE;
- goto end;
- }
-
- for(src=buffer; (src-buffer)*sizeof(src[0])<dataLength &&
*src!='\0';
- src=dst+lstrlenW(dst)+1)
- {
- DWORD dwFlags=0;
-
- printf("processing next command\n");
-
- dst=src+lstrlenW(src)+1;
-
- /* We need to skip the \??\ header */
- if (src[0]=='\\' && src[1]=='?' &&
src[2]=='?' && src[3]=='\\')
- src+=4;
-
- if (dst[0]=='!')
- {
- dwFlags|=MOVEFILE_REPLACE_EXISTING;
- dst++;
- }
-
- if (dst[0]=='\\' && dst[1]=='?' &&
dst[2]=='?' && dst[3]=='\\')
- dst+=4;
-
- if (*dst!='\0')
- {
- /* Rename the file */
- MoveFileExW(src, dst, dwFlags);
- } else
- {
- /* Delete the file or directory */
- res = GetFileAttributesW (src);
- if (res != (DWORD)-1)
- {
- if ((res&FILE_ATTRIBUTE_DIRECTORY)==0)
- {
- /* It's a file */
- DeleteFileW(src);
- } else
- {
- /* It's a directory */
- RemoveDirectoryW(src);
- }
- } else
- {
- printf("couldn't get file attributes (%ld)\n",
GetLastError());
- }
- }
- }
-
- if ((res=RegDeleteValueW(hSession, ValueName))!=ERROR_SUCCESS)
- {
- printf("Error deleting the value (%lu)\n", GetLastError());
- res=FALSE;
- } else
- res=TRUE;
-
-end:
- if (buffer!=NULL)
- free(buffer);
-
- if (hSession!=NULL)
- RegCloseKey(hSession);
-
- return res;
-}
-
-enum runkeys {
- RUNKEY_RUN, RUNKEY_RUNONCE, RUNKEY_RUNSERVICES,
RUNKEY_RUNSERVICESONCE
-};
-
-const WCHAR runkeys_names[][30]=
-{
- {'R','u','n',0},
-
{'R','u','n','O','n','c','e',0},
-
{'R','u','n','S','e','r','v','i','c','e','s',0},
-
{'R','u','n','S','e','r','v','i','c','e','s','O','n','c','e',0}
-};
-
-#define INVALID_RUNCMD_RETURN -1
-/**
- * This function runs the specified command in the specified dir.
- * [in,out] cmdline - the command line to run. The function may change
the passed buffer.
- * [in] dir - the dir to run the command in. If it is NULL, then the
current dir is used.
- * [in] wait - whether to wait for the run program to finish before
returning.
- * [in] minimized - Whether to ask the program to run minimized.
- *
- * Returns:
- * If running the process failed, returns INVALID_RUNCMD_RETURN. Use
GetLastError to get the error code.
- * If wait is FALSE - returns 0 if successful.
- * If wait is TRUE - returns the program's return value.
- */
-static int runCmd(LPWSTR cmdline, LPCWSTR dir, BOOL wait, BOOL
minimized)
-{
- STARTUPINFOW si;
- PROCESS_INFORMATION info;
- DWORD exit_code=0;
-
- memset(&si, 0, sizeof(si));
- si.cb=sizeof(si);
- if (minimized)
- {
- si.dwFlags=STARTF_USESHOWWINDOW;
- si.wShowWindow=SW_MINIMIZE;
- }
- memset(&info, 0, sizeof(info));
-
- if (!CreateProcessW(NULL, cmdline, NULL, NULL, FALSE, 0, NULL, dir,
&si, &info))
- {
- printf("Failed to run command (%ld)\n", GetLastError());
-
- return INVALID_RUNCMD_RETURN;
- }
-
- printf("Successfully ran command\n"); //%s - Created process handle
%p\n",
- //wine_dbgstr_w(cmdline), info.hProcess);
-
- if (wait)
- { /* wait for the process to exit */
- WaitForSingleObject(info.hProcess, INFINITE);
- GetExitCodeProcess(info.hProcess, &exit_code);
- }
-
- CloseHandle(info.hProcess);
-
- return exit_code;
-}
-
-/**
- * Process a "Run" type registry key.
- * hkRoot is the HKEY from which
"Software\Microsoft\Windows\CurrentVersion" is
- * opened.
- * szKeyName is the key holding the actual entries.
- * bDelete tells whether we should delete each value right before
executing it.
- * bSynchronous tells whether we should wait for the prog to complete
before
- * going on to the next prog.
- */
-static BOOL ProcessRunKeys(HKEY hkRoot, LPCWSTR szKeyName, BOOL
bDelete,
- BOOL bSynchronous)
-{
- static const WCHAR
WINKEY_NAME[]={'S','o','f','t','w','a','r','e','\\',
-
'M','i','c','r','o','s','o','f','t','\\','W','i','n','d','o','w','s','\\
',
-
'C','u','r','r','e','n','t','V','e','r','s','i','o','n',0};
- HKEY hkWin=NULL, hkRun=NULL;
- LONG res=ERROR_SUCCESS;
- DWORD i, nMaxCmdLine=0, nMaxValue=0;
- WCHAR *szCmdLine=NULL;
- WCHAR *szValue=NULL;
-
- if (hkRoot==HKEY_LOCAL_MACHINE)
- wprintf(L"processing %s entries under HKLM\n", szKeyName);
- else
- wprintf(L"processing %s entries under HKCU\n", szKeyName);
-
- if ((res=RegOpenKeyExW(hkRoot, WINKEY_NAME, 0, KEY_READ,
&hkWin))!=ERROR_SUCCESS)
- {
- printf("RegOpenKey failed on
Software\\Microsoft\\Windows\\CurrentVersion (%ld)\n",
- res);
-
- goto end;
- }
-
- if ((res=RegOpenKeyExW(hkWin, szKeyName, 0,
bDelete?KEY_ALL_ACCESS:KEY_READ, &hkRun))!=
- ERROR_SUCCESS)
- {
- if (res==ERROR_FILE_NOT_FOUND)
- {
- printf("Key doesn't exist - nothing to be done\n");
-
- res=ERROR_SUCCESS;
- }
- else
- printf("RegOpenKey failed on run key (%ld)\n", res);
-
- goto end;
- }
-
- if ((res=RegQueryInfoKeyW(hkRun, NULL, NULL, NULL, NULL, NULL,
NULL, &i, &nMaxValue,
- &nMaxCmdLine, NULL, NULL))!=ERROR_SUCCESS)
- {
- printf("Couldn't query key info (%ld)\n", res);
-
- goto end;
- }
-
- if (i==0)
- {
- printf("No commands to execute.\n");
-
- res=ERROR_SUCCESS;
- goto end;
- }
-
- if ((szCmdLine=malloc(nMaxCmdLine))==NULL)
- {
- printf("Couldn't allocate memory for the commands to be
executed\n");
-
- res=ERROR_NOT_ENOUGH_MEMORY;
- goto end;
- }
-
- if ((szValue=malloc((++nMaxValue)*sizeof(*szValue)))==NULL)
- {
- printf("Couldn't allocate memory for the value names\n");
-
- res=ERROR_NOT_ENOUGH_MEMORY;
- goto end;
- }
-
- while(i>0)
- {
- DWORD nValLength=nMaxValue, nDataLength=nMaxCmdLine;
- DWORD type;
-
- --i;
-
- if ((res=RegEnumValueW(hkRun, i, szValue, &nValLength, 0,
&type,
- (LPBYTE)szCmdLine,
&nDataLength))!=ERROR_SUCCESS)
- {
- printf("Couldn't read in value %ld - %ld\n", i, res);
-
- continue;
- }
-
- if (bDelete && (res=RegDeleteValueW(hkRun,
szValue))!=ERROR_SUCCESS)
- {
- printf("Couldn't delete value - %ld, %ld. Running command
anyways.\n", i, res);
- }
-
- if (type!=REG_SZ)
- {
- printf("Incorrect type of value #%ld (%ld)\n", i, type);
-
- continue;
- }
-
- if ((res=runCmd(szCmdLine, NULL, bSynchronous,
FALSE))==INVALID_RUNCMD_RETURN)
- {
- printf("Error running cmd #%ld (%ld)\n", i,
GetLastError());
- }
-
- printf("Done processing cmd #%ld\n", i);
- }
-
- res=ERROR_SUCCESS;
-
-end:
- if (hkRun!=NULL)
- RegCloseKey(hkRun);
- if (hkWin!=NULL)
- RegCloseKey(hkWin);
-
- printf("done\n");
-
- return res==ERROR_SUCCESS?TRUE:FALSE;
-}
-
- /// structure holding startup flags
-struct op_mask {
- BOOL w9xonly; /* Perform only operations done on Windows 9x */
- BOOL ntonly; /* Perform only operations done on Windows NT */
- BOOL startup; /* Perform the operations that are performed every
boot */
- BOOL preboot; /* Perform file renames typically done before the
system starts */
- BOOL prelogin; /* Perform the operations typically done before the
user logs in */
- BOOL postlogin; /* Operations done after login */
-};
-
-static const struct op_mask
- SESSION_START = {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE},
- SETUP = {FALSE, FALSE, FALSE, TRUE, TRUE,
TRUE};
-#define DEFAULT SESSION_START
-
-int startup(int argc, char *argv[])
-{
- struct op_mask ops; /* Which of the ops do we want to perform? */
- /* First, set the current directory to SystemRoot */
- TCHAR gen_path[MAX_PATH];
- DWORD res;
-
- res = GetWindowsDirectory(gen_path, sizeof(gen_path));
-
- if (res==0)
- {
- printf("Couldn't get the windows directory - error
%ld\n",
- GetLastError());
-
- return 100;
- }
-
- if (res>=sizeof(gen_path))
- {
- printf("Windows path too long (%ld)\n", res);
-
- return 100;
- }
-
- if (!SetCurrentDirectory(gen_path))
- {
- wprintf(L"Cannot set the dir to %s (%ld)\n", gen_path,
GetLastError());
-
- return 100;
- }
-
- if (argc>1)
- {
- switch(argv[1][0])
- {
- case 'r': /* Restart */
- ops=SETUP;
- break;
- case 's': /* Full start */
- ops=SESSION_START;
- break;
- default:
- ops=DEFAULT;
- break;
- }
- } else
- ops=DEFAULT;
-
- /* Perform the ops by order, stopping if one fails, skipping if
necessary */
- /* Shachar: Sorry for the perl syntax */
- res=(ops.ntonly || !ops.preboot || wininit()) &&
- (ops.w9xonly || !ops.preboot || pendingRename()) &&
- (ops.ntonly || !ops.prelogin ||
- ProcessRunKeys(HKEY_LOCAL_MACHINE,
runkeys_names[RUNKEY_RUNSERVICESONCE], TRUE, FALSE)) &&
- (ops.ntonly || !ops.prelogin || !ops.startup ||
- ProcessRunKeys(HKEY_LOCAL_MACHINE,
runkeys_names[RUNKEY_RUNSERVICES], FALSE, FALSE)) &&
- (!ops.postlogin ||
- ProcessRunKeys(HKEY_LOCAL_MACHINE,
runkeys_names[RUNKEY_RUNONCE], TRUE, TRUE)) &&
- (!ops.postlogin || !ops.startup ||
- ProcessRunKeys(HKEY_LOCAL_MACHINE, runkeys_names[RUNKEY_RUN],
FALSE, FALSE)) &&
- (!ops.postlogin || !ops.startup ||
- ProcessRunKeys(HKEY_CURRENT_USER, runkeys_names[RUNKEY_RUN],
FALSE, FALSE));
-
- printf("Operation done\n");
-
- return res?0:101;
-}
_____
Modified: trunk/reactos/subsys/system/explorer/taskbar/desktopbar.cpp
--- trunk/reactos/subsys/system/explorer/taskbar/desktopbar.cpp
2005-03-28 02:50:23 UTC (rev 14360)
+++ trunk/reactos/subsys/system/explorer/taskbar/desktopbar.cpp
2005-03-28 09:16:50 UTC (rev 14361)
@@ -41,7 +41,11 @@
DesktopBar::DesktopBar(HWND hwnd)
: super(hwnd),
+#ifdef _ROS_
_trayIcon(hwnd, ID_TRAY_VOLUME)
+#else
+ WM_TASKBARCREATED(RegisterWindowMessage(WINMSG_TASKBARCREATED))
+#endif
{
SetWindowIcon(hwnd, IDI_REACTOS/*IDI_SEARCH*/); // icon in for
TrayNotifyDlg
@@ -107,6 +111,12 @@
// create tray notification area
_hwndNotify = NotifyArea::Create(_hwnd);
+
+ // notify all top level windows about the successfully created
desktop bar
+ //@@ Use SendMessage() instead of PostMessage() to avoid
problems with delayed created shell service objects?
+ PostMessage(HWND_BROADCAST, WM_TASKBARCREATED, 0, 0);
+
+
_hwndQuickLaunch = QuickLaunchBar::Create(_hwnd);
// create rebar window to manage task and quick launch bar
@@ -147,11 +157,9 @@
SendMessage(_hwndrebar, RB_INSERTBAND, (WPARAM)-1,
(LPARAM)&rbBand);
#endif
+
RegisterHotkeys();
- // notify all top level windows about the successfully created
desktop bar
- PostMessage(HWND_BROADCAST, WM_TASKBARCREATED, 0, 0);
-
// prepare Startmenu, but hide it for now
_startMenuRoot = GET_WINDOW(StartMenuRoot,
StartMenuRoot::Create(_hwnd));
@@ -332,6 +340,7 @@
PostMessage(_hwndQuickLaunch, PM_UPDATE_DESKTOP,
desktop_idx, 0);
break;}
+#ifdef _ROS_
case ID_TRAY_VOLUME:
launch_file(_hwnd, TEXT("sndvol32.exe"), SW_SHOWNORMAL);
// launch volume control application
break;
@@ -339,6 +348,7 @@
case ID_VOLUME_PROPERTIES:
launch_cpanel(_hwnd, TEXT("mmsys.cpl"));
break;
+#endif
default:
if (_hwndQuickLaunch)
@@ -381,6 +391,8 @@
[truncated at 1000 lines; 377 more skipped]