{"id":2633,"date":"2005-11-29T15:31:00","date_gmt":"2005-11-29T15:31:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/heaths\/2005\/11\/29\/windows-installer-cache\/"},"modified":"2005-11-29T15:31:00","modified_gmt":"2005-11-29T15:31:00","slug":"windows-installer-cache","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/setup\/windows-installer-cache\/","title":{"rendered":"Windows Installer Cache"},"content":{"rendered":"<p>Windows Installer packages may contain streams identified in the <a href=\"http:\/\/msdn.microsoft.com\/library\/en-us\/msi\/setup\/media_table.asp\">Media table<\/a> if the Cabinet column value begins with the number sign #, as documented for the <a href=\"http:\/\/msdn.microsoft.com\/library\/en-us\/msi\/setup\/cabinet.asp\">Cabinet data type<\/a>. This cabinet is embedded as a stream within the <i>.msi<\/i> file and contains files referenced in the <a href=\"http:\/\/msdn.microsoft.com\/library\/en-us\/msi\/setup\/file_table.asp\">File table<\/a> using their File key column value. When packages are installed, however, cabinet streams are stripped from the <i>.msi<\/i> file and the <i>.msi<\/i> file is copied to <i>%WINDIR%\\Installer<\/i>. This saves a significant amount of space required for large packages that are installed on the machine; however, this is part of the reason for prompts for source when the original media isn&#8217;t available.<\/p>\n<p>As documented in <a href=\"http:\/\/blogs.msdn.com\/heaths\/archive\/2005\/09\/01\/459561.aspx\">What&#8217;s in a Patch<\/a>, patches may also contain embedded streams since <i>.msp<\/i> files use structured storage as do <i>.msi<\/i> files. When patches are applied to a product, however, the embedded cabinet streams are not stripped. This is necessary because of <a href=\"http:\/\/blogs.msdn.com\/heaths\/archive\/2005\/09\/12\/464047.aspx\">how patches are applied<\/a> and how updated files are made available. The patched files&#8217; Sequence column value is updated and a new Media table entry added for each patch being applied. This determines which cabinet stream to use by matching the DiskId column value of the Media table entry to the Media column value in the <a href=\"http:\/\/msdn.microsoft.com\/library\/en-us\/msi\/setup\/patchpackage_table.asp\">PatchPackage table<\/a>. When the patched features are reinstalled the updated files are extracted from the correct patch and copied to the destination location (or to a temporary location to be later copied after a reboot).<\/p>\n<p>For example, we will take a look at the differences between the source and cached <i>.msi<\/i> files for my <a href=\"http:\/\/blogs.msdn.com\/heaths\/archive\/2005\/11\/17\/494000.aspx\">Shell Extensions for .NET Assemblies, version 1.4.1993<\/a>. With the Windows Installer SDK installed as part of the <a href=\"http:\/\/msdn.microsoft.com\/platformsdk\/\">Platform SDK<\/a>, we&#8217;ll need to invoke the <i>WiStream.vbs<\/i> script from the <i>Samples\\SysMgmt\\Msi\\Scripts<\/i> directory under the Platfrom SDK installation root directory.<\/p>\n<p>First <i>WiStream.vbs<\/i> is invoked with the <i>AsmShell.msi<\/i> file that was downloaded as the sole parameter and you&#8217;ll see the following:<\/p>\n<pre>Binary.UpFldrBtn\nBinary.NewFldrBtn\nBinary.DefBannerBitmap\n_8FAD87CB641B23946B4BDE84517E0FCF\n?SummaryInformation<\/pre>\n<p>Here <font face=\"Courier New\">?<\/font> is the character displayed for the octal number \\005 which begins the \\005SummaryInformation stream as it is displayed in the OEM code page 437 used by the console for U.S. English.<\/p>\n<p>After <i>AsmShell.msi<\/i> is installed, we need to find the cached package under <i>%WINDIR%\\Installer<\/i>.<\/p>\n<blockquote>\n<p><b>Warning<\/b>: Do not alter the Windows Installer internal information by hand. If you alter the Windows Installer internal information, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from altering the Windows Installer internal information. Alter the Windows Installer internal information at your own risk.<\/span><\/font><\/p>\n<\/blockquote>\n<p>The names aren&#8217;t descriptive, so one way of finding the correct <i>.msi<\/i> file is to open the hidden <i>%WINDIR%\\Installer<\/i> directory in Windows Explorer, change to the Details view, right-click on the columns, and add the Comments column. Find the file with the comment, &#8220;Windows Explorer Shell Extensions for .NET Assemblies&#8221;. Now invoke <i>WiStream.vbs<\/i> on that file and you&#8217;ll see the following:<\/p>\n<pre>Binary.UpFldrBtn\nBinary.NewFldrBtn\nBinary.DefBannerBitmap\n?SummaryInformation<\/pre>\n<p>Notice that <font face=\"Courier New\">_8FAD87CB641B23946B4BDE84517E0FCF<\/font> is missing. If you look in the Media table for <i>AsmShell.msi<\/i> you&#8217;ll see that lone cabinet name is <font face=\"Courier New\">#_8FAD87CB641B23946B4BDE84517E0FCF<\/font>, which is an embedded stream since it begins with the number sign #.<\/p>\n<p>Now we will do the same with the patch referenced in <a href=\"http:\/\/blogs.msdn.com\/heaths\/archive\/2005\/09\/02\/460311.aspx\">Updated Sample MSI Scripts<\/a>, which will allow <i>WiStream.vbs<\/i> and <i>WiSubStg.vbs<\/i> to work on <i>.msp<\/i> files which will be necessary for this next step. After installing the patch that applies to the Platform SDK we invoke <i>WiStream.vbs<\/i> on the <i>Scripts.msp<\/i> and will see the following output:<\/p>\n<pre>PCW_CAB_PSDK\n?SummaryInformation<\/pre>\n<p>Next you&#8217;ll need to find the <i>.msp<\/i> file in <i>%WINDIR%\\Installer<\/i> that has the revision number {F32C36B7-3547-4B1F-954F-FFED85EBDE92} which, for a patch, is the patch code. Invoking <i>WiStream.vbs<\/i> on that file yields the following output:<\/p>\n<pre>PCW_CAB_PSDK\n?SummaryInformation<\/pre>\n<p>You&#8217;ll notice the cabinet stream that contains the patch files is present in both the source and cached <i>.msp<\/i> files.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Windows Installer packages may contain streams identified in the Media table if the Cabinet column value begins with the number sign #, as documented for the Cabinet data type. This cabinet is embedded as a stream within the .msi file and contains files referenced in the File table using their File key column value. When [&hellip;]<\/p>\n","protected":false},"author":389,"featured_media":3843,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[20],"class_list":["post-2633","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-installation"],"acf":[],"blog_post_summary":"<p>Windows Installer packages may contain streams identified in the Media table if the Cabinet column value begins with the number sign #, as documented for the Cabinet data type. This cabinet is embedded as a stream within the .msi file and contains files referenced in the File table using their File key column value. When [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/posts\/2633","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/users\/389"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/comments?post=2633"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/posts\/2633\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/media\/3843"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/media?parent=2633"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/categories?post=2633"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/setup\/wp-json\/wp\/v2\/tags?post=2633"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}