我正在尝试更新exe文件bt的资源,当我运行该文件时它显示错误,xxxx.exe不是有效的win32应用程序,但我使用默认代码创建了一个有效的win32 gui应用程序来创建空窗口。
但是当我在 notepad.exe 或 calc.exe 中添加资源时,它的工作正常......请帮助......
void export_data::generate(void)
{
HRSRC hrsrc;
HGLOBAL hglobal;
HANDLE hfile, hupdate;
BOOL temp;
unsigned long rsize, rsize2;
unsigned long bytes_written;
cout << "Generating new file";
hupdate = BeginUpdateResource("notepad.exe", FALSE);
if (hupdate == NULL)
cout << "nError beginupdateresource";
temp = UpdateResource(hupdate, RT_RCDATA, MAKEINTRESOURCE(10), MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), pbuffer, Filesize);
if (temp == 0)
cout << "nupdate resource error 1";
temp = UpdateResource(hupdate, RT_RCDATA, MAKEINTRESOURCE(20), MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), pPass, pass_size);
if (temp == 0)
cout << "nupdate resource error 2";
cout << "nn" << pPass << "n";
system("pause");
temp = EndUpdateResource(hupdate, FALSE);
if (temp == FALSE)
cout << "end update error";
CloseHandle(hupdate);
system("pause");
}