microsoft / winfile

Original Windows File Manager (winfile) with enhancements
MIT License
6.76k stars 699 forks source link

Start admin command prompt in selected directory #367

Closed schinagl closed 1 year ago

schinagl commented 1 year ago

Any comments on this one? Good to go?

malxau-msft commented 1 year ago

Have you looked at bash? I'm wondering what if anything needs doing there. Does it allow arguments to be passed into the VM at all? There's also some indication from the WSL team that it should never be run as Administrator: https://github.com/microsoft/WSL/issues/5727

schinagl commented 1 year ago

Have you looked at bash? I'm wondering what if anything needs doing there. Does it allow arguments to be passed into the VM at all? There's also some indication from the WSL team that it should never be run as Administrator: microsoft/WSL#5727

No I havent't looked into bash, but we could in a separate PR

ScottHollows commented 1 year ago

I logged the original bug. I can test this on any Windows versions from NT to 11 or even earlier, in admin and non-admin accounts. However I would need someone to build a winfile.exe for me and share it to me. Let me know if you want me to do the testing. Thanks for looking into this bug

schinagl commented 1 year ago

There's a "retro" branch trying to target older systems but it doesn't see much development, and changes to how UAC works wouldn't make much sense there.

I created a W2K/WXP branch based on @malxau-msft work/branch with 10.2.0.0 functionality except for symlinks. It can be downloaded here.

ScottHollows commented 1 year ago

Thanks

Ill test that and get back to you tomorrow

Can you do a 32 bit build as most of my machines are 32 prior to Windows 10

Scott

On Sun, 8 Jan 2023 at 9:44 pm, schinagl @.***> wrote:

However I would need someone to build a winfile.exe for me and share it to me. Let me know if you want me to do the testing.

A 64bit Windows version from my private https://github.com/schinagl/winfile/tree/_hermann branch can be downloaded here https://schinagl.priv.at/nt/winfile/winfile.zip. I called this version 10.2.0.3. This is just my internal number.

— Reply to this email directly, view it on GitHub https://github.com/microsoft/winfile/pull/367#issuecomment-1374839931, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6TBYSAA5S2NC5ER6J4CNDWRLADLANCNFSM6AAAAAAS4NFOC4 . You are receiving this because you commented.Message ID: @.***>

-- Scott Hollows Email @.*** Mobile 0417 973 958 LinkedIn www.linkedin.com/in/scotthollows

ScottHollows commented 1 year ago

does your Win7 have UAC enabled, running a split-token Administrator

Im not sure as I cant check now, but Ill test it with and without UAC on Administrator accounts and normal accounts

I can test the 64 bit version on Windows 10 - 11

If anyone can provide a 32 bit compiled exe Ill test that on Windows 7+ and Ill go back as far as WIndows NT just for fun as well.

On Mon, Jan 9, 2023 at 5:46 AM malxau-msft @.***> wrote:

@.**** commented on this pull request.

In src/wfcomman.c https://github.com/microsoft/winfile/pull/367#discussion_r1064206968:

  • if (PathFileExists(szToRun)) {
  • wsprintf(szParams, ConEmuParamFormat, szDir);
  • bUseCmd = FALSE;
  • }
  • }
  • // use cmd.exe if ConEmu doesn't exist or we are running admin mode
  • if (bUseCmd) {
  • // NOTE: assume system directory and "\cmd.exe" never exceed MAXPATHLEN
  • if (GetSystemDirectory(szToRun, MAXPATHLEN) != 0)
  • lstrcat(szToRun, TEXT("\cmd.exe"));
  • else
  • lstrcpy(szToRun, TEXT("cmd.exe"));
  • if (bRunAs) {
  • // Windows >= 8 ignores the 5th parameter of ShellExecute aka 'lpDirectory' when elevating,

Just some theories - does your Win7 have UAC enabled, running a split-token Administrator? (Mine had UAC disabled and I had to enable it and create a new user account to test this PR.)

— Reply to this email directly, view it on GitHub https://github.com/microsoft/winfile/pull/367#discussion_r1064206968, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6TBYW7YWB5KZLHTFOMBT3WRMYTPANCNFSM6AAAAAAS4NFOC4 . You are receiving this because you commented.Message ID: @.***>

malxau-msft commented 1 year ago

Ill go back as far as WIndows NT just for fun as well.

The current build environment emits binaries tagged for Vista and above. I know there are WOW functions used that don't exist in XP, so it may be possible to generate a binary for 2003 and up, but going earlier than that will need code changes.

There's a "retro" branch trying to target older systems but it doesn't see much development, and changes to how UAC works wouldn't make much sense there.

schinagl commented 1 year ago

A 32bit Windows version from my private branch can be downloaded here. I called this version 10.2.0.3. This is just my internal number.

ScottHollows commented 1 year ago

I tested the the release (10.2.0.3 INTERNAL)

Overall, this is an improvement so I would be happy to go ahead with this change.

I have noted a few low priority issues below

I tested variations of :

Windows 7 (32 bit) would not run at all as expected. 1) Error in 32 bit winfile.exe "The program can't start because MSVCP140.dll is missing from your computer. Try reinstalling the program to fix this problem. 2) Error in 64 bit winfile.exe The version of this file is not compatible with the version of Windows you're running. ...

I was not able to find my Windows Vista VM so I couldnt test that

I am a bit suspiscious about the non Administrator account testing as I was able to start an elevated command shell in that account - that does not sound right to me so maybe someone else can test that to verify.

Issues noted during testing

These low priority issues were noted during testing. These are consisent with prior releases

======================================================= Issue #1) SUBST drive mapping does not work with CTRL SHIFT K

steps to reproduce

More info - the Z: logical drive has a label of "OS" which it probably got from C: as that is also "OS"

======================================================= Issue #2) Inconsistent directories when using CTRL K / CTRL SHIFT K for a folder that does not exist

Steps to reproduce

Expected behaviour) the DOS shell should show the same directory when using CTRL K and CTRL SHIFT K

Similar behaviour occurs if the drive is no longer available

======================================================= Issue #3) VMWare Server drive mapping does not work with CTRL SHIFT K

See demonstration Video https://youtu.be/5BdSoOwkYDU

steps to reproduce

More info - the Z: drive has a label of "Shared Folders"

So, a few minor issues but overall it is an improvement and has not broken any other functionality

schinagl commented 1 year ago

@craigwims, @malxau-msft Can we merge this now?

ScottHollows commented 1 year ago

I logged the original issue #365

Please close this as resolved

Thank you to everyone that helped with this