franzageek/WinEFIMounter

Doesn't work if EFI is on removable media

1dolla opened this issue · 15 comments

The WinEFIMounter doesn't actually mount the EFI partition if the partition is on a removable device (which would be always until you've successfully installed macOS on an internal drive).

It doesn't say it failed, though.

But manually trying to mount it in diskpart reveals why:

DISKPART> assign letter=z

Virtual Disk Service error:
The operation is not supported on removable media.

diskpart apparently can't or won't assign a drive letter to this type of partition, or perhaps any partition on external media.

After searching the interwebs, turns out you can do it with a powershell command (as admin, of course):

Add-PartitionAccessPath -DiskNumber 2 -PartitionNumber 1 -AccessPath "Z:"

Perhaps the code could be updated to detect this error (any non-zero exit code from diskpart is at the very least an indicator something went wrong) and use this powershell command instead?

I did this myself, and then let WinEFIMounter continue with its copying of files to the C: drive for editing. I'm guessing it won't have a problem copying them back when I'm done editing and I'm guessing diskpart won't refuse to unmount the partition in the end, either.

Cheers :)

wow thanks for letting me know, i actually wanted to turn it into C++ code cause well, at the time i didnt realize how crap of a choice could C# be.
this will definitely be the first thing im going to fix.
thank you so much, have a great day!!
(the reason why i mightve missed this "bug" is that at the time i only tested winefimounter on my personal hackintosh - installed on an internal drive - and didnt realize diskpart could get in the way with an efi partition located somewhere else. thanks for reporting - hope it didnt fuck anything up :)) actually i might need to get in touch with you again in the future to get a more specific description of the bug, hope youll help me out. thanks again, bye!!)

ok i've just updated the readme file, really looking forward to fixing all those things.
(i'm not closing the issue in the hope of being able to come back here and get a more detailed description of the bug in order to fully patch it out of existence. thanks again for letting me know.)
(P.S. to answer your concern about winefimounter not detecting diskpart's non-zero exit code, i have to publicly admit that i absolutely hate diskpart and the way it is structured. everything must happen inside of its sandboxed cli without any way of communicating with the outside world. that's why, if you look in the code, i have to create each time a batch script to inject commands inside of diskpart. and believe it or not, there's absolutely no way of knowing whether something failed & if yes then what. i think this is the real limitation of winefimounter - i really wish there was a slightly better tool for dealing with disks in windows [kinda like fdisk for linux] - but unfortunately that's the only thing we get. i hope this clarifies things a bit.)

Hello again :)

Writing this from my i7-12700KF 96GB 4k120Hz RX 6600 Sonoma Hackintosh. Jesus Christ, it's fast XD. I had bought a refurbished 2018 i7 Mac mini previously that I had to send back, because the HDMI port on that model is completely fudged. The difference between that machine and this Hackintosh is RIDICULOUS. I've never had so fast a Mac before, and never had such snappy a UI, even on my Ryzen 7950X3D Windows gaming rig that also has the fastest Radeon card in it (I forget what it's called. Something-something RTX).

Anyway, I just wanted to add a second thing that when using the PowerShell command from before, it actually not only mounts the EFI folder as Z:, it does it so that every time Windows is restarted, or the USB stick or drive is reinserted, it's automatically mounted as Z:. Still as a restricted drive that you need an admin command prompt or PowerShell to access.

I just ended up keeping my EFI work folder on the C: drive, and then I did a robocopy c:\EFIPartition\ z:\ /mir every time I wanted to update the EFI partition before a reboot.

I will definitely help out with any questions, though I'm not much on Github, so if it feels like I'm ignoring the thread, it's just that I'm doing something else :)

Cheers.

damn it man, so jealous of your hackintosh...
anyways, i've once again updated the readme, and i'm expecting to start working on the fix in a few days. thanks for willing to help me out! i'll definitely credit you somewhere in the repo. take care :)

@1dolla ok, i've just finished* working on the fix, i've managed to figure out the bug by myself - it was an easy fix. can't wait to show you guys!! will upload the update in a couple of days. this thing will be a lot more reliable than the previous version, i've spent 70% of the time on making it unbreakable. thanks & thanks again for reporting the bug, have a good one!

Please release this soon🙏

@Diowboss released!! it is in the dev-1.0.2 branch

Thank you so much!!! I’ve been using this for so long to fix my efi, but the one time I put it on a usb😂

so happy to hear that!! i hope you like this new update!

it seems like every time i try to open the exe it pops up "libgcc_s_seh-1.dll" and "libstdc++-6.dll" are not found...

hmm, i think you might be lacking some c++ dlls, i'll make the executable static compiled in a few hours, that should do the job

@Diowboss alright, see if you can run WinEFIMounter-static.exe now, i compiled it with the option to embed all the dependencies in the executable itself. you'll find the EXE in the zip file in v1.0.2, i've just updated it.

ok so, it ran perfectly fine, but it gets stuck on the "press m to mount or b to go back" and neither works even if i click enter.

@Diowboss did you type capital M? the prompt is case-sensittive