1

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"ddddddd@gmail.com"};
UpdateResource(hExeFile,RT_STRING,MAKEINTRESOURCEW(?????), MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), (LPVOID)mail, wcslen(mail)*2);
EndUpdateResource(hExeFile, FALSE);
AstroCB
  • 12,337
  • 20
  • 57
  • 73

1 Answers1

1

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.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770