Compare commits

...

20 Commits

Author SHA1 Message Date
37cefa11c6 1.49.0 2025-03-28 13:41:39 +01:00
862d157672 Update branch builds 2025-03-28 13:22:59 +01:00
e433df62cf Add ge_prerelease as acceptable 2025-03-28 12:49:48 +01:00
1933521e0d Disable some safety features in the development mode 2025-03-28 12:48:59 +01:00
7b3cd4eb10 1.48.0 2024-10-22 23:28:00 +02:00
c1f00cecbd Merge pull request 'Add support for NetFX updates' (#1) from abbodi1406/api:master into master
Reviewed-on: #1
2024-10-22 23:27:34 +02:00
8b576e4496 Add support for NetFX updates 2024-10-21 17:24:10 +03:00
21b1500490 Fix warning 2024-06-22 18:50:39 +02:00
fb2c89b2f8 Remove DesktopDeployment from appx sets 2024-06-21 21:07:17 +02:00
846feb2629 Update WU parameters 2024-06-21 15:37:16 +02:00
5e31a6f724 Add additional appx presence checks 2024-06-21 13:31:41 +02:00
faa3b7fa45 Add Appx presence check 2024-06-19 13:29:23 +02:00
42b1091c0b Save architecture used to fetch the build to fileinfo 2024-05-09 22:22:29 +02:00
aa2dbd2938 Add ProfessionalCountrySpecific 2024-04-19 23:01:21 +02:00
42c1c12405 Update auto branch detection for 26100 2024-04-17 21:35:02 +02:00
092e968f0c Initial WNC support
The value was revealed to me in a dream
2024-03-18 20:16:47 +01:00
d58f53de42 Fix broken minor support 2024-03-12 20:50:07 +01:00
ca81835609 Branch selection support 2024-02-28 18:38:42 +01:00
d10e24cf5b Ignore case of specified build 2023-11-11 03:39:16 +01:00
140613f657 Minor flags fixes 2023-11-09 20:36:28 +01:00
8 changed files with 188 additions and 36 deletions

View File

@ -23,7 +23,7 @@ require_once dirname(__FILE__).'/listid.php';
function uupApiPrivateParseFlags($str) { function uupApiPrivateParseFlags($str) {
$split = explode('+', $str); $split = explode('+', $str);
$flags = []; $flagsSafe = [];
if(isset($split[1])) { if(isset($split[1])) {
$flags = array_unique(explode(',', strtolower($split[1]))); $flags = array_unique(explode(',', strtolower($split[1])));
@ -50,6 +50,61 @@ function uupApiPrivateGetLatestBuild() {
return $build; return $build;
} }
function uupApiPrivateIsAcceptableBranch($branch) {
if(!uupApiConfigIsTrue('production_mode')) {
return true;
}
$branches = [
'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',
'ge_prerelease',
'rs_prerelease',
];
return in_array($branch, $branches);
}
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',
@ -60,24 +115,46 @@ function uupFetchUpd(
$type = 'Production', $type = 'Production',
$cacheRequests = 0 $cacheRequests = 0
) { ) {
uupApiPrintBrand();
$arch = strtolower($arch);
$ring = strtoupper($ring);
$flight = ucwords(strtolower($flight));
$flight = 'Active';
$buildWithFlags = $build;
[$build, $flags] = uupApiPrivateParseFlags($build); [$build, $flags] = uupApiPrivateParseFlags($build);
if($build == 'latest' || (!$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();
$np = uupApiPrivateNormalizeFetchParams($params);
$arch = $np['arch'];
$ring = $np['ring'];
$flight = 'Active';
$branch = $np['branch'];
$build = $np['build'];
$minor = $np['minor'];
$sku = $np['sku'];
$type = $np['type'];
$flags = $np['flags'];
$flagsStr = implode(',', $flags);
if(strtolower($build) == 'latest' || (!$build)) {
$build = uupApiPrivateGetLatestBuild(); $build = uupApiPrivateGetLatestBuild();
} }
$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');
@ -103,6 +180,9 @@ function uupFetchUpd(
return array('error' => 'ILLEGAL_MINOR'); return array('error' => 'ILLEGAL_MINOR');
} }
if(!uupApiPrivateIsAcceptableBranch($branch))
$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';
@ -116,13 +196,13 @@ function uupFetchUpd(
$type = 'Production'; $type = 'Production';
} }
$res = "api-fetch-$arch-$ring-$flight-$buildWithFlags-$minor-$sku-$type"; $res = "api-fetch-$arch-$ring-$flight-$branch-$build-$flagsStr-$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]; $composerArgs = [$arch, $flight, $ring, $build, $sku, $type, $flags, $branch];
$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');
@ -150,7 +230,7 @@ function uupFetchUpd(
$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); $info = parseFetchUpdate($val, $out, $arch, $ring, $flight, $build, $sku, $type, $flags, $branch);
if(isset($info['error'])) { if(isset($info['error'])) {
$errorCount++; $errorCount++;
continue; continue;
@ -180,7 +260,7 @@ function uupFetchUpd(
return $data; return $data;
} }
function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku, $type, $flags) { function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku, $type, $flags, $branch) {
$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);
@ -222,6 +302,15 @@ 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);
@ -241,8 +330,12 @@ 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("/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('/ 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);
@ -358,7 +451,9 @@ 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;

View File

@ -76,6 +76,8 @@ function uupGetFiles(
$info['sku'] = 48; $info['sku'] = 48;
} }
$genPack = [];
if($usePack) { if($usePack) {
$genPack = uupApiGetPacks($updateId); $genPack = uupApiGetPacks($updateId);
if(empty($genPack)) return array('error' => 'UNSUPPORTED_COMBINATION'); if(empty($genPack)) return array('error' => 'UNSUPPORTED_COMBINATION');
@ -298,7 +300,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|.*?DesktopDeployment.*?\.cab/i', $temp); $temp = preg_grep('/.*?AggregatedMetadata.*?\.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 {
@ -372,6 +374,7 @@ function uupGetFiles(
'build' => $updateBuild, 'build' => $updateBuild,
'sku' => $updateSku, 'sku' => $updateSku,
'hasUpdates' => $hasUpdates, 'hasUpdates' => $hasUpdates,
'appxPresent' => uupAreAppxPresent($genPack),
'files' => $files, 'files' => $files,
]; ];

View File

@ -40,6 +40,7 @@ function uupListLangsInternal($updateId) {
return [ return [
'langList' => $langList, 'langList' => $langList,
'langFancyNames' => $langListFancy, 'langFancyNames' => $langListFancy,
'appxPresent' => uupAreAppxPresent($genPack),
]; ];
} }
@ -51,11 +52,10 @@ function uupListLangs($updateId = 0, $returnInfo = true) {
$langList = uupListLangsInternal($updateId); $langList = uupListLangsInternal($updateId);
$response = [ $response = array_merge(
'apiVersion' => uupApiVersion(), ['apiVersion' => uupApiVersion()],
'langList' => $langList['langList'], $langList
'langFancyNames' => $langList['langFancyNames'], );
];
if($returnInfo) $response['updateInfo'] = $info; if($returnInfo) $response['updateInfo'] = $info;

View File

@ -35,6 +35,10 @@ class UupDumpCache {
} }
public function get() { public function get() {
if(!uupApiConfigIsTrue('production_mode')) {
return false;
}
$cacheFile = $this->cacheFile; $cacheFile = $this->cacheFile;
if(!file_exists($cacheFile)) { if(!file_exists($cacheFile)) {
@ -58,6 +62,10 @@ class UupDumpCache {
} }
public function put($content, $validity) { public function put($content, $validity) {
if(!uupApiConfigIsTrue('production_mode')) {
return false;
}
$cacheFile = $this->cacheFile; $cacheFile = $this->cacheFile;
$expires = $validity ? time() + $validity : false; $expires = $validity ? time() + $validity : false;

View File

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

View File

@ -83,6 +83,7 @@ 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',

View File

@ -16,8 +16,10 @@ 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) { function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type, $flags, $branch) {
if($branch == 'auto')
$branch = branchFromBuild($build); $branch = branchFromBuild($build);
$blockUpgrades = 0; $blockUpgrades = 0;
$flightEnabled = 1; $flightEnabled = 1;
$isRetail = 0; $isRetail = 0;
@ -31,12 +33,14 @@ 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
@ -112,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=247', 'AttrDataVer=281',
'AllowInPlaceUpgrade=1', 'AllowInPlaceUpgrade=1',
'AllowOptionalContent=1', 'AllowOptionalContent=1',
'AllowUpgradesWithUnsupportedTPMOrCPU=1', 'AllowUpgradesWithUnsupportedTPMOrCPU=1',
@ -120,6 +124,8 @@ 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),
@ -142,13 +148,15 @@ 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',
@ -164,6 +172,7 @@ 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',
@ -179,18 +188,21 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type, $fl
'ProcessorIdentifier=Intel64 Family 6 Model 186 Stepping 3', 'ProcessorIdentifier=Intel64 Family 6 Model 186 Stepping 3',
'ProcessorManufacturer=GenuineIntel', 'ProcessorManufacturer=GenuineIntel',
'ProcessorModel=13th Gen Intel(R) Core(TM) i7-1355U', 'ProcessorModel=13th Gen Intel(R) Core(TM) i7-1355U',
'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),
@ -199,7 +211,10 @@ 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',
@ -212,6 +227,7 @@ 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,
); );
@ -282,6 +298,7 @@ function branchFromBuild($build) {
case 22621: case 22621:
case 22631: case 22631:
case 22635:
$branch = 'ni_release'; $branch = 'ni_release';
break; break;
@ -289,6 +306,12 @@ function branchFromBuild($build) {
$branch = 'zn_release'; $branch = 'zn_release';
break; break;
case 26100:
case 26120:
case 26200:
$branch = 'ge_release';
break;
default: default:
$branch = 'rs_prerelease'; $branch = 'rs_prerelease';
break; break;
@ -308,16 +331,23 @@ 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);
//$branch = branchFromBuild($info['checkBuild']); $arch = 'amd64';
if(isset($info['fetchArch'])) {
$arch = $info['fetchArch'];
} elseif(isset($info['arch'])) {
$arch = $info['arch'];
}
$deviceAttributes = composeDeviceAttributes( $deviceAttributes = composeDeviceAttributes(
isset($info['flight']) ? $info['flight'] : 'Active', isset($info['flight']) ? $info['flight'] : 'Active',
isset($info['ring']) ? $info['ring'] : 'RETAIL', isset($info['ring']) ? $info['ring'] : 'RETAIL',
isset($info['checkBuild']) ? $info['checkBuild'] : '10.0.19041.1', isset($info['checkBuild']) ? $info['checkBuild'] : '10.0.19041.1',
isset($info['arch']) ? $info['arch'] : 'amd64', $arch,
isset($info['sku']) ? $info['sku'] : 48, isset($info['sku']) ? $info['sku'] : 48,
$type, $type,
isset($info['flags']) ? $info['flags'] : [], isset($info['flags']) ? $info['flags'] : [],
isset($info['branch']) ? $info['branch'] : 'auto',
); );
return <<<XML return <<<XML
@ -361,7 +391,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 = []) { function composeFetchUpdRequest($arch, $flight, $ring, $build, $sku = 48, $type = 'Production', $flags = [], $branch = 'auto') {
$encData = uupEncryptedData(); $encData = uupEncryptedData();
if($encData === false) if($encData === false)
return false; return false;
@ -377,6 +407,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';
@ -399,6 +430,10 @@ 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(
@ -418,7 +453,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=2018.12.2.0"; $products[] = "PN=Microsoft.NETFX.$currArch&V=0.0.0.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";
@ -453,7 +488,8 @@ function composeFetchUpdRequest($arch, $flight, $ring, $build, $sku = 48, $type
$arch, $arch,
$sku, $sku,
$type, $type,
$flags $flags,
$branch
); );
$syncCurrent = in_array('thisonly', $flags) ? 'true' : 'false'; $syncCurrent = in_array('thisonly', $flags) ? 'true' : 'false';
@ -538,6 +574,7 @@ 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>

View File

@ -64,8 +64,12 @@ function sendWuPostRequestInternal($url, $postData, $saveCookie = true) {
curl_setopt($req, CURLOPT_RETURNTRANSFER, 1); curl_setopt($req, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($req, CURLOPT_ENCODING, ''); curl_setopt($req, CURLOPT_ENCODING, '');
curl_setopt($req, CURLOPT_POSTFIELDS, $postData); curl_setopt($req, CURLOPT_POSTFIELDS, $postData);
if(uupApiConfigIsTrue('production_mode')) {
curl_setopt($req, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt($req, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($req, CURLOPT_TIMEOUT, 15); curl_setopt($req, CURLOPT_TIMEOUT, 15);
}
curl_setopt($req, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($req, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($req, CURLOPT_HTTPHEADER, array( curl_setopt($req, CURLOPT_HTTPHEADER, array(
'User-Agent: Windows-Update-Agent/10.0.10011.16384 Client-Protocol/2.50', 'User-Agent: Windows-Update-Agent/10.0.10011.16384 Client-Protocol/2.50',
@ -199,3 +203,7 @@ function getAllowedFlags() {
return $flags; return $flags;
} }
function uupAreAppxPresent($genPack) {
return isset($genPack['neutral']['APP']);
}