简体   繁体   English

C ++创建安装程序和处理提取的*聪明*方法是什么

[英]c++ what is the *clever* way of creating setup program and handle extraction

I know how to create and code my own setup program but i need to be redirected at some point. 我知道如何创建和编写自己的安装程序,但在某些时候需要重定向。 This point i'm sure inlight other people too. 这一点我肯定也会启发其他人。

I created a setup project. 我创建了一个安装项目。 All is done. 一切都完成了。 Except, installation files inside of EXE. 除了EXE内的安装文件。

I know 2 different ways of doing this: 我知道2种不同的方法:

  1. Create resource in EXE and embed RAR/ZIP file. 在EXE中创建资源并嵌入RAR / ZIP文件。
  2. Put compressed archive with files along with EXE. 将压缩的存档文件与EXE一起放入。 EXE will read contents and data from this protected and compressed ZIP. EXE将从此受保护的压缩ZIP中读取内容和数据。

But what i want is number 1 . 但是我想要的是1号 I want to embed it. 我要嵌入它。 But; 但;

  1. What is the proper way of embedding this? 嵌入此内容的正确方法是什么? Are other setup creators do the same thing? 其他设置创建者是否也做同样的事情? Embed resource as compressed single zip in EXE? 将资源作为压缩的单个zip嵌入EXE中? Or do they another trick? 还是他们的另一个把戏?
  2. How do you extract files? 您如何提取文件? On the fly by memory? 记忆中的飞行? Like read each file one-by-one. 就像一个一个地读取每个文件。 Synced. 已同步。 Or first, copy ZIP to temp and extract from it. 或首先,将ZIP复制到temp并从中提取。
  3. Or even embed all files separately to the resources. 甚至将所有文件分别嵌入到资源中。

I, even think that if i should create simple MSI without dialogs and embed it and run from background but i want to take all control. 我什至认为如果我应该创建没有对话框的简单MSI并将其嵌入并从后台运行,但我想获得所有控制权。 I want everything belongs to the original setup that i created. 我希望所有内容都属于我创建的原始设置。

Note: 注意:

I want to make my own dialogs, effects, procedures, functions and steps. 我要创建自己的对话框,效果,过程,功能和步骤。 Yes, MSI is acceptable but i will stick with its features. 是的,MSI是可以接受的,但我会坚持使用其功能。 Oh, If im able to extend it, why should i spent more time doing this instead of making my own? 哦,如果我不能扩展它,为什么我应该花更多的时间而不是自己做呢? I am so confused... I am talking about very big setup project here. 我很困惑...我在这里谈论很大的安装项目。 Not just a standard ugly UI with less features. 不仅仅是功能较少的标准丑陋UI。 At least, im gonna try :) 至少,我会尝试:)

Do not give me any sample/code just show me a correct path, please. 请不要给我任何示例/代码 ,请告诉我正确的路径。

Best options here: 最佳选择:

  1. Create ZIP compatible EXE that reads itself as ZIP and read the file list and extract. 创建与ZIP兼容的EXE,将其读取为ZIP并读取文件列表并提取。
  2. Create non-zip compatible EXE that has a hidden body somewhere and read that area (seek) and get the list & extract. 创建一个非zip兼容的EXE,该EXE的某个位置具有隐藏的正文,并读取该区域(搜索)并获取列表和提取。

The proper way to do it is to use the Windows installer technology, aka MSI. 正确的方法是使用Windows安装程序技术(也称为MSI)。 There is a nice, Microsoft blessed toolset called WiX that you can use to greatly simplify the process. 有一个不错的,Microsoft祝福的工具集,称为WiX,您可以使用它极大地简化该过程。

http://wix.codeplex.com/ http://wix.codeplex.com/

如果您确实打算重新发明轮子,则可以遍历WiX的源代码以了解事情的完成方式。

Best options here: 最佳选择:

  1. Create ZIP compatible EXE that reads itself as ZIP and read the file list and extract. 创建与ZIP兼容的EXE,将其读取为ZIP并读取文件列表并提取。
  2. Create non-zip compatible EXE that has a hidden body somewhere and read that area (seek) and get the list & extract. 创建一个非zip兼容的EXE,该EXE的某个位置具有隐藏的正文,并读取该区域(搜索)并获取列表和提取。

Why write your own? 为什么要自己写? Much easier to use WiX ( http://wixtoolset.org/ ) with optionally a graphical interface like WiXEdit ( http://wixedit.sourceforge.net/ ). 使用WiX( http://wixtoolset.org/ )和可选的图形界面(例如WiXEdit( http://wixedit.sourceforge.net/ ))要容易得多。 Have you thought about additional requirements like uninstall etc... 您是否考虑过其他要求,例如卸载等...

Good luck! 祝好运!

Would InnoSetup help with your problem? InnoSetup可以帮助您解决问题吗? You can personalise the dialogs and extend its functionality quite a lot. 您可以个性化对话框并大量扩展其功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM