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

"Format disk..." doesn't work #62

Closed
daviunic opened this issue Apr 10, 2018 · 16 comments
Closed

"Format disk..." doesn't work #62

daviunic opened this issue Apr 10, 2018 · 16 comments

Comments

@daviunic
Copy link

On Windows 10 x64, using the "Format disk..." option in the Disk menu results in an error message saying "File manager cannot obtain disk information. Make sure the disk is in the drive." .

I'm not sure what this is suppose to do (perhaps it was only meant to format floppies?), but it would be nice if it actually called the standard format disk dialog of Windows, like Explorer does.

@NazmusLabs
Copy link
Contributor

I think we should have that menu item just call the native Windows format disk UI, the one you get when you right click a drive on file explorer and click "Format Disk...".

@T8z5h3
Copy link

T8z5h3 commented Apr 10, 2018

ether that or call disk management MMC

@matthewjustice
Copy link
Contributor

@daviunic - Are you referring to the menu item in the screenshot below?

format

Because if so, it is always disabled for me (and I would assume for most users today), because I have no floppy drives. See this line of code:

https://github.com/Microsoft/winfile/blob/a06f6f19a9eedbbd1fbcd6462737055be8c39eb9/src/wfinit.c#L411

I'm curious, is it enabled for you, and do you have a floppy drive on your system? Thanks!

@craigwi
Copy link
Contributor

craigwi commented Apr 12, 2018

It is clear that the old FormatDisk code isn't doing what we think is should. That's also true of other things like the old Security menu.

I would prefer to map out a simple approach to enable this functionality (FormatDisk in this case) or, if that is not possible, to delete the feature.

@matthewjustice
Copy link
Contributor

I like @NazmusLabs's suggestion of invoking the current Windows format disk UI (shown below). However, I also have a concern with this approach.

Today when a user invokes this UI from the shell, explorer.exe calls ShFormatDrive which displays the UI. Unfortunately, MSDN says that ShFormatDrive is deprecated. So if we want to use this exact UI, we'll need to rely on a deprecated function. Of course explorer.exe is still using it, so that's something. I haven't yet come across a supported Windows API function that does the same thing.

format-explorer2

@daviunic
Copy link
Author

daviunic commented Apr 12, 2018

@matthewjustice it is enabled for me and invoking it causes the error I mentioned. No floppy drives, but I have a USB 3.0 + card reader combo device installed via USB 3.0 headers and for every type of card it supports it displays a drive in explorer, acting much like a floppy drive would. So it seems it misdetects removable drives which behave this way.

And I'm not sure why they would deprecate a function they continue to use anyway and fail to provide an alternative for.

@T8z5h3
Copy link

T8z5h3 commented Apr 12, 2018

@daviunic that would make sense because to windows your Card reader looks like a USB Floppy drive but i think how the programming interacts with the card reader is incomparable.

@NazmusLabs
Copy link
Contributor

@matthewjustice I'm shocked to see this listed as deprecated. Usually things that get deprecated usually have had newer API calls or alternatives for a long time now. This doesn't seem to have any. Or does MS want to use the CMD for that now? And, like you said, Explorer uses this....

Regardless, I'm confident this feature won't go away anytime soon until Microsoft introduces an alternative and creates a redirect.

For example, the classic "calc" run command now redirects a call to launch the Calculator UWP app so that things like hardware calculator buttons on keyboards don't break.

@matthewjustice
Copy link
Contributor

@daviunic Thanks for confirming. Good to know that card readers can cause that menu option to enable.

@NazmusLabs Agreed that the deprecation it is a bit surprising without an alternative available! It does seem unlikely that support for it would be completely dropped in the near term.

@T8z5h3
Copy link

T8z5h3 commented Apr 13, 2018

@NazmusLabs i feel that microsoft want the programer to do the simplest things when it comes to formatting witch is why they have a API call for the built in formatting tool

@NazmusLabs
Copy link
Contributor

@T8z5h3 yes, but in this case, it is the API that you are referring to itself that has apparently been deprecated, which is the reason for my surprise.

@matthewjustice
Copy link
Contributor

PR #108 submitted. I went with the SHFormatDrive approach.

@NazmusLabs
Copy link
Contributor

Funny thing: it used to be disabled for me. Now it's enabled all of the sudden, and I don't know why. I don't have a card reader. I always had an external USB 3.0 hard drive. Perhaps it for disconnected and reconnected, causing file manager to enable it. Back in the early to mid 90s, a drive wouldn't just pop up on a running operating systems, as USB mass storage devices werent yet a thing. The only way to have a drive being added while the OS was running, I'd imagine, would be if a floppy was inserted. So, maybe, the fact that my external hard drive got disconnected an reconnected caused the drive to disappear and reappear on my PC, could have triggered the Winfile app to enable the menu item. I'll need to check the code to see if it include such trigger events. Either that, or someone else can explain it better.

@ZanderBrown
Copy link

Would make sense, it seems the item is enabled based on the value of nFloppies

https://github.com/Microsoft/winfile/blob/c57f75539c91c461754910850e3d8c7b01e65640/src/wfinit.c#L1332-L1347

And as you can see that value is calculated based on the assumption a removable drive is a floppy disk so as far as the logic cares your external harddrive is a floppy

@NazmusLabs
Copy link
Contributor

@ZanderBrown nice! Thanks for confirming my assumption. So it appears it may not have anything to do with having a card reader, but rather any removal drive. 🙂

@craigwi craigwi mentioned this issue Apr 22, 2018
@craigwi
Copy link
Contributor

craigwi commented May 12, 2018

We have a solution and there don't appear to be specific next steps here. Reopen if you disagree.

@craigwi craigwi closed this as completed May 12, 2018
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

No branches or pull requests

6 participants