Jump to content

Formatting an external drive using different interfaces


Dave-H

Recommended Posts

Well, if it works directly inside an elevated command prompt then it should work exactly the same when run through elevate.exe. :unsure:

 

Maybe it is the "mixed mode" that is the issue?

dsfi is 32 bit.

 

Try using the 32 bit elevate.exe, and try also from a non-elevated command prompt to run (it is well possible that the modified batch code isn't doing what I expected it to do, I have no way to test it directly):

 

elevate.exe -c -w dsfi \\.\I: 0 0 as512.bss

 

And/or try running this as a batch:

dsfi \\.\I: 0 0 as512.bssECHO Errolevel is %ERRORLEVEL%

maybe the Errorlevel is not set/parsed correctly?

 

 

jaclaz

Link to comment
Share on other sites


I've tried using the 32 bit version of elevate.exe, with the same result.

Running "elevate.exe -c -w dsfi \\.\I: 0 0 as512.bss" from a non-elevated command prompt does work.

The batch file apparently does nothing when it's run.

 

I've tried changing the line at the end of switcher.cmd simply to -

IF "YES"=="%Confirm%" elevate.exe -c -w dsfi \\.\%SecondDriveLetter% 0 0 %Source% &GOTO :Check

 

That seems to work, although you have to OK the UAC prompt each time, both in the eSATA connection and the USB connection.

Not too much of a problem, as it does now finally work OK, at least in Windows 8.1.

Haven't tried it in Windows XP yet..........

:)

Link to comment
Share on other sites

Good, but the elevate.exe run under XP will throw an error.

I need your feedback on the behaviour of the command.

Try reverting the check.

IF "YES"=="%Confirm%" (elevate.exe -c -w dsfi \\.\%SecondDriveLetter% 0 0 %Source%IF %ERRORLEVEL% equ 0 GOTO :Checkdsfi \\.\%SecondDriveLetter% 0 0 %Source%GOTO :check)

this will attempt to run dsfi through elevate.exe and if the OS is not Vista or later it will attempt running it directly.

I could add an OS version detection routine of course, but if we get to have the batch working this way it will be simpler.

 

jaclaz

Link to comment
Share on other sites

Tried that, and when I go to the USB interface in Windows XP and enter "YES" to convert the drive a message pops up saying "elevate.exe is not a valid Win32 application".

I am definitely using the 32 bit version of elevate.exe.

:no:

Link to comment
Share on other sites

Well, this is due to elevate.exe having been compiled with minimum OS version 6.
Try using the attached (edited) version.
Change that part of the batch to:
 

IF "YES"=="%Confirm%" (elevate.exe -c -w dsfi \\.\%SecondDriveLetter% 0 0 %Source%GOTO :Check)

 
The good thing :unsure: with this approach is that a popup needing a confirmation by the user appears in XP as well.

All in all and at the end of the day checking the OS version may be still better, but this allows for an added possibility to cancel.

 
Can you please in the Windows 8.x try running this as batch (make sure that I: is the right drive letter or change according to your current drive lettering):
 
 
 

dsfi \\.\I: 0 0 as512.bssECHO Errorlevel is %ERRORLEVEL%

 
and report the output?

 

jaclaz

 

 

elevateXP.zip

Link to comment
Share on other sites

Tried with the new elevate.exe and the modified entry in switcher.cmd, in XP using the USB interface.

Now when I enter "YES" a "runas" box pops up asking me what user account I want to run it under.

If I say OK to the default current user entry the box goes away and a new (apparently empty) prompt pops up, and both prompts then disappear, but the drive hasn't been switched.

:no:

Edited by Dave-H
Link to comment
Share on other sites

Yes, it works if you do that of course!

:yes:

I've now checked it out with Windows XP and Windows 8.1 using both interfaces and I'm glad to report that everything now seems to be working fine!

:thumbup

The UAC prompt comes up on 8.1 and has to be given the OK, which is fine.

The prompt on XP isn't so convenient as you have to deselect the "Protect my computer..." option every time, but it's no big deal.

 

One thing I should mention is that with the addition of elevate.exe the 68KB drive is now showing a red bar in 8.1 as it's nearly full.

Maybe it could do with being a bit bigger.

 

The next thing of course, is how do I get access to the rest of my 1TB drive?

Presumably the .bss files determine the size of the partitions.

Will you need a different one for every drive to make the second partition the size you want?

:)

Link to comment
Share on other sites

Good :), now that we have a "working prototype", we need to find a way to reproduce on *any* disk.

 

The sample image I posted was "hand made" and uses a trick (or two) that make it not really-really "kosher", to save myself some strange calculations I removed part of the boot code of the NTFS volume and used it's bootsector as both bootsector and EPBR.

 

I am thinking about the best way to have the thingy (besides working) also as "compatible" as possible with the various "queer" (or in some cases plainly "stupid" limitations/conventions of the various OS's).

 

Since we are anyway talking of at least a 1 Tb drive, I guess it is not an issue if we waste a handful of megabytes, in order to make the (now 68k) small partition a bit larger. (there are some constraints that may cause a few megabytes "wasted")

 

The NTFS volume NEEDS to be formatted when the disk is mounted "as 4096 bytes/sector", but I am not yet convinced of the procedure to have the stupid disk manager (or the stupid diskpart) to do the exact things I need.

 

Most probably it will be needed to create the NTFS partition as primary after a "dummy" temporary partition and then convert it to logical volume inside extended :unsure:

 

I still need to know what happens with the errorlevel of dsfi under windows 8.1, please.

 

jaclaz

Link to comment
Share on other sites

Hi again jaclaz, sorry for the delay but MSFN seems to have been down for the last few hours.

:(

I ran that batch in a command prompt and got this -

J:\>dsfi \\.\I: 0 0 as512.bssOK, written 4096 bytes at offset 0J:\>ECHO Errorlevel is %ERRORLEVEL%Errorlevel is 0J:\>

J: is the drive where your files are, and I: is the drive I'm mounting.

I hope that's right.

:)

Link to comment
Share on other sites

Hi again jaclaz, sorry for the delay but MSFN seems to have been down for the last few hours.

:(

I ran that batch in a command prompt and got this -

J:\>dsfi \\.\I: 0 0 as512.bssOK, written 4096 bytes at offset 0J:\>ECHO Errorlevel is %ERRORLEVEL%Errorlevel is 0J:\>
J: is the drive where your files are, and I: is the drive I'm mounting.

I hope that's right.

:)

It's queer.

Did you try it in Windows 8.x from an open command prompt NOT in elevated mode (and on the eSATA connection)?

It should have got you a failure of some kind :unsure:

With the machines booted into 8.1, everything is fine on the USB interface (which is how I left it) with both drives and their contents accessible.

On the eSATA interface however I can access the drive with your files on it, but when I run the switcher command and enter "YES" I get an "access is denied" message so I can't switch modes to see the other drive, which reports unformatted.

:no:

jaclaz

Link to comment
Share on other sites

Oops, sorry I must have done it in an elevated command prompt (I have the shortcut set to do that automatically).

:blushing:

This should be better!

J:\>dsfi \\.\I: 0 0 as512.bss\\.\I: - Access is denied.J:\>ECHO Errorlevel is %ERRORLEVEL%Errorlevel is 1J:\>

:) 

Link to comment
Share on other sites

Then, this should work nicely :unsure: (still in 8.x, NOT elevated command prompt):
 

dsfi \\.\I: 0 0 as512.bss || elevate.exe -c -w dsfi \\.\I: 0 0 as512.bss

as well as on XP (on 8.x the command should be run through the elevate.exe and thus prompt for UAC elevation, on XP directly).

 

jaclaz

Link to comment
Share on other sites

Although this may be seen as somewhat out-of-topic, that isn't truly the case, IMO: :D
You two may find this (KB946932) of interest, in case it still works (notice, please, that the article was retired in early 2008). However, despite the article withdrawal, the necessary App Comp Toolkit remains being offered, and now it has reached  v. 5.6, unless I have missed some further update. And here is the apposite recipe for Disabling UAC for Certain Applications in Vista.

...And here're some assorted musings: Win 7 UAC whitelist...

Link to comment
Share on other sites

Thanks den.

:)

 

jaclaz, when I run your command line using the eSATA connection it seems to work fine, although there seems to be quite a bit of delay before the drive is actually mounted after dismissing the UAC prompt.

 

If I run it on the USB connected machine however, I just get a message "OK, written 4096 bytes at offset 0", but the drive is not activated.

No UAC prompt either, which there is on the eSATA connected machine.

 

All in Windows 8.1 of course with non-elevated command prompts.

 

Is that what you would expect?

:)

Edited by Dave-H
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...