Jump to content

Detecting Windows Xp Version from Source


Recommended Posts

Hi

I am currently writting a program to aid in creating Unattended Windows XP CD and i need to be able to detect the windows version through the source file like Nlite does.

Anyone have a routine that can do this?

Many thanks

Worf

Link to comment
Share on other sites


Or mine here! which with modification for install media would be something like this!

@Echo off&Setlocal
Set "Root=E:"
Call :G_
If %Pid% Equ 000 Echo: Other ^(includes some retail, upgrade and evaluation ^
versions^)
If %Pid% Equ 007 Echo: Retail
If %Pid% Equ 009 Echo: Not for resale - bundle
If %Pid% Equ 011 Echo: Upgrade ^(XP Home?^)
If %Pid% Equ 083 Echo: Windows Genuine Advantage
If %Pid% Equ OEM Echo: OEM
If %Pid% Equ 270 Echo: Volume License
If %Pid% Equ 296 Echo: MSDN
If %Pid% Equ 308 Echo: Microsoft Action Pack subscription
If %Pid% Equ 347 Echo: Microsoft Action Pack subscription
If %Pid% Equ 335 Echo: Retail
If %Pid% Geq 640 (If %Pid% Leq 652 Echo: Volume License)
If %Pid% Equ 699 Echo: Volume Windows XP Tablet Edition
If %Pid% Equ 071 Echo: Unknown
Ping -n 6 127.0.0.1>Nul&Goto :Eof
:G_
For /f "delims=" %%# In ('Find "Pid="^<%Root%\I386\SETUPP.INI') Do Set "%%#"
Set "Pid=%Pid:~-3%"

You would just need to alter the content of variable %Root% defined on line 2!

Link to comment
Share on other sites

Here's the batch file I wrote for my OEMSCAN addon here: http://siginetsoftware.com/forum/showthread.php?t=272

You should be able to tailor it for your use, it is designed to be run at T-39 via DetachedProgram in winnt.sif.

It's primary mission is to find OEM PIDs, so you'll need to alter the code. A list of PIDs can be found here: http://wiki.lunarsoft.net/wiki/Product_IDs

After the file copy stage, a new file is created for all unattended installs at %systemroot%\system32\$WINNT$.INF

The batch uses an entry in that to determine the install source at dospath=X:\blah

It then sets that as the source variable then scans for setupp.ini to check the PIDs.

Pure magic I tell ya! ;)

Make the following entry in i386\winnt.sif (or unattend.txt)

[GuiUnattended]
DetachedProgram = CMD.EXE
Arguments="/Q /C FOR /F %? IN ('%SYSTEMROOT%\SYSTEM32\MOUNTVOL.EXE^|FINDSTR :\') DO IF EXIST %?WIN51 START %?.\OEM\OEMSCAN.CMD"

Contents of OEMSCAN.CMD

@echo off
rem This batch file was created by mr_smartepants
title= Scanning for matching OEMBIOS string
echo Scanning for matching OEMBIOS string, please wait
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:\WIN51" SET CDROM=%%i:

:VARIABLES
SET HOME="%CDROM%\OEM\SCAN_XHM"
SET PRO="%CDROM%\OEM\SCAN_PRO"
SET MCE="%CDROM%\OEM\SCAN_MCE"
SET W2K3="%CDROM%\OEM\SCAN_2k3"

:PATH
setLocal EnableDelayedExpansion

for /f "tokens=* delims= " %%a in (%systemroot%\system32\$WINNT$.INF) do (
echo %%a | find "dospath=" > nul
if not errorlevel 1 set str=%%a
)
for /f "tokens=2 delims==" %%a in ('echo !str!') do (
SET dospath=%%a
echo dospath=!dospath!
)

:TYPE
if not exist %dospath%\I386\SETUPP.INI goto TYPEX
for /f "tokens=* delims= " %%? in (%dospath%\I386\SETUPP.INI) do set Pid=%%?
set Pid=%Pid:~-3%
if '%Pid%'=='OEM' echo WinXP OEM version detected && goto VERSION

:TYPEX
echo "Incorrect Windows type. OEM files not found!"
goto ERROR

:VERSION
setLocal EnableDelayedExpansion

for /f "tokens=* delims= " %%a in (%dospath%\I386\SETUPP.INI) do (
echo %%a | find "Pid=" > nul
if not errorlevel 1 set str=%%a
)
for /f "tokens=2 delims==" %%a in ('echo !str!') do (
set myvar=%%a
echo myvar=!myvar!
set finalvar=!myvar:~0,5!
echo finalvar=!finalvar!
)

rem English PIDs
if '%finalvar%'=='76487' echo WinXP Pro version detected && goto MCE
if '%finalvar%'=='76481' echo WinXP Pro version detected && goto MCE
if '%finalvar%'=='76500' echo WinXP Pro version detected && goto MCE
if '%finalvar%'=='76477' echo WinXP Home version detected && goto HOME
if '%finalvar%'=='76475' echo WinXP Home version detected && goto HOME
rem Other Language PIDs
if '%finalvar%'=='76392' echo WinXP Pro version detected && goto MCE
if '%finalvar%'=='76396' echo WinXP Pro version detected && goto MCE
if '%finalvar%'=='76413' echo WinXP Pro version detected && goto MCE
if '%finalvar%'=='76440' echo WinXP Pro version detected && goto MCE
if '%finalvar%'=='76447' echo WinXP Pro version detected && goto MCE
if '%finalvar%'=='55375' echo WinXP Pro version detected && goto MCE
if '%finalvar%'=='55679' echo WinXP Pro version detected && goto MCE
if '%finalvar%'=='76470' echo WinXP Home version detected && goto HOME
if '%finalvar%'=='76460' echo WinXP Home version detected && goto HOME
if '%finalvar%'=='76412' echo WinXP Home version detected && goto HOME
if '%finalvar%'=='76381' echo WinXP Home version detected && goto HOME
if '%finalvar%'=='55372' echo WinXP Home version detected && goto HOME
if '%finalvar%'=='55677' echo WinXP Home version detected && goto HOME
rem win2003 PIDs
if '%finalvar%'=='69712' echo Windows 2003 version detected && goto 2K3
if '%finalvar%'=='69753' echo Windows 2003 version detected && goto 2K3
if '%finalvar%'=='69713' echo Windows 2003 version detected && goto 2K3
if '%finalvar%'=='69754' echo Windows 2003 version detected && goto 2K3
if '%finalvar%'=='69770' echo Windows 2003 version detected && goto 2K3
if '%finalvar%'=='69769' echo Windows 2003 version detected && goto 2K3
rem questionable PIDs
if '%finalvar%'=='55274' echo WinXP Pro version detected && goto MCE
if '%finalvar%'=='55276' echo WinXP Pro version detected && goto HOME
if '%finalvar%'=='55277' echo WinXP Home version detected && goto HOME
if '%finalvar%'=='55285' echo WinXP Pro version detected && goto MCE
if '%finalvar%'=='55661' echo WinXP Pro version detected && goto MCE

:VERSIONX
echo "Could not find suitable SLP Product ID"
goto ERROR

:HOME
if not exist %CDROM%\win51ic goto MCE
CALL "%HOME%\OEMSCAN.EXE"
GOTO END

:MCE
if not exist %CDROM%\win51ip goto 2K3
if not exist %CDROM%\CMPNENTS\MEDIACTR\I386\MEDIACTR.CAB goto PRO
CALL "%MCE%\OEMSCAN.EXE"
GOTO END

:PRO
if not exist %CDROM%\win51ip goto 2K3
CALL "%PRO%\OEMSCAN.EXE"
GOTO END

:2K3
if not exist %CDROM%\win51aa goto 2K3a
CALL "%W2K3%\OEMSCAN.EXE"
GOTO END

:2K3a
if not exist %CDROM%\win51ia goto 2K3b
CALL "%W2K3%\OEMSCAN.EXE"
GOTO END

:2K3b
if not exist %CDROM%\win51ib goto 2K3c
CALL "%W2K3%\OEMSCAN.EXE"
GOTO END

:2K3c
if not exist %CDROM%\win51is goto ERROR
CALL "%W2K3%\OEMSCAN.EXE"
GOTO END

:END
EXIT

:ERROR
echo Could not match files
echo Please report errors to mr_smartepants

pause
GOTO END

Edited by mr_smartepants
Link to comment
Share on other sites

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...