Jump to content

Recommended Posts

Posted

Hi,

I have always used my CD using the $OEM$ folders and etc. but I discovered something... I don't use any DriverPacks or hacked files, so I am trying to get rid of the $OEM$ distribution folders....

--> The reason: WINNT.SIF not being executed when setup is launched by WINNT32.EXE, and I would like to retain the ability to install using this method (useful for BartPE...)

---> So, I am trying to migrate the RunOnceEx.cmd code to a CMD file that gets executed by SVCPACK.INF ....

--> My only problem is that I cannot create the %SRCPATH% variable that contains the source of the installation files ....

--> In $OEM$ distribution folders, when RunOnceEx.cmd is executed, Windows makes the current folder %CDletter%\$OEM$, so if I use relative paths in the batch file, RunOnceEx.cmd becomes independent of the CD-ROM drive letter and I can install Windows XP UA from the CD or the hard drive, but if I use the normal CD-ROM detection code:

FOR %%i IN (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:\BootCD.dat set SRCPATH=%%i:

- RunOnceEx will always require installing from the CD-ROM since when installing from the hard drive the paths will get messed up and none of my customization will be executed...

---> So now, I migrated the code the SVCPACK.INF, but the problem is:

--> When SVCPACK.CMD launches, the current directory is %WinDir%\SYSTEM32\inetsrv, not %SRCPATH%\i386\svcpack, so I cannot use relative paths anymore....

--> So I thought of a workaround ::

--> If Windows stores the location of its installation source in the registry I can implement the following code:

reg QUERY "%REGKEY%" /v "%VALUE%" | find ":" > %PP%\fndsrc.tmp
FOR /F "usebackq delims=," %%i IN (`type %PP%\fndsrc.tmp`) DO set SRCPATH=%%i
set SRCPATH=%SRCPATH:~33,-1%
%SRCPATH:~,2%
cd %SRCPATH%

- So I can change the directory to %SRCPATH%\ so I can use relative paths again...

--> But problem is I cannot find the registry key that points to Windows Source Paths...

- 2 keys I tried ...

HKLM\Software\Microsoft\Windows NT\CurrentVersion

- There is a REG_SZ value called SourcePath that I tried, but I found out that this value isn't written to the registry until SETUP ends so I cannot use that ....

HKLM\Software\Microsoft\COM3\Setup

- There is a REG_SZ value called "Source Path", but the problem is that it works fine when booting from CD, otherwise it is changed to C:\WINNT????.~LS folder (?? I cannot remember the name) when installing from WINNT32.EXE or WINNT.EXE, so I cannot use that ...

- 1 key still not tried...

HKLM\Software\Microsoft\Windows\CurrentVersion\Setup

- There is a REG_SZ value called "ServicePackSourcePath" that is pointing to the location of the Setup files, but I don't know, will that key exist during SETUP... ???

-- Can I modify SETUPREG.HIV to add such a key.. I so how, and what should I enter .....

---> Sorry for lengthy post, but I try to include as much detail to what I'm doing as possible....

-- NOTE: WXP SP2 + RyanVM Update Pack 1.2.2 a FULL + Gnome's WMP10 Slipstreamer....

--> Feedback appreciated.....


Posted (edited)

Hey :hello:

I can't help you with your workaround because I know to little about about this :blushing: .

I can however help you with this:

--> The reason: WINNT.SIF not being executed when setup is launched by WINNT32.EXE, and I would like to retain the ability to install using this method (useful for BartPE...)

When you install from a CD, winnt.sif is used standard as your answer file. When you install with winnt.exe or winnt32.exe this is not the case, you need to specify the path. I have renamed my winnt.sif to unattended.txt I install form a second harddrive, and there my driver strucutre looks like this:

D:\
|---------->WINXP
             |-----------------i386
                                  |-----------------$OEM$

my unattended.txt is in the WINXP folder

This is how I start my installation:

set AnswerFile=D:\WINXP\unattended.txt
set SetupFiles=D:\WINXP\I386

%SetupFiles%\winnt32.exe /s:%SetupFiles% /unattend:%AnswerFile% /tempdrive:C /syspart:C

Also note that if you install with winnt.exe or winnt32.exe, your $OEM$ folder has to be inside the i386 folder

Hope this helps!

EDIT:

For more info about winnt32.exe go to the i386 folder and open winnt32.hlp

Edited by erik_demon
Posted (edited)

Hi,

--> I have managed to create this batch file that can read and process each separate line from a REG_MULTI_SZ variable, here is the source code, took me about 2 hours to fully test....

--> However it depends on 2 external programs that need to somehow be copied to %SystemRoot%\System32 before T-14 (SVCPACK.INF)...

--> Programs are: 1. Linex.com (extracts individual lines from stdout of a command)

2. Windows Global Search and Replace (GSAR.EXE)

-> Can someone please examine my source and see if it can be optimized...

--> Can I replace these commands by Windows-native programs .....

To Test:

--------

- Download attachment, unzip to a separate folder and double-click TEST.CMD to execute....

@Echo Off
REM
REM -- Created by n7Epsilon @ MSFN.ORG
REM - Feel free to incorporate into your batch files
REM but just don't remove these non-intrusive remark lines...
REM
Echo.
Echo *** Read HKLM\Software\Microsoft\Windows\CurrentVersion\Setup
Echo *** Read "Installation Sources" REG_MULTI_SZ value and process
Echo each line individually...
Echo.
Echo.
Echo ** Press any key to start ...
PAUSE > NUL
Echo.
Echo ** Looking for Windows XP installation source ...
reg QUERY "HKLM\Software\Microsoft\Windows\CurrentVersion\Setup" /v "Installation Sources" | find ":" > %TEMP%\fndsrc.tmp
gsar -s:x5C:x30 -r:x0D:x0A -o %temp%\fndsrc.tmp > NUL
gsar -sInstallation:x20Sources -r -o %temp%\fndsrc.tmp > NUL
gsar -sREG_MULTI_SZ -r -o %temp%\fndsrc.tmp > NUL
gsar -s:x20:x20:x20:x20:x09:x09 -r -o %temp%\fndsrc.tmp > NUL
goto process

:process
find /C ":" %Temp%\fndsrc.tmp > %temp%\no.xx
gsar -s:x0D:x0A -r -o %temp%\no.xx > NUL
for /F "usebackq delims=," %%i IN (`type %temp%\no.xx`) DO set loops=%%i
set loops=%Loops:~-2%
del %temp%\no.xx
goto loopstart

:loopstart
set fndcnt=0
:loop
If exist %temp%\work.ctl del %temp%\work.ctl > NUL
set srctest=
If not "%SRCPATH%"=="" goto srcpathset
If "%fndcnt%"=="%loops%" goto loopfail
set /A fndcnt=%fndcnt%+1
linex %fndcnt% < %temp%\fndsrc.tmp > %temp%\work.ctl
FOR /F "usebackq delims=," %%i IN (`type %temp%\work.ctl`) DO set srctest=%%i
set srcstbx=%srctest:~-1%
Echo %srcstbx% | find "\" > NUL
If not errorlevel=1 set srctest=%srctest:~0,-1%
If exist %srctest%\WIN51IP.SP2 set SRCPATH=%SRCTEST%
goto loop
:loopfail
set fndcnt=
set loops=
Echo.
Echo !!!- Error: Unable to read Windows XP installation
Echo !!!- files source path from the registry...
Echo.
goto end

:srcpathset
set fndcnt=
set loops=
Echo.
Echo ** Windows Installation Source Folder:
Echo * %SRCPATH%
Echo.
goto end

:end
set srcstbx=
PAUSE

TEST.zip

Edited by ChipCraze23
  • 7 months later...
Posted (edited)
Hi,

--> I have managed to create this batch file that can read and process each separate line from a REG_MULTI_SZ variable, here is the source code, took me about 2 hours to fully test....

--> However it depends on 2 external programs that need to somehow be copied to %SystemRoot%\System32 before T-14 (SVCPACK.INF)...

--> Programs are: 1. Linex.com (extracts individual lines from stdout of a command)

2. Windows Global Search and Replace (GSAR.EXE)

-> Can someone please examine my source and see if it can be optimized...

--> Can I replace these commands by Windows-native programs .....

fndsrc.tmp output before removing with gsar.exe unwanted chars x5C (Reverse Solidus) and x30 (Digit Zero) at end of fndsrc.tmp

D:\fsc.tmp\driver\sound\ad_1986_v5_12_01_5170_w2k_wxp\SMAXWDM\W2K_XP\0D:\FSC.TMP\DRIVER\DISPLAY\INTEL_915_PV14_7_0_3889_W2K_WXP\WIN2000\0D:\FSC.TMP\DRIVER\NETWORK\BROADCOM_GIGABIT_V8_22_1_0_NT4_W2K_WXP_X64\0I:\\0\0

Only checked on running Windows, not @T13 (SVCPACK.INF)

Echo.
Echo ** Looking for Windows XP installation source ...
FOR /F "TOKENS=3 DELIMS= " %%? IN ('REG QUERY "HKLM\Software\Microsoft\Windows\CurrentVersion\Setup" /v "Installation Sources" ^2^>NUL') DO (IF ERRORLEVEL 0 echo/%%?>%TEMP%\fndsrc.tmp)&(gsar -s:x5C:x30 -r:x0D:x0A -o %TEMP%\fndsrc.tmp >NUL)

:process
for /f "skip=1 tokens=3 delims= " %%? in ('type %temp%\fndsrc.tmp ^|find /C ":"') do (IF ERRORLEVEL 0 set loops=%%?)

i re-use some code (with little modification) posted by Yzöwl MSFN batch expert.

@Yzöwl,

can give us a solution not to use gsar in the first for /F command to remove the unwanted chars.

Edited by Bilou_Gateux
Posted (edited)

What is trying to be achieved?

Don't get me wrong, I haven't got a problem creating a piece of code to 'split' the MULTI_REG_SZ into its multiple entries, I just dont know why.

In the meantime, here is a snippet which will create a text file named tmp_.txt, containing up to 9 strings from the MULTI_REG_SZ data

@echo off &setlocal enableextensions
set key="HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup"
set val="Installation Sources"
for /f "skip=1 tokens=3 delims= " %%? in ('reg query %key% /v %val% ^2^>nul') do if errorlevel 0 set "dat=%%?"
if not defined dat goto end
set "dat=%dat:\0\0=%" &set "dat=%dat:\0=ž%"
for /f "tokens=1,2,3,4,5,6,7,8,9 delims=ž" %%a in ("%dat%") do (
for %%? in ("%%a" "%%b" "%%c" "%%d" "%%e" "%%f" "%%g" "%%h" "%%i") do if "%%~?" neq "" echo>>tmp_.txt %%~?
)
:end
endlocal &goto :eof

where, on line 4, delims=<tab>

Hope it helps you out!

Edited by Yzöwl
Posted (edited)

Thank for help. each time you post a new script, i learn something new.

I always forget about the replace function in the SET command.

How strange is this char ž Latin Small Letter Z with Caron from the MULTI_REG_SZ data value.

Edited by Bilou_Gateux

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...