+ Reply to Thread
Results 1 to 10 of 10
  1. #1
    Senior Member
    Join Date
    Feb 2009
    Location
    Where you aren't.
    Posts
    148

    Question Loading a DLL from memory

    Okay, so this issue is confusing me.

    Does anybody know of a way to load an dll file from memory?

    What I am trying to accomplish is storing the plugin for my server on the hard drive in an encrypted form. Then I could load the file where the encrypted data is stored into memory and decrypt it. That way the decrypt version would never exist on the disk.

    I found something that does almost exactly what I want at http://www.joachim-bauch.de/tutorial...l-from-memory/
    But it only works using FILE classes and is rather stick with winapi, not to mention it throws an error at the end.

    Does anybody have any ideas or source?

  2. #2
    Senior Member
    Join Date
    Aug 2008
    Location
    In your stack O___O
    Posts
    3,101
    What do you mean it only works using FILE classes?
    From what i see, you can just read your encrypted dll to say a byte *(malloc'd or whatever you use) then decrypt it and pass it to MemoryLoadLibrary

    pseudocode

    Code:
      HANDLE hFile =   CreateFile(_T("yourfile.ext"),GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);
    
      DWORD dwSizeofFile = GetFileSize(hFile,NULL);
    
      byte *lpMem = (byte *)malloc(dwSizeofFile);
    
      ReadFile_To_ByteArray(lpMem);
    
      Decrypt_Bytes(lpMem);
    
      void *lpLibraryMem = MemoryLoadLibrary(lpMem);
      /* do things with lpLibraryMem such as walk the EAT or call GetProcAddress, and free the mem once you are done with it*/
    Last edited by mjrod5; 06-08-2010 at 19:10.
    [img]http://www.photochopz.com/forum/images/smilies/fap.gif[/img]In The Oven (err in Development) : Pie [img]http://www.photochopz.com/forum/images/smilies/fap.gif[/img]
    [QUOTE=uraskiddie;115188]What are you? Like 10 years old?
    That's complete rubbish, you probably got your depictions of being a "hacker" from a prepubescent forum infested with homosexually-oriented pedophiles.[/QUOTE]
    [QUOTE=Envy;136433]Russian?
    Trusted.
    Botnets are like our right hands.[/QUOTE]
    [url]http://cognitivity.org/[/url]

  3. #3
    Senior Member
    Join Date
    May 2010
    Location
    /system
    Posts
    307
    You must spread some Reputation around before giving it to mjrod5 again.
    i prefer backseat rather than storming the front.
    sniper's way xD

  4. #4
    Senior Member
    Join Date
    Feb 2009
    Location
    Where you aren't.
    Posts
    148
    I gave reputation?

  5. #5
    Senior Member
    Join Date
    May 2010
    Location
    /system
    Posts
    307
    Quote Originally Posted by Lost One View Post
    I gave reputation?
    you make me lol everytime with your statements. xD
    i prefer backseat rather than storming the front.
    sniper's way xD

  6. #6
    Senior Member
    Join Date
    Feb 2009
    Location
    Where you aren't.
    Posts
    148
    Executer, you are confusing me...

  7. #7
    Senior Member
    Join Date
    Aug 2008
    Location
    In your stack O___O
    Posts
    3,101
    Quote Originally Posted by Lost One View Post
    Executer, you are confusing me...
    What he said was the message the forum gave him when he tried giving me some rep

    Did you ever try what i told you?
    [img]http://www.photochopz.com/forum/images/smilies/fap.gif[/img]In The Oven (err in Development) : Pie [img]http://www.photochopz.com/forum/images/smilies/fap.gif[/img]
    [QUOTE=uraskiddie;115188]What are you? Like 10 years old?
    That's complete rubbish, you probably got your depictions of being a "hacker" from a prepubescent forum infested with homosexually-oriented pedophiles.[/QUOTE]
    [QUOTE=Envy;136433]Russian?
    Trusted.
    Botnets are like our right hands.[/QUOTE]
    [url]http://cognitivity.org/[/url]

  8. #8
    Senior Member
    Join Date
    Feb 2009
    Location
    Where you aren't.
    Posts
    148
    Oh yeah lol. Sorry I forgot to reply.
    It worked fine with you way. My problem was I tried to read the file to a char[] instead of a BYTE[] lol

  9. #9
    Senior Member
    Join Date
    Aug 2008
    Location
    In your stack O___O
    Posts
    3,101
    Quote Originally Posted by Lost One View Post
    Oh yeah lol. Sorry I forgot to reply.
    It worked fine with you way. My problem was I tried to read the file to a char[] instead of a BYTE[] lol
    Lol glad it worked out
    btw get on msn more often
    [img]http://www.photochopz.com/forum/images/smilies/fap.gif[/img]In The Oven (err in Development) : Pie [img]http://www.photochopz.com/forum/images/smilies/fap.gif[/img]
    [QUOTE=uraskiddie;115188]What are you? Like 10 years old?
    That's complete rubbish, you probably got your depictions of being a "hacker" from a prepubescent forum infested with homosexually-oriented pedophiles.[/QUOTE]
    [QUOTE=Envy;136433]Russian?
    Trusted.
    Botnets are like our right hands.[/QUOTE]
    [url]http://cognitivity.org/[/url]

  10. #10
    Senior Member
    Join Date
    Feb 2009
    Location
    Where you aren't.
    Posts
    148
    I'm on almost every night. Be more nocturnal...

 

 

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Loading dll ( infecting pe )
    By Sav1or in forum Malware sources
    Replies: 5
    Last Post: 17-11-2011, 14:29
  2. [HELP] Loading Dynamically an api
    By guro in forum Delphi Help
    Replies: 0
    Last Post: 05-10-2008, 10:21
  3. Loading a DLL form a DLL
    By drkdreams in forum Delphi Help
    Replies: 5
    Last Post: 10-10-2006, 21:09
  4. DLL Loading...
    By unreachableboy in forum General Programming Help
    Replies: 0
    Last Post: 03-11-2005, 19:30

Tags for this Thread

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:37.
www.opensc.ws
Copyright ©2005 - 2012, OpenSC Forums



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