Compare commits
19 Commits
7b3cd4eb10
...
287a25a353
| Author | SHA1 | Date | |
|---|---|---|---|
| 287a25a353 | |||
| 1e07081a0e | |||
| 2ddfdfc9f4 | |||
| a433e40841 | |||
| 22e344bdf2 | |||
| 0774988365 | |||
| e7fddd4e43 | |||
| 2231d65edb | |||
| 0da5532141 | |||
| 6b5a6885f8 | |||
| 5000b4c4b9 | |||
| 887dcf71d3 | |||
| 84a149c044 | |||
| 2d2321b21c | |||
| 5bed3a028a | |||
| 37cefa11c6 | |||
| 862d157672 | |||
| e433df62cf | |||
| 1933521e0d |
120
fetchupd.php
120
fetchupd.php
@@ -34,24 +34,39 @@ function uupApiPrivateParseFlags($str) {
|
||||
}
|
||||
|
||||
function uupApiPrivateGetLatestBuild() {
|
||||
$builds = array('22000.1');
|
||||
|
||||
$ids = uupListIds();
|
||||
if(isset($ids['error'])) {
|
||||
$ids['builds'] = array();
|
||||
|
||||
if(!isset($ids['builds']) || empty($ids['builds'])) {
|
||||
return '26100.1';
|
||||
}
|
||||
|
||||
if(empty($ids['builds'])) {
|
||||
$build = $builds[0];
|
||||
} else {
|
||||
$build = $ids['builds'][0]['build'];
|
||||
return $ids['builds'][0]['build'];
|
||||
}
|
||||
|
||||
return $build;
|
||||
function uupApiPrivateGetLatestPatch($build) {
|
||||
$ids = uupListIds();
|
||||
|
||||
if(!isset($ids['builds']) || empty($ids['builds'])) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
function uupApiPrivateGetAcceptableBranches() {
|
||||
return [
|
||||
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) {
|
||||
if(!uupApiConfigIsTrue('production_mode')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$branches = [
|
||||
'auto',
|
||||
'rs2_release',
|
||||
'rs3_release',
|
||||
@@ -66,8 +81,12 @@ function uupApiPrivateGetAcceptableBranches() {
|
||||
'ni_release',
|
||||
'zn_release',
|
||||
'ge_release',
|
||||
'br_release',
|
||||
'ge_prerelease',
|
||||
'rs_prerelease',
|
||||
];
|
||||
|
||||
return in_array($branch, $branches);
|
||||
}
|
||||
|
||||
function uupApiPrivateNormalizeFetchParams($params) {
|
||||
@@ -75,7 +94,7 @@ function uupApiPrivateNormalizeFetchParams($params) {
|
||||
'arch' => 'amd64',
|
||||
'ring' => 'WIF',
|
||||
'flight' => 'Active',
|
||||
'branch' => 'ge_release',
|
||||
'branch' => 'auto',
|
||||
'build' => 'latest',
|
||||
'minor' => 0,
|
||||
'sku' => 48,
|
||||
@@ -146,9 +165,15 @@ function uupFetchUpd2($params, $cacheRequests = 0) {
|
||||
}
|
||||
|
||||
$build = explode('.', $build);
|
||||
if(isset($build[1])) $minor = intval($build[1]);
|
||||
if(isset($build[1])) $minor = $build[1];
|
||||
$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')) {
|
||||
return array('error' => 'UNKNOWN_ARCH');
|
||||
}
|
||||
@@ -173,7 +198,7 @@ function uupFetchUpd2($params, $cacheRequests = 0) {
|
||||
return array('error' => 'ILLEGAL_MINOR');
|
||||
}
|
||||
|
||||
if(!in_array($branch, uupApiPrivateGetAcceptableBranches()))
|
||||
if(!uupApiPrivateIsAcceptableBranch($branch))
|
||||
$branch = 'auto';
|
||||
|
||||
if($ring == 'DEV') $ring = 'WIF';
|
||||
@@ -276,32 +301,40 @@ function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku
|
||||
return array('error' => 'EMPTY_FILELIST');
|
||||
}
|
||||
|
||||
preg_match('/ProductReleaseInstalled Name\="(.*?)\..*\.(.*?)" Version\="10\.0\.(.*?)"/', $updateInfo, $info);
|
||||
$foundType = @strtolower($info[1]);
|
||||
$foundArch = @strtolower($info[2]);
|
||||
$foundBuild = @$info[3];
|
||||
preg_match('/ProductReleaseInstalled Name\="(.*?)" Version\="(.*?)"/', $updateInfo, $info);
|
||||
if(!isset($info[0]) || empty($info[0])) {
|
||||
$infoExt = preg_grep('/<ExtendedProperties .*?>/', $updateMeta);
|
||||
preg_match('/ProductName\="(.*?)" ReleaseVersion\="(.*?)"/', $infoExt[0], $info);
|
||||
}
|
||||
$matchName = @strtolower($info[1]);
|
||||
$matchVersion = @$info[2];
|
||||
|
||||
if(!isset($foundArch) || empty($foundArch)) {
|
||||
preg_match('/ProductReleaseInstalled Name\="(.*?)\.(.*?)" Version\="10\.0\.(.*?)"/', $updateInfo, $info);
|
||||
$foundType = @strtolower($info[1]);
|
||||
$foundArch = @strtolower($info[2]);
|
||||
$foundBuild = @$info[3];
|
||||
if($matchVersion == '1.0.0.0' || $matchVersion == '10.0.0.0') {
|
||||
preg_match('/"BuildFlightVersion":"(.*?)"/', $updateInfo, $infoVer);
|
||||
$matchVersion = @$infoVer[1];
|
||||
}
|
||||
|
||||
if(!isset($foundArch) || empty($foundArch)) {
|
||||
preg_match('/ProductReleaseInstalled Name\="(.*?)\.(.*?)" Version\="(.*?)"/', $updateInfo, $info);
|
||||
$foundType = @strtolower($info[1]);
|
||||
$foundArch = @strtolower($info[2]);
|
||||
$foundBuild = @$info[3];
|
||||
}
|
||||
$arrayName = explode('.', $matchName);
|
||||
$arrayVersion = explode('.', $matchVersion);
|
||||
|
||||
$foundArch = $arrayName[count($arrayName)-1];
|
||||
$foundType = $arrayName[0];
|
||||
if($foundType == 'windows' || $foundType == 'microsoft')
|
||||
$foundType = $arrayName[1];
|
||||
|
||||
$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;
|
||||
preg_match('/ProductReleaseInstalled Name\=".*\.(.*?)\.(.*?)" Version\=".*\.\d{5}\.(.*?)"/', $updateInfo, $info);
|
||||
$foundType = @strtolower($info[1]);
|
||||
$foundArch = @strtolower($info[2]);
|
||||
$foundBuild = @$info[3];
|
||||
} else {
|
||||
$foundBuild = $matchVersion;
|
||||
}
|
||||
|
||||
$addKB = 0;
|
||||
if($isNet || $foundType == 'oobe') {
|
||||
$addKB = 1;
|
||||
}
|
||||
|
||||
$updateTitle = preg_grep('/<Title>.*<\/Title>/', $updateMeta);
|
||||
@@ -320,9 +353,12 @@ function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku
|
||||
if($foundType == 'hololens' || $foundType == 'wcosdevice0')
|
||||
$updateTitle = preg_replace('/ for .{3,5}-based/i', ' for', $updateTitle);
|
||||
|
||||
preg_match('/\((KB.*?)\)/', $updateTitle, $updateKB);
|
||||
|
||||
$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;
|
||||
|
||||
if($isNet) {
|
||||
$updateTitle = preg_replace("/3.5 and 4.8.1 |3.5 and 4.8 | for $foundArch| for x64| \(KB.*?\)/i", '', $updateTitle);
|
||||
} else {
|
||||
@@ -337,6 +373,15 @@ function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku
|
||||
$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)
|
||||
$updateTitle = str_replace('Microsoft server operating system', 'Azure Stack HCI', $updateTitle);
|
||||
|
||||
@@ -346,7 +391,10 @@ function parseFetchUpdate($updateInfo, $out, $arch, $ring, $flight, $build, $sku
|
||||
if($foundType == 'hololens' || $foundType == 'wcosdevice0')
|
||||
$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.')';
|
||||
|
||||
preg_match('/UpdateID=".*?"/', $updateInfo, $updateId);
|
||||
|
||||
@@ -35,6 +35,10 @@ class UupDumpCache {
|
||||
}
|
||||
|
||||
public function get() {
|
||||
if(!uupApiConfigIsTrue('production_mode')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$cacheFile = $this->cacheFile;
|
||||
|
||||
if(!file_exists($cacheFile)) {
|
||||
@@ -58,6 +62,10 @@ class UupDumpCache {
|
||||
}
|
||||
|
||||
public function put($content, $validity) {
|
||||
if(!uupApiConfigIsTrue('production_mode')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$cacheFile = $this->cacheFile;
|
||||
$expires = $validity ? time() + $validity : false;
|
||||
|
||||
|
||||
@@ -31,6 +31,9 @@ function uupApiGetFileinfoDirs() {
|
||||
}
|
||||
|
||||
function uupApiGetFileinfoName($updateId, $meta = false) {
|
||||
if(!uupApiCheckUpdateId($updateId))
|
||||
return null;
|
||||
|
||||
$fileName = $updateId.'.json';
|
||||
$dirs = uupApiGetFileinfoDirs();
|
||||
|
||||
@@ -41,7 +44,12 @@ function uupApiGetFileinfoName($updateId, $meta = false) {
|
||||
}
|
||||
|
||||
function uupApiFileInfoExists($updateId) {
|
||||
return file_exists(uupApiGetFileinfoName($updateId));
|
||||
$name = uupApiGetFileinfoName($updateId);
|
||||
|
||||
if($name === null)
|
||||
return false;
|
||||
|
||||
return file_exists($name);
|
||||
}
|
||||
|
||||
function uupApiWriteFileinfoMeta($updateId, $info) {
|
||||
@@ -49,12 +57,19 @@ function uupApiWriteFileinfoMeta($updateId, $info) {
|
||||
unset($info['files']);
|
||||
|
||||
$file = uupApiGetFileinfoName($updateId, true);
|
||||
|
||||
if($file === null)
|
||||
return false;
|
||||
|
||||
return uupApiWriteJson($file, $info);
|
||||
}
|
||||
|
||||
function uupApiWriteFileinfo($updateId, $info) {
|
||||
$file = uupApiGetFileinfoName($updateId);
|
||||
|
||||
if($file === null)
|
||||
return false;
|
||||
|
||||
if(uupApiWriteJson($file, $info) === false)
|
||||
return false;
|
||||
|
||||
@@ -64,10 +79,14 @@ function uupApiWriteFileinfo($updateId, $info) {
|
||||
function uupApiReadFileinfoMeta($updateId) {
|
||||
$file = uupApiGetFileinfoName($updateId, true);
|
||||
|
||||
if($file === null)
|
||||
return false;
|
||||
|
||||
if(file_exists($file))
|
||||
return uupApiReadJson($file);
|
||||
|
||||
$info = uupApiReadFileinfo($updateId, false);
|
||||
|
||||
if($info === false)
|
||||
return false;
|
||||
|
||||
@@ -88,6 +107,10 @@ function uupApiReadFileinfo($updateId, $meta = false) {
|
||||
return uupApiReadFileinfoMeta($updateId);
|
||||
|
||||
$file = uupApiGetFileinfoName($updateId);
|
||||
|
||||
if($file === null)
|
||||
return false;
|
||||
|
||||
$info = uupApiReadJson($file);
|
||||
|
||||
return $info;
|
||||
|
||||
@@ -16,7 +16,7 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
function uupApiVersion() {
|
||||
return '1.48.0';
|
||||
return "I can't be bothered to update the version; use commit hash.";
|
||||
}
|
||||
|
||||
require_once dirname(__FILE__).'/auths.php';
|
||||
|
||||
@@ -16,6 +16,7 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
require_once dirname(__FILE__).'/../listid.php';
|
||||
require_once dirname(__FILE__).'/utils.php';
|
||||
|
||||
function uupGetInfoTexts() {
|
||||
$fancyLangNames = array(
|
||||
@@ -204,11 +205,19 @@ function uupGetInfoTexts() {
|
||||
}
|
||||
|
||||
function uupApiGetPacks($updateId) {
|
||||
if(empty($updateId)) return [];
|
||||
if(!file_exists('packs/'.$updateId.'.json.gz')) return [];
|
||||
if(empty($updateId))
|
||||
return [];
|
||||
|
||||
if(!uupApiCheckUpdateId($updateId))
|
||||
return [];
|
||||
|
||||
if(!file_exists('packs/'.$updateId.'.json.gz'))
|
||||
return [];
|
||||
|
||||
$genPack = @gzdecode(@file_get_contents('packs/'.$updateId.'.json.gz'));
|
||||
if(empty($genPack)) return [];
|
||||
|
||||
if(empty($genPack))
|
||||
return [];
|
||||
|
||||
$genPack = json_decode($genPack, 1);
|
||||
return $genPack;
|
||||
|
||||
@@ -116,7 +116,7 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type, $fl
|
||||
$attrib = array(
|
||||
'App=WU_OS',
|
||||
'AppVer='.$build,
|
||||
'AttrDataVer=281',
|
||||
'AttrDataVer=352',
|
||||
'AllowInPlaceUpgrade=1',
|
||||
'AllowOptionalContent=1',
|
||||
'AllowUpgradesWithUnsupportedTPMOrCPU=1',
|
||||
@@ -124,6 +124,7 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type, $fl
|
||||
'BranchReadinessLevel=CB',
|
||||
'CIOptin=1',
|
||||
'CurrentBranch='.$branch,
|
||||
'DataExpDateEpoch_GE25H2='.(time()+82800),
|
||||
'DataExpDateEpoch_GE24H2='.(time()+82800),
|
||||
'DataExpDateEpoch_GE24H2Setup='.(time()+82800),
|
||||
'DataExpDateEpoch_CU23H2='.(time()+82800),
|
||||
@@ -148,6 +149,7 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type, $fl
|
||||
//'FlightContent='.$fltContent,
|
||||
'FlightRing='.$fltRing,
|
||||
'Free=gt64',
|
||||
'GStatus_GE25H2=2',
|
||||
'GStatus_GE24H2=2',
|
||||
'GStatus_GE24H2Setup=2',
|
||||
'GStatus_CU23H2=2',
|
||||
@@ -172,6 +174,7 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type, $fl
|
||||
'IsDeviceRetailDemo=0',
|
||||
'IsFlightingEnabled='.$flightEnabled,
|
||||
'IsRetailOS='.$isRetail,
|
||||
'LaunchUserOOBE=1',
|
||||
'LCUVer=0.0.0.0',
|
||||
'MediaBranch=',
|
||||
'MediaVersion='.$build,
|
||||
@@ -211,6 +214,7 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type, $fl
|
||||
'TPMVersion=2',
|
||||
'UpdateManagementGroup=2',
|
||||
'UpdateOfferedDays=0',
|
||||
'UpgEx_GE25H2=Green',
|
||||
'UpgEx_GE24H2Setup=Green',
|
||||
'UpgEx_GE24H2=Green',
|
||||
'UpgEx_CU23H2=Green',
|
||||
@@ -229,6 +233,11 @@ function composeDeviceAttributes($flight, $ring, $build, $arch, $sku, $type, $fl
|
||||
'UserInPlaceUpgrade=1',
|
||||
'VBSState=2',
|
||||
'Version_RS5=2000000000',
|
||||
'Win10CommercialAzureESUEligible=1',
|
||||
'Win10CommercialKeybasedESUEligible=1',
|
||||
'Win10CommercialW365ESUEligible=1',
|
||||
'Win10ConsumerESUStatus=3',
|
||||
'Win10ConsumerESUAY=9',
|
||||
'WuClientVer='.$build,
|
||||
);
|
||||
|
||||
@@ -298,6 +307,7 @@ function branchFromBuild($build) {
|
||||
|
||||
case 22621:
|
||||
case 22631:
|
||||
case 22635:
|
||||
$branch = 'ni_release';
|
||||
break;
|
||||
|
||||
@@ -306,9 +316,17 @@ function branchFromBuild($build) {
|
||||
break;
|
||||
|
||||
case 26100:
|
||||
case 26120:
|
||||
case 26200:
|
||||
case 26300:
|
||||
$branch = 'ge_release';
|
||||
break;
|
||||
|
||||
case 28000:
|
||||
case 28100:
|
||||
$branch = 'br_release';
|
||||
break;
|
||||
|
||||
default:
|
||||
$branch = 'rs_prerelease';
|
||||
break;
|
||||
@@ -459,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.ManagementOOBE.$currArch&IsWindowsManagementOOBE=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=Hammer.$currArch&Source=UpdateOrchestrator&V=0.0.0.0";
|
||||
$products[] = "PN=MSRT.$currArch&Source=UpdateOrchestrator&V=0.0.0.0";
|
||||
@@ -575,6 +595,13 @@ function composeFetchUpdRequest($arch, $flight, $ring, $build, $sku = 48, $type
|
||||
<int>3</int>
|
||||
<int>30077688</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>5169043</int>
|
||||
<int>5169044</int>
|
||||
|
||||
@@ -19,7 +19,7 @@ function uupApiPrintBrand() {
|
||||
global $uupApiBrandPrinted;
|
||||
|
||||
if(!isset($uupApiBrandPrinted)) {
|
||||
consoleLogger('UUP dump API v'.uupApiVersion());
|
||||
consoleLogger('UUP dump API');
|
||||
$uupApiBrandPrinted = 1;
|
||||
}
|
||||
}
|
||||
@@ -64,8 +64,12 @@ function sendWuPostRequestInternal($url, $postData, $saveCookie = true) {
|
||||
curl_setopt($req, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($req, CURLOPT_ENCODING, '');
|
||||
curl_setopt($req, CURLOPT_POSTFIELDS, $postData);
|
||||
|
||||
if(uupApiConfigIsTrue('production_mode')) {
|
||||
curl_setopt($req, CURLOPT_CONNECTTIMEOUT, 5);
|
||||
curl_setopt($req, CURLOPT_TIMEOUT, 15);
|
||||
}
|
||||
|
||||
curl_setopt($req, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
curl_setopt($req, CURLOPT_HTTPHEADER, array(
|
||||
'User-Agent: Windows-Update-Agent/10.0.10011.16384 Client-Protocol/2.50',
|
||||
|
||||
Reference in New Issue
Block a user