dimanche 1 juin 2014

embed resource to native exe from c#


Vote count:

0




i want to embed a resource in a exe file using c#.


If i use c++ code it works well :



UpdateResource(hResource,RT_RCDATA,MAKEINTRESOURCE(104),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),(LPVOID)text,FileSize);


c# code that dosent work :



IntPtr handle = BeginUpdateResource(this.NomeFileCryptato, false);
IntPtr fileptr = ToPtr(encrypted);
bool res = UpdateResource(handle, "RT_RCDATA", "104", 1040, fileptr, Convert.ToUInt32(encrypted.Length));
EndUpdateResource(handle, false);


Actualy, the c# code embed the resource in the exe file (let's call it a.exe) but if i embed the resource with c++, a.exe can read and extract, if i embed from c#, a.exe cannot.


any ideas?



asked 18 secs ago






Aucun commentaire:

Enregistrer un commentaire