MemoryModule x86 and x64 (static lib, import and example)

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

MemoryModule x86 and x64 (static lib, import and example)

Post by ts-soft »

MemoryModule is to load DLL from Memory!
This Version works with x86 and x64 in ASCII or Unicode.

Download
Last edited by ts-soft on Fri Aug 03, 2012 9:57 pm, edited 1 time in total.
cas
Enthusiast
Enthusiast
Posts: 597
Joined: Mon Nov 03, 2008 9:56 pm

Re: MemoryModule x86 and x64 (static lib, import and example

Post by cas »

Thanks for sharing, works great, especially x64 version :o .
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: MemoryModule x86 and x64 (static lib, import and example

Post by ts-soft »

you are welcome :D
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Re: MemoryModule x86 and x64 (static lib, import and example

Post by Mistrel »

No source? :|
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: MemoryModule x86 and x64 (static lib, import and example

Post by IdeasVacuum »

....source is in the source folder
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Re: MemoryModule x86 and x64 (static lib, import and example

Post by Mistrel »

MemoryModule static lib, import and example
I thought it was just the static library. I should have looked.

Thanks, ts-soft!
User avatar
Rings
Moderator
Moderator
Posts: 1427
Joined: Sat Apr 26, 2003 1:11 am

Re: MemoryModule x86 and x64 (static lib, import and example

Post by Rings »

thx Thomas for the port....

also some infos available at:
http://www.joachim-bauch.de/tutorials/l ... om-memory/
SPAMINATOR NR.1
cas
Enthusiast
Enthusiast
Posts: 597
Joined: Mon Nov 03, 2008 9:56 pm

Re: MemoryModule x86 and x64 (static lib, import and example

Post by cas »

Looks like it is not stable, with this code i get ~23500 loads and unloads of dll, it fails with invalid memory access (read error at address 68) on MemoryLoadLibrary(). Shouldn't it return 0 if it fails to load dll? Maybe it is some kind of memory leak, with bigger dll's i get invalid memory access sooner.

Code: Select all

XIncludeFile "MemoryModule.pbi"

DataSection
  DLL: IncludeBinary "test.dll"
EndDataSection

For k=0 To 40000
  Debug k
  Define hDLL = MemoryLoadLibrary(?DLL)
  If hDLL
    MemoryFreeLibrary(hDLL)
  EndIf
Next
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: MemoryModule x86 and x64 (static lib, import and example

Post by ts-soft »

cas wrote:Looks like it is not stable, with this code i get ~23500 loads and unloads of dll, it fails with invalid memory access (read error at address 68) on MemoryLoadLibrary(). Shouldn't it return 0 if it fails to load dll? Maybe it is some kind of memory leak, with bigger dll's i get invalid memory access sooner.
This is a problem with some 32-bit dll's, but i can't help. The same problem with
PBOSL_LoadDLLMemory and PurePROCS by gnozal.

greetings
Thomas
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8433
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: MemoryModule x86 and x64 (static lib, import and example

Post by netmaestro »

Thanks, ts-soft, it's quite well done. I particulary appreciate the release format of static library, impervious to future changes in PB and as usual from you, source all in. The small price is a little .pbi for the imports, well worth it. Thanks again :mrgreen:
BERESHEIT
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Re: MemoryModule x86 and x64 (static lib, import and example

Post by Mistrel »

I overlooked the first line 'Import "oldnames.lib" : EndImport' and received a linker error. Replacing this line fixed it. But what is oldnames.lib?

A very accurate but also very unhelpful result as the first hit on google:

"What the hell is OLDNAMES.LIB?"

http://social.msdn.microsoft.com/forums ... db157c6d08

Most of the other results are just people looking for it. Would you care to share your wisdom?
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: MemoryModule x86 and x64 (static lib, import and example

Post by ts-soft »

the c-source uses stricmp, this is an old function, removed from actuell libs. oldnames.lib is to wrap
the old function to new.
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Re: MemoryModule x86 and x64 (static lib, import and example

Post by Mistrel »

But isn't stricmp also in msvcrt.lib?
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: MemoryModule x86 and x64 (static lib, import and example

Post by ts-soft »

Mistrel wrote:But isn't stricmp also in msvcrt.lib?
only in old versions.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: MemoryModule x86 and x64 (static lib, import and example

Post by ts-soft »

Update:

Recompiled from Source-Version 0.03
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Post Reply