IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Add registry settings with migrate.inf
cdob
post Apr 30 2007, 08:26 AM
Post #1


Platinum Member
*****

Group: Moderator
Posts: 3,648
Joined: 31-October 03
Member No.: 2,304



As knows windows setup migrate migrate.inf at boottime.
BartPE does read .\i386\system32\migrate.inf.

The rule seems to be: migrate.inf goes first, setupreg.hiv next.

Therefore path setting at migrate.inf fails:
CODE
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Environment","Path",0x00020002,"%SystemRoot%\system32;%SystemRoot%;%RamDrv\bin%"


Adding setting does work, e.g. set device letters.
Paraglider described MountedDevices usage in the past.
http://www.911cd.net/forums//index.php?s=&...ost&p=72805

Example:
RAM loaded PE image at X: and set USB stick to letter U:

Copy MkMigratgeInf.cmd to USB stick, launch it and copy migrate.inf to PE image.
Booting PE image, USB stick get letter U:.

MkMigratgeInf.cmd
CODE
@echo off
rem MkMigratgeInf by cdob
setlocal EnableExtensions

set Drive=%~d1
if %Drive%.==. set Drive=%~d0

set FileName=%~2
if %FileName%.==. set FileName=MIGRATE.INF

set MigrateDrive=U:
if not %~d3.==. set MigrateDrive=%~d3

set Value=
FOR /F "skip=2 tokens=1-2*" %%a IN ('reg query HKLM\System\MountedDevices /v \DosDevices\%Drive%') DO set Value=%%c

if %Value%.==. (echo drive settings %Drive% not found & goto :EOF)

set MigrateStr=%Value:~0,2%
set count=2
:begin_parse
  call :exec set MidStr=%%Value:~%count%,2%%
  if %MidStr%.==. goto :exit_parse
  set MigrateStr=%MigrateStr%,%MidStr%
  set /a count+=2
  goto begin_parse
:exit_parse

(echo [Version]
echo Signature = "$Windows NT$"
echo.
echo [Addreg]
echo HKLM,"SYSTEM\MountedDevices","\DosDevices\%MigrateDrive%",0x00030001,\
echo %MigrateStr%)>%FileName%

goto :EOF

:exec
  %*
goto :EOF


Idea:
Migrate.inf can be used in a multi boot environment.
The same file setupreg.hiv is used, but different migrat?.inf.
A second setupldr.bin may load migrat2.inf.
That way a multi boot environment may load slightly different settings at boottime.

This post has been edited by jaclaz: Jul 9 2008, 04:23 AM
Go to the top of the page
 
+Quote Post
jaclaz
post Apr 30 2007, 10:49 AM
Post #2


The Finder
******

Group: Moderator
Posts: 7,313
Joined: 25-July 04
From: Italy
Member No.: 6,779



Interesting info, as always! (IMG:http://www.911cd.net/forums//style_emoticons/default/smile.gif)

Cannot say if this can be of use right now, but I just tested the script and had a look at values for different drives/partitions.

Here is the result, following is an example:
Output of the script (contents of created migrate.inf):
QUOTE
[Version]
Signature = "$Windows NT$"
[Addreg]
HKLM,"SYSTEM\MountedDevices","\DosDevices\U:",0x00030001,\
10,27,11,27,00,7E,00,00,00,00,00,00


The green numbers are the hex values of the disk signature i.e. contents of bytes 440,441,442 and 443 of the MBR exactly as they are.

The red numbers are the offset of the beginning of the partition, calculated in bytes.

The blue zeroes appear to be an extension of the addresses, ALL my partitions, on ALL drives have 00 as 11th and 12th number, most probably they are used on larger drives.


Words are, as usual, reversed, so 007E 0000 0000 actually means:
000000007E00=7E00=32,256 dec. i.e. 63 sectors x 512 bytes/sector

The above carries the consequence that ANY USB stick or HD device's FIRST partition formatted without a "peculiar" number of "hidden sectors" will have the 7E000000 byte sequence, and this will cover 99,99% of bootable USB sticks and hard disks.

The value can be however calculated by taking, respectively for 1st, 2nd,3rd and 4th Primary Partition the values in the MBR:
bytes 454457
bytes 470473
bytes 486489
bytes 502505
and multiplying them by 512 (for the 99.99% of drives that use 512 bytes sectors).


These findings may be useful if one wants to manually modify the MIGRATE.INF file, but could also be used to "reverse" cdob's idea:
QUOTE
Idea:
Migrate.inf can be used in a multi boot environment.
The same file setupreg.hiv is used, but different migrat?.inf.
A second setupldr.bin may load migrat2.inf.
That way a multi boot environment may load slightly different settings at boottime.

One could use a single migrate.inf file with several entries pointing to different (all non-existant but one) MBR signatures and change the signature in the MBR before booting the "slightly different" needed settings.

jaclaz

P.S.: I am cross-linking this post to the MSFN one about installing from USB stick, as it may become useful in that context:
http://www.msfn.org/board/index.php?showto...0&start=120

This post has been edited by jaclaz: Feb 25 2008, 01:37 PM
Go to the top of the page
 
+Quote Post
jeffgc
post Jun 27 2008, 09:27 AM
Post #3


Member
**

Group: Members
Posts: 19
Joined: 6-June 08
Member No.: 37,783



cdob,
when you said "copy migrate.inf to PE image", do you mean copy to the i386 directory on the RAM disk?
thanks,
Jeff

This post has been edited by Ed_P: Jun 27 2008, 09:55 AM
Reason for edit: Removed needless quote. Please use the Add Reply button.
Go to the top of the page
 
+Quote Post
cdob
post Jun 27 2008, 01:12 PM
Post #4


Platinum Member
*****

Group: Moderator
Posts: 3,648
Joined: 31-October 03
Member No.: 2,304



QUOTE (jeffgc @ Jun 27 2008, 02:27 PM) *
when you said "copy migrate.inf to PE image", do you mean copy to the i386 directory on the RAM disk?

QUOTE (myself)
BartPE does read .\i386\system32\migrate.inf.
Copy file to .\i386\system32\
This maybe a RAM disk, a hard disk, a USB stick, CD drive and more.
Go to the top of the page
 
+Quote Post
Andy07
post Jul 2 2008, 12:57 PM
Post #5


Member
**

Group: Members
Posts: 20
Joined: 9-March 07
Member No.: 25,739



cdob,

sorry, no success for me - USB stick is not mounted as U:

Here's what I did:
The migrate.inf was created using your batch posted above, while the USB stick was mounted in BartPE as drive E: ( mkmigrateinf.bat e: ), and then injected into the pre-built BartPE ISO file into \i386\system32. The whole stuff then goes to the same bootable USB stick, which loads fine - but simply does not assign the drive letter of the stick to U: !

I assume that the .inf file is read at runtime (i.e. boot) of BartPE, not during the build, right ?

For more details, could you check out this post
http://www.911cd.net/forums//index.php?sho...;hl=migrate.inf
and perhaps give me some advice about the migrate.inf not working. Perhaps I only misunderstood your instructions ...


Andy
Go to the top of the page
 
+Quote Post
cdob
post Jul 3 2008, 12:44 AM
Post #6


Platinum Member
*****

Group: Moderator
Posts: 3,648
Joined: 31-October 03
Member No.: 2,304



QUOTE (Andy07 @ Jul 2 2008, 06:57 PM) *
then injected into the pre-built BartPE ISO file into \i386\system32. The whole stuff then goes to the same bootable USB stick
Can you clarify this part?
How do you inject a file? Which file systems do you use at ISO image?
I'm used to building new images by mkisofs.
This is a early boot file, hence case is importand at ISO9660: MIGRATE.INF

Havn't done ISO RAM loading in years. Have to test as free time permits

Did you format USB stick with a MBR?
Can you post your migrate.inf?
Go to the top of the page
 
+Quote Post
Andy07
post Jul 4 2008, 09:42 AM
Post #7


Member
**

Group: Members
Posts: 20
Joined: 9-March 07
Member No.: 25,739



Hi cdob,

to be more specific about the "injected":

I use a 1GB USB Stick, formatted FAT16 bootable. Then, I put on the following files (boot loader taken from Server2003S1 and renamed), according to the following "cookbook":

QUOTE
How to prepare a USB stick for booting BartPE/WinPE (FAT formatted - restricted to 2GB)

BaseOS running on host computer used for preparing the USB stick: WinXP SP2
H: is the USB Stick drive letter

1)
format h: /fs:fat /u /v:usb /backup
(standard WinXP format)

2)
mkbt -x -l=BartPE pe2usb.bin h:
(from \BartPE\plugin\peinst)

3)
copy the network boot files to the Stick:
- NTLDR (w2k3sp1 setupldr.bin renamed to NTLDR)
- ntdetect.com (w2k3sp1 file)
- winnt.sif (with ramdisk option and correct ISO image specified)
- BartPE.ISO (or similar)



In this way, I get a bootable USB stick which boots the XP loader, loads the ISO from the stick into RAM, mounts and boots it. The result is BartPE running with B: as ram disk, X: as virtual BartPE CDROM (the ISO loaded into the RAM and mounted), and C:/D:/E: (whatever is free) with the physical USB stick (where I see the boot files and the ISO), depending on the partitioning of the builtin HDD - and the cause of my problems.
The BartPE.ISO used is the same which I do burn on a CD to boot, or use via PXE (Network) boot.

So far, so good, and no migrate.inf ivolved so far.

Now, I use an ISO editor (ISO Commander) to open the BartPE.ISO (because I am lazy and didn't want to rebuild it ...) and copy (aka "inject") the migrate.inf into \i386\system32 directoy. Then, I save the ISO to the stick and use this to boot. It boots as fine as before, but still the C:/D:/E: drive letter mess instead of having the stick on U:
So, either the contents of the migrate.inf is wrong, or it is not read at boot of BartPE.

I didn't care for the file system in the ISO, because it was initially created with BartPE Builder and runs fine, even after inserting the .inf file.
Means: Booting is not an issue here, only the INF file, which is not regarded !

First question of all: Is the file located at the correct place ?

The MIGRATE.INF is another hint - I am checking in ISO Commander: All in capitals, and when BartPE is booted, it appears in X:\I386\SYSTEM32\MIGRATE.INF, so caps should be no issue.

Then, I check in regedit the \HKLM\SYSTEM\MountedDevices: USB Stick is on \DosDevices\E:, and the Data part is the same as copied by MKMIGRATEINF.CMD into the INF. Here it is:

QUOTE
[Version]
Signature = "$Windows NT$"

[Addreg]
HKLM,"SYSTEM\MountedDevices","\DosDevices\U:",0x00030001,\
5C,00,3F,00,3F,00,5C,00,53,00,54,00,4F,00,52,00,41,00,47,00,45,00,23,00,52,00,65
,00,6D,00,6F,00,76,00,61,00,62,00,6C,00,65,00,4D,00,65,00,64,00,69,00,61,00,23,0
0
,37,00,26,00,37,00,38,00,30,00,33,00,61,00,39,00,62,00,26,00,30,00,26,00,52,00,4
D
,00,23,00,7B,00,35,00,33,00,66,00,35,00,36,00,33,00,30,00,64,00,2D,00,62,00,36,0
0
,62,00,66,00,2D,00,31,00,31,00,64,00,30,00,2D,00,39,00,34,00,66,00,32,00,2D,00,3
0
,00,30,00,61,00,30,00,63,00,39,00,31,00,65,00,66,00,62,00,38,00,62,00,7D,00
HKLM,"SYSTEM\MountedDevices","\DosDevices\V:",0x00030001,\
10,27,11,27,00,7E,00,00,00,00,00,00



I was wondering about the long data chunk (U: - 5c,00,3f, ...) and added the V: entry according to jaclaz' instructions above. No effect for both.

I hope this makes things more clear now.

Then, after re-reading jaclaz' post and the thing about the green bytes, I used:
c:\>mbrfix /drive 2 readsignature
7E8D6DF6

and added the entry
HKLM,"SYSTEM\MountedDevices","\DosDevices\W:",0x00030001,\
7E,8D,6D,F6,00,7E,00,00,00,00,00,00

to the INF file - but still no success :-( grmbl !

BTW: The entries from the INF file, shouldn't they appear in the registry as soon as BartPE is loaded ? They do not - is this an indicator that the INF is not processed ?

Thanks for your patience !

Andy

PS: [Edit] I also Byte-Reversed 7E8D6DF6 upon suggestion of jaclaz, but still no success - USB stick remains D: and no \...\U: key can be found in the registry of the running BartPE. Is this correct ? If the migrate.inf would be processed at boot, shouldn't the key(s) appear in the registry ? If yes, something about the processing of the INF is wrong !

This post has been edited by Andy07: Jul 4 2008, 10:29 AM
Go to the top of the page
 
+Quote Post
jaclaz
post Jul 4 2008, 12:29 PM
Post #8


The Finder
******

Group: Moderator
Posts: 7,313
Joined: 25-July 04
From: Italy
Member No.: 6,779



Andy07

Why don't you simply run mkmigrate.inf on your system, on your USB stick?

Post the resulting migrate.inf file and attach a copy of the MBR of the stick (use hdhacker for the latter)

jaclaz
Go to the top of the page
 
+Quote Post
Andy07
post Jul 14 2008, 04:12 AM
Post #9


Member
**

Group: Members
Posts: 20
Joined: 9-March 07
Member No.: 25,739



Jaclaz,

that's what I did whe I created the migrate.inf.

Here's the result of the current run (I: is the usb stick):

c:\> mkmigrateinf i:

CODE
[Version]
Signature = "$Windows NT$"

[Addreg]
HKLM,"SYSTEM\MountedDevices","\DosDevices\U:",0x00030001,\
5C,00,3F,00,3F,00,5C,00,53,00,54,00,4F,00,52,00,41,00,47,00,45,00,23,00,52,00,65
,00,6D,00,6F,00,76,00,61,00,62,00,6C,00,65,00,4D,00,65,00,64,00,69,00,61,00,23,0
0
,37,00,26,00,37,00,38,00,30,00,33,00,61,00,39,00,62,00,26,00,30,00,26,00,52,00,4
D
,00,23,00,7B,00,35,00,33,00,66,00,35,00,36,00,33,00,30,00,64,00,2D,00,62,00,36,0
0
,62,00,66,00,2D,00,31,00,31,00,64,00,30,00,2D,00,39,00,34,00,66,00,32,00,2D,00,3
0
,00,30,00,61,00,30,00,63,00,39,00,31,00,65,00,66,00,62,00,38,00,62,00,7D,00


MBR Dump will follow in next post

Andy

This post has been edited by Andy07: Jul 14 2008, 04:40 AM
Go to the top of the page
 
+Quote Post
Andy07
post Jul 14 2008, 04:45 AM
Post #10


Member
**

Group: Members
Posts: 20
Joined: 9-March 07
Member No.: 25,739



... bull - Can't attach binary file.
Am I missing the "attach" function ?
Perhaps I am simply too tired. It's Monday morning ...

Andy
Go to the top of the page
 
+Quote Post
jaclaz
post Jul 14 2008, 05:27 AM
Post #11


The Finder
******

Group: Moderator
Posts: 7,313
Joined: 25-July 04
From: Italy
Member No.: 6,779



QUOTE (Andy07 @ Jul 14 2008, 11:12 AM) *
Jaclaz,

that's what I did whe I created the migrate.inf.

Here's the result of the current run (I: is the usb stick):

c:\> mkmigrateinf i:

CODE
[Version]
Signature = "$Windows NT$"

[Addreg]
HKLM,"SYSTEM\MountedDevices","\DosDevices\U:",0x00030001,\
5C,00,3F,00,3F,00,5C,00,53,00,54,00,4F,00,52,00,41,00,47,00,45,00,23,00,52,00,65
,00,6D,00,6F,00,76,00,61,00,62,00,6C,00,65,00,4D,00,65,00,64,00,69,00,61,00,23,0
0
,37,00,26,00,37,00,38,00,30,00,33,00,61,00,39,00,62,00,26,00,30,00,26,00,52,00,4
D
,00,23,00,7B,00,35,00,33,00,66,00,35,00,36,00,33,00,30,00,64,00,2D,00,62,00,36,0
0
,62,00,66,00,2D,00,31,00,31,00,64,00,30,00,2D,00,39,00,34,00,66,00,32,00,2D,00,3
0
,00,30,00,61,00,30,00,63,00,39,00,31,00,65,00,66,00,62,00,38,00,62,00,7D,00


MBR Dump will follow in next post

Andy



I'm sorry, Andy, I now realize that I (unwantingly) mis-directed you.
The MBR and signature is only valid for devices that are seen as "fixed", like a Hard Disk or a USB stick with the "Removable bit" flipped, or under the use of o filter driver.
Since I "flipped" all my USB sticks, it works for me, but it cannot of course if the stick is "Removable".


QUOTE (Andy07 @ Jul 4 2008, 04:42 PM) *
Now, I use an ISO editor (ISO Commander) to open the BartPE.ISO (because I am lazy and didn't want to rebuild it ...) and copy (aka "inject") the migrate.inf into \i386\system32 directoy. Then, I save the ISO to the stick and use this to boot. It boots as fine as before, but still the C:/D:/E: drive letter mess instead of having the stick on U:
So, either the contents of the migrate.inf is wrong, or it is not read at boot of BartPE.

I didn't care for the file system in the ISO, because it was initially created with BartPE Builder and runs fine, even after inserting the .inf file.
Means: Booting is not an issue here, only the INF file, which is not regarded !

First question of all: Is the file located at the correct place ?

The MIGRATE.INF is another hint - I am checking in ISO Commander: All in capitals, and when BartPE is booted, it appears in X:\I386\SYSTEM32\MIGRATE.INF, so caps should be no issue.


...and sorry again, I missed your question, can you try with migrate.inf in \I386\ or in the ROOT of the .iso instead of \I386\System32\ ?

Maybe in this case that path is needed, in the "Install XP from USB" method migrate.inf goes to $WIN_NT$.~BT.

Another try could be that of adding the entry to setupreg.hiv.

jaclaz


P.S.: Compress the file in a .zip archive, in order to be able to attach it (IMG:http://www.911cd.net/forums//style_emoticons/default/wink.gif)
but there is not anymore a reason to check your MBR....

This post has been edited by jaclaz: Jul 14 2008, 05:28 AM
Go to the top of the page
 
+Quote Post
cdob
post Jul 14 2008, 05:38 AM
Post #12


Platinum Member
*****

Group: Moderator
Posts: 3,648
Joined: 31-October 03
Member No.: 2,304



QUOTE (Andy07 @ Jul 4 2008, 02:42 PM) *
the ISO loaded into the RAM and mounted
This is another task. ISO RAM loading is different.
Migrate.inf maybe read or not.

Burn a real CD and try.

And try the classic solution, add settings to setupreg.hiv.
http://www.911cd.net/forums//index.php?s=&...st&p=147891
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 17th August 2016 - 02:21 AM