UWP应用中的PRI文件反编译

PRI全称Package Resources Index, MSDN官方解释

pri文件是通过微软提供的工具makepri.exe提供了打包、解包PRI功能的。

Windows 8.1版本的makepri.exe路径:

 C:\Program Files (x86)\Windows Kits\8.1\bin\x86\makepri.exe

Windows 10版本的makepri.exe路径: 

C:\Program Files (x86)\Windows Kits\10\bin\x64\makepri.exe

如果要反编译Pri to Xml 直接输入命令

“C:\Program Files (x86)\Windows Kits\10\bin\x64\makepri.exe” dump  /if “c:\resources.pri” /of “c:\resources.pri.xml”

这时候会在c盘得到resources.pri.xml文件,里面就包含pri的各种信息,下面就是一个pri.xml文件的例子:

<PriInfo>
	<ResourceMap name="9452VitorCid.PocketExtractor" version="1.0" primary="true">
		<Qualifiers>
			<Language>EN-US</Language>
			<Scale>240</Scale>
			<TargetSize>256,16,32,48</TargetSize>
		</Qualifiers>
		<ResourceMapSubtree name="Files">
			<NamedResource name="App.xbf" uri="ms-resource://9452VitorCid.PocketExtractor/Files/App.xbf">
				<Candidate type="Path">
					<Value>App.xbf</Value>
				</Candidate>
			</NamedResource>
			<NamedResource name="FileIcon.png" uri="ms-resource://9452VitorCid.PocketExtractor/Files/FileIcon.png">
				<Candidate type="Path">
					<Value>FileIcon.png</Value>
				</Candidate>
			</NamedResource>
			<NamedResource name="IntroPage.xbf" uri="ms-resource://9452VitorCid.PocketExtractor/Files/IntroPage.xbf">
				<Candidate type="Path">
					<Value>IntroPage.xbf</Value>
				</Candidate>
			</NamedResource>
			<NamedResource name="MobileZip.xr.xml" uri="ms-resource://9452VitorCid.PocketExtractor/Files/MobileZip.xr.xml">
				<Candidate type="Path">
					<Value>MobileZip.xr.xml</Value>
				</Candidate>
			</NamedResource>
			<NamedResource name="PivotPage.xbf" uri="ms-resource://9452VitorCid.PocketExtractor/Files/PivotPage.xbf">
				<Candidate type="Path">
					<Value>PivotPage.xbf</Value>
				</Candidate>
			</NamedResource>
			<NamedResource name="WindowsStoreProxy.xml" uri="ms-resource://9452VitorCid.PocketExtractor/Files/WindowsStoreProxy.xml">
				<Candidate type="Path">
					<Value>WindowsStoreProxy.xml</Value>
				</Candidate>
			</NamedResource>
			<ResourceMapSubtree name="Assets">
				<NamedResource name="BadgeLogo.png" uri="ms-resource://9452VitorCid.PocketExtractor/Files/Assets/BadgeLogo.png">
					<Candidate qualifiers="Scale-240" isDefault="true" type="Path">
						<Value>Assets\BadgeLogo.scale-240.png</Value>
					</Candidate>
				</NamedResource>
				<NamedResource name="FileIcon.png" uri="ms-resource://9452VitorCid.PocketExtractor/Files/Assets/FileIcon.png">
					<Candidate type="Path">
						<Value>Assets\FileIcon.png</Value>
					</Candidate>
				</NamedResource>
				<NamedResource name="Icon.png" uri="ms-resource://9452VitorCid.PocketExtractor/Files/Assets/Icon.png">
					<Candidate qualifiers="TargetSize-48" isDefault="true" type="Path">
						<Value>Assets\Icon.targetsize-48.png</Value>
					</Candidate>
					<Candidate qualifiers="TargetSize-32" isDefault="true" type="Path">
						<Value>Assets\Icon.targetsize-32.png</Value>
					</Candidate>
					<Candidate qualifiers="TargetSize-256" isDefault="true" type="Path">
						<Value>Assets\Icon.targetsize-256.png</Value>
					</Candidate>
					<Candidate qualifiers="TargetSize-16" isDefault="true" type="Path">
						<Value>Assets\Icon.targetsize-16.png</Value>
					</Candidate>
				</NamedResource>
				<NamedResource name="Logo.png" uri="ms-resource://9452VitorCid.PocketExtractor/Files/Assets/Logo.png">
					<Candidate qualifiers="Scale-240" isDefault="true" type="Path">
						<Value>Assets\Logo.scale-240.png</Value>
					</Candidate>
				</NamedResource>
				<NamedResource name="SmallLogo.png" uri="ms-resource://9452VitorCid.PocketExtractor/Files/Assets/SmallLogo.png">
					<Candidate qualifiers="Scale-240" isDefault="true" type="Path">
						<Value>Assets\SmallLogo.scale-240.png</Value>
					</Candidate>
				</NamedResource>
				<NamedResource name="SplashScreen.png" uri="ms-resource://9452VitorCid.PocketExtractor/Files/Assets/SplashScreen.png">
					<Candidate qualifiers="Scale-240" isDefault="true" type="Path">
						<Value>Assets\SplashScreen.scale-240.png</Value>
					</Candidate>
				</NamedResource>
				<NamedResource name="Square71x71Logo.png" uri="ms-resource://9452VitorCid.PocketExtractor/Files/Assets/Square71x71Logo.png">
					<Candidate qualifiers="Scale-240" isDefault="true" type="Path">
						<Value>Assets\Square71x71Logo.scale-240.png</Value>
					</Candidate>
				</NamedResource>
				<NamedResource name="StoreLogo.png" uri="ms-resource://9452VitorCid.PocketExtractor/Files/Assets/StoreLogo.png">
					<Candidate qualifiers="Scale-240" isDefault="true" type="Path">
						<Value>Assets\StoreLogo.scale-240.png</Value>
					</Candidate>
				</NamedResource>
				<ResourceMapSubtree name="icons">
					<NamedResource name="ZipIconDark.png" uri="ms-resource://9452VitorCid.PocketExtractor/Files/Assets/icons/ZipIconDark.png">
						<Candidate type="Path">
							<Value>Assets\icons\ZipIconDark.png</Value>
						</Candidate>
					</NamedResource>
					<NamedResource name="ZipIconLight.png" uri="ms-resource://9452VitorCid.PocketExtractor/Files/Assets/icons/ZipIconLight.png">
						<Candidate type="Path">
							<Value>Assets\icons\ZipIconLight.png</Value>
						</Candidate>
					</NamedResource>
				</ResourceMapSubtree>
			</ResourceMapSubtree>
			<ResourceMapSubtree name="Common">
				<NamedResource name="ReadMe.txt" uri="ms-resource://9452VitorCid.PocketExtractor/Files/Common/ReadMe.txt">
					<Candidate type="Path">
						<Value>Common\ReadMe.txt</Value>
					</Candidate>
				</NamedResource>
			</ResourceMapSubtree>
			<ResourceMapSubtree name="DataModel">
				<NamedResource name="SampleData.json" uri="ms-resource://9452VitorCid.PocketExtractor/Files/DataModel/SampleData.json">
					<Candidate type="Path">
						<Value>DataModel\SampleData.json</Value>
					</Candidate>
				</NamedResource>
			</ResourceMapSubtree>
		</ResourceMapSubtree>
		<ResourceMapSubtree name="Resources">
			<ResourceMapSubtree name="AddAppBarButton">
				<NamedResource name="Label" uri="ms-resource://9452VitorCid.PocketExtractor/Resources/AddAppBarButton/Label">
					<Candidate qualifiers="Language-EN-US" isDefault="true" type="String">
						<Value>add</Value>
					</Candidate>
				</NamedResource>
			</ResourceMapSubtree>
			<ResourceMapSubtree name="Header">
				<NamedResource name="Text" uri="ms-resource://9452VitorCid.PocketExtractor/Resources/Header/Text">
					<Candidate qualifiers="Language-EN-US" isDefault="true" type="String">
						<Value>MOBILE ZIP</Value>
					</Candidate>
				</NamedResource>
			</ResourceMapSubtree>
		</ResourceMapSubtree>
	</ResourceMap>
</PriInfo>

pri文件的反编译不仅可以用于UWP,Modern应用,还有一个比较成功的案例Windows-10-Login-Background-Changer,用于更换Win10登录背景的工具。