Editing images via a dll, errors

Just starting out? Need help? Post your questions and find answers here.
es_91
Enthusiast
Enthusiast
Posts: 298
Joined: Thu Jan 27, 2011 12:00 pm
Location: DE

Editing images via a dll, errors

Post by es_91 »

I wanted to open an image in my main .exe, call the function of a dll giving it the image number (#image) and edit it there. The edited new image is created in the dll code, filled with pixels and stored into a structure. The structure now contains the #image number.

Back in the .exe main, after calling the function, the #image number is 0 and i can not find out what happened in the dll code for i can not debug it the same time i run the main .exe

What is the best way to process? Copying the code into the main file and run it there? Can i debug a dll ?? logging ??

I am using createImage () inside the dll to get an #image number and hand it back to the main program. There it is 0. :?:

Wanted to edit some image content, maybe i try editing the original #image instead.
:mrgreen:
AZJIO
Addict
Addict
Posts: 2225
Joined: Sun May 14, 2017 1:48 am

Re: Editing images via a dll, errors

Post by AZJIO »

1. Dbgview.exe
Submit the data and Dbgview will show it.

Code: Select all

OutputDebugString_("test")
2. OnError
3. Before creating a dll, you need to test the code as an exe
User avatar
HeX0R
Addict
Addict
Posts: 1219
Joined: Mon Sep 20, 2004 7:12 am
Location: Hell

Re: Editing images via a dll, errors

Post by HeX0R »

#Images created in main, are not valid inside a DLL!
You can even create two individual images with #Image = 0 inside a DLL and inside Main.
You have to work with ImageID()s
es_91
Enthusiast
Enthusiast
Posts: 298
Joined: Thu Jan 27, 2011 12:00 pm
Location: DE

Re: Editing images via a dll, errors

Post by es_91 »

According to this, HeX0R, a dll would have to load every image content from either the clipboard or the file system when both exe and dll use it.

ImageIDs can not be used inside startDrawing ( imageOutput ( ) ). The memory should be readable but no image command can be used 'cause #images are not global.
:mrgreen:
DarkDragon
Addict
Addict
Posts: 2347
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Re: Editing images via a dll, errors

Post by DarkDragon »

es_91 wrote: Fri Apr 26, 2024 3:22 pm According to this, HeX0R, a dll would have to load every image content from either the clipboard or the file system when both exe and dll use it.

ImageIDs can not be used inside startDrawing ( imageOutput ( ) ). The memory should be readable but no image command can be used 'cause #images are not global.
A DLL can be written in many languages, how are you supposed to work with PB images in other languages? You can't. So what you typically do is pass the image data towards the dll, see DrawingBuffer for example. You don't need to go through the hard drive.

Pass the image data pointer, width, height, pitch, bpp and channels to the function inside and work in memory.
bye,
Daniel
User avatar
HeX0R
Addict
Addict
Posts: 1219
Joined: Mon Sep 20, 2004 7:12 am
Location: Hell

Re: Editing images via a dll, errors

Post by HeX0R »

I think EncodeImage() might also work (untested), then pass the Buffer to the DLL and recatch it.
Post Reply