从Web服务器下载我的程序数据(基本上只是.EXE变成.txt),但是当我将其放入.exe中时,它不会运行吗?

发布于 2025-02-06 19:37:10 字数 485 浏览 4 评论 0原文

因此,目前我正在使用基本的HTTP请求来从我的服务器weblink.com/program.exe中提取EXE数据 它以.txt表单返回我的程序,但是当我将其放入文件中时,它将无法运行。 我认为这是因为我需要元数据,但不知道如何找到该过程,甚至不知道如何搜索像这样的特定内容...所以我要么要求解决方案(如何添加适当的.EXE元数据),要么在是在C ++ *中下载类似文件的更好方法

*注意i 不能使用基本的窗口功能,例如DownloadTofilea或外部库(例如libcurl/curl)

OutFile.open(XorStr("C:\\Users\\Program.exe").c_str(), std::ios::out);
if (OutFile.is_open())
{
     OutFile << Output;
     //Initialize .exe Meta Data???  
}
OutFile.close();

So currently I am using a basic Http request to pull the exe data from my server weblink.com/Program.exe
it returns my program in .txt form but when I put it into a file it will not run.
I assume this is because I need metadata but have no clue how to find that process or even how to google something as specific as that... So I am either asking for a solution (how to add proper .exe metadata) or if there is a better way to download files like that in C++

*Note I cannot use basic windows functions such as DownloadToFileA or External Library's (Like LibCurl/Curl)

OutFile.open(XorStr("C:\\Users\\Program.exe").c_str(), std::ios::out);
if (OutFile.is_open())
{
     OutFile << Output;
     //Initialize .exe Meta Data???  
}
OutFile.close();

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

維他命╮ 2025-02-13 19:37:11

您需要在二进制模式下打开文件,否则newline翻译将搞砸您的可执行文件:

OutFile.open(XorStr("C:\\Users\\Program.exe").c_str(), std::ios::out | std::ios::binary);

You need to open your file in binary mode otherwise newline translation will screw up your executable:

OutFile.open(XorStr("C:\\Users\\Program.exe").c_str(), std::ios::out | std::ios::binary);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文