rfvgyhn / min-ed-launcher

Minimal Elite Dangerous Launcher
MIT License
252 stars 9 forks source link

start as a different Windows user throws an exception #69

Closed b166er closed 1 year ago

b166er commented 1 year ago

Hello, I try to start the application in Windows under a different user with this command: C:\Windows\System32\runas.exe /user:user2 /savecred "D:\games\ED\MinEdLauncher.exe /frontier user2 /autorun /autoquit /edo" to separate my ED-Logs, because i have multiple accounts and i would like to play all of them at same time. unfortunately this error comes up:

[23:34:59 INF] Elite Dangerous: Minimal Launcher - v0.7.3+486163a7
[23:34:59 ERR] Couldn't extract salt - System.IO.FileNotFoundException:
IO_FileName_Name, C:\WINDOWS\system32\ClientSupport.dll
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromPath(IntPtr , String , String , ObjectHandleOnStack )
   at System.Runtime.Loader.AssemblyLoadContext.InternalLoadFromPath(String , String )
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String )
   at System.Reflection.Assembly.LoadFrom(String )
   at MinEdLauncher.Cobra.getSalt@53.Invoke(Unit unitVar)
Press any key to quit...

if i try to start just the cmd (C:\Windows\System32\runas.exe /user:user2 /savecred cmd), i see the default start-directory is always C:\Windows\system32, and runas.exe has no option to setup a default startup-working-directory. I already set up a path for gameLocation var in C:\Users\user2\AppData\Local\min-ed-launcher\settings.json but unfortunately it doesn't help.

any suggestions? Why can't min-ed-launcher load all necessary files from gameLocation-Path?

thanks!

rfvgyhn commented 1 year ago

I'm not able to replicate this on my end. Can you post a run from the log file in C:\Users\user2\AppData\Local\min-ed-launcher\min-ed-launcher.log?

b166er commented 1 year ago

call: C:\Windows\System32\runas.exe /user:user2 /savecred "D:\games\ED\MinEdLauncher.exe /frontier user2 /autorun /autoquit /edo"

content of C:\Users\user2\AppData\Local\min-ed-launcher\min-ed-launcher.log is:

2022-10-27 00:49:38.426 +02:00 [INF] Elite Dangerous: Minimal Launcher - v0.7.3+486163a7
2022-10-27 00:49:38.553 +02:00 [DBG] 
    Args: [|"/frontier"; "user2"; "/autorun"; "/autoquit"; "/edo"|]
    OS: Win64
    Env: 

2022-10-27 00:49:38.558 +02:00 [DBG] Reading settings from 'C:\Users\user2\AppData\Local\min-ed-launcher\settings.json'
2022-10-27 00:49:38.863 +02:00 [ERR] Couldn't extract salt - System.IO.FileNotFoundException: 
IO_FileName_Name, C:\WINDOWS\system32\ClientSupport.dll
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromPath(IntPtr , String , String , ObjectHandleOnStack )
   at System.Runtime.Loader.AssemblyLoadContext.InternalLoadFromPath(String , String )
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String )
   at System.Reflection.Assembly.LoadFrom(String )
   at MinEdLauncher.Cobra.getSalt@53.Invoke(Unit unitVar)

my settings C:\Users\user2\AppData\Local\min-ed-launcher\settings.json

{
    "apiUri": "https://api.zaonce.net",
    "watchForCrashes": false,
        "gameLocation": "D:\\games\\ED\\",
    "language": null,
    "autoUpdate": true,
    "maxConcurrentDownloads": 4,
    "forceUpdate": "",
    "processes": [],
    "filterOverrides": [
        { "sku": "FORC-FDEV-DO-1000", "filter": "edo" },
        { "sku": "FORC-FDEV-DO-38-IN-40", "filter": "edh4" }
    ],
    "additionalProducts": []
}

user2 is a standard-user profile with user permissions on my windows (not guest). if i log in as user2 in my windows, i can start the min-ed-launcher without issues, but if i try it under my main user profile with runas.exe, i get the exception as described above.

rfvgyhn commented 1 year ago

You can use the CI build until the next release.

b166er commented 1 year ago

YES! Thank you! I think I just found an alternative solution myself. i created a "start-ed.bat" file with this content:

pushd D:\games\ED
D:\games\ED\MinEdLauncher.exe /frontier user2 /autorun /autoquit /edo

and i call them: C:\Windows\System32\runas.exe /user:user2 /savecred "D:\games\start-ed.bat"

and now it works too :) But of course I would prefer your built-in solution.

b166er commented 1 year ago

You can use the CI build until the next release.

your solution works for me! thank you! now the min-ed-launcher is ready for parallel using with different user accounts in windows! i think you can comment this tickets too, for the solution: #19 #55

hint for preparation:

  1. you need first to login in windows as this user to create a windows-profile in C:\User\USERNAME, then logout and login as primary user
  2. then with primary user execute: C:\Windows\System32\runas.exe /user:YOUR_SECOND_USER /savecred cmd and call min-ed-launcher and legendary, for authentification with frontier/steam/epic account. after auth and setup is complete, you can create a shortcut with: frontier C:\Windows\System32\runas.exe /user:user2 /savecred "PATH-TO-ED\MinEdLauncher.exe /frontier user /autorun /autoquit /edo" legendary for epic: C:\Windows\System32\runas.exe /user:user3 /savecred "D:\games\legendary.exe launch 9c203b6ed35846e8a4a9ff1e314f6593 --override-exe MinEdLauncher.exe /autorun /autoquit /edo" // you need to call the base game instead of DLC: 9c203b6ed35846e8a4a9ff1e314f6593