Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start admin command prompt in selected directory #367

Merged
merged 3 commits into from
Jan 14, 2023

Conversation

schinagl
Copy link
Contributor

No description provided.

@schinagl
Copy link
Contributor Author

schinagl commented Jan 6, 2023

Any comments on this one?
Good to go?

src/wfcomman.c Outdated Show resolved Hide resolved
src/wfcomman.c Outdated Show resolved Hide resolved
@malxau-msft
Copy link
Contributor

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

@schinagl
Copy link
Contributor Author

schinagl commented Jan 8, 2023

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
Copy link

ScottHollows commented Jan 8, 2023

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
Copy link
Contributor Author

schinagl commented Jan 8, 2023

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
Copy link

ScottHollows commented Jan 8, 2023 via email

@ScottHollows
Copy link

ScottHollows commented Jan 9, 2023 via email

@malxau-msft
Copy link
Contributor

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
Copy link
Contributor Author

schinagl commented Jan 9, 2023

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
Copy link

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 10 and Windows 11
  • 32 and 64 bit versions of File Manager
  • UAC enabled and UAC disabled
  • Administrator account and non Administrator account
  • Hard and soft symbolic links
  • Drive mapping via Registry "DOS Devices"

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

  • Windows 10 and Windows 11
  • create a folder c:\temp
  • start a DOS command shell in normal mode (not "As Administrator")
    start -- run -- command
  • Type this DOS command to map the logical drive Z: to the folder
    SUBST C:\TEMP Z:
    Z: drive will not appear if Explorer and also in File Manager
  • Start file manager 32 or 64 bit as normal, not as Administrator
  • Select the Z: drive
  • Press CTRL K - a command shell opens with Z:\ as the current directory - PASS
  • Press CTRL SHIFT K - FAIL
    EXPECTED) A command shell opens with Z:\C_TEMP as the current directory
    ACTUAL) A command shell opens with C:\WINDOWS\SYSTEM32 as the current directory

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

  • Windows 10 and Windows 11
  • Start file manager
  • Create a nested folder C:\TEMP\TEST_1\TEST_2
  • In File Manager select the folder C:\TEMP\TEST_1
    The TEST_2 folder will be visible in the left or right hand pane
  • start an explorer or dos shell ... then delete the C:\TEMP\TEST_1\TEST_2 fodler
  • Return to File Manager and the C:\TEMP\TEST_1\TEST_2 folder is still visible
  • In File Manager select the C:\TEMP\TEST_1\TEST_2 folder (this folder no longer exists)
  • Press CTRL K - a command shell opens with C:\ as the current folder
  • Press CTRL SHIFT K - a command shell opens with C:\WINDOWS\SYSTEM32 as the current folder

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

  • VMware Server running a Windows 10 or Windows 11 virtual machien

  • VM -- Settings -- Options -- Shared Folders
    Enable shared fodlers
    and add C:TEMP as a shared folder, mapped to C_TEMP

  • Start the VM

  • Z: drive will be mounted and will show Z:\C_TEMP

  • Start winfile (32 or 64 bit) in normal mode
    (winfile wont see the Z:\ drive if you start it in Admininistrator mode, so use normal mode)

  • In File Manager, select the folder Z:\C_TEMP

  • Press SHIFT CTRL K

  • EXPECTED) A command shell opens with Z:\C_TEMP as the current directory

  • ACTUAL) A command shell opens with C:\WINDOWS\SYSTEM32 as the current directory

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
Copy link
Contributor Author

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

@malxau-msft malxau-msft merged commit eb6ddc2 into microsoft:master Jan 14, 2023
@ScottHollows
Copy link

I logged the original issue #365

Please close this as resolved

Thank you to everyone that helped with this

@schinagl schinagl deleted the open_cmd_as_admin branch January 23, 2023 20:20
schinagl added a commit to schinagl/winfile that referenced this pull request Feb 4, 2023
* Start admin command prompt in selected directory

* Show dependency between CmdParamFormat and ConEmuParamFormat

* Removed comment

Co-authored-by: schinagl <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants