Compare commits

..

No commits in common. "master" and "master" have entirely different histories.

10 changed files with 145 additions and 281 deletions

View File

@ -21,83 +21,6 @@ require_once dirname(__FILE__).'/shared/cache.php';
require_once dirname(__FILE__).'/shared/fileinfo.php'; require_once dirname(__FILE__).'/shared/fileinfo.php';
require_once dirname(__FILE__).'/listid.php'; require_once dirname(__FILE__).'/listid.php';
function uupApiPrivateParseFlags($str) {
$split = explode('+', $str);
$flagsSafe = [];
if(isset($split[1])) {
$flags = array_unique(explode(',', strtolower($split[1])));
$flagsSafe = array_intersect(getAllowedFlags(), $flags);
}
return [$split[0], $flagsSafe];
}
function uupApiPrivateGetLatestBuild() {
$builds = array('22000.1');
$ids = uupListIds();
if(isset($ids['error'])) {
$ids['builds'] = array();
}
if(empty($ids['builds'])) {
$build = $builds[0];
} else {
$build = $ids['builds'][0]['build'];
}
return $build;
}
function uupApiPrivateGetAcceptableBranches() {
return [
'auto',
'rs2_release',
'rs3_release',
'rs4_release',
'rs5_release',
'rs5_release_svc_hci',
'19h1_release',
'vb_release',
'fe_release_10x',
'fe_release',
'co_release',
'ni_release',
'zn_release',
'ge_release',
'rs_prerelease',
];
}
function uupApiPrivateNormalizeFetchParams($params) {
$np = array_replace([
'arch' => 'amd64',
'ring' => 'WIF',
'flight' => 'Active',
'branch' => 'ge_release',
'build' => 'latest',
'minor' => 0,
'sku' => 48,
'type' => 'Production',
'flags' => [],
], $params);
if(!is_array($np['flags'])) $np['flags'] = [];
$np['arch'] = strtolower($np['arch']);
$np['ring'] = strtoupper($np['ring']);
$np['flight'] = ucwords(strtolower($np['flight']));
$np['branch'] = strtolower($np['branch']);
$np['build'] = strtolower($np['build']);
$np['minor'] = intval($np['minor']);
$np['sku'] = intval($np['sku']);
$np['type'] = ucwords(strtolower($np['type']));
$np['flags'] = array_map('strtolower', $np['flags']);
return $np;
}
function uupFetchUpd( function uupFetchUpd(
$arch = 'amd64', $arch = 'amd64',
$ring = 'WIF', $ring = 'WIF',
@ -108,46 +31,33 @@ function uupFetchUpd(
$type = 'Production', $type = 'Production',
$cacheRequests = 0 $cacheRequests = 0
) { ) {
[$build, $flags] = uupApiPrivateParseFlags($build);
$params = [
'arch' => $arch,
'ring' => $ring,
'flight' => $flight,
'build' => $build,
'minor' => $minor,
'sku' => $sku,
'type' => $type,
'flags' => $flags,
];
return uupFetchUpd2($params, $cacheRequests);
}
function uupFetchUpd2($params, $cacheRequests = 0) {
uupApiPrintBrand(); uupApiPrintBrand();
$np = uupApiPrivateNormalizeFetchParams($params); $arch = strtolower($arch);
$ring = strtoupper($ring);
$arch = $np['arch']; $flight = ucwords(strtolower($flight));
$ring = $np['ring'];
$flight = 'Active'; $flight = 'Active';
$branch = $np['branch'];
$build = $np['build'];
$minor = $np['minor'];
$sku = $np['sku'];
$type = $np['type'];
$flags = $np['flags'];
$flagsStr = implode(',', $flags); if($build == 'latest' || (!$build)) {
$builds = array('22000.1');
if(strtolower($build) == 'latest' || (!$build)) { $ids = uupListIds();
$build = uupApiPrivateGetLatestBuild(); if(isset($ids['error'])) {
$ids['builds'] = array();
}
if(empty($ids['builds'])) {
$build = $builds[0];
} else {
$build = $ids['builds'][0]['build'];
}
unset($builds, $ids);
} }
$build = explode('.', $build); $build = explode('.', $build);
if(isset($build[1])) $minor = intval($build[1]); if(isset($build[1])) $minor = intval($build[1]);
$build = intval($build[0]); $build = intval($build[0]);
$sku = intval($sku);
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');
@ -173,9 +83,6 @@ function uupFetchUpd2($params, $cacheRequests = 0) {
return array('error' => 'ILLEGAL_MINOR'); return array('error' => 'ILLEGAL_MINOR');
} }
if(!in_array($branch, uupApiPrivateGetAcceptableBranches()))
$branch = 'auto';
if($ring == 'DEV') $ring = 'WIF'; if($ring == 'DEV') $ring = 'WIF';
if($ring == 'BETA') $ring = 'WIS'; if($ring == 'BETA') $ring = 'WIS';
if($ring == 'RELEASEPREVIEW') $ring = 'RP'; if($ring == 'RELEASEPREVIEW') $ring = 'RP';
@ -189,15 +96,15 @@ 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-$build-$minor-$sku-$type";
$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];
$out = sendWuPostRequestHelper('client', 'composeFetchUpdRequest', $composerArgs); $out = sendWuPostRequestHelper('client', 'composeFetchUpdRequest', $composerArgs);
if($out === false || $out['error'] != 200) { if($out['error'] != 200) {
consoleLogger('The request has failed'); consoleLogger('The request has failed');
return array('error' => 'WU_REQUEST_FAILED'); return array('error' => 'WU_REQUEST_FAILED');
} }
@ -223,7 +130,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);
if(isset($info['error'])) { if(isset($info['error'])) {
$errorCount++; $errorCount++;
continue; continue;
@ -253,7 +160,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) {
$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);
@ -295,15 +202,6 @@ function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku
$foundBuild = @$info[3]; $foundBuild = @$info[3];
} }
$isNet = 0;
if(strpos($foundArch, 'netfx') !== false) {
$isNet = 1;
preg_match('/ProductReleaseInstalled Name\=".*\.(.*?)\.(.*?)" Version\=".*\.\d{5}\.(.*?)"/', $updateInfo, $info);
$foundType = @strtolower($info[1]);
$foundArch = @strtolower($info[2]);
$foundBuild = @$info[3];
}
$updateTitle = preg_grep('/<Title>.*<\/Title>/', $updateMeta); $updateTitle = preg_grep('/<Title>.*<\/Title>/', $updateMeta);
sort($updateTitle); sort($updateTitle);
@ -323,11 +221,7 @@ function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku
$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 Update|Microsoft Edge|Windows Feature Experience Pack|Cumulative security Hotpatch/i', $updateTitle)) {
$isCumulativeUpdate = 1; $isCumulativeUpdate = 1;
if($isNet) { $updateTitle = preg_replace('/ for .{3,5}-based systems| \(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 {
$updateTitle = preg_replace('/ for .{3,5}-based systems| \(KB.*?\)/i', '', $updateTitle);
}
} }
$updateTitle = preg_replace("/ ?\d{4}-\d{2}\D ?| ?$foundArch ?| ?x64 ?/i", '', $updateTitle); $updateTitle = preg_replace("/ ?\d{4}-\d{2}\D ?| ?$foundArch ?| ?x64 ?/i", '', $updateTitle);
@ -444,9 +338,7 @@ function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku
$temp['title'] = $updateTitle; $temp['title'] = $updateTitle;
$temp['ring'] = $ring; $temp['ring'] = $ring;
$temp['flight'] = $flight; $temp['flight'] = $flight;
$temp['branch'] = $branch;
$temp['arch'] = $foundArch; $temp['arch'] = $foundArch;
$temp['fetchArch'] = $arch == 'all' ? 'amd64' : $arch;
$temp['build'] = $foundBuild; $temp['build'] = $foundBuild;
$temp['checkBuild'] = $build; $temp['checkBuild'] = $build;
$temp['sku'] = $sku; $temp['sku'] = $sku;
@ -459,10 +351,6 @@ function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku
$temp['releasetype'] = $type; $temp['releasetype'] = $type;
} }
if(!empty($flags)) {
$temp['flags'] = $flags;
}
$temp['created'] = time(); $temp['created'] = time();
$temp['sha256ready'] = true; $temp['sha256ready'] = true;
$temp['files'] = $shaArray; $temp['files'] = $shaArray;

View File

@ -76,10 +76,8 @@ function uupGetFiles(
$info['sku'] = 48; $info['sku'] = 48;
} }
$genPack = [];
if($usePack) { if($usePack) {
$genPack = uupApiGetPacks($updateId); $genPack = uupGetGenPacks($build, $info['arch'], $updateId);
if(empty($genPack)) return array('error' => 'UNSUPPORTED_COMBINATION'); if(empty($genPack)) return array('error' => 'UNSUPPORTED_COMBINATION');
if(!isset($genPack[$usePack])) { if(!isset($genPack[$usePack])) {
@ -300,7 +298,7 @@ function uupGetFiles(
$temp = preg_grep('/Windows(10|11)\.0-KB.*-baseless/i', $filesInfoKeys, PREG_GREP_INVERT); $temp = preg_grep('/Windows(10|11)\.0-KB.*-baseless/i', $filesInfoKeys, PREG_GREP_INVERT);
if($appEdition) { if($appEdition) {
$temp = preg_grep('/.*?AggregatedMetadata.*?\.cab/i', $temp); $temp = preg_grep('/.*?AggregatedMetadata.*?\.cab|.*?DesktopDeployment.*?\.cab/i', $temp);
} else if($build > 21380) { } else if($build > 21380) {
$temp = preg_grep('/Windows(10|11)\.0-KB|SSU-.*?\....$|.*?AggregatedMetadata.*?\.cab|.*?DesktopDeployment.*?\.cab/i', $temp); $temp = preg_grep('/Windows(10|11)\.0-KB|SSU-.*?\....$|.*?AggregatedMetadata.*?\.cab|.*?DesktopDeployment.*?\.cab/i', $temp);
} else { } else {
@ -374,7 +372,6 @@ function uupGetFiles(
'build' => $updateBuild, 'build' => $updateBuild,
'sku' => $updateSku, 'sku' => $updateSku,
'hasUpdates' => $hasUpdates, 'hasUpdates' => $hasUpdates,
'appxPresent' => uupAreAppxPresent($genPack),
'files' => $files, 'files' => $files,
]; ];
@ -402,7 +399,7 @@ function uupGetOnlineFiles($updateId, $rev, $info, $cacheRequests, $type) {
$composerArgs = [$updateId, $info, $rev, $type]; $composerArgs = [$updateId, $info, $rev, $type];
$out = sendWuPostRequestHelper('clientSecured', 'composeFileGetRequest', $composerArgs); $out = sendWuPostRequestHelper('clientSecured', 'composeFileGetRequest', $composerArgs);
if($out === false || $out['error'] != 200) { if($out['error'] != 200) {
consoleLogger('The request has failed'); consoleLogger('The request has failed');
return array('error' => 'WU_REQUEST_FAILED'); return array('error' => 'WU_REQUEST_FAILED');
} }

View File

@ -1,6 +1,6 @@
<?php <?php
/* /*
Copyright 2023 UUP dump API authors Copyright 2022 UUP dump API authors
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -17,35 +17,60 @@ limitations under the License.
require_once dirname(__FILE__).'/shared/main.php'; require_once dirname(__FILE__).'/shared/main.php';
require_once dirname(__FILE__).'/shared/packs.php'; require_once dirname(__FILE__).'/shared/packs.php';
require_once dirname(__FILE__).'/updateinfo.php';
function uupListEditions($lang = 'en-us', $updateId = 0) { function uupListEditions($lang = 'en-us', $updateId = 0) {
if($updateId) {
$info = uupUpdateInfo($updateId, false, true);
}
if(!$lang) { if(!$lang) {
return array('error' => 'UNSUPPORTED_LANG'); return array('error' => 'UNSUPPORTED_LANG');
} }
$lang = strtolower($lang); if(isset($info['info'])) $info = $info['info'];
$genPack = uupApiGetPacks($updateId);
$fancyEditionNames = uupGetInfoTexts()['fancyEditionNames'];
if(!isset($genPack[$lang])) { if(isset($info['build'])) {
return array('error' => 'UNSUPPORTED_LANG'); $build = explode('.', $info['build']);
$build = $build[0];
} else {
$build = 15063;
} }
$editionList = []; if(!isset($info['arch'])) {
$editionListFancy = []; $info['arch'] = null;
}
$genPack = uupGetGenPacks($build, $info['arch'], $updateId);
$fancyTexts = uupGetInfoTexts();
$fancyEditionNames = $fancyTexts['fancyEditionNames'];
if($lang) {
$lang = strtolower($lang);
if(!isset($genPack[$lang])) {
return array('error' => 'UNSUPPORTED_LANG');
}
}
$editionList = array();
$editionListFancy = array();
foreach(array_keys($genPack[$lang]) as $edition) { foreach(array_keys($genPack[$lang]) as $edition) {
if(in_array($edition, ['LXP', 'FOD'])) continue; if($edition == 'LXP') continue;
if($edition == 'FOD') continue;
$fancyName = isset($fancyEditionNames[$edition]) ? $fancyEditionNames[$edition] : $edition; if(isset($fancyEditionNames[$edition])) {
$fancyName = $fancyEditionNames[$edition];
} else {
$fancyName = $edition;
}
$editionList[] = $edition; $editionList[] = $edition;
$editionListFancy[$edition] = $fancyName; $editionListFancy[$edition] = $fancyName;
} }
return [ return array(
'apiVersion' => uupApiVersion(), 'apiVersion' => uupApiVersion(),
'editionList' => $editionList, 'editionList' => $editionList,
'editionFancyNames' => $editionListFancy, 'editionFancyNames' => $editionListFancy,
]; );
} }

View File

@ -1,6 +1,6 @@
<?php <?php
/* /*
Copyright 2023 UUP dump API authors Copyright 2022 UUP dump API authors
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -19,45 +19,63 @@ require_once dirname(__FILE__).'/shared/main.php';
require_once dirname(__FILE__).'/shared/packs.php'; require_once dirname(__FILE__).'/shared/packs.php';
require_once dirname(__FILE__).'/updateinfo.php'; require_once dirname(__FILE__).'/updateinfo.php';
function uupListLangsInternal($updateId) { function uupListLangs($updateId = 0) {
$genPack = uupApiGetPacks($updateId); if($updateId) {
$fancyLangNames = uupGetInfoTexts()['fancyLangNames']; $info = uupUpdateInfo($updateId, false, true);
}
$langList = []; if(isset($info['info'])) {
$langListFancy = []; $info = $info['info'];
unset($info['files']);
}
if(isset($info['build'])) {
$build = explode('.', $info['build']);
$build = $build[0];
} else {
$build = 15063;
}
if(!isset($info['arch'])) {
$info['arch'] = null;
}
$genPack = uupGetGenPacks($build, $info['arch'], $updateId);
$fancyTexts = uupGetInfoTexts();
$fancyLangNames = $fancyTexts['fancyLangNames'];
$langList = array();
$langListFancy = array();
foreach($genPack as $key => $val) { foreach($genPack as $key => $val) {
if(!count(array_diff(array_keys($val), ['LXP', 'FOD']))) { if(!count(array_diff(array_keys($val), array('LXP')))) {
continue;
}
if(!count(array_diff(array_keys($val), array('FOD')))) {
continue; continue;
} }
$fancyName = isset($fancyLangNames[$key]) ? $fancyLangNames[$key] : $key; if(isset($fancyLangNames[$key])) {
$fancyName = $fancyLangNames[$key];
} else {
$fancyName = $key;
}
$langList[] = $key; $langList[] = $key;
$langListFancy[$key] = $fancyName; $langListFancy[$key] = $fancyName;
} }
return [ if(isset($info)) {
'langList' => $langList, return array(
'langFancyNames' => $langListFancy, 'apiVersion' => uupApiVersion(),
'appxPresent' => uupAreAppxPresent($genPack), 'langList' => $langList,
]; 'langFancyNames' => $langListFancy,
} 'updateInfo' => $info
);
function uupListLangs($updateId = 0, $returnInfo = true) { } else {
if($returnInfo) { return array(
$info = uupUpdateInfo($updateId, ignoreFiles: true); 'apiVersion' => uupApiVersion(),
$info = isset($info['info']) ? $info['info'] : false; 'langList' => $langList,
'langFancyNames' => $langListFancy
);
} }
$langList = uupListLangsInternal($updateId);
$response = array_merge(
['apiVersion' => uupApiVersion()],
$langList
);
if($returnInfo) $response['updateInfo'] = $info;
return $response;
} }

View File

@ -18,10 +18,10 @@ Parameters:
- **Supported Flight values:** `Active`, `Skip`, `Current` - **Supported Flight values:** `Active`, `Skip`, `Current`
- **NOTE:** `Skip` is for `WIF` ring only. `Current` is for `RP` ring only. - **NOTE:** `Skip` is for `WIF` ring only. `Current` is for `RP` ring only.
- `build` - Build number to use when fetching information. Can also be used to provide optional fetch flags in `major.minor+flag1,flag2` format. - `build` - Build number to use when fetching information
- **Supported values:** Any correctly formatted build (`major` or `major.minor`) from range of 9841 and `PHP_INT_MAX-1`. - **Supported values:** >= 9841 and <= PHP_INT_MAX-1
- `minor` - Build minor to use when fetching information. Unused when build is formatted in `major.minor` format - `minor` - Build minor to use when fetching information
- **Supported values:** >= 0 and <= PHP_INT_MAX-1 - **Supported values:** >= 0 and <= PHP_INT_MAX-1
- `sku` - SKU number to use when fetching information - `sku` - SKU number to use when fetching information
@ -80,8 +80,6 @@ Outputs list of languages supported for specified Update ID.
Parameters: Parameters:
- `updateId` - Update identifier (optional) - `updateId` - Update identifier (optional)
- **Supported values:** any update UUID - **Supported values:** any update UUID
- `returnInfo` - Should the full update inforation be returned with a list of languages
- **Supported values:** `true` or `false`
#### updateinfo.php: `uupUpdateInfo($updateId, $onlyInfo, $ignoreFiles);` #### updateinfo.php: `uupUpdateInfo($updateId, $onlyInfo, $ignoreFiles);`

View File

@ -60,9 +60,6 @@ function uupEncryptedData() {
if(empty($cookieInfo)) { if(empty($cookieInfo)) {
$data = sendWuPostRequestHelper('client', 'composeGetCookieRequest', [], false); $data = sendWuPostRequestHelper('client', 'composeGetCookieRequest', [], false);
if($data === false || $data['error'] != 200)
return false;
$cookieInfo = uupSaveCookieFromResponse($data['out']); $cookieInfo = uupSaveCookieFromResponse($data['out']);
} }

View File

@ -16,7 +16,7 @@ limitations under the License.
*/ */
function uupApiVersion() { function uupApiVersion() {
return '1.48.0'; return '1.41.0';
} }
require_once dirname(__FILE__).'/auths.php'; require_once dirname(__FILE__).'/auths.php';

View File

@ -83,7 +83,6 @@ function uupGetInfoTexts() {
'PPIPRO' => 'Windows Team', 'PPIPRO' => 'Windows Team',
'PROFESSIONAL' => 'Windows Pro', 'PROFESSIONAL' => 'Windows Pro',
'PROFESSIONALN' => 'Windows Pro N', 'PROFESSIONALN' => 'Windows Pro N',
'PROFESSIONALCOUNTRYSPECIFIC' => 'Windows Pro China Only',
'SERVERSTANDARD' => 'Windows Server Standard', 'SERVERSTANDARD' => 'Windows Server Standard',
'SERVERSTANDARDCORE' => 'Windows Server Standard, Core', 'SERVERSTANDARDCORE' => 'Windows Server Standard, Core',
'SERVERDATACENTER' => 'Windows Server Datacenter', 'SERVERDATACENTER' => 'Windows Server Datacenter',
@ -203,7 +202,7 @@ function uupGetInfoTexts() {
); );
} }
function uupApiGetPacks($updateId) { function uupGetGenPacks($build = 15063, $arch = null, $updateId = null) {
if(empty($updateId)) return []; if(empty($updateId)) return [];
if(!file_exists('packs/'.$updateId.'.json.gz')) return []; if(!file_exists('packs/'.$updateId.'.json.gz')) return [];
@ -213,7 +212,3 @@ function uupApiGetPacks($updateId) {
$genPack = json_decode($genPack, 1); $genPack = json_decode($genPack, 1);
return $genPack; return $genPack;
} }
function uupGetGenPacks($build = 15063, $arch = null, $updateId = null) {
return uupApiGetPacks($updateId);
}

View File

@ -16,10 +16,8 @@ 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) {
if($branch == 'auto') $branch = branchFromBuild($build);
$branch = branchFromBuild($build);
$blockUpgrades = 0; $blockUpgrades = 0;
$flightEnabled = 1; $flightEnabled = 1;
$isRetail = 0; $isRetail = 0;
@ -33,14 +31,12 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type, $fl
$dvcFamily = 'Windows.Desktop'; $dvcFamily = 'Windows.Desktop';
$insType = 'Client'; $insType = 'Client';
$prodType = 'WinNT';
if($sku == 119) { if($sku == 119) {
$dvcFamily = 'Windows.Team'; $dvcFamily = 'Windows.Team';
} }
if(uupApiIsServer($sku)) { if(uupApiIsServer($sku)) {
$dvcFamily = 'Windows.Server'; $dvcFamily = 'Windows.Server';
$insType = 'Server'; $insType = 'Server';
$prodType = 'ServerNT';
$blockUpgrades = 1; $blockUpgrades = 1;
} }
/*/ Hololens /*/ Hololens
@ -54,12 +50,12 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type, $fl
$insType = 'FactoryOS'; $insType = 'FactoryOS';
} }
$fltBranch = '';
$fltContent = 'Mainline'; $fltContent = 'Mainline';
$fltRing = 'External'; $fltRing = 'External';
$flight = 'Active'; $flight = 'Active';
if($ring == 'RETAIL') { if($ring == 'RETAIL') {
$fltBranch = '';
$fltContent = $flight; $fltContent = $flight;
$fltRing = 'Retail'; $fltRing = 'Retail';
$flightEnabled = 0; $flightEnabled = 0;
@ -116,7 +112,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=281', 'AttrDataVer=247',
'AllowInPlaceUpgrade=1', 'AllowInPlaceUpgrade=1',
'AllowOptionalContent=1', 'AllowOptionalContent=1',
'AllowUpgradesWithUnsupportedTPMOrCPU=1', 'AllowUpgradesWithUnsupportedTPMOrCPU=1',
@ -124,8 +120,6 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type, $fl
'BranchReadinessLevel=CB', 'BranchReadinessLevel=CB',
'CIOptin=1', 'CIOptin=1',
'CurrentBranch='.$branch, 'CurrentBranch='.$branch,
'DataExpDateEpoch_GE24H2='.(time()+82800),
'DataExpDateEpoch_GE24H2Setup='.(time()+82800),
'DataExpDateEpoch_CU23H2='.(time()+82800), 'DataExpDateEpoch_CU23H2='.(time()+82800),
'DataExpDateEpoch_CU23H2Setup='.(time()+82800), 'DataExpDateEpoch_CU23H2Setup='.(time()+82800),
'DataExpDateEpoch_NI22H2='.(time()+82800), 'DataExpDateEpoch_NI22H2='.(time()+82800),
@ -148,15 +142,13 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type, $fl
//'FlightContent='.$fltContent, //'FlightContent='.$fltContent,
'FlightRing='.$fltRing, 'FlightRing='.$fltRing,
'Free=gt64', 'Free=gt64',
'GStatus_GE24H2=2',
'GStatus_GE24H2Setup=2',
'GStatus_CU23H2=2', 'GStatus_CU23H2=2',
'GStatus_CU23H2Setup=2', 'GStatus_CU23H2Setup=2',
'GStatus_NI23H2=2',
'GStatus_NI22H2=2', 'GStatus_NI22H2=2',
'GStatus_NI22H2Setup=2', 'GStatus_NI22H2Setup=2',
'GStatus_CO21H2=2', 'GStatus_CO21H2=2',
'GStatus_CO21H2Setup=2', 'GStatus_CO21H2Setup=2',
'GStatus_23H2=2',
'GStatus_22H2=2', 'GStatus_22H2=2',
'GStatus_21H2=2', 'GStatus_21H2=2',
'GStatus_21H1=2', 'GStatus_21H1=2',
@ -172,37 +164,33 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type, $fl
'IsDeviceRetailDemo=0', 'IsDeviceRetailDemo=0',
'IsFlightingEnabled='.$flightEnabled, 'IsFlightingEnabled='.$flightEnabled,
'IsRetailOS='.$isRetail, 'IsRetailOS='.$isRetail,
'LCUVer=0.0.0.0',
'MediaBranch=', 'MediaBranch=',
'MediaVersion='.$build, 'MediaVersion='.$build,
'CloudPBR=1', 'CloudPBR=1',
'DUScan=1', 'DUScan=1',
'OEMModel=21F6CTO1WW', 'OEMModel=Asus ROG Maximus Z690 Extreme',
'OEMModelBaseBoard=21F6CTO1WW', 'OEMModelBaseBoard=ROG MAXIMUS Z690 EXTREME',
'OEMName_Uncleaned=LENOVO', 'OEMName_Uncleaned=Contoso Corporation',
'OemPartnerRing=UPSFlighting', 'OemPartnerRing=UPSFlighting',
'OSArchitecture='.$arch, 'OSArchitecture='.$arch,
'OSSkuId='.$sku, 'OSSkuId='.$sku,
'OSUILocale=en-US', 'OSUILocale=en-US',
'OSVersion='.$build, 'OSVersion='.$build,
'ProcessorIdentifier=Intel64 Family 6 Model 186 Stepping 3', 'ProcessorIdentifier=Intel64 Family 6 Model 151 Stepping 2',
'ProcessorManufacturer=GenuineIntel', 'ProcessorManufacturer=GenuineIntel',
'ProcessorModel=13th Gen Intel(R) Core(TM) i7-1355U', 'ProcessorModel=12th Gen Intel(R) Core(TM) i9-12900K',
'ProductType='.$prodType,
'ReleaseType='.$type, 'ReleaseType='.$type,
'SdbVer_20H1=2000000000', 'SdbVer_20H1=2000000000',
'SdbVer_19H1=2000000000', 'SdbVer_19H1=2000000000',
'SecureBootCapable=1', 'SecureBootCapable=1',
'TelemetryLevel=3', 'TelemetryLevel=3',
'TimestampEpochString_GE24H2='.(time()-3600),
'TimestampEpochString_GE24H2Setup='.(time()-3600),
'TimestampEpochString_CU23H2='.(time()-3600), 'TimestampEpochString_CU23H2='.(time()-3600),
'TimestampEpochString_CU23H2Setup='.(time()-3600), 'TimestampEpochString_CU23H2Setup='.(time()-3600),
'TimestampEpochString_NI23H2='.(time()-3600),
'TimestampEpochString_NI22H2='.(time()-3600), 'TimestampEpochString_NI22H2='.(time()-3600),
'TimestampEpochString_NI22H2Setup='.(time()-3600), 'TimestampEpochString_NI22H2Setup='.(time()-3600),
'TimestampEpochString_CO21H2='.(time()-3600), 'TimestampEpochString_CO21H2='.(time()-3600),
'TimestampEpochString_CO21H2Setup='.(time()-3600), 'TimestampEpochString_CO21H2Setup='.(time()-3600),
'TimestampEpochString_23H2='.(time()-3600),
'TimestampEpochString_22H2='.(time()-3600), 'TimestampEpochString_22H2='.(time()-3600),
'TimestampEpochString_21H2='.(time()-3600), 'TimestampEpochString_21H2='.(time()-3600),
'TimestampEpochString_21H1='.(time()-3600), 'TimestampEpochString_21H1='.(time()-3600),
@ -211,10 +199,7 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type, $fl
'TPMVersion=2', 'TPMVersion=2',
'UpdateManagementGroup=2', 'UpdateManagementGroup=2',
'UpdateOfferedDays=0', 'UpdateOfferedDays=0',
'UpgEx_GE24H2Setup=Green',
'UpgEx_GE24H2=Green',
'UpgEx_CU23H2=Green', 'UpgEx_CU23H2=Green',
'UpgEx_NI23H2=Green',
'UpgEx_NI22H2=Green', 'UpgEx_NI22H2=Green',
'UpgEx_CO21H2=Green', 'UpgEx_CO21H2=Green',
'UpgEx_23H2=Green', 'UpgEx_23H2=Green',
@ -227,16 +212,15 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type, $fl
'UpgradeAccepted=1', 'UpgradeAccepted=1',
'UpgradeEligible=1', 'UpgradeEligible=1',
'UserInPlaceUpgrade=1', 'UserInPlaceUpgrade=1',
'VBSState=2',
'Version_RS5=2000000000', 'Version_RS5=2000000000',
'WuClientVer='.$build, 'WuClientVer='.$build,
); );
if(in_array('thisonly', $flags)) { if(uupApiConfigIsTrue('fetch_sync_current_only')) {
$attrib[] = 'MediaBranch='.$branch; $attrib[] = 'MediaBranch='.$branch;
} }
if(in_array('corpnet', $flags) && uupApiConfigIsTrue('allow_corpnet')) { if($ring == 'MSIT' && uupApiConfigIsTrue('allow_corpnet')) {
$attrib[] = 'DUInternal=1'; $attrib[] = 'DUInternal=1';
} }
@ -305,10 +289,6 @@ function branchFromBuild($build) {
$branch = 'zn_release'; $branch = 'zn_release';
break; break;
case 26100:
$branch = 'ge_release';
break;
default: default:
$branch = 'rs_prerelease'; $branch = 'rs_prerelease';
break; break;
@ -328,23 +308,15 @@ function composeFileGetRequest($updateId, $info, $rev = 1, $type = 'Production')
$created = gmdate(DATE_W3C, $createdTime); $created = gmdate(DATE_W3C, $createdTime);
$expires = gmdate(DATE_W3C, $expiresTime); $expires = gmdate(DATE_W3C, $expiresTime);
$arch = 'amd64'; //$branch = branchFromBuild($info['checkBuild']);
if(isset($info['fetchArch'])) {
$arch = $info['fetchArch'];
} elseif(isset($info['arch'])) {
$arch = $info['arch'];
}
$deviceAttributes = composeDeviceAttributes( $deviceAttributes = composeDeviceAttributes(
isset($info['flight']) ? $info['flight'] : 'Active', $info['flight'],
isset($info['ring']) ? $info['ring'] : 'RETAIL', $info['ring'],
isset($info['checkBuild']) ? $info['checkBuild'] : '10.0.19041.1', $info['checkBuild'],
$arch, $info['arch'],
isset($info['sku']) ? $info['sku'] : 48, $info['sku'],
$type, $type
isset($info['flags']) ? $info['flags'] : [],
isset($info['branch']) ? $info['branch'] : 'auto',
); );
return <<<XML return <<<XML
@ -388,12 +360,9 @@ 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') {
$encData = uupEncryptedData();
if($encData === false)
return false;
$device = uupDevice(); $device = uupDevice();
$encData = uupEncryptedData();
$uuid = genUUID(); $uuid = genUUID();
$createdTime = time(); $createdTime = time();
@ -404,8 +373,7 @@ function composeFetchUpdRequest($arch, $flight, $ring, $build, $sku = 48, $type
$expires = gmdate(DATE_W3C, $expiresTime); $expires = gmdate(DATE_W3C, $expiresTime);
$cookieExpires = gmdate(DATE_W3C, $cookieExpiresTime); $cookieExpires = gmdate(DATE_W3C, $cookieExpiresTime);
if($branch == 'auto') $branch = branchFromBuild($build);
$branch = branchFromBuild($build);
$mainProduct = 'Client.OS.rs2'; $mainProduct = 'Client.OS.rs2';
if(uupApiIsServer($sku)) { if(uupApiIsServer($sku)) {
@ -427,10 +395,6 @@ function composeFetchUpdRequest($arch, $flight, $ring, $build, $sku = 48, $type
if($sku == 189) { if($sku == 189) {
$mainProduct = 'WCOSDevice0.OS'; $mainProduct = 'WCOSDevice0.OS';
} }
// WNC
if($sku == 210) {
$mainProduct = 'WNC.OS';
}
if($arch == 'all') { if($arch == 'all') {
$arch = array( $arch = array(
@ -450,7 +414,7 @@ function composeFetchUpdRequest($arch, $flight, $ring, $build, $sku = 48, $type
$products[] = "PN=$mainProduct.$currArch&Branch=$branch&PrimaryOSProduct=1&Repairable=1&V=$build&ReofferUpdate=1"; $products[] = "PN=$mainProduct.$currArch&Branch=$branch&PrimaryOSProduct=1&Repairable=1&V=$build&ReofferUpdate=1";
$products[] = "PN=Adobe.Flash.$currArch&Repairable=1&V=0.0.0.0"; $products[] = "PN=Adobe.Flash.$currArch&Repairable=1&V=0.0.0.0";
$products[] = "PN=Microsoft.Edge.Stable.$currArch&Repairable=1&V=0.0.0.0"; $products[] = "PN=Microsoft.Edge.Stable.$currArch&Repairable=1&V=0.0.0.0";
$products[] = "PN=Microsoft.NETFX.$currArch&V=0.0.0.0"; $products[] = "PN=Microsoft.NETFX.$currArch&V=2018.12.2.0";
$products[] = "PN=Windows.Autopilot.$currArch&Repairable=1&V=0.0.0.0"; $products[] = "PN=Windows.Autopilot.$currArch&Repairable=1&V=0.0.0.0";
$products[] = "PN=Windows.AutopilotOOBE.$currArch&Repairable=1&V=0.0.0.0"; $products[] = "PN=Windows.AutopilotOOBE.$currArch&Repairable=1&V=0.0.0.0";
$products[] = "PN=Windows.Appraiser.$currArch&Repairable=1&V=$build"; $products[] = "PN=Windows.Appraiser.$currArch&Repairable=1&V=$build";
@ -484,12 +448,11 @@ function composeFetchUpdRequest($arch, $flight, $ring, $build, $sku = 48, $type
$build, $build,
$arch, $arch,
$sku, $sku,
$type, $type
$flags,
$branch
); );
$syncCurrent = in_array('thisonly', $flags) ? 'true' : 'false'; $syncCurrent = uupApiConfigIsTrue('fetch_sync_current_only');
$syncCurrentStr = $syncCurrent ? 'true' : 'false';
return <<<XML return <<<XML
<s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:s="http://www.w3.org/2003/05/soap-envelope"> <s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:s="http://www.w3.org/2003/05/soap-envelope">
@ -571,7 +534,6 @@ function composeFetchUpdRequest($arch, $flight, $ring, $build, $sku = 48, $type
<int>2359977</int> <int>2359977</int>
<int>24513870</int> <int>24513870</int>
<int>28880263</int> <int>28880263</int>
<int>296374060</int>
<int>3</int> <int>3</int>
<int>30077688</int> <int>30077688</int>
<int>30486944</int> <int>30486944</int>
@ -613,7 +575,7 @@ function composeFetchUpdRequest($arch, $flight, $ring, $build, $sku = 48, $type
</ExtendedUpdateInfoParameters> </ExtendedUpdateInfoParameters>
<ClientPreferredLanguages/> <ClientPreferredLanguages/>
<ProductsParameters> <ProductsParameters>
<SyncCurrentVersionOnly>$syncCurrent</SyncCurrentVersionOnly> <SyncCurrentVersionOnly>$syncCurrentStr</SyncCurrentVersionOnly>
<DeviceAttributes>$deviceAttributes</DeviceAttributes> <DeviceAttributes>$deviceAttributes</DeviceAttributes>
<CallerAttributes>$callerAttrib</CallerAttributes> <CallerAttributes>$callerAttrib</CallerAttributes>
<Products>$products</Products> <Products>$products</Products>

View File

@ -102,9 +102,6 @@ function sendWuPostRequestHelper(
]; ];
$postData = call_user_func_array($postComposer, $postComposerArgs); $postData = call_user_func_array($postComposer, $postComposerArgs);
if($postData === false)
return false;
$data = sendWuPostRequestInternal($endpoints[$endpoint], $postData, $saveCookie); $data = sendWuPostRequestInternal($endpoints[$endpoint], $postData, $saveCookie);
if($data['error'] == 500 && preg_match('/<ErrorCode>(ConfigChanged|CookieExpired|InvalidCookie)<\/ErrorCode>/', $data['out'])) { if($data['error'] == 500 && preg_match('/<ErrorCode>(ConfigChanged|CookieExpired|InvalidCookie)<\/ErrorCode>/', $data['out'])) {
@ -190,16 +187,3 @@ function uupApiConfigIsTrue($config) {
return $data[$config] == true; return $data[$config] == true;
} }
function getAllowedFlags() {
$flags = ['thisonly'];
if(uupApiConfigIsTrue('allow_corpnet'))
$flags[] = 'corpnet';
return $flags;
}
function uupAreAppxPresent($genPack) {
return isset($genPack['neutral']['APP']);
}