On 12/9/20, Niko Pasanen <n...@pasanen.me> wrote:
>
> So the problem might be that on the Person C's computer, there is actually
> a file called "first" that is creating the error. The reason why I was
> using win32process.CreateProcess like this was that I'm actually using
> pywinauto, which uses  win32process.CreateProcess. I'll have to still test
> this, but apparently this will fix some possible bugs. Thank you!

If you can't use lpApplicationName (preferred if the exact path is
known) because you don't control the code, then just manually quote
the executable path, e.g. pywinauto_call( f'"{exepath}"', ...).

> The results for assoc and ftype are the same on my machine (should be tested
> on person C's pc, too).

The assoc and ftype commands have nothing to do with CreateProcess, so
the suggestion to inspect them isn't particularly relevant. The only
way the desktop shell's ".exe" file association might be relevant is
if it's customized in some way to allow ShellExecuteEx to succeed even
though CreateProcess on its own fails. The default association for
".exe" files defines a template command `"%1" %*`, which tells
ShellExecuteEx to just call CreateProcess with the path of the
executable and the command-line arguments. In theory the ".exe"
association can be changed to proxy process creation with a launcher,
but that would be a wonky thing to do, and it's not relevant to
calling CreateProcess directly.

FYI, assoc and ftype are old CMD shell builtin commands from NT 4.0
(1996) that get and set file associations and the "open" action of
progids (f[ile]type program identifiers) in "HKLM\Software\Classes".
These settings *might* be used by ShellExecuteEx. Nowadays these two
commands are outdated and should not be relied on.
"HKCU\Software\Classes" takes precedence, which these commands do not
show. Numerous other registry keys for primary and fallback settings
have also been added over the years, which these two commands also do
not show. And, what's even more important is that the desktop shell
was changed to cache and permanently store user choices separate from
the default association selection algorithm. Cached choices and the
pinned "UserChoice" are stored in
"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\<extension>".
_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32

Reply via email to