Problem with ShellExecute and HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths

Dan Kegel dank at kegel.com
Sun Dec 29 17:52:21 CST 2002


Duane Clark wrote:
> Dan Kegel wrote:
> 
>> ...
>> I also noticed that ShellExecute will sometimes try to
>> run the executable  "C:\\Program" (the first word of "C:\\Program 
>> Files\\whatever...").
>> I fixed that for the case I touched, I think, but didn't do a general 
>> fix.
> 
> 
> MSDN for CreateProcess claims that if the supplied string is not quoted, 
> then that is the correct behavior.

That is the correct behavior for CreateProcess, yes.
But it is an error for ShellExecute to execute
C:\Program
when it intended to execute
C:\Program Files\Accessories\wordpad.exe

See the "Security Remarks" at the bottom of
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/createprocess.asp
which advise callers of CreateProcess to avoid this pitfall.
- Dan

-- 
Dan Kegel
Linux User #78045
http://www.kegel.com




More information about the wine-devel mailing list