Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to extract Putty 0.68 installer #78

Closed
beatcracker opened this issue Mar 11, 2017 · 6 comments
Closed

Fails to extract Putty 0.68 installer #78

beatcracker opened this issue Mar 11, 2017 · 6 comments
Assignees
Labels
Milestone

Comments

@beatcracker
Copy link

Site: http://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
Direct link: https://the.earth.li/~sgtatham/putty/latest/w32/putty-0.68-installer.msi

Error message

The following error occured extracting the MSI:

System.Runtime.InteropServices.ExternalException (0x0000064F):

Failed to create view with query: SELECT * FROM `_Streams` WHERE `Name` = 'putty.cab'

   at Microsoft.Tools.WindowsInstallerXml.Msi.View..ctor(Database db, String query)
   at Microsoft.Tools.WindowsInstallerXml.Msi.Database.OpenExecuteView(String query)
   at LessMsi.Msi.Wixtracts.ExtractCabFromPackage(Path filePath, String cabName, Database inputDatabase)
   at LessMsi.Msi.Wixtracts.CabsFromMsiToDisk(Path msi, Database msidb, String outputDir)
   at LessMsi.Msi.Wixtracts.ExtractFiles(Path msi, String outputDir, MsiFile[] filesToExtract, AsyncCallback progressCallback)
   at LessMsi.Gui.MainForm.btnExtract_Click(Object sender, EventArgs e)

Exception

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
   at LessMsi.Gui.MainForm.fileGrid_KeyDown(Object sender, KeyEventArgs e)
   at System.Windows.Forms.Control.OnKeyDown(KeyEventArgs e)
   at System.Windows.Forms.DataGridView.OnKeyDown(KeyEventArgs e)
   at System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m)
   at System.Windows.Forms.DataGridView.ProcessKeyEventArgs(Message& m)
   at System.Windows.Forms.Control.ProcessKeyMessage(Message& m)
   at System.Windows.Forms.Control.WmKeyChar(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.DataGridView.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1087.0 built by: NETFXREL4STAGE
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
lessmsi-gui
    Assembly Version: 1.5.1.0
    Win32 Version: 1.5.1
    CodeBase: file:///C:/Soft/LessMSI/lessmsi-gui.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1087.0 built by: NETFXREL4STAGE
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1087.0 built by: NETFXREL4STAGE
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1087.0 built by: NETFXREL4STAGE
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1087.0 built by: NETFXREL4STAGE
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1087.0 built by: NETFXREL4STAGE
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.1087.0 built by: NETFXREL4STAGE
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
Microsoft.GeneratedCode
    Assembly Version: 1.0.0.0
    Win32 Version: 4.6.1087.0 built by: NETFXREL4STAGE
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
wix
    Assembly Version: 2.0.2110.0
    Win32 Version: 2.0.2110.0
    CodeBase: file:///C:/Soft/LessMSI/wix.DLL
----------------------------------------
lessmsi.core
    Assembly Version: 1.5.1.0
    Win32 Version: 1.5.1
    CodeBase: file:///C:/Soft/LessMSI/lessmsi.core.DLL
----------------------------------------
LessIO
    Assembly Version: 0.5.0.0
    Win32 Version: 0.5.0
    CodeBase: file:///C:/Soft/LessMSI/LessIO.DLL
----------------------------------------
libmspackn
    Assembly Version: 0.8.0.0
    Win32 Version: 0.8
    CodeBase: file:///C:/Soft/LessMSI/libmspackn.DLL
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
@activescott activescott self-assigned this Mar 12, 2017
@activescott activescott added this to the vNext milestone Mar 12, 2017
@activescott
Copy link
Owner

Weird. No _Streams table present. Will have to investigate this...

@activescott
Copy link
Owner

activescott commented Mar 12, 2017

Seems putty started using wix (source) and wix does something funny here. Others have noticed the missing _Streams table as noted in the following thread: http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/CAB-not-being-written-to-Streams-table-td699090.html#none

Since the installer works, obviously there is some way to make an assumption and find the CAB's stream. So I'm trying to chase that down next...

@activescott
Copy link
Owner

Interestingly, Dark.exe which is a wix's own decompiler, also isn't able to decompile this msi and fails in exactly the same way:

C:\Users\scott\Downloads\putty-extract-wix>c:\tools\wix\dark.exe -x .\ ./putty-0.68-installer.msi
Windows Installer XML Toolset Decompiler version 3.8.1128.0
Copyright (c) Outercurve Foundation. All rights reserved.

putty-0.68-installer.msi
dark.exe : error DARK0001 : Internal MSI failure. Win32 error: 1615, MSI error: 2228, detail: C:\Users\scott\Downloads\putty-extract-wix\putty-0.68-in
staller.msi, _Streams, SELECT `Data` FROM `_Streams` WHERE `Name` = ?

Exception Type: Microsoft.Tools.WindowsInstallerXml.Msi.MsiException

Stack Trace:
  at Microsoft.Tools.WindowsInstallerXml.Msi.View..ctor(Database db, String query)
  at Microsoft.Tools.WindowsInstallerXml.Unbinder.ExtractCabinets(Output output, Database database, String databaseFile, String exportBasePath)
  at Microsoft.Tools.WindowsInstallerXml.Unbinder.UnbindDatabase(String databaseFile, OutputType outputType, String exportBasePath)
  at Microsoft.Tools.WindowsInstallerXml.Unbinder.Unbind(String file, OutputType outputType, String exportBasePath)
  at Microsoft.Tools.WindowsInstallerXml.Tools.Dark.Run(String[] args)

C:\Users\scott\Downloads\putty-extract-wix>c:\tools\wix\dark.exe -x .\ ./putty-0.68-installer.msi

@activescott
Copy link
Owner

Everything I read suggests that the _Streams table should be available (and maybe auto-generated upon request). However, I cannot figure out how to get it to work with this particular installer.

msi2xml also cannot read this file, but it reads others. Something goofy about this one that I cannot put my finger on. I'm putting some hacked code in a branch 78_no_streams_table. See OleStorageHelper.cs for how to get the raw OLE streams, but still that _Streams table should be accessible somehow.

activescott added a commit that referenced this issue Mar 12, 2017
… raw streams but they are mangled and dont readily map back to the File table.
@activescott activescott removed their assignment Mar 12, 2017
@activescott activescott removed this from the vNext milestone Mar 12, 2017
@activescott activescott self-assigned this Mar 13, 2017
@activescott activescott added this to the vNext milestone Mar 13, 2017
@activescott activescott modified the milestones: vNext, v1.6 Mar 13, 2017
@activescott
Copy link
Owner

@beatcracker Thank you for the feedback. It will be great if you can check out the new release and do a bit of testing. Note I've implemented a fallback that does a trick making a pretty bold assumption but it should work for most (but not all) MSIs. Fortunately it is a fallback that won't be resorted to in most cases.

If you have a moment to tinker with the other items in this release that would be much appreciated!

@beatcracker
Copy link
Author

Thanks and sorry for the late reply. Extracting works perfectly.

> If you have a moment to tinker with the other items in this release that would be much appreciated!

It looks like the Streams tab makes some invalid assumptions about character encoding:

unicode_issues_crop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants