IPB

Welcome Guest ( Log In | Register )

Recommended
BootDisk.com

Active Users

4 Pages V  « < 2 3 4  
Reply to this topicStart new topic
Managing MBR's by jaclaz MBRBatch Release 0.01 ALPHA
Lancelot
post Yesterday, 09:08 AM
Post #31


Bug Catcher
***

Group: Advanced user
Posts: 663
Thank(s): 48
Joined: 8-May 08
Member No.: 15,072


Turkey


I found a solution by using nfgdump.exe,
http://lancelot.winbuilder.net/5F/nfgdump.exe
so now before unmounting image, correction can be made by modifying mkimg.cmd

REM CORRECTION on vdk mounted image
for /f "tokens=3 delims=\Dev " %%A in ('nfgdump list^|FIND "%DRIVE%"') do SET Drivenumber=%%A
del /q /f %Targetfile%512a.mbr
del /q /f %Targetfile%512a_patch.mbr
dsfo \\.\PHYSICALDRIVE%Drivenumber% 0 512 %Targetfile%512a.mbr
copy /b %Targetfile%512a.mbr %Targetfile%512a_patch.mbr
bpatcher.exe %Targetfile%512a_patch.mbr 1C2 %PartType%
dsfi \\.\PHYSICALDRIVE%Drivenumber% 0 512 %Targetfile%512a_patch.mbr

VDK.EXE REMOVE


Again I need confirmation ? (sorry, but i am still a rookie, it will take looong time to (IMG:../forums/style_emoticons/default/smart.gif) graduate (IMG:../forums/style_emoticons/default/rolleyes.gif) )
I didnt use If closes this time (if "%PartType%" == "0E" ...), maybe i do right, maybe wrong??
and if confirmed yes, than the previous modification to change %targetfile% would be useless???
Go to the top of the page
 
+Quote Post
jaclaz
post Yesterday, 09:27 AM
Post #32


Finder
***

Group: Advanced user
Posts: 2,959
Thank(s): 111
Joined: 14-July 06
Member No.: 2


Italy


As I see it, a check with %parttype% would be advisable.

The latest snippet will uncoditionally re-write the partition type, this can take a few seconds, which are unneeded when written partition type already equals %parttype%.

Also, why you need using two files?:
%Targetfile%512a.mbr
%Targetfile%512a_patch.mbr
cannot you just patch the extracted %Targetfile%512a.mbr? (IMG:../forums/style_emoticons/default/unsure.gif)

For the record, nfgdump is an Open Source project, the homepage is here:
http://sourceforge.net/projects/nfgdump/

jaclaz
Go to the top of the page
 
+Quote Post
Lancelot
post Yesterday, 09:40 AM
Post #33


Bug Catcher
***

Group: Advanced user
Posts: 663
Thank(s): 48
Joined: 8-May 08
Member No.: 15,072


Turkey


QUOTE
a check with %parttype% would be advisable


So final 1 is that:

REM CORRECTION on vdk mounted image
if "%PartType%" == "0E" goto :correctionfixa
if "%PartType%" == "0C" goto :correctionfixa
goto correctionacontinue
:correctionfixa
for /f "tokens=3 delims=\Dev " %%A in ('nfgdump list^|FIND "%DRIVE%"') do SET Drivenumber=%%A
del /q /f %Targetfile%512a.mbr
del /q /f %Targetfile%512a_patch.mbr
dsfo \\.\PHYSICALDRIVE%Drivenumber% 0 512 %Targetfile%512a.mbr
copy /b %Targetfile%512a.mbr %Targetfile%512a_patch.mbr
bpatcher.exe %Targetfile%512a_patch.mbr 1C2 %PartType%
dsfi \\.\PHYSICALDRIVE%Drivenumber% 0 512 %Targetfile%512a_patch.mbr
:correctionacontinue

VDK.EXE REMOVE

QUOTE
Also, why you need using two files?
cannot you just patch the extracted %Targetfile%512a.mbr?

yes one file is enough, i use this method to see the change before/after during trials (IMG:../forums/style_emoticons/default/smile.gif) As i am a rookie, i double (in this case triple, 2 files + created image file) check as much as possible, i loose lots of times with a gain of making less (but not zero) mistakes. (IMG:../forums/style_emoticons/default/smile.gif)

So final2 can be this:

REM CORRECTION on vdk mounted image
if "%PartType%" == "0E" goto :correctionfixa
if "%PartType%" == "0C" goto :correctionfixa
goto correctionacontinue
:correctionfixa
for /f "tokens=3 delims=\Dev " %%A in ('nfgdump list^|FIND "%DRIVE%"') do SET Drivenumber=%%A
del /q /f %Targetfile%512a.mbr
del /q /f %Targetfile%512a_patch.mbr
dsfo \\.\PHYSICALDRIVE%Drivenumber% 0 512 %Targetfile%512a.mbr
copy /b %Targetfile%512a.mbr %Targetfile%512a_patch.mbr
bpatcher.exe %Targetfile%512a_patch.mbr 1C2 %PartType%
dsfi \\.\PHYSICALDRIVE%Drivenumber% 0 512 %Targetfile%512a_patch.mbr
del /q /f %Targetfile%512a.mbr
del /q /f %Targetfile%512a_patch.mbr
:correctionacontinue

VDK.EXE REMOVE
Go to the top of the page
 
+Quote Post
jaclaz
post Yesterday, 10:08 AM
Post #34


Finder
***

Group: Advanced user
Posts: 2,959
Thank(s): 111
Joined: 14-July 06
Member No.: 2


Italy


Yep, but "final 3" could be:
CODE
REM CORRECTION on vdk mounted image
if "%PartType%" == "0E" CALL :correctionfixa
if "%PartType%" == "0C" CALL :correctionfixa
VDK.EXE REMOVE
GOTO :EOF

:correctionfixa
for /f "tokens=3 delims=\Dev " %%A in ('nfgdump list^|FIND "%DRIVE%"') do SET Drivenumber=%%A
IF EXIST %Targetfile%512a.mbr del /q /f %Targetfile%512a.mbr
dsfo \\.\PHYSICALDRIVE%Drivenumber% 0 512 %Targetfile%512a.mbr
bpatcher.exe %Targetfile%512a.mbr 1C2 %PartType%
dsfi \\.\PHYSICALDRIVE%Drivenumber% 0 512 %Targetfile%512a.mbr
del /q /f %Targetfile%512a.mbr
GOTO :EOF


jaclaz
Go to the top of the page
 
+Quote Post
Lancelot
post Yesterday, 12:05 PM
Post #35


Bug Catcher
***

Group: Advanced user
Posts: 663
Thank(s): 48
Joined: 8-May 08
Member No.: 15,072


Turkey


YES Capitan

I made some changes so correction made before explorer executed (so someone who look mbr info of mounted disk will see final mbr of image, and a diskcopy utility can be used at this stage), i guess this time i did all right?

IF /I NOT %NoPrompts%.==/np. (
if exist .\BootFiles\NTLDR copy /y ".\BootFiles\NTLDR" %drive%
if exist .\BootFiles\NTDETECT.COM copy /y ".\BootFiles\NTDETECT.COM" %drive%
if exist .\BootFiles\boot.ini copy /y ".\BootFiles\boot.ini" %drive%
if exist .\BootFiles\grldr copy /y ".\BootFiles\grldr" %drive%
if exist .\BootFiles\MENU.LST copy /y ".\BootFiles\MENU.LST" %drive%
xcopy .\ExtraFiles\*.* %drive% /s /y /e /h
)
REM CORRECTION on vdk mounted image
if "%PartType%" == "0E" CALL :correctionfixa
if "%PartType%" == "0C" CALL :correctionfixa

START /WAIT %SystemRoot%\explorer.exe %drive%
ECHO.
ECHO Press any key to unmount the image and uninstall vdk.exe...
ECHO.
PAUSE
VDK.EXE REMOVE
vdk.exe open * %Targetfile% /rw
VDK.EXE REMOVE
GOTO :EOF

:correctionfixa
for /f "tokens=3 delims=\Dev " %%A in ('nfgdump list^|FIND "%DRIVE%"') do SET Drivenumber=%%A
IF EXIST %Targetfile%512a.mbr del /q /f %Targetfile%512a.mbr
dsfo \\.\PHYSICALDRIVE%Drivenumber% 0 512 %Targetfile%512a.mbr
bpatcher.exe %Targetfile%512a.mbr 1C2 %PartType%
dsfi \\.\PHYSICALDRIVE%Drivenumber% 0 512 %Targetfile%512a.mbr
del /q /f %Targetfile%512a.mbr
GOTO :EOF

:MKIMGI_TF
Go to the top of the page
 
+Quote Post
« Next Oldest · Tutorials · Next Newest »
 

4 Pages V  « < 2 3 4
Fast ReplyReply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 

Display Mode: Standard · Switch to: Linear+ · Switch to: Outline

Track this topic · Email this topic · Print this topic · Subscribe to this forum

RSS Lo-Fi Version Time is now: 8th October 2008 - 05:22 AM

W3C XHTML • © 2008 Boot Land • All rights reserved • W3C CSS