Compare commits

..
3 Commits
Author SHA1 Message Date
abbodi1406 45af6f1c46 Update deviceAttributes 2026-10-02 10:03:40 +03:00
orin 1c942f52d3 Add target release selection support 2026-09-05 18:05:18 +02:00
orin 20ddcb74e5 Rework listid.php, move low priority updates to the bottom 2026-06-28 00:53:52 +02:00
4 changed files with 138 additions and 97 deletions

No files matched your search

+19 -4
View File
@@ -33,6 +33,15 @@ function uupApiPrivateParseFlags($str) {
return [$split[0], $flagsSafe]; return [$split[0], $flagsSafe];
} }
function uupApiPrivateParseRing($str) {
$split = explode(':', $str);
if(!isset($split[1])) {
return [$split[0], -1];
}
return $split;
}
function uupApiPrivateGetLatestBuild() { function uupApiPrivateGetLatestBuild() {
$ids = uupListIds(); $ids = uupListIds();
@@ -100,6 +109,7 @@ function uupApiPrivateNormalizeFetchParams($params) {
'sku' => 48, 'sku' => 48,
'type' => 'Production', 'type' => 'Production',
'flags' => [], 'flags' => [],
'targetRelease' => -1,
], $params); ], $params);
if(!is_array($np['flags'])) $np['flags'] = []; if(!is_array($np['flags'])) $np['flags'] = [];
@@ -113,6 +123,7 @@ function uupApiPrivateNormalizeFetchParams($params) {
$np['sku'] = intval($np['sku']); $np['sku'] = intval($np['sku']);
$np['type'] = ucwords(strtolower($np['type'])); $np['type'] = ucwords(strtolower($np['type']));
$np['flags'] = array_map('strtolower', $np['flags']); $np['flags'] = array_map('strtolower', $np['flags']);
$np['targetRelease'] = intval($np['targetRelease']);
return $np; return $np;
} }
@@ -128,6 +139,7 @@ function uupFetchUpd(
$cacheRequests = 0 $cacheRequests = 0
) { ) {
[$build, $flags] = uupApiPrivateParseFlags($build); [$build, $flags] = uupApiPrivateParseFlags($build);
[$ring, $targetRelease] = uupApiPrivateParseRing($ring);
$params = [ $params = [
'arch' => $arch, 'arch' => $arch,
@@ -138,6 +150,7 @@ function uupFetchUpd(
'sku' => $sku, 'sku' => $sku,
'type' => $type, 'type' => $type,
'flags' => $flags, 'flags' => $flags,
'targetRelease' => $targetRelease,
]; ];
return uupFetchUpd2($params, $cacheRequests); return uupFetchUpd2($params, $cacheRequests);
@@ -157,6 +170,7 @@ function uupFetchUpd2($params, $cacheRequests = 0) {
$sku = $np['sku']; $sku = $np['sku'];
$type = $np['type']; $type = $np['type'];
$flags = $np['flags']; $flags = $np['flags'];
$targetRelease = $np['targetRelease'];
$flagsStr = implode(',', $flags); $flagsStr = implode(',', $flags);
@@ -214,13 +228,13 @@ function uupFetchUpd2($params, $cacheRequests = 0) {
$type = 'Production'; $type = 'Production';
} }
$res = "api-fetch-$arch-$ring-$flight-$branch-$build-$flagsStr-$minor-$sku-$type"; $res = "api-fetch-$arch-$ring-$flight-$branch-$build-$flagsStr-$minor-$sku-$type-$targetRelease";
$cache = new UupDumpCache($res); $cache = new UupDumpCache($res);
$fromCache = $cache->get(); $fromCache = $cache->get();
if($fromCache !== false) return $fromCache; if($fromCache !== false) return $fromCache;
consoleLogger('Fetching information from the server...'); consoleLogger('Fetching information from the server...');
$composerArgs = [$arch, $flight, $ring, $build, $sku, $type, $flags, $branch]; $composerArgs = [$arch, $flight, $ring, $build, $sku, $type, $flags, $branch, $targetRelease];
$out = sendWuPostRequestHelper('client', 'composeFetchUpdRequest', $composerArgs); $out = sendWuPostRequestHelper('client', 'composeFetchUpdRequest', $composerArgs);
if($out === false || $out['error'] != 200) { if($out === false || $out['error'] != 200) {
consoleLogger('The request has failed'); consoleLogger('The request has failed');
@@ -248,7 +262,7 @@ function uupFetchUpd2($params, $cacheRequests = 0) {
$num++; $num++;
consoleLogger("Checking build information for update {$num} of {$updatesNum}..."); consoleLogger("Checking build information for update {$num} of {$updatesNum}...");
$info = parseFetchUpdate($val, $out, $arch, $ring, $flight, $build, $sku, $type, $flags, $branch); $info = parseFetchUpdate($val, $out, $arch, $ring, $flight, $build, $sku, $type, $flags, $branch, $targetRelease);
if(isset($info['error'])) { if(isset($info['error'])) {
$errorCount++; $errorCount++;
continue; continue;
@@ -278,7 +292,7 @@ function uupFetchUpd2($params, $cacheRequests = 0) {
return $data; return $data;
} }
function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku, $type, $flags, $branch) { function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku, $type, $flags, $branch, $targetRelease) {
$updateNumId = preg_replace('/<UpdateInfo><ID>|<\/ID>.*/i', '', $updateInfo); $updateNumId = preg_replace('/<UpdateInfo><ID>|<\/ID>.*/i', '', $updateInfo);
$updates = preg_replace('/<Update>/', "\n<Update>", $out); $updates = preg_replace('/<Update>/', "\n<Update>", $out);
@@ -493,6 +507,7 @@ function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku
$temp['ring'] = $ring; $temp['ring'] = $ring;
$temp['flight'] = $flight; $temp['flight'] = $flight;
$temp['branch'] = $branch; $temp['branch'] = $branch;
$temp['targetRelease'] = $targetRelease;
$temp['arch'] = $foundArch; $temp['arch'] = $foundArch;
$temp['fetchArch'] = $arch == 'all' ? 'amd64' : $arch; $temp['fetchArch'] = $arch == 'all' ? 'amd64' : $arch;
$temp['build'] = $foundBuild; $temp['build'] = $foundBuild;
+74 -75
View File
@@ -27,19 +27,8 @@ function uupApiPrivateInvalidateFileinfoCache() {
$cache2->delete(); $cache2->delete();
} }
function uupApiPrivateGetFromFileinfo($sortByDate = 0) { function uupApiGetFileInfoCache($cacheFile) {
$dirs = uupApiGetFileinfoDirs();
$fileinfo = $dirs['fileinfoData'];
$fileinfoRoot = $dirs['fileinfo'];
$files = scandir($fileinfo);
$files = preg_grep('/\.json$/', $files);
consoleLogger('Parsing database info...');
$cacheFile = $fileinfoRoot.'/cache.json';
$cacheV2Version = 1; $cacheV2Version = 1;
$database = uupApiReadJson($cacheFile); $database = uupApiReadJson($cacheFile);
if(isset($database['version'])) { if(isset($database['version'])) {
@@ -54,88 +43,98 @@ function uupApiPrivateGetFromFileinfo($sortByDate = 0) {
$database = array(); $database = array();
} }
if(empty($database)) $database = array(); if(empty($database))
$database = [];
return $database;
}
function uupApiPrivateGetCachedBuild(&$cache, $uuid) {
if(!isset($cache[$uuid])) {
$info = uupApiReadFileinfoMeta($uuid);
$data = [
'title' => isset($info['title']) ? $info['title'] : 'UNKNOWN',
'build' => isset($info['build']) ? $info['build'] : 'UNKNOWN',
'arch' => isset($info['arch']) ? $info['arch'] : 'UNKNOWN',
'created' => isset($info['created']) ? $info['created'] : null,
];
$cache[$uuid] = $data;
} else {
$data = $cache[$uuid];
}
$data['uuid'] = $uuid;
return $data;
}
function uupApiPrivateGetSortTag($data, $sortByDate) {
$tmp = explode('.', $data['build']);
if($sortByDate) {
$tag = PHP_INT_MAX - intval($data['created']);
} else {
$tag = '';
}
$tag .= intval(uupApiIsUpdateLowPriority($data['title']));
if(isset($tmp[1])) {
$tag .= str_pad(999999999 - $tmp[0], 10, '0', STR_PAD_LEFT);
$tag .= str_pad(999999999 - $tmp[1], 10, '0', STR_PAD_LEFT);
}
$tag .= $data['arch'] . $data['title'] . $data['uuid'];
return $tag;
}
function uupApiPrivateGetFromFileinfo($sortByDate = 0) {
$dirs = uupApiGetFileinfoDirs();
$fileinfo = $dirs['fileinfoData'];
$fileinfoRoot = $dirs['fileinfo'];
$files = scandir($fileinfo);
$files = preg_grep('/\.json$/', $files);
consoleLogger('Parsing database info...');
$cacheFile = $fileinfoRoot.'/cache.json';
$cacheV2Version = 1;
$database = uupApiGetFileInfoCache($cacheFile);
$oldDb = $database;
$newDb = array();
$builds = array();
foreach($files as $file) { foreach($files as $file) {
if($file == '.' || $file == '..') if($file == '.' || $file == '..')
continue; continue;
$uuid = preg_replace('/\.json$/', '', $file); $uuid = preg_replace('/\.json$/', '', $file);
if(!isset($database[$uuid])) { $data = uupApiPrivateGetCachedBuild($database, $uuid);
$info = uupApiReadFileinfoMeta($uuid); $tag = uupApiPrivateGetSortTag($data, $sortByDate);
$title = isset($info['title']) ? $info['title'] : 'UNKNOWN'; $buildAssoc[$tag] = $uuid;
$build = isset($info['build']) ? $info['build'] : 'UNKNOWN';
$arch = isset($info['arch']) ? $info['arch'] : 'UNKNOWN';
$created = isset($info['created']) ? $info['created'] : null;
$temp = array(
'title' => $title,
'build' => $build,
'arch' => $arch,
'created' => $created,
);
$newDb[$uuid] = $temp;
} else {
$title = $database[$uuid]['title'];
$build = $database[$uuid]['build'];
$arch = $database[$uuid]['arch'];
$created = $database[$uuid]['created'];
$newDb[$uuid] = $database[$uuid];
} }
$temp = array( if(empty($buildAssoc))
'title' => $title, return [];
'build' => $build,
'arch' => $arch,
'created' => $created,
'uuid' => $uuid,
);
$tmp = explode('.', $build); ksort($buildAssoc);
if(isset($tmp[1])) {
$tmp[0] = str_pad($tmp[0], 10, '0', STR_PAD_LEFT); $builds = [];
$tmp[1] = str_pad($tmp[1], 10, '0', STR_PAD_LEFT); foreach($buildAssoc as $val) {
$tmp = $tmp[0].$tmp[1]; $builds[] = uupApiPrivateGetCachedBuild($database, $val);
} else {
consoleLogger($uuid.'.json appears to be broken and may be useless.');
$tmp = 0;
} }
if($sortByDate) {
$tmp = $created.$tmp;
}
$buildAssoc[$tmp][] = $arch.$title.$uuid;
$builds[$tmp.$arch.$title.$uuid] = $temp;
}
if(empty($buildAssoc)) return [];
krsort($buildAssoc);
$buildsNew = array();
foreach($buildAssoc as $key => $val) {
sort($val);
foreach($val as $id) {
$buildsNew[] = $builds[$key.$id];
}
}
$builds = $buildsNew;
consoleLogger('Done parsing database info.'); consoleLogger('Done parsing database info.');
if($newDb != $database) { if($database != $oldDb) {
if(!file_exists('cache')) mkdir('cache'); if(!file_exists('cache')) mkdir('cache');
$cacheData = array( $cacheData = array(
'version' => $cacheV2Version, 'version' => $cacheV2Version,
'database' => $newDb, 'database' => $database,
); );
$success = @file_put_contents( $success = @file_put_contents(
+30 -18
View File
@@ -16,7 +16,7 @@ limitations under the License.
*/ */
// Composes DeviceAttributes parameter needed to fetch data // Composes DeviceAttributes parameter needed to fetch data
function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type, $flags, $branch) { function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type, $flags, $branch, $targetRelease) {
if($branch == 'auto') if($branch == 'auto')
$branch = branchFromBuild($build); $branch = branchFromBuild($build);
@@ -116,29 +116,31 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type, $fl
$attrib = array( $attrib = array(
'App=WU_OS', 'App=WU_OS',
'AppVer='.$build, 'AppVer='.$build,
'AttrDataVer=352', 'AttrDataVer=370',
'AllowInPlaceUpgrade=1', 'AllowInPlaceUpgrade=1',
'AllowOptionalContent=1', 'AllowOptionalContent=1',
'AllowUpgradesWithUnsupportedTPMOrCPU=1', 'AllowUpgradesWithUnsupportedTPMOrCPU=1',
'AllowWindowsServerFeatureUpdate=1',
'BlockFeatureUpdates='.$blockUpgrades, 'BlockFeatureUpdates='.$blockUpgrades,
'BranchReadinessLevel=CB', 'BranchReadinessLevel=CB',
'CIOptin=1', 'CIOptin=1',
'CurrentBranch='.$branch, 'CurrentBranch='.$branch,
'DataExpDateEpoch_GE26H2='.(time()+82800),
'DataExpDateEpoch_GE25H2='.(time()+82800), 'DataExpDateEpoch_GE25H2='.(time()+82800),
'DataExpDateEpoch_GE24H2='.(time()+82800), 'DataExpDateEpoch_GE24H2='.(time()+82800),
'DataExpDateEpoch_GE24H2Setup='.(time()+82800), 'DataExpDateEpoch_GE24H2Setup='.(time()+82800),
'DataExpDateEpoch_CU23H2='.(time()+82800), 'DataExpDateEpoch_NI23H2='.(time()+82800),
'DataExpDateEpoch_CU23H2Setup='.(time()+82800),
'DataExpDateEpoch_NI22H2='.(time()+82800), 'DataExpDateEpoch_NI22H2='.(time()+82800),
'DataExpDateEpoch_NI22H2Setup='.(time()+82800), 'DataExpDateEpoch_NI22H2Setup='.(time()+82800),
'DataExpDateEpoch_CO21H2='.(time()+82800), 'DataExpDateEpoch_CO21H2='.(time()+82800),
'DataExpDateEpoch_CO21H2Setup='.(time()+82800), 'DataExpDateEpoch_CO21H2Setup='.(time()+82800),
'DataExpDateEpoch_23H2='.(time()+82800),
'DataExpDateEpoch_22H2='.(time()+82800), 'DataExpDateEpoch_22H2='.(time()+82800),
'DataExpDateEpoch_21H2='.(time()+82800), 'DataExpDateEpoch_21H2='.(time()+82800),
'DataExpDateEpoch_21H1='.(time()+82800), 'DataExpDateEpoch_21H1='.(time()+82800),
'DataExpDateEpoch_20H1='.(time()+82800), 'DataExpDateEpoch_20H1='.(time()+82800),
'DataExpDateEpoch_20H1Setup='.(time()+82800),
'DataExpDateEpoch_19H1='.(time()+82800), 'DataExpDateEpoch_19H1='.(time()+82800),
'DataExpDateEpoch_19H1Setup='.(time()+82800),
'DataVer_RS5=2000000000', 'DataVer_RS5=2000000000',
'DefaultUserRegion=191', 'DefaultUserRegion=191',
'DeviceFamily='.$dvcFamily, 'DeviceFamily='.$dvcFamily,
@@ -149,11 +151,10 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type, $fl
//'FlightContent='.$fltContent, //'FlightContent='.$fltContent,
'FlightRing='.$fltRing, 'FlightRing='.$fltRing,
'Free=gt64', 'Free=gt64',
'GStatus_GE26H2=2',
'GStatus_GE25H2=2', 'GStatus_GE25H2=2',
'GStatus_GE24H2=2', 'GStatus_GE24H2=2',
'GStatus_GE24H2Setup=2', 'GStatus_GE24H2Setup=2',
'GStatus_CU23H2=2',
'GStatus_CU23H2Setup=2',
'GStatus_NI23H2=2', 'GStatus_NI23H2=2',
'GStatus_NI22H2=2', 'GStatus_NI22H2=2',
'GStatus_NI22H2Setup=2', 'GStatus_NI22H2Setup=2',
@@ -193,14 +194,17 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type, $fl
'ProcessorModel=13th Gen Intel(R) Core(TM) i7-1355U', 'ProcessorModel=13th Gen Intel(R) Core(TM) i7-1355U',
'ProductType='.$prodType, 'ProductType='.$prodType,
'ReleaseType='.$type, 'ReleaseType='.$type,
'SdbVer_GE24H2=2000000000',
'SdbVer_NI22H2=2000000000',
'SdbVer_CO21H2=2000000000',
'SdbVer_20H1=2000000000', 'SdbVer_20H1=2000000000',
'SdbVer_19H1=2000000000', 'SdbVer_19H1=2000000000',
'SecureBootCapable=1', 'SecureBootCapable=1',
'TelemetryLevel=3', 'TelemetryLevel=3',
'TimestampEpochString_GE26H2='.(time()-3600),
'TimestampEpochString_GE25H2='.(time()-3600),
'TimestampEpochString_GE24H2='.(time()-3600), 'TimestampEpochString_GE24H2='.(time()-3600),
'TimestampEpochString_GE24H2Setup='.(time()-3600), 'TimestampEpochString_GE24H2Setup='.(time()-3600),
'TimestampEpochString_CU23H2='.(time()-3600),
'TimestampEpochString_CU23H2Setup='.(time()-3600),
'TimestampEpochString_NI23H2='.(time()-3600), 'TimestampEpochString_NI23H2='.(time()-3600),
'TimestampEpochString_NI22H2='.(time()-3600), 'TimestampEpochString_NI22H2='.(time()-3600),
'TimestampEpochString_NI22H2Setup='.(time()-3600), 'TimestampEpochString_NI22H2Setup='.(time()-3600),
@@ -210,17 +214,21 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type, $fl
'TimestampEpochString_21H2='.(time()-3600), 'TimestampEpochString_21H2='.(time()-3600),
'TimestampEpochString_21H1='.(time()-3600), 'TimestampEpochString_21H1='.(time()-3600),
'TimestampEpochString_20H1='.(time()-3600), 'TimestampEpochString_20H1='.(time()-3600),
'TimestampEpochString_20H1Setup='.(time()-3600),
'TimestampEpochString_19H1='.(time()-3600), 'TimestampEpochString_19H1='.(time()-3600),
'TimestampEpochString_19H1Setup='.(time()-3600),
'TPMVersion=2', 'TPMVersion=2',
'UpdateManagementGroup=2', 'UpdateManagementGroup=2',
'UpdateOfferedDays=0', 'UpdateOfferedDays=0',
'UpgEx_GE26H2=Green',
'UpgEx_GE25H2=Green', 'UpgEx_GE25H2=Green',
'UpgEx_GE24H2Setup=Green', 'UpgEx_GE24H2Setup=Green',
'UpgEx_GE24H2=Green', 'UpgEx_GE24H2=Green',
'UpgEx_CU23H2=Green',
'UpgEx_NI23H2=Green', 'UpgEx_NI23H2=Green',
'UpgEx_NI22H2=Green', 'UpgEx_NI22H2=Green',
'UpgEx_NI22H2Setup=Green',
'UpgEx_CO21H2=Green', 'UpgEx_CO21H2=Green',
'UpgEx_CO21H2Setup=Green',
'UpgEx_23H2=Green', 'UpgEx_23H2=Green',
'UpgEx_22H2=Green', 'UpgEx_22H2=Green',
'UpgEx_21H2=Green', 'UpgEx_21H2=Green',
@@ -234,13 +242,18 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type, $fl
'VBSState=2', 'VBSState=2',
'Version_RS5=2000000000', 'Version_RS5=2000000000',
'Win10CommercialAzureESUEligible=1', 'Win10CommercialAzureESUEligible=1',
'Win10CommercialKeybasedESUEligible=1', 'Win10CommercialKeybasedESUEligible=2',
'Win10CommercialW365ESUEligible=1', 'Win10CommercialW365ESUEligible=1',
'Win10ConsumerESUStatus=3', 'Win10ConsumerESUStatus=3',
'Win10ConsumerESUAY=9', 'Win10ConsumerESUAY=10',
'WuClientVer='.$build, 'WuClientVer='.$build,
); );
if($bldnum >= 26100) {
$attrib[] = 'FlightUpgradeTarget='.$targetRelease;
$attrib[] = 'IsFutureKeyEnabled=1';
}
if(in_array('thisonly', $flags)) { if(in_array('thisonly', $flags)) {
$attrib[] = 'MediaBranch='.$branch; $attrib[] = 'MediaBranch='.$branch;
} }
@@ -288,7 +301,6 @@ function branchFromBuild($build) {
case 19043: case 19043:
case 19044: case 19044:
case 19045: case 19045:
case 19046:
$branch = 'vb_release'; $branch = 'vb_release';
break; break;
@@ -307,7 +319,6 @@ function branchFromBuild($build) {
case 22621: case 22621:
case 22631: case 22631:
case 22635:
$branch = 'ni_release'; $branch = 'ni_release';
break; break;
@@ -316,7 +327,6 @@ function branchFromBuild($build) {
break; break;
case 26100: case 26100:
case 26120:
case 26200: case 26200:
case 26300: case 26300:
$branch = 'ge_release'; $branch = 'ge_release';
@@ -363,6 +373,7 @@ function composeFileGetRequest($updateId, $info, $rev = 1, $type = 'Production')
$type, $type,
isset($info['flags']) ? $info['flags'] : [], isset($info['flags']) ? $info['flags'] : [],
isset($info['branch']) ? $info['branch'] : 'auto', isset($info['branch']) ? $info['branch'] : 'auto',
isset($info['targetRelease']) ? $info['targetRelease'] : -1
); );
return <<<XML return <<<XML
@@ -406,7 +417,7 @@ XML;
} }
// Composes POST data for fetching the latest update information from Windows Update // Composes POST data for fetching the latest update information from Windows Update
function composeFetchUpdRequest($arch, $flight, $ring, $build, $sku = 48, $type = 'Production', $flags = [], $branch = 'auto') { function composeFetchUpdRequest($arch, $flight, $ring, $build, $sku = 48, $type = 'Production', $flags = [], $branch = 'auto', $targetRelease = -1) {
$encData = uupEncryptedData(); $encData = uupEncryptedData();
if($encData === false) if($encData === false)
return false; return false;
@@ -506,7 +517,8 @@ function composeFetchUpdRequest($arch, $flight, $ring, $build, $sku = 48, $type
$sku, $sku,
$type, $type,
$flags, $flags,
$branch $branch,
$targetRelease
); );
$syncCurrent = in_array('thisonly', $flags) ? 'true' : 'false'; $syncCurrent = in_array('thisonly', $flags) ? 'true' : 'false';
@@ -601,7 +613,7 @@ function composeFetchUpdRequest($arch, $flight, $ring, $build, $sku = 48, $type
<int>327065581</int> <int>327065581</int>
<int>327072300</int> <int>327072300</int>
<int>327072305</int> <int>327072305</int>
<int>327100345</int> <int>333703234</int>
<int>5143990</int> <int>5143990</int>
<int>5169043</int> <int>5169043</int>
<int>5169044</int> <int>5169044</int>
+15
View File
@@ -207,3 +207,18 @@ function getAllowedFlags() {
function uupAreAppxPresent($genPack) { function uupAreAppxPresent($genPack) {
return isset($genPack['neutral']['APP']); return isset($genPack['neutral']['APP']);
} }
function uupApiIsUpdateLowPriority($title) {
$titles = [
'Update Stack Package',
'.NET Framework',
'OOBE'
];
foreach($titles as $val) {
if(str_contains($title, $val) == true)
return true;
}
return false;
}