Adding nodes to xml with DOM in inno Setup - strange problems

别来无恙 提交于 2019-12-01 00:26:33

In the end, there didn't seem to be any way out of this mess, and I ended up simply making an external app to do my XML edits. The tool for making the xml changes was simply extracted to the program folder, and set in the Run and UninstallRun sections with the correct parameters.

(the UninstallRun part was needed because the XML to edit was part of an external app that needed to be integrated with our app. Obviously, if you're in this situation but need it for xml edits in your own program, simply extracting the app into {tmp} and running it once from there should be enough)

If anyone ever figures out what makes this COM mess fail, though, please do add another Answer. From what I ran into when making the external app, though, it is probably related to the change in namespace halfway in the XML tree.

Not a solution, but further information on the subject.

Overview: Unicode Inno installers targeting anything newer than Windows 7/Server 2008 R2 should be fine. For those platforms and older I would not rely on using MSXML inside Inno Setup. I did not test ANSI Inno Setup at all (I've heard there are regularly less issues with things).

Details: I too noticed similar issues using MSXML Variant objects. The problems I saw usually occurred when a method using Variants was closing (thus likely freeing resources), and I received the DLL crash. Never had any errors when specifically invoking MSXML methods themselves. So possibly this issue is semi-PascalScript related in how its handling the COM object references? I was developing on Windows 10 and had no issues testing my installer, but only after deploying it did I start to notice the madness. Which eventually led me to believe it is platform dependent.

Platform                Version  Works  Notes
----------------------------------------------------------------
Windows 10              NT 10.0  YES
Windows Server 2016     NT 10.0  YES
Windows 8.1             NT 6.3   YES
Windows Server 2012 R2  NT 6.3   YES    Requires .NET 4.5.2
Windows 8               NT 6.2   ???    Most likely works
Windows Server 2012     NT 6.2   YES    Requires .NET 4.5.1
Windows 7               NT 6.1   NO
Windows Server 2008 R2  NT 6.1   NO
Windows Vista           NT 6.0   NO

Note that anything based off NT 6.1 or older is where the problems start occuring. I could not test plain Windows 8 but under these assumptions I'll bet it works. I'm doing fairly complex XML manipulation (removing nodes, adding nodes, modifying nodes, and a smattering of various XPath queries with handy XPath methods) so I feel fairly confident that you are likely to see the same results. I do not know why .NET would be required (for the Server 2012 tests) because MSXML is not really related to .NET in any way, but perhaps when installing those Frameworks another 3rd party dependency is updated (which makes everything happy). Even after applying all security updates and fixes for Windows 7 or Server 2008 R2 the problem persists. For all the other platforms I performed NO additional updates after installation (unless noted like .NET Frameworks). All of them were installed with the latest Service Pack/Update for that platform.

Any specific version notes

InnoSetup-5.5.9(u)

Windows 10 Version 1511 (Updated Feb 2016)
Windows 8.1 with Update
Windows 7 with SP1
Windows Vista with SP2

Windows Server 2016
Windows Server 2012 R2 with SP1
Windows Server 2012
Windows Server 2008 R2 with SP1

I have seen that your seekNode function is returning for the first attribute it checked. I guess you need to remove following section:

else begin Result:=false; Exit; end;

I dont know whether this solves your problem.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!