#C++ LoadLibraryA Memory
189 messages ยท Page 1 of 1 (latest)
Whats the error
Because loading a DLL from memory is not supported by windows
It's a bunch of dirty hacks
it doesnt give me a error
i mean still
still what?
i need to get it working
why do you need this anyways?
so i can have 1 .exe instead of a thousand dlls
why?
is it better for my other apps to download this .exe
or
i have to make it download 1 .exe and then dlls
its simpler
download a .zip then extract it
in c++
why is your app downloading executables anyways?
how else will it open stuff
If you really want just one .exe then the solution is to statically link the dependencies
why does your app need to open stuff?
why does discord have to open stuff
why does anything have to open anything
bro what are these questions
discord doesn't randomly download .exe and execute them 
I'm trying to understand your use case so I can provide the best solution
i just need to load the dll in memory
you really don't
are there things like relocations i have to worry about
with this method anything can break at any moment
thats kinda gay
please don't use "gay" as a derogatory term
but yes, the method you are trying to use is not reliable
I have suggested a method that is more correct and reliable tho
that was a typo sorry
in memory
it isnt that deep
hmm
then the dlls will be baked into the executable
exactly!
you can do that sure
i need the first dll to not have any crt dependencies tho
and the first dll is pure C
why?
so it doesnt mess up the first .exe
seems like you are overcomplicating things
i mean this is just how it needs to be
if you explain why maybe we can probide further guidance
if the first dll has any crt dependencies or dynamic libraries or something then it crashes the first .exe
get rid of all dlls
so i made a first dll that has no crt dependencies that handles the loading of the second dll that has crt dependencies
statically link everything
is there no other way?
if you want no file beside your program you either do that or you put the source code of the dependencies directly into your program
Ill take a look in a sec
Ill see if i can fix it
Staff here doesnt like loadlib or anything memory related
i asked deepseek it said i need to
1. Rebuild the DLL with Relocations
In Visual Studio:
Go to Project Properties โ Linker โ Advanced โ Randomized Base Address โ Set to Yes (/DYNAMICBASE).
Remove /FIXED from linker flags (if present).
This adds relocation data, allowing the DLL to load at any address.
thanks
i believe your dllData is wrong
take a look at https://github.com/fancycode/MemoryModule/blob/master/example/DllLoader/DllLoader.cpp
im not going to lie, ive never loaded dlls from memory but yea
ill test this
im a lil busy today, but if you really cant figure out how to fix this out ill ask my pro friend
to help
i have been trying to figure it out all day for like 3 days already
but im trying the dllloader rn
dllloader worked with loadfromfile but not loadfrommemory
like it ran the dll for a little and then the dll stopped
but loadfromfile worked perfectly
i looked at the sampeldll code
do i need to also use MODULE instead of SHARED?
you have the source code?
of what
i tried this
the dependencies?
its not wrong i tested
but i dont get
how loadlibrarya works
and this doesnt
i mean yeah memory hacky wacky
but
the memorymodule should handle all the things that loadlibrarya
does
it doesn't
my dll has openssl so this should help
but i have NO idea how that dude fixed it
cause the way he worded it i cant understand anything
oh is he loading the openssl.dll instead of using openssl.lib
well that doesnt fix my problem cause id have to then load motha flipin openssl from memory and the same thing will happen
i think i might have found a fix
in the dllloader
what if i memoryloadlibrary of openssl.dll before i load the main.dll
i tried this and got further
tried to use procmon to see what more dlls it needs but it didnt show anything so i need to somehow
find those
i loaded all the possible dlls that there are to load
@delicate hare has reached level 6. GG!
for openssl the libcrypto libssl zlib
it like works but it doesnt start
it just sends out the startup console.log and then it just starts waiting for input but it doesnt start the thing that is the main purpose of it
how could i find out whats wrong
for example if openssl gets a error or something
why do you have to make this so complicated
it's so obvious you're trying to make something malicious and if this is the case loading libraries dynamically is heavily detected and will just get you 70/70 on virus total
fortunately i dont care about that cause it isnt malicious
i just need to get it working
how do u even interpret loading a file in memory malicious
id get if it was loading a executable in memory
DLLs are essentially the same as an executable lol
well if it were the same then why doesnt it work

would i really go thru all of this effort as a "skid malware writer p100"
yes
yes
@grim hull has reached level 3. GG!
lol
if loading a dll from memory is only for malicious use then i dont seem to understand why so many people have starred the repo on github
well you still haven't given a compeling reasin why you are trying to do something that is not supported by Windows when there are other supported ways
.
hey, check the dms ill send you an inv to a server that can help you w this
thanks!
like I said, you could package it in a compressed file, you can link statically
you can even package everything into a single executable that then extracts itself somewhere before running the real stuff (or use an installer)
you can write the dll to file and then load it from there
there are so many valid and reliable ways to do it
yeah but i wanna load it from memory without having to exclusively drop a file
I gave examples of how to do that too
just statically link your dependencies. it will all go into the exe and there will be no other files. go to visual studio settings there should be an option for multi threaded dll change it to multi threaded
it is multithreaded
but how do i "statically link it" exactly
i need to make the first.dll load the second.dll
first.dll loading the second.dll using loadlibrary works
so
how do i statically link second.dll to first.dll
are you breaking your project into multiple dlls
no
I don't understand. why does first.dll need to load second.dll
i think you need to refactor your approach and go back to the drawing board
it doesnt matter
it just needs to be done
and im trying to look at a way to do it
not to be told to do it another way
well we'll see how far it gets you then
yes we told you how to do it
the right way to run your executable without having the dlls on the side is to link them statically

i think i found a project that can do it
its a project that hooks the file getting part of the loadlibrary
and overwrites it with the data
thats smart
See if this interests you
pretty much a recreation of win32's loadlibary
obviously you'd need to implement it with whatever you're using if you do decide to test with this
you would use GetLoadedModule with your dll name to load it
i managed to get it working tho
now
using
Load a dynamic library from memory by modifying the native Windows loader - EvanMcBroom/perfect-loader
๐
noob