[TOOL] XP2ESD - Create modern Windows XP installer v1.6.2

Discussion in 'Windows XP / Older OS' started by George King, Jan 8, 2021.

  1. George King

    George King MDL Expert

    Aug 5, 2009
    1,963
    2,506
    60
    #2941 George King, Jan 29, 2024
    Last edited: Jan 29, 2024
    (OP)
    How you get correct physical disk and partition number when diskpart uses it's own logical counting?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. Gelip

    Gelip MDL Senior Member

    Feb 28, 2011
    456
    336
    10
    #2942 Gelip, Jan 29, 2024
    Last edited: Jan 29, 2024
    Script displays disks and asks about the disk number on which to install:
    Code:
    ...
    REM Make partitions, format & assign letters U: EFI 100MB FAT32
    diskpart /s diskprep1.txt
    echo:
    set /p disk=Please enter the disk number (q to discard):
    if %disk%==q cmd /k
    set /p part=Please enter the size of the OS partition in MB (min. 2100):
    diskpart /s diskprep2.txt
    
    REM Search CD\DVD\USB drive letter and set in %drive% variable
    for %%i in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist "%%i:\sources\*.wim" set drive=%%i:
    
    REM Copy EFI folder from %drive%\sources to EFI partition
    xcopy %drive%\sources\EFI U:\EFI /e /h /c /i
    ...

    diskprep1.txt
    Code:
    list disk

    diskprep2.txt
    Code:
    sel disk %disk%
    clean
    convert gpt
    create par efi size=100
    format fs=fat32 label="EFI"
    assign letter u
    create par pri size=%part%
    format fs=ntfs quick label="OS"
    assign letter c
    create par pri
    format fs=ntfs quick label="Data"
    

    I have a simple scenario - the user chooses the disk and the size of the partition on which WinXP wants to install. The WinXP or Win10 installer also displays a window with disks where you can choose a disk, partition or divide it again:
    disks.png

    I don't understand what you want to automate?
     
  3. George King

    George King MDL Expert

    Aug 5, 2009
    1,963
    2,506
    60
    #2943 George King, Jan 29, 2024
    Last edited: Jan 29, 2024
    (OP)
    @Gelip Thats not automated solution. Manually you can do always anything.

    And handling EFI partition or bootloader is not issue. When is used winload thats different mapping story in BCD than boot.ini
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. Gelip

    Gelip MDL Senior Member

    Feb 28, 2011
    456
    336
    10
    OK, but I still do not understand what it needed for ??? What scenario do you assume?

    I understand only 2 scenarios:

    1. WinXP installation on one clean disk
    2. The user has a PC with factory-installed Win10 on the GPT disk - so there are ESP, MSR, OS and Recovery partitions
    • To install XP, you must first separate the space on the disk
    • If the partition with the Win10 (OS) system is not the last on the disk, it cannot be done in an easy way and you need to use specialized tools
    • If the partition Win10 (OS) is last on the disk, you can easily reduce it with diskpart with shrink desired= command
    • Now you can install WinXP in this separate area and then you do not need to create an ESP partition, only edit BCD on an existing ESP partition
     
  5. Seven4ever

    Seven4ever MDL Member

    May 16, 2023
    131
    55
    10
  6. Seven4ever

    Seven4ever MDL Member

    May 16, 2023
    131
    55
    10
    + scenario 3 : Replacing an existing partition. Similar to 2 plus delete partition / BCD entry option
     
  7. Gelip

    Gelip MDL Senior Member

    Feb 28, 2011
    456
    336
    10
    #2947 Gelip, Jan 29, 2024
    Last edited: Jan 29, 2024
    deleted
     
  8. George King

    George King MDL Expert

    Aug 5, 2009
    1,963
    2,506
    60
    #2948 George King, Jan 30, 2024
    Last edited: Jan 30, 2024
    (OP)
    Because I have no time to burn it with ListDisk development. I will use it for listing only for now to achieve needed result. Polishing with used tools can be done later as usual.

    DISKPART - Physical disk numbers are OK, partition numbers are logical - unusable for building boot.ini
    BOOTICE - Physical disk numbers are OK, partitions numbers starts from 0 instead of 1. Not sure if it's physical. Seems physical just started from 0
    LISTDISK - Physical disk numbers are OK, partitions numbers are physical too - usable for building boot.ini

    Anyway my goal should be doable to cover all wanted scenarios now.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. UsefulAGKHelper

    UsefulAGKHelper MDL Senior Member

    Aug 28, 2021
    402
    263
    10
    That's great news!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. user469

    user469 MDL Member

    Oct 23, 2015
    127
    14
    10
    Pardon me so in new version you dont need to a clean install on a new disk but you can choose on wich partition install XP and of course make it bootable ?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  11. George King

    George King MDL Expert

    Aug 5, 2009
    1,963
    2,506
    60
    That will be possible in future If you mean deploying from already installed system. For now it means we can get rid of needed partition number selection in POWIS. And also this means limit to be installed in first partition is gone. Now it should be on any disk and any partition.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  12. Gelip

    Gelip MDL Senior Member

    Feb 28, 2011
    456
    336
    10
    #2952 Gelip, Feb 1, 2024
    Last edited: Feb 1, 2024
    @George King
    I'm trying to use ListDisk to find the EFI partition but I am not doing something:
    Code:
    @ECHO OFF
    
    REM Find the USB drive on which the needed files are
    for %%a in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist "%%a:\listdisk.exe" set drive=%%a:
    
    %drive%\listdisk
    for /f "tokens=6 delims= " %%p in ('echo listdisk ^| find "EFI System"') do set efi=%%p
    echo:
    echo EFI partition is %efi%
    echo:
    pause
    
    find_EFI.png
    P.S. Please fix ListDisk because data still not fit in WinPE window e.g. change Partition to Par or/and remove character | from table as diskpart displays:
    diskpart_fit_cmd_window.png
     
  13. George King

    George King MDL Expert

    Aug 5, 2009
    1,963
    2,506
    60
    @Gelip Just change default console settings width do 95. Table view is there for a reason to be able to parse output in scripts easily.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  14. Gelip

    Gelip MDL Senior Member

    Feb 28, 2011
    456
    336
    10
    Unnecessary additional clicks :(
    It is not easier at all - diskpart displays the data very nicely without any characters and it is easier to search e.g.
    for /f "tokens= delims=
     
  15. acer-5100

    acer-5100 MDL Guru

    Dec 8, 2018
    4,001
    2,969
    150
    #2955 acer-5100, Feb 1, 2024
    Last edited: Feb 1, 2024
    No need to fight with the incredibly dumb pre W10 consolle

    ConEmu is a must have (also in W10 W11)

    upload_2024-2-1_17-22-1.png

    You get normal copy and paste (via CTRL+C/CTRL+V), tabs, dynamically resizable consolle, a ton of personalizations, and another huge list of features

    Optionally (but strongly suggested) you can also install the tiny Clink, and you get also the Bash like persistent history (invaluable IMO)

    AFAIR the last ConEmu version Working in Windows 5.1/5.2 is 180626, the last Clink working is 0.4.8

    @George King

    I tested listdisk on a stock Server 2003R2 it complains about missing msvcp140.dll (so VC 2015 I guess, which isn't officially supported in XP/2003).

    I ask myself, given it's aimed mainly to XP and is compiled from scratch, is 2015 really needed, wouldn't better to compile it with an older VC and make it working even on a freshly installed XP (plus a supported VC runtime)?
     
  16. George King

    George King MDL Expert

    Aug 5, 2009
    1,963
    2,506
    60
    @acer-5100 Yes, You need latest Visual C++ repack installed for listdisk. Yes, I this case I have downloaded Visual Studio 2010 Professional + SP1 + All updates from catalog. I would like to try it in future. But I quess there will be code compatibility issues.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  17. acer-5100

    acer-5100 MDL Guru

    Dec 8, 2018
    4,001
    2,969
    150
  18. Gelip

    Gelip MDL Senior Member

    Feb 28, 2011
    456
    336
    10
    @George King
    Your tool not mount EFI partition:
    Code:
    | Disk 1 | Partition 1 | GPT   |  100.00 MB | EFI System    | FAT32  |     | EFI              |
    | Disk 1 | Partition 2 | GPT   |   10.00 GB | Basic Data    | NTFS   | G:  | OS               |
    | Disk 1 | Partition 3 | GPT   |   29.90 GB | Basic Data    | NTFS   | Z:  | Data             |
    
    EFI partition on disk 1 is 1
    
    Volume not found for Disk 1, Partition 1
    Failed to mount Disk 1, Partition 1
    Press any key to continue . . .
    
    Code:
    @ECHO OFF
    
    REM Find the USB drive on which the needed files are
    for %%a in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist "%%a:\listdisk.exe" set drive=%%a:
    
    %drive%\listdisk
    for /f "tokens=3 delims= " %%p in ('%drive%\listdisk ^| find "EFI System"') do set disk=%%p
    for /f "tokens=6 delims= " %%p in ('%drive%\listdisk ^| find "EFI System"') do set par=%%p
    echo:
    echo EFI partition on disk %disk% is %par%
    echo:
    %drive%\listdisk /mount %disk% %par% U
    pause
    
     
  19. George King

    George King MDL Expert

    Aug 5, 2009
    1,963
    2,506
    60
    #2959 George King, Feb 2, 2024
    Last edited: Feb 2, 2024
    (OP)
    @Gelip, Yes there is some kind of bug. I was not able to fix it even I smell where is issue. It not depends on MBR or GPT or other detection mechanism. It's caused by "volume not found" which means same thing. Simply your Disk 1 Partition 1 have not mount point in system. This is connected with structure where Im reading all needed data. But probably not my fault. I was unable to change type or set partition active until I switched to direct. And seems even I tried many methods, none of them worked. For example 0x07 partition to 0x17 works fine, mount too. But opposite nope. Caused by missing mounpoint / mount volume in structure which is used to load data.

    Btw, currently mix of LISTDISK, DISKPART, BOOTICE can do all needed steps. ListDisk needs to be improved of course, I'm not givving up, just focusing to simple way to provide public release with all possible features.. :)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  20. Gelip

    Gelip MDL Senior Member

    Feb 28, 2011
    456
    336
    10
    #2960 Gelip, Feb 3, 2024
    Last edited: Feb 3, 2024
    It is a pity that he cannot mount - without this, tool it is useless to me :( So what if it shows disks and partitions as I can't mount because diskpart shows a different partition or volume number than listdisk

    But I have already found a solution - you don't need diskpart, bootice or listdisk to search EFI partition

    Just use the mountvol command, e.g. mountvol U: /s
    Code:
    mountvol /?
    ...
        /S          Mount the EFI System Partition on the given drive.
    ...
    The command will find the partition itself and mount it under the indicated letter - in this case U: :)
    Code:
    DISKPART>
      Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
      ----------  ---  -----------  -----  ----------  -------  ---------  --------
      Volume 0     E   Rescue       UDF    DVD-ROM      229 MB  Healthy
      Volume 1     C   OS           NTFS   Partition     10 GB  Healthy
      Volume 2     D   Data         NTFS   Partition     29 GB  Healthy
      Volume 3                      FAT32  Partition    100 MB  Healthy    Hidden
    
    X:\windows\system32>mountvol U: /s
    
    DISKPART>
      Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
      ----------  ---  -----------  -----  ----------  -------  ---------  --------
      Volume 0     E   Rescue       UDF    DVD-ROM      229 MB  Healthy
      Volume 1     C   OS           NTFS   Partition     10 GB  Healthy
      Volume 2     D   Data         NTFS   Partition     29 GB  Healthy
      Volume 3     U                FAT32  Partition    100 MB  Healthy    Hidden
    
    The mountvol does not work if there are two or more EFI partitions but this is an unlikely scenario.

    P.S. The bcdedit.exe can edit BCD without mounting the EFI partition, but if you want to copy files to the partition, however, you need to mount.

    My script is now much simpler, shorter and transparent :cool::)