Code Monkey home page Code Monkey logo

dsplayer / memorymodule Goto Github PK

View Code? Open in Web Editor NEW
52.0 13.0 23.0 242 KB

With BTMemoryModule for Lazarus and Delphi a dynamic link library (DLL) can be loaded from memory without storing it on the hard-disk first. BTMemoryModule is a Pascal port of Joachim Bauch's C / C++ Memory Module. The port includes the complete memorymodule pascal sourcecode and examples to demonstrate the use.

Home Page: http://www.dsplayer.com

License: Other

Pascal 99.93% Batchfile 0.07%

memorymodule's People

Contributors

dsplayer avatar starwong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

memorymodule's Issues

Invalid hInstance?

Hi!
When I use BTMemoryModule, hInstance variable seems to be invalid.
In my DLL I use SetWindowsHookEx(WH_KEYBOARD,@KeyboardProc,HInstance,0);
If I use standard DLL approach (e.g. DLL is located in file, HInstance is not 0 and after SetWindowsHookEx function GetLastError returns 0 - e.g. no error.
If I use BTMemoryModule and execute the same code, HInstance is also not 0, but GetLastError returns 126 (0x7E) - ERROR_MOD_NOT_FOUND, which means that the specified module could not be found.
I suspect this is somehow related to HInstance value, which probably is invalid.
I use Delphi XE7, the project is compiled in 32-bit, under Windows 7 Ultimate x64.
Thank you in advance for your time!

IncP instead of DecP

In version 0.0.4 and 0.0.41 I see at line 545 the instruction:

      DecP(lp_section, SizeOf(TImageSectionHeader));

But I think that instead it should be:

      IncP(lp_section, SizeOf(TImageSectionHeader));

because the code is going through the list of sections in ascending order...

Please let me know if this makes sense... 

Original issue reported on code.google.com by [email protected] on 11 Mar 2013 at 4:31

Fix for DEP compatibility (Data Execution Prevention)

The unit does not work on operating systems where DEP is enabled by default. 
That's because the dll is loaded into non-executable memory areas. 

Fixing this issue is easy: 
In all VirtualAlloc() calls, replace the "PAGE_READWRITE" constant by 
"PAGE_EXECUTE_READWRITE". That means: replace "PAGE_READWRITE" by 
"PAGE_EXECUTE_READWRITE" everywhere in the file except the occurence in the 
GetSectionProtection() function. 

Original issue reported on code.google.com by [email protected] on 10 Nov 2014 at 9:26

VirtualAlloc problem

I'm trying load 7z.dll (32bit, version 9.38) with BTMemoryModule 0.0.4.2 but failed,
exception on line 683:

l_locationdelta := Cardinal
      (UInt64(l_code) - l_old_header.OptionalHeader.ImageBase);

because sometimes UInt64(l_code) < l_old_header.OptionalHeader.ImageBase($10000000), so a range error occurred.
then I changed line 650, from:

      l_code := VirtualAlloc(nil, l_old_header.OptionalHeader.SizeOfImage,
        MEM_RESERVE, PAGE_EXECUTE_READWRITE);

to:

      l_code := VirtualAlloc(nil, l_old_header.OptionalHeader.SizeOfImage,
        MEM_RESERVE or MEM_TOP_DOWN, PAGE_EXECUTE_READWRITE);

and it seems OK.

64x dll load

What steps will reproduce the problem?
1. I Try Load x64 bit dll.
2. When run LoadLibrary, i see violation access error

Os:Windows 7 x64
IDE:Delphi XE2

I wanna load x64 dll, what need change to do it?



Original issue reported on code.google.com by [email protected] on 30 Jan 2012 at 11:08

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.