[Bug 51957] Program started via HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths should also be started if extension ".exe" is missing

WineHQ Bugzilla wine-bugs at winehq.org
Wed Nov 3 04:34:08 CDT 2021


https://bugs.winehq.org/show_bug.cgi?id=51957

--- Comment #2 from Louis Lenders <xerox.xerox2000x at gmail.com> ---
Created attachment 70948
  --> https://bugs.winehq.org/attachment.cgi?id=70948
test executable

I did a bit more testing, and it turns out that Autohotkey does successfully
start when you start it via "cmd /c Autohotkey", but it doesn't when trying to
start via the PSconsole. 

So I put extra traces in the in shelexec.c to find the difference and it looks
like essential difference is:
Via cmd  one gets in ShellExecuteExW for sei->lpVerb: L"open"

whereas via PSconsole one gets:
sei->lpVerb NULL

I have attached test-executable that replicates the problem, and source below.
To avoid having to install Autohotkey, it tries to start something outside the
path, like ngen.exe

On windows this successfully is started (via ShellExecuteExW), whereas in wine
this fails.
I`ll see if i try add test to wine

Source of test executable:

#include <windows.h>
#include <stdio.h>

int __cdecl wmain( int argc, WCHAR *argv[] )
{
   HKEY hk;
   WCHAR app_pathW[] = L"Software\\Microsoft\\Windows\\CurrentVersion\\App
Paths\\ngen.exe";
   WCHAR exe_pathW[] =
L"c:\\windows\\MicroSoft.NET\\Framework\\v4.0.30319\\ngen.exe";
   BOOL success = FALSE;
   SHELLEXECUTEINFOW sei;

   memset( &sei, 0, sizeof( sei ) );
   sei.cbSize = sizeof( sei );
  // sei.lpVerb = NULL;
   sei.lpFile = L"ngen";
   sei.fMask = 1344;
   sei.nShow = 1;


   RegCreateKeyW( HKEY_LOCAL_MACHINE, app_pathW, &hk );
   RegSetValueExW(hk, NULL, 0, REG_SZ, (LPBYTE) exe_pathW, sizeof(WCHAR) * (
lstrlenW(exe_pathW)+1));
   RegCloseKey( hk );

   printf("Trying to start ngen via App Paths...\n");
   success = ShellExecuteExW( &sei );

   if ( success )
       printf("successfully started ngen.exe\n");
   else
       printf("No success!!!!!!!!!!!!!\n");

   RegDeleteKeyW( HKEY_LOCAL_MACHINE, app_pathW);
   return 0; 
}

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list