10 Commits

Author SHA1 Message Date
287a25a353 simplify OOBE title 2026-04-21 00:47:14 +03:00
1e07081a0e rework detection for product info 2026-04-21 00:23:36 +03:00
2ddfdfc9f4 add new OOBE attributes 2026-04-21 00:06:49 +03:00
a433e40841 add new category Ids 2026-04-20 23:46:29 +03:00
22e344bdf2 Simplify latest build number retrieval function 2026-01-14 13:58:53 +01:00
0774988365 Fix Windows CPC OS names.
Doubled build number in the name is Microsoft's fault and I can't be bothered to make a hackfix that.
2026-01-14 13:51:59 +01:00
e7fddd4e43 Fix branch selection when the branch is not specified 2026-01-14 13:17:44 +01:00
2231d65edb Add automatic minor number detection 2026-01-14 13:03:27 +01:00
0da5532141 Add Windows 11 to update names 2025-11-21 18:23:07 +01:00
6b5a6885f8 Update for new naming scheme 2025-11-18 12:52:37 +01:00
2 changed files with 90 additions and 34 deletions

View File

@@ -34,20 +34,31 @@ function uupApiPrivateParseFlags($str) {
} }
function uupApiPrivateGetLatestBuild() { function uupApiPrivateGetLatestBuild() {
$builds = array('22000.1');
$ids = uupListIds(); $ids = uupListIds();
if(isset($ids['error'])) {
$ids['builds'] = array(); if(!isset($ids['builds']) || empty($ids['builds'])) {
return '26100.1';
} }
if(empty($ids['builds'])) { return $ids['builds'][0]['build'];
$build = $builds[0];
} else {
$build = $ids['builds'][0]['build'];
} }
return $build; function uupApiPrivateGetLatestPatch($build) {
$ids = uupListIds();
if(!isset($ids['builds']) || empty($ids['builds'])) {
return 0;
}
foreach($ids['builds'] as $val) {
$valBuild = explode('.', $val['build']);
if($valBuild[0] == $build && isset($valBuild[1])) {
return intval($valBuild[1]);
}
}
return 0;
} }
function uupApiPrivateIsAcceptableBranch($branch) { function uupApiPrivateIsAcceptableBranch($branch) {
@@ -83,7 +94,7 @@ function uupApiPrivateNormalizeFetchParams($params) {
'arch' => 'amd64', 'arch' => 'amd64',
'ring' => 'WIF', 'ring' => 'WIF',
'flight' => 'Active', 'flight' => 'Active',
'branch' => 'ge_release', 'branch' => 'auto',
'build' => 'latest', 'build' => 'latest',
'minor' => 0, 'minor' => 0,
'sku' => 48, 'sku' => 48,
@@ -154,9 +165,15 @@ function uupFetchUpd2($params, $cacheRequests = 0) {
} }
$build = explode('.', $build); $build = explode('.', $build);
if(isset($build[1])) $minor = intval($build[1]); if(isset($build[1])) $minor = $build[1];
$build = intval($build[0]); $build = intval($build[0]);
if($minor == 'latest') {
$minor = uupApiPrivateGetLatestPatch($build);
} else {
$minor = intval($minor);
}
if(!($arch == 'amd64' || $arch == 'x86' || $arch == 'arm64' || $arch == 'arm' || $arch == 'all')) { if(!($arch == 'amd64' || $arch == 'x86' || $arch == 'arm64' || $arch == 'arm' || $arch == 'all')) {
return array('error' => 'UNKNOWN_ARCH'); return array('error' => 'UNKNOWN_ARCH');
} }
@@ -284,32 +301,40 @@ function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku
return array('error' => 'EMPTY_FILELIST'); return array('error' => 'EMPTY_FILELIST');
} }
preg_match('/ProductReleaseInstalled Name\="(.*?)\..*\.(.*?)" Version\="10\.0\.(.*?)"/', $updateInfo, $info); preg_match('/ProductReleaseInstalled Name\="(.*?)" Version\="(.*?)"/', $updateInfo, $info);
$foundType = @strtolower($info[1]); if(!isset($info[0]) || empty($info[0])) {
$foundArch = @strtolower($info[2]); $infoExt = preg_grep('/<ExtendedProperties .*?>/', $updateMeta);
$foundBuild = @$info[3]; preg_match('/ProductName\="(.*?)" ReleaseVersion\="(.*?)"/', $infoExt[0], $info);
}
$matchName = @strtolower($info[1]);
$matchVersion = @$info[2];
if(!isset($foundArch) || empty($foundArch)) { if($matchVersion == '1.0.0.0' || $matchVersion == '10.0.0.0') {
preg_match('/ProductReleaseInstalled Name\="(.*?)\.(.*?)" Version\="10\.0\.(.*?)"/', $updateInfo, $info); preg_match('/"BuildFlightVersion":"(.*?)"/', $updateInfo, $infoVer);
$foundType = @strtolower($info[1]); $matchVersion = @$infoVer[1];
$foundArch = @strtolower($info[2]);
$foundBuild = @$info[3];
} }
if(!isset($foundArch) || empty($foundArch)) { $arrayName = explode('.', $matchName);
preg_match('/ProductReleaseInstalled Name\="(.*?)\.(.*?)" Version\="(.*?)"/', $updateInfo, $info); $arrayVersion = explode('.', $matchVersion);
$foundType = @strtolower($info[1]);
$foundArch = @strtolower($info[2]); $foundArch = $arrayName[count($arrayName)-1];
$foundBuild = @$info[3]; $foundType = $arrayName[0];
} if($foundType == 'windows' || $foundType == 'microsoft')
$foundType = $arrayName[1];
$isNet = 0; $isNet = 0;
if(strpos($foundArch, 'netfx') !== false) { if(strpos($matchVersion, '10.0.') !== false) {
$foundBuild = $arrayVersion[2].'.'.$arrayVersion[3];
} elseif($foundType == 'netfx') {
$foundBuild = $arrayVersion[1].'.'.$arrayVersion[2];
$isNet = 1; $isNet = 1;
preg_match('/ProductReleaseInstalled Name\=".*\.(.*?)\.(.*?)" Version\=".*\.\d{5}\.(.*?)"/', $updateInfo, $info); } else {
$foundType = @strtolower($info[1]); $foundBuild = $matchVersion;
$foundArch = @strtolower($info[2]); }
$foundBuild = @$info[3];
$addKB = 0;
if($isNet || $foundType == 'oobe') {
$addKB = 1;
} }
$updateTitle = preg_grep('/<Title>.*<\/Title>/', $updateMeta); $updateTitle = preg_grep('/<Title>.*<\/Title>/', $updateMeta);
@@ -328,9 +353,12 @@ function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku
if($foundType == 'hololens' || $foundType == 'wcosdevice0') if($foundType == 'hololens' || $foundType == 'wcosdevice0')
$updateTitle = preg_replace('/ for .{3,5}-based/i', ' for', $updateTitle); $updateTitle = preg_replace('/ for .{3,5}-based/i', ' for', $updateTitle);
preg_match('/\((KB.*?)\)/', $updateTitle, $updateKB);
$isCumulativeUpdate = 0; $isCumulativeUpdate = 0;
if(preg_match('/\d{4}-\d{2}.+Update|Cumulative Update|Microsoft Edge|Windows Feature Experience Pack|Cumulative security Hotpatch/i', $updateTitle)) { if(preg_match('/\d{4}-\d{2}.+Update|(Cumulative|Security|Preview) Update|Microsoft Edge|Windows Feature Experience Pack|Cumulative security Hotpatch/i', $updateTitle)) {
$isCumulativeUpdate = 1; $isCumulativeUpdate = 1;
if($isNet) { if($isNet) {
$updateTitle = preg_replace("/3.5 and 4.8.1 |3.5 and 4.8 | for $foundArch| for x64| \(KB.*?\)/i", '', $updateTitle); $updateTitle = preg_replace("/3.5 and 4.8.1 |3.5 and 4.8 | for $foundArch| for x64| \(KB.*?\)/i", '', $updateTitle);
} else { } else {
@@ -345,6 +373,15 @@ function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku
$updateTitle = str_replace('Windows 11', 'Windows Server', $updateTitle); $updateTitle = str_replace('Windows 11', 'Windows Server', $updateTitle);
} }
if(preg_match('/Windows 1\d|Server|Azure Stack HCI|Windows CPC OS/i', $updateTitle) !== 1) {
$osName = $foundType != 'server' ? 'Windows 11' : 'Microsoft server operating system';
$updateTitle = str_replace('Update', "Update for $osName", $updateTitle);
}
if($foundType == 'oobe' && !preg_match("/OOBE|Out of Box/i", $updateTitle)) {
$updateTitle = str_replace('Update', 'OOBE Update', $updateTitle);
}
if($sku == 406) if($sku == 406)
$updateTitle = str_replace('Microsoft server operating system', 'Azure Stack HCI', $updateTitle); $updateTitle = str_replace('Microsoft server operating system', 'Azure Stack HCI', $updateTitle);
@@ -354,7 +391,10 @@ function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku
if($foundType == 'hololens' || $foundType == 'wcosdevice0') if($foundType == 'hololens' || $foundType == 'wcosdevice0')
$updateTitle = $updateTitle.' - '.$type; $updateTitle = $updateTitle.' - '.$type;
if(!preg_match("/$foundBuild/i", $updateTitle)) if($addKB && isset($updateKB[0]))
$updateTitle = $updateTitle.' - '.$updateKB[1];
if(!str_contains($updateTitle, $foundBuild))
$updateTitle = $updateTitle.' ('.$foundBuild.')'; $updateTitle = $updateTitle.' ('.$foundBuild.')';
preg_match('/UpdateID=".*?"/', $updateInfo, $updateId); preg_match('/UpdateID=".*?"/', $updateInfo, $updateId);

View File

@@ -116,7 +116,7 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type, $fl
$attrib = array( $attrib = array(
'App=WU_OS', 'App=WU_OS',
'AppVer='.$build, 'AppVer='.$build,
'AttrDataVer=331', 'AttrDataVer=352',
'AllowInPlaceUpgrade=1', 'AllowInPlaceUpgrade=1',
'AllowOptionalContent=1', 'AllowOptionalContent=1',
'AllowUpgradesWithUnsupportedTPMOrCPU=1', 'AllowUpgradesWithUnsupportedTPMOrCPU=1',
@@ -174,6 +174,7 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type, $fl
'IsDeviceRetailDemo=0', 'IsDeviceRetailDemo=0',
'IsFlightingEnabled='.$flightEnabled, 'IsFlightingEnabled='.$flightEnabled,
'IsRetailOS='.$isRetail, 'IsRetailOS='.$isRetail,
'LaunchUserOOBE=1',
'LCUVer=0.0.0.0', 'LCUVer=0.0.0.0',
'MediaBranch=', 'MediaBranch=',
'MediaVersion='.$build, 'MediaVersion='.$build,
@@ -317,9 +318,15 @@ function branchFromBuild($build) {
case 26100: case 26100:
case 26120: case 26120:
case 26200: case 26200:
case 26300:
$branch = 'ge_release'; $branch = 'ge_release';
break; break;
case 28000:
case 28100:
$branch = 'br_release';
break;
default: default:
$branch = 'rs_prerelease'; $branch = 'rs_prerelease';
break; break;
@@ -470,6 +477,8 @@ function composeFetchUpdRequest($arch, $flight, $ring, $build, $sku = 48, $type
$products[] = "PN=Windows.FeatureExperiencePack.$currArch&Repairable=1&V=0.0.0.0"; $products[] = "PN=Windows.FeatureExperiencePack.$currArch&Repairable=1&V=0.0.0.0";
$products[] = "PN=Windows.ManagementOOBE.$currArch&IsWindowsManagementOOBE=1&Repairable=1&V=$build"; $products[] = "PN=Windows.ManagementOOBE.$currArch&IsWindowsManagementOOBE=1&Repairable=1&V=$build";
$products[] = "PN=Windows.OOBE.$currArch&IsWindowsOOBE=1&Repairable=1&V=$build"; $products[] = "PN=Windows.OOBE.$currArch&IsWindowsOOBE=1&Repairable=1&V=$build";
$products[] = "PN=Windows.OOBE.Cumulative.$currArch&V=0.0.0.0";
$products[] = "PN=Windows.OOBE.Standalone.$currArch&V=0.0.0.0";
$products[] = "PN=Windows.UpdateStackPackage.$currArch&Name=Update Stack Package&Repairable=1&V=$build"; $products[] = "PN=Windows.UpdateStackPackage.$currArch&Name=Update Stack Package&Repairable=1&V=$build";
$products[] = "PN=Hammer.$currArch&Source=UpdateOrchestrator&V=0.0.0.0"; $products[] = "PN=Hammer.$currArch&Source=UpdateOrchestrator&V=0.0.0.0";
$products[] = "PN=MSRT.$currArch&Source=UpdateOrchestrator&V=0.0.0.0"; $products[] = "PN=MSRT.$currArch&Source=UpdateOrchestrator&V=0.0.0.0";
@@ -586,6 +595,13 @@ function composeFetchUpdRequest($arch, $flight, $ring, $build, $sku = 48, $type
<int>3</int> <int>3</int>
<int>30077688</int> <int>30077688</int>
<int>30486944</int> <int>30486944</int>
<int>316003061</int>
<int>326686062</int>
<int>326686063</int>
<int>327065581</int>
<int>327072300</int>
<int>327072305</int>
<int>327100345</int>
<int>5143990</int> <int>5143990</int>
<int>5169043</int> <int>5169043</int>
<int>5169044</int> <int>5169044</int>