Digg this topic Add to my del.icio.us Submit to SlashDot 3 Pages V   1 2 3 >  
Reply to this topicStart new topic
> MakeBS.cmd ALPHA RELEASE, A small batch file to modify NTLDR bootsectors
jaclaz
post Jun 8 2007, 09:06 PM
Post #1


Finder
***

Group: Advanced user
Posts: 1,140
Joined: 14-July 06
Member No.: 2


Italy


Following one of cdob's hint here:
http://www.msfn.org/board/index.php?showto...1384&st=197
QUOTE(cdob)
By the way: did you opened KB310994 floppy image? Bootsector loads setupldr.bin.


I put together a small batch file to perform a copy of current bootsector of a partition (FAT16 or FAT32, NT/2K/XP/2003 "standard" bootsector invoking NTLDR) and to modify this copy as to load ANOTHER loader, for example SETUPLDR.BIN, thus making this copy "chainloadable" from NTLDR through a BOOT.INI entry.

The .cmd is attached here, I would like members that like to experiment to try it, the batch in itself is safe as it simply does a backup of your current bootsector to a file BackupBS.ori in the root of the same drive, then makes a copy of it, modifying the latter as to invoke another bootsector; optionally it adds a suitable entry in BOOT.INI.

There is NO help file, but if you run the batch in any directory without parameters or with /? as parameter it will display in the console window detailed usage info and links for the "inner engine" aka the dsfo.exe part of the DSFOK toolkit.

Since the "ALPHA" status of the release, the use and testing of the batch is suggested ONLY to
individuals that can be refeered to as:
QUOTE
Now there's a frood who really knows where his towel is.

with, additionally, a decent knowledge of booting/multibooting in the DOS/NT/WINDOWS world.

I sincerely regret, mainly due to cdob's idea being posted a few days AFTER it (IMG:../forums/style_emoticons/default/happy.gif) , not having been able to release this for Towel's day:
http://en.wikipedia.org/wiki/Towel_Day
but since I stand by the fact that "real" Towel Day is June 22, if some other member can help me in the testing/debugging, it could be possible to release a BETA or maybe even a FINAL version just in time for that date.

This application, if hopefully proven to be working, is particularly dedicated to our good spacesurfer, so that maybe he will stop going through half the internet suggesting to rename something to something else. (IMG:../forums/style_emoticons/default/wink.gif) (IMG:../forums/style_emoticons/default/whistling.gif)

Anyway, should it be working properly or not, please do report your experience, suggestions, etc., and of course, the most important thing, have fun (IMG:../forums/style_emoticons/default/smile.gif) .

(IMG:../forums/style_emoticons/default/cheers.gif)

jaclaz
Attached File(s)
Attached File  MakeBS.zip ( 2.56k ) Number of downloads: 125
 
Go to the top of the page
 
+Quote Post
wimb
post Jul 10 2007, 07:19 PM
Post #2


Newbie
*

Group: Members
Posts: 1
Joined: 10-July 07
Member No.: 9,517


Netherlands


I have used your script and was able now to use it successfully !

At first I made the mistake to add dsfo.exe to the folder containing MakeBS.cmd and I got then:
"" string NOT found in drive R: bootsector
Program aborted - wrong filesystem or bootsector type

But then I realised that possibly more files of dsfok folder were needed
and then I placed MakeBS.cmd inside the dsfok folder, so that it is working now for me.

Thank you for this handy script (IMG:../forums/style_emoticons/default/smile.gif)
Go to the top of the page
 
+Quote Post
jaclaz
post Jul 24 2007, 02:26 PM
Post #3


Finder
***

Group: Advanced user
Posts: 1,140
Joined: 14-July 06
Member No.: 2


Italy


Updated MakeBS.cmd to take care of FAT12 bootsectors too.

jaclaz
Attached File(s)
Attached File  MakeBS002.zip ( 2.56k ) Number of downloads: 52
 
Go to the top of the page
 
+Quote Post
ilko
post Aug 3 2007, 05:05 PM
Post #4


Newbie
*

Group: Members
Posts: 7
Joined: 27-May 07
Member No.: 7,732


Bulgaria


Hi jaclaz, great job with the script (IMG:../forums/style_emoticons/default/smile.gif)

Script run from custom folder, dsfo.exe only(NOT from folder GUI in archive) in the same folder.
Lexar 1GB USB stick, with XP SP2 Setup files on it and setupldr.bin in root, stick is seen as fixed using Hitachi driver.

Formated stick from XP SP2 in FAT and run the script makeBS E:\setupldr.bin /A "TXT Setup"- stick booted to boot.ini, if choose "TXT Setup" I get blank screen with blinking cursor, nothing else.
Run the script again with normal NTLDR as an option, instead of setupldr.bin- boot.ini gets reloaded, in short- XP SP2 setupldr.bin didn't like to be called that way or a problem with the geometry?

Rename setupldr.bin to ntldr- Setup loads fine.
XP SP2 files used. Used setupldr.bin from 2003 SP1- no more hangs, Setup loads fine.

Same setup- format FAT32 from XP this time- choose TXT Setup- Setup loads just fine using setupldr.bin from XP SP2.

Same setup- format stick using PeToUSB in FAT16X- everything works fine.
If you are interested I have backup of MBRs and bootsectors for the 3 different setups.

Just ideas if anyone has troubles with XP boot loader/Setupldr.bin and USB sticks.

An idea about the script- could you make it the option A to be accebted in small letters as well? Took me a while to figure out it must be capital letter. (IMG:../forums/style_emoticons/default/hammer.gif)

ilko
Go to the top of the page
 
+Quote Post
jaclaz
post Aug 3 2007, 06:07 PM
Post #5


Finder
***

Group: Advanced user
Posts: 1,140
Joined: 14-July 06
Member No.: 2


Italy


@ilko

Yes please, zip all MBR and bootsectors together and attach them in this thread, I'll have a look at them, most probably there is a "glitch" of some kind in the batch.

By the way, OT, but not much (IMG:../forums/style_emoticons/default/wink.gif) , I just found the way to load SETUPLDR.BIN to get to Recovery Console directly (without using NTLDR and the /CMDCONS switch in BOOT.INI) and guess what?
It's NTLDR that modifies on the fly the bootsector (IMG:../forums/style_emoticons/default/ranting2.gif) , so I intend to add this possibility (pre-modify the bootsector) to the batch, in the same occasion I will try and fix the problem you had.

jaclaz
Go to the top of the page
 
+Quote Post
thunn
post Aug 4 2007, 05:47 AM
Post #6


Advanced Member
***

Group: .script developer
Posts: 363
Joined: 27-July 06
From: Queens, New York
Member No.: 75


United States


thank you.
Go to the top of the page
 
+Quote Post
ilko
post Aug 4 2007, 12:40 PM
Post #7


Newbie
*

Group: Members
Posts: 7
Joined: 27-May 07
Member No.: 7,732


Bulgaria


QUOTE(jaclaz @ Aug 3 2007, 07:07 PM) *
@ilko

Yes please, zip all MBR and bootsectors together and attach them in this thread, I'll have a look at them, most probably there is a "glitch" of some kind in the batch.
Jaclaz, my bad, it's nothing to do with the script, it works just fine.
It's possibly about buggy setupldr.bin from XP SP2, or what is most likely it's place on the stick- i.e. copied right after format, along with ntldr, boot.ini, txtsetup.sif and ntdetect.com, then the rest of the files.
In short- all boot files must be copied to the stick right after the format, including the custom bootloader, which the bootsector will be patched for.
Not sure if this limitation applies only for FAT16 or in general.
I am still testing, will post results when done.

QUOTE(jaclaz @ Aug 3 2007, 07:07 PM) *
By the way, OT, but not much (IMG:../forums/style_emoticons/default/wink.gif) , I just found the way to load SETUPLDR.BIN to get to Recovery Console directly (without using NTLDR and the /CMDCONS switch in BOOT.INI) and guess what?
It's NTLDR that modifies on the fly the bootsector (IMG:../forums/style_emoticons/default/ranting2.gif) , so I intend to add this possibility (pre-modify the bootsector) to the batch, in the same occasion I will try and fix the problem you had.

jaclaz
This is very interesting, could you post more details, good finding (IMG:../forums/style_emoticons/default/thumbup.gif)
Go to the top of the page
 
+Quote Post
jaclaz
post Aug 4 2007, 01:18 PM
Post #8


Finder
***

Group: Advanced user
Posts: 1,140
Joined: 14-July 06
Member No.: 2


Italy


Version 003 attached.

Introduced the /I switch on IF checks for parameters, now /A or /a will be accepted as well.
Minor fixes

On second thought, I will make another batch, reusing much of the code, but specific for the Recovery Console bootsector, as not to mix two different things.

@ilko
Yes, bootfiles need to be at the beginning of the partition, if they are copied after a certain address they cannot be found by the bootsector, this applies to CD's too.

About the Recovery Console trick it is actually very simple (once you know it (IMG:../forums/style_emoticons/default/wink.gif) ).
Normally when you install a Recovery Console, it would add an entry in BOOT.INI like:
QUOTE
C:\CMDCONS\BOOTSECT.DAT="Recovery Console" /cmdcons

I.e. a custom bootsector invoking SETUPLDR.BIN is chainloaded, and a parameter /cmdcons is passed.
I thought that the /cmdcons parameter was a SETUPLDR.BIN one and lost a couple of days trying to replicate it's behaviour chainloading through grub4dos or using the bootsector directly and using WINNT.SIF, until I found out that it is really a NTLDR parameter that makes it "patch on the fly" the bootsector, changing a few bytes at the beginning of it (the OS field) as follows:
NORMAL bootsect.dat:
CODE
Offset      0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F

00000000   EB 3C 90 4D 53 44 4F 53  35 2E 30 00 02 08 01 00   <�MSDOS5.0.....

to
PATCHED bootsect.dat:
CODE
Offset      0  1  2  3  4  5  6  7   8  9  A  B  C  D  E  F

00000000   EB 3C 90 63 6D 64 63 6F  6E 73 00 00 02 08 01 00   <cmdcons......


Now, the even more interesting thing is that the /rollback parameter:
http://support.microsoft.com/kb/312569/en-us
which is NOT listed here:
http://www.microsoft.com/technet/sysintern...on/bootini.mspx
appears to be working much in the same way, cannot say what it could be useful for, but I am going to experiment a bit with it too. (IMG:../forums/style_emoticons/default/smile.gif)

jaclaz


Attached File(s)
Attached File  MakeBS003.zip ( 2.57k ) Number of downloads: 34
 
Go to the top of the page
 
+Quote Post
ilko
post Aug 29 2007, 08:19 PM
Post #9


Newbie
*

Group: Members
Posts: 7
Joined: 27-May 07
Member No.: 7,732


Bulgaria


Hi,

Any ideas why would NTLDR patch bootsecor.dat?

About MakeBS.cmd- is it possible to make it usable with NTFS?

ilko
Go to the top of the page
 
+Quote Post
jaclaz
post Aug 30 2007, 04:55 PM
Post #10


Finder
***

Group: Advanced user
Posts: 1,140
Joined: 14-July 06
Member No.: 2


Italy


QUOTE(ilko @ Aug 29 2007, 10:19 PM) *
Any ideas why would NTLDR patch bootsecor.dat?

My guess? (IMG:../forums/style_emoticons/default/rolleyes.gif)

In 1998 a guy at MS, working on the new Recovery Console feature of Windows 2000, sent a note to another guy developing the NTLDR.
The note was lost in a breakdown of the internal server (MS Exchange? (IMG:../forums/style_emoticons/default/unsure.gif) (IMG:../forums/style_emoticons/default/wink.gif) )
Two weeks before the official launch of windows 2000, someone noticed that there was no simple way to load Recovery Console when installed to HD, but since the time was not enough to develop and test a proper solution (and document it), and since Recovery Console was already finished, whilst NTLDR was still in the works, a "quick and dirty" hack was applied to respect schedule.
Once the product was delivered, the first guy, or the second one, or both, changed their jobs and the "hack" remained in the source code, and was kept in later releases (XP/2003).
No documentation was ever produced about this feature, as noone but the two guys, that by the way never met personally, knows about it.

DISCLAIMER:
The above work is purely fictional and satirical in nature and should not be interpreted as a factual record of events.
Any names of characters, companies and products used in the story are purely coincidental and/or cited for mere entertainment purposes.
No persons, animals, furry little creatures from Alpha Centauri were harmed during the writing of this story.


QUOTE(ilko @ Aug 29 2007, 10:19 PM) *
About MakeBS.cmd- is it possible to make it usable with NTFS?

Yes, I think it's just a matter of adding to the batch the right "addresses" to search for, but I have to check them.

Give me a few days and I'll try and add the feature.

jaclaz
Go to the top of the page
 
+Quote Post
« Next Oldest · Boot Methods and various OS support · Next Newest »
 

3 Pages V   1 2 3 >
Fast ReplyReply to this topicStart new topic

Collapse

> Similar Topics

  Topic Replies Topic Starter Views Last Action
No new Topic has attachmentsRelease candidate of plop with USB support
26 jaclaz 656 9th October 2007 - 06:09 PM
Last post by: ktp
No New Posts Topic has attachmentsRelease 52
Some open issues
11 psc 1,479 8th November 2006 - 11:40 PM
Last post by: Nuno Brito


 

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


- Lo-Fi Version Time is now: 18th October 2007 - 01:14 PM

MKPortal ©2003-2006 mkportal.it