mirror of
https://github.com/reactos/reactos.git
synced 2026-05-22 23:30:07 +08:00
Suppose you copy a CPL file (e.g. console.dll renamed into console.cpl)
into a path containing spaces, for example into the Desktop:
C:\Documents and Settings\Administrator\Desktop\console.cpl
If the shell registry value for the "open" action of 'cplfile' does not
contain quotes around %1, then the Control_RunDLL function will attempt
to load "C:\Documents" as a file, which of course does not exist.
(NOTE: Missing in ReactOS: Doing a PathFindOnPath() or a PathFileExists()
call to verify that the file actually exists, instead of blindly trying
to run it and failing later in kernel32!LoadExecuteExW ...)
Adding quotes around the %1 fixes this and the correct file is being
loaded.
This behaviour has been confirmed to exist e.g. on Windows Server 2003
too (and is thus *NOT* a bug in ReactOS/Wine's Control_RunDLL
implementation).
----------------------
How to confirm this behaviour, in Win2k3 x86:
1. Start Win2k3 in debug mode under WinDbg. Ensure you have the debug
symbols available.
2. Once loaded, break into the debugger, attach context to explorer.exe,
and enter the magical :) single WinDbg command (all in one line, with
**NO inserted newlines!!**):
bp shell32!CPL_RunMeBaby ".echo \"CPL CmdLine:\"; ?? (wchar_t*)*(void**)(@esp+12);
bp SHLWAPI!PathIsFileSpecW \".echo \\\"CPL Path:\\\"; ?? (wchar_t*)*(void**)(@esp+4);
bc \\\"SHLWAPI!PathIsFileSpecW\\\"; g;\"; g"
(Explanation:
a breakpoint is placed in the internal shell32!CPL_RunMeBaby function.
When the bp is hit, it runs the large WinDbg command inside the quotes.
This command echoes an informative line, then dumps the 3rd parameter
of the function on the stack that contains the CPL command-line.
It then adds a new breakpoint in SHLWAPI!PathIsFileSpecW, which is the
function that is being called *just after* the internal parsing of the
CPL command-line, and will verify whether the extracted CPL path does
exist. That new breakpoint in turn will run a WinDbg command that will:
(i) Display the CPL file path (1st-param of that new function), then
(ii) Clear that breakpoint. Finally, automatic continuation ensues.)
3. On vanilla Win2k3, whose 'cplfile' "open" action does contain the
quotes around %1:
rundll32.exe shell32.dll,Control_RunDLL "%1",%*
you will observe the following:
CPL CmdLine:
wchar_t * 0x00094e30
""C:\Documents and Settings\Administrator\Desktop\console.cpl","
CPL Path:
wchar_t * 0x0007f898
"C:\Documents and Settings\Administrator\Desktop\console.cpl"
Notice the extra pair of quotes around the CPL filename in the CmdLine.
4. When modifying the 'cplfile' "open" action by *removing* the quotes
around %1, you will instead see the following, thereby confirming
the behaviour, which is now identical to what used to happen in ROS:
CPL CmdLine:
wchar_t * 0x00094e30
"C:\Documents and Settings\Administrator\Desktop\console.cpl,"
CPL Path:
wchar_t * 0x0007f898
"C:\Documents"
Due to the (now) absence of quotes around %1, the command-line gets
wrongly parsed and the extracted file path is incorrect.
======================== ReactOS™ Version 0.4.x Updated October 9, 2021 ======================== 1. What is ReactOS? ------------------- ReactOS™ is an Open Source effort to develop a quality operating system that is compatible with applications and drivers written for the Microsoft® Windows™ NT family of operating systems (NT4, 2000, XP, 2003, Vista, 7). More information is available at: https://reactos.org 2. Relationship with the WINE project ------------------------------------- ReactOS has always intended to work with the WINE project to share as much programming effort as possible. This mainly concerns User Mode DLLs and still happens to a degree today. Other areas of cooperation lie in applications and testing suites. 3. Future compatibility ----------------------- The ReactOS project, although currently focused on Windows Server 2003 compatibility, is always keeping an eye toward compatibility with Windows Vista and future Windows NT releases. 4. Supporting other System Applications --------------------------------------- The Windows NT architecture allows for subsystems, as does the ReactOS architecture. A subsystem is an implementation of the APIs of another operating system, allowing ReactOS to run applications from other systems. We are already looking at subsystems for: Java, OS/2, and DOS and possibly others in the future. 5. Is ReactOS legal? -------------------- Yes we are. All the code of ReactOS has been written from scratch by our developers. We go to great lengths to ensure that the code our developers create is clean, same applies to the variety of methods we use to understand Windows internals, including clean room reverse engineering, using existing documentation freely available both in books and on the web, using extensive tests (tens of millions) which apply black box engineering methods against both public and private APIs exposed by the operating system. 6. Tutorials ------------ Developer and User Tutorials: https://reactos.org/wiki The tutorials contain more information on the project, compiling and testing ReactOS - amongst other topics. Contributors to the project are always welcome. 7. Frequently Asked Questions ----------------------------- Some of your questions may be answered in: https://reactos.org/faq In addition, the ReactOS forum: https://reactos.org/forum may contain complementary, yet non-official, information. 8. Authors ---------- This document was originally written by Jason Filby (jasonfilby@yahoo.com) and is now occasionally updated by various contributors.