Author: hbelusca
Date: Wed Mar 13 01:35:46 2013
New Revision: 58480
URL: http://svn.reactos.org/svn/reactos?rev=58480&view=rev
Log:
[SHELL32]
Implement the usage of the STARTF_TITLEISLINKNAME flag (in a STARTUPINFO structure, it signals that the program was started from a shell link, and therefore its lpTitle member holds the path of the link).
What I do is that, in CShellLink::InvokeCommand (called when a shortcut is being executed), I initialize the SHELLEXECUTEINFO structure such that we know that we are starting from a shortcut (use the
SEE_MASK_HASLINKNAME flag), and to hold the path to the flag I use its lpClass member (which is not used for other things in this code path). Then the whole thing is passed to ShellExecuteExW which, in turn,
calls the SHELL_ExecuteW function. This function reads the SHELLEXECUTEINFO structure and, if it has the flag SEE_MASK_HASLINKNAME (or SEE_MASK_HASTITLE too, if somebody also uses lpClass to pass a particular
title for the startup), we use the forementioned lpClass member, holding the link path, as the title (lpTitle member) of a new STARTUPINFO object used when calling CreateProcess (and thus, launching the
new application). So that this application will be aware that she was launched via a link (therefore we become compliant with the STARTF_TITLEISLINKNAME documentation).
Modified:
branches/ros-csrss/dll/win32/shell32/shelllink.cpp
branches/ros-csrss/dll/win32/shell32/shelllink.h
branches/ros-csrss/dll/win32/shell32/shlexec.cpp
Modified: branches/ros-csrss/dll/win32/shell32/shelllink.cpp
URL: http://svn.reactos.org/svn/reactos/branches/ros-csrss/dll/win32/shell32/she…
==============================================================================
--- branches/ros-csrss/dll/win32/shell32/shelllink.cpp [iso-8859-1] (original)
+++ branches/ros-csrss/dll/win32/shell32/shelllink.cpp [iso-8859-1] Wed Mar 13 01:35:46 2013
@@ -1825,10 +1825,10 @@
else
path = strdupW(sPath);
- if (lpici->cbSize == sizeof (CMINVOKECOMMANDINFOEX) &&
- (lpici->fMask & CMIC_MASK_UNICODE))
- {
- LPCMINVOKECOMMANDINFOEX iciex = (LPCMINVOKECOMMANDINFOEX) lpici;
+ if ( lpici->cbSize == sizeof(CMINVOKECOMMANDINFOEX) &&
+ (lpici->fMask & CMIC_MASK_UNICODE) )
+ {
+ LPCMINVOKECOMMANDINFOEX iciex = (LPCMINVOKECOMMANDINFOEX)lpici;
DWORD len = 2;
if (sArgs)
@@ -1854,8 +1854,10 @@
SHELLEXECUTEINFOW sei;
memset(&sei, 0, sizeof sei);
sei.cbSize = sizeof sei;
- sei.fMask = SEE_MASK_UNICODE | (lpici->fMask & (SEE_MASK_NOASYNC | SEE_MASK_ASYNCOK | SEE_MASK_FLAG_NO_UI));
+ sei.fMask = SEE_MASK_HASLINKNAME | SEE_MASK_UNICODE |
+ (lpici->fMask & (SEE_MASK_NOASYNC | SEE_MASK_ASYNCOK | SEE_MASK_FLAG_NO_UI));
sei.lpFile = path;
+ sei.lpClass = sLinkPath;
sei.nShow = iShowCmd;
sei.lpDirectory = sWorkDir;
sei.lpParameters = args;
Modified: branches/ros-csrss/dll/win32/shell32/shelllink.h
URL: http://svn.reactos.org/svn/reactos/branches/ros-csrss/dll/win32/shell32/she…
==============================================================================
--- branches/ros-csrss/dll/win32/shell32/shelllink.h [iso-8859-1] (original)
+++ branches/ros-csrss/dll/win32/shell32/shelllink.h [iso-8859-1] Wed Mar 13 01:35:46 2013
@@ -67,11 +67,11 @@
LPWSTR sWorkDir;
LPWSTR sDescription;
LPWSTR sPathRel;
- LPWSTR sProduct;
- LPWSTR sComponent;
+ LPWSTR sProduct;
+ LPWSTR sComponent;
volume_info volume;
- LPWSTR sLinkPath;
- BOOL bRunAs;
+ LPWSTR sLinkPath;
+ BOOL bRunAs;
BOOL bDirty;
INT iIdOpen; /* id of the "Open" entry in the context menu */
CComPtr<IUnknown> site;
Modified: branches/ros-csrss/dll/win32/shell32/shlexec.cpp
URL: http://svn.reactos.org/svn/reactos/branches/ros-csrss/dll/win32/shell32/shl…
==============================================================================
--- branches/ros-csrss/dll/win32/shell32/shlexec.cpp [iso-8859-1] (original)
+++ branches/ros-csrss/dll/win32/shell32/shlexec.cpp [iso-8859-1] Wed Mar 13 01:35:46 2013
@@ -450,6 +450,11 @@
startup.cb = sizeof(STARTUPINFOW);
startup.dwFlags = STARTF_USESHOWWINDOW;
startup.wShowWindow = psei->nShow;
+ startup.lpTitle = (LPWSTR)(psei->fMask & (SEE_MASK_HASLINKNAME | SEE_MASK_HASTITLE) ? psei->lpClass : NULL);
+
+ if (psei->fMask & SEE_MASK_HASLINKNAME)
+ startup.dwFlags |= STARTF_TITLEISLINKNAME;
+
dwCreationFlags = CREATE_UNICODE_ENVIRONMENT;
if (psei->fMask & SEE_MASK_NO_CONSOLE)
Author: hbelusca
Date: Wed Mar 13 01:19:43 2013
New Revision: 58479
URL: http://svn.reactos.org/svn/reactos?rev=58479&view=rev
Log:
[PSDK]
- Define all the missing STARTF_* flags needed for the STARTUPINFO structure (taken from http://msdn.microsoft.com/en-us/library/windows/desktop/ms686331(v=vs.85).a…).
Amongst them is the STARTF_TITLEISLINKNAME flag that I use in the console server to determine whether a console app was started from a shell link, and if so, extract
the name of the link and its icon.
- Define all the missing SEE_MASK_* flags needed for the SHELLEXECUTEINFO structure, but the Windows 8 flag (taken from http://msdn.microsoft.com/en-us/library/windows/desktop/bb759784(v=vs.85).a…).
Furthermore I add three undocumented flags, SEE_MASK_HASLINKNAME, SEE_MASK_HASTITLE and SEE_MASK_FLAG_SEPVDM. These three flags are undocumented and even not present in the official Windows SDK.
However they are used in shobjidl.idl to define some CMIC_MASK_* flags, these ones being mentioned in the MSDN documentation of the CMINVOKECOMMANDINFOEX structure (see http://msdn.microsoft.com/en-us/library/windows/desktop/bb773217(v=vs.85).a…).
So I affect them a range of values which seems to be strangely empty (see the code). Of course their values may differ from the real ones, however I have no way of discovering them. If somebody else
can verify them, it would be great.
Modified:
branches/ros-csrss/include/psdk/shellapi.h
branches/ros-csrss/include/psdk/winbase.h
Modified: branches/ros-csrss/include/psdk/shellapi.h
URL: http://svn.reactos.org/svn/reactos/branches/ros-csrss/include/psdk/shellapi…
==============================================================================
--- branches/ros-csrss/include/psdk/shellapi.h [iso-8859-1] (original)
+++ branches/ros-csrss/include/psdk/shellapi.h [iso-8859-1] Wed Mar 13 01:19:43 2013
@@ -20,23 +20,42 @@
#define ABE_BOTTOM 3
#define ABS_AUTOHIDE 1
#define ABS_ALWAYSONTOP 2
-#define SEE_MASK_CLASSNAME 1
-#define SEE_MASK_CLASSKEY 3
-#define SEE_MASK_IDLIST 4
-#define SEE_MASK_INVOKEIDLIST 12
-#define SEE_MASK_ICON 0x10
-#define SEE_MASK_HOTKEY 0x20
-#define SEE_MASK_NOCLOSEPROCESS 0x40
-#define SEE_MASK_CONNECTNETDRV 0x80
+
+#define SEE_MASK_DEFAULT 0x00000000
+#define SEE_MASK_CLASSNAME 0x00000001
+#define SEE_MASK_CLASSKEY 0x00000003
+#define SEE_MASK_IDLIST 0x00000004
+#define SEE_MASK_INVOKEIDLIST 0x0000000C
+#define SEE_MASK_ICON 0x00000010
+#define SEE_MASK_HOTKEY 0x00000020
+#define SEE_MASK_NOCLOSEPROCESS 0x00000040
+#define SEE_MASK_CONNECTNETDRV 0x00000080
#define SEE_MASK_NOASYNC 0x00000100
#define SEE_MASK_FLAG_DDEWAIT SEE_MASK_NOASYNC
-#define SEE_MASK_DOENVSUBST 0x200
-#define SEE_MASK_FLAG_NO_UI 0x400
-#define SEE_MASK_NO_CONSOLE 0x8000
-#define SEE_MASK_UNICODE 0x10000
-#define SEE_MASK_ASYNCOK 0x100000
-#define SEE_MASK_HMONITOR 0x200000
-#define SEE_MASK_NOZONECHECKS 0x00800000
+#define SEE_MASK_DOENVSUBST 0x00000200
+#define SEE_MASK_FLAG_NO_UI 0x00000400
+#define SEE_MASK_UNICODE 0x00004000
+#define SEE_MASK_NO_CONSOLE 0x00008000
+/*
+ * NOTE: The following three flags are undocumented and are not present in the
+ * official Windows SDK. However they are used in shobjidl.idl to define some
+ * CMIC_MASK_* flags, these ones being mentioned in the MSDN documentation of
+ * the CMINVOKECOMMANDINFOEX structure.
+ * I affect them this range of values which seems to be strangely empty. Of
+ * course their values may differ from the real ones, however I have no way
+ * of discovering them. If somebody else can verify them, it would be great.
+ */
+#define SEE_MASK_HASLINKNAME 0x00010000
+#define SEE_MASK_HASTITLE 0x00020000
+#define SEE_MASK_FLAG_SEPVDM 0x00040000
+/* END NOTE */
+#define SEE_MASK_ASYNCOK 0x00100000
+#define SEE_MASK_HMONITOR 0x00200000
+#define SEE_MASK_NOZONECHECKS 0x00800000
+#define SEE_MASK_NOQUERYCLASSSTORE 0x01000000
+#define SEE_MASK_WAITFORINPUTIDLE 0x02000000
+#define SEE_MASK_FLAG_LOG_USAGE 0x04000000
+
#define ABM_NEW 0
#define ABM_REMOVE 1
#define ABM_QUERYPOS 2
Modified: branches/ros-csrss/include/psdk/winbase.h
URL: http://svn.reactos.org/svn/reactos/branches/ros-csrss/include/psdk/winbase.…
==============================================================================
--- branches/ros-csrss/include/psdk/winbase.h [iso-8859-1] (original)
+++ branches/ros-csrss/include/psdk/winbase.h [iso-8859-1] Wed Mar 13 01:19:43 2013
@@ -467,16 +467,23 @@
#define STREAM_MODIFIED_WHEN_READ 1
#define STREAM_CONTAINS_SECURITY 2
#define STREAM_CONTAINS_PROPERTIES 4
-#define STARTF_USESHOWWINDOW 1
-#define STARTF_USESIZE 2
-#define STARTF_USEPOSITION 4
-#define STARTF_USECOUNTCHARS 8
-#define STARTF_USEFILLATTRIBUTE 16
-#define STARTF_RUNFULLSCREEN 32
-#define STARTF_FORCEONFEEDBACK 64
-#define STARTF_FORCEOFFFEEDBACK 128
-#define STARTF_USESTDHANDLES 256
-#define STARTF_USEHOTKEY 512
+
+#define STARTF_USESHOWWINDOW 0x00000001
+#define STARTF_USESIZE 0x00000002
+#define STARTF_USEPOSITION 0x00000004
+#define STARTF_USECOUNTCHARS 0x00000008
+#define STARTF_USEFILLATTRIBUTE 0x00000010
+#define STARTF_RUNFULLSCREEN 0x00000020
+#define STARTF_FORCEONFEEDBACK 0x00000040
+#define STARTF_FORCEOFFFEEDBACK 0x00000080
+#define STARTF_USESTDHANDLES 0x00000100
+#if (WINVER >= 0x400)
+#define STARTF_USEHOTKEY 0x00000200
+#define STARTF_TITLEISLINKNAME 0x00000800
+#define STARTF_TITLEISAPPID 0x00001000
+#define STARTF_PREVENTPINNING 0x00002000
+#endif /* (WINVER >= 0x400) */
+
#define TC_NORMAL 0
#define TC_HARDERR 1
#define TC_GP_TRAP 2