Sure, assuming that you have the CHECKED version of XP that you wish to
test. If you don’t, getting the CHECKED build of SP2 requires an MSDN
subscription (I think), and it is only available as a network
installation pack. This means that you have to start the installation,
let it finish extracting, at which point it will fail because your
installing on FREE version of XP. Before dismissing the dialog box, go
find the extracted files, and copy NTLDR to another location. While
you’re there, you might as well copy ntos*.* and hal*.*, as the checked
versions of these files have better diagnostic information and can be
used with an otherwise FREE system. Personally, as this process sucks,
I would copy everything. When you’re done copying, dismiss the dialog
box. I haven’t done this in two years or more, and it is unfortunately
possible that this will not work, because it might fail before
extracting; I don’t thing so, but I don’t remember. If it does, you
are, as far as I know, legally SOL, as for reasons known only to
Microsoft, they no longer distribute a CHECKED version of XP, XP with
SP2, or SP2 anymore. If your desperate, there are checked versions of
ntldr, ntoskrnl and hal in the ‘debug’ folder of the XP 2600 DDK, but I
have never gotten them to work, nor have I have I ever head of anyone
getting them to work.
In any case:
-
Obtain the CHECKED version of NTLDR that matches your OS and SP.
-
It’s been a while since I’ve done this with XP, and I don’t recall
if NTLDR is compressed on the installation medium. Use EXPAND to ensure
that it isn’t, otherwise you’ll be non-bootable.
-
Replace the FREE version with the CHECKED one.
That’s it on the target.
For version of Windows that use boot.ini (and not bcd), boot time
debugging is only possible on com port 1 @ 19200.
On the host, start WinDbg:
WinDbg -b -d -k com:port=1,baud=19200
Plus anything else you want, like a symbol path so that you get ntldr
symbols. The module name in WinDbg for NTLDR is actually OSLOADER,
because ntldr is made of a block of flat code with a block of code that
is formatted as PE named OSLOADER appended to it. By the time you get
control, the first block of code is history.
You probably already know this, but, if not, If you haven’t already,
even though you’re looking at pre os, I would install checked copies of
ntoskrnl and the hal as well. The procedure starts out like the case
for NTLDR (get the checked ones, expand them), but you have to give them
different names (I usually use ntoskrnl.chk and hal.chk), and you have
to be absolutely certain that you have the correct hal and kernel, adn
you have to replace them both. The easiest way to do that is to right
click each file on the target, and take properties, and then the version
tab. Look at the OriginalFilename field. That’s the file you need to
copy from the CHECKED OS medium. Once you’ve got them and expanded them
to a new name, copy them to \Windows\System32 on the target. Then,
clear the readonly attribute of \boot.ini (which is also usually
hidden), and open it. Copy the line that corresponds to the
configuration you usually use for debugging, and paste on a free line.
Using the names I usually use, add /KERNEL=ntoskrnl.chk and /HAL=hal.chk
to the line you just pasted.
Also, a couple more ideas that may be of interest to you. Considering
what you are attempting to do, if you don’t have a means to do this
already, you will by any reasonable definition need some means of
stepping through the firmware and NTLDR prior to when WinDbg kicks in.
Usually, this is done using a JTAG emulator (I use an American Arium
ECM-50/XDP), but these are very expensive, and it is very, very, very,
very difficult to connect one to a motherboard reliably, unless it
happens to have an XDP socket, which for all practical purposes nothing
does. AS I recall, this is a personal project, so I’m assuming that you
don’t want to drop $11,000+ on something like this, but I thought I
would mention it in case I misunderstood your goal.
Assuming that is out, you might want to look in to Bochs, as it is open
source. Another option, if you’re doing this on AMD64 is a free
emulator that AMD provides on their website. Although it does not have
open source code, you probably won’t need it, and its at least five
times faster than Bochs and probably closer to ten times. It also, in
theory, can be connected to WinDbg, although that did not work when I
tried it, but that was two years ago. Another source of information you
might find useful is LinuxBIOS, and open source BIOS. It might be a
helpful reference when you get desperate.
Good luck,
mm
xxxxx@test.viksten.nu wrote:
Nice to hear that it is OK to post here! 
I can’t watch the video right now either and as I think I wrote I don’t know too much about XPE. However from what I’ve read, yes you can boot XPE from USB (I think it is officially supported even). What I’m trying to do though is related to this:
http://www.ngine.de/index.jsp?pageid=4176
Following that guide you can modify your regular install CD of XP and make it be USB-installable / bootable. You can then boot from a USB device except on computers which have no USB-boot capability in BIOS (i.e. INT13 extension for USB devices I’m guessing). It works quite nice if you can live with no swap-file (since it is a removable drive, which I believe there is a filter driver which can fix).
What I’m trying to do is make such a modified XP version boot from USB on computers without BIOS support for boot from USB. I would need to make a boot-floppy / CD, chuck that in, start NTLDR which then loads ntbootdd.sys which sets up a rudimentary USB-stack / (hub driver) / mass-storage capabilities and thus extends NTLDR to be able to read USB devices. Once it has read ntoskrnl and all the boot drivers the ordinary USB-drivers take over (which are after modification above working as bootable drivers). That’s the idea at least. 
I’m also hoping it could be used to boot VMware or similar from USB.
Since you seem interested I will keep you updated, though it might take a while because of work and vacation coming up.
Technical question of the day:
In the pre-OS environment which is NTLDR, is there a way of attaching a debugger???