Maysam Nobility
Maysam Nobility

Reputation: 11

Modify resource for String table type in win32 native exe

I want to modify some string in my exe resource. That resource type is a string table, but when i use UpdateResource function i don't know what parameter must be pass to it so it's pointing to the exact raw in the string table.

The type parameter is RT_STRING, but what should I send to MAKEINTRESOURCEW()?

HANDLE hExeFile = BeginUpdateResource(L"d:\\m.exe", FALSE);
WCHAR mail[]={L"[email protected]"};
UpdateResource(hExeFile,RT_STRING,MAKEINTRESOURCEW(?????), MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), (LPVOID)mail, wcslen(mail)*2);
EndUpdateResource(hExeFile, FALSE);

Upvotes: 1

Views: 698

Answers (1)

Remy Lebeau
Remy Lebeau

Reputation: 596397

An exe file cannot update its own resources while it is running. The resources are locked by the OS and are read-only. But if you could update the resources, then obviously you have to know the ID of your resource in order to update it. If it is a compiler-generated resource, then you are probably out of luck unless your compiler uses a predictable ID number, like 1. Otherwise, use an .rc file to define your own resource data, then you can use whatever ID you want.

Upvotes: 1

Related Questions