+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Senior Member
    Join Date
    Mar 2009
    Posts
    565

    [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;
    }
    i put it into a method to try and isolate the problem but i with no luck.
    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

  2. #2
    Member
    Join Date
    May 2009
    Posts
    32
    I hope this link will help you a bit :
    Code:
    http://www.codeproject.com/KB/cpp/UpdateResource.aspx
    Greetz Zer0Flag

  3. #3
    Senior Member
    Join Date
    Mar 2009
    Posts
    565
    Quote Originally Posted by Zer0Flag View Post
    I hope this link will help you a bit :
    Code:
    http://www.codeproject.com/KB/cpp/UpdateResource.aspx
    Greetz Zer0Flag
    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

  4. #4
    Senior Member
    Join Date
    Mar 2009
    Posts
    565
    still cant get it working can any one help me
    I'm guess im doing this part right then... maybe my PE has something wrong with it?? no clue... Im use g++ compiler...

  5. #5
    Member
    Join Date
    May 2009
    Posts
    32
    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);
         }
      }
    }
    Greetz Zer0Flag

 

 

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Help about adding usb spread on projects
    By kari in forum Malware Discussion and General Help
    Replies: 0
    Last Post: 09-07-2009, 13:37
  2. Adding a stealer in a program?
    By VitaminX in forum General Programming Help
    Replies: 1
    Last Post: 19-05-2009, 22:40
  3. Adding a digit
    By OD_ in forum Delphi Help
    Replies: 1
    Last Post: 25-08-2006, 03:42
  4. Adding parameters to a procedure
    By ratws in forum Delphi Help
    Replies: 6
    Last Post: 28-09-2005, 22:58
  5. Adding VNC capabilities to a RAT
    By ratws in forum Delphi Help
    Replies: 7
    Last Post: 29-07-2005, 15:14

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
All times are GMT +1. The time now is 21:42.
www.opensc.ws
Copyright ©2005 - 2012, OpenSC Forums



Search Engine Friendly URLs by vBSEO 3.6.0 ©2011, Crawlability, Inc.