我正在尝试更新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");
}