![]() | ![]() |
|
![]() |
|
|
|
|||
|
[c++] Runtime Resource Adding
I'm Trying to make a "builder" for my crypter.
But i have a problem that with hours of googleing msnding i cannot solve... When i add a resource to my dropped stub the droped file ends up smaller insize (and doesnt work). (im adding not replacesing as the number of resources im going 2 need is unknow at the time of compiling my stub as i have to split the payload into maybe resources so its not detected.) The code im using is below. Code:
BOOL addResource(char* szFileName, LPBYTE lpData, DWORD dwSize, int id)
{
HANDLE hUpdateRes = BeginUpdateResource(szFileName, FALSE);
if (hUpdateRes == NULL)
{
MessageBox(NULL,"BeginUpdateResource()","ERROR",MB_OK);
return FALSE;
}
BOOL result = UpdateResource(
hUpdateRes,
RT_RCDATA,
MAKEINTRESOURCE(id),
MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL),
(LPVOID)lpData,
dwSize
);
if (!result)
{
MessageBox(NULL,"UpdateResource()","ERROR",MB_OK);
EndUpdateResource(hUpdateRes, TRUE);
return FALSE;
}
if(EndUpdateResource(hUpdateRes, FALSE))
{
return TRUE;
}
return FALSE;
}
Am i doing it wrong? i have tryed to look at sources for builders (only finding cryptic) and could not find a solution... Thanks in advance, DigitalNemeis |
|
|||
|
thanks man, i found that one on google already, but ill double check my stuff on it XD i got the cast to (LPVOID) from that page
|
|
|||
|
I got some errors when I wanted to use the resource type like you. I just changed it into "RT_RCDATA" ( yes with the "" ) and it worked.
else try this one: Code:
void addResource(char* szFileName, LPBYTE lpData, DWORD dwSize, int id){
HANDLE hResource = BeginUpdateResource(szFileName, FALSE);
if (NULL != hResource){
if (UpdateResource(hResource,
"RT_RCDATA",
MAKEINTRESOURCE(id),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPVOID) lpBuffer,
dwFileSize) != FALSE)
{
EndUpdateResource(hResource, FALSE);
}
}
}
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help about adding usb spread on projects | kari | Trojan discussion and general help | 0 | 09-07-2009 14:37 |
| Adding a stealer in a program? | VitaminX | Source Code help | 1 | 19-05-2009 23:40 |
| Adding a digit | OD_ | Delphi help | 1 | 25-08-2006 04:42 |
| Adding parameters to a procedure | ratws | Delphi help | 6 | 28-09-2005 23:58 |
| Adding VNC capabilities to a RAT | ratws | Delphi help | 7 | 29-07-2005 16:14 |