I have a image file encrypted. now my program will read the encrypted file and create the image in a char array. now my problem is i need to open the image with some image viewer without writing the image file to the hard disc. it should be possible because the image data is already loaded in the ram.
Share
I don’t know of any image viewer that is able to load images from memory regions. Even if you would create your own image viewer, you’d have to share the memory region or the viewer most probably won’t be able to access your programs memory for security reasons.
A compromise would be to write the image to a temporary directory on the hard disk, open it with the image viewer and overwriting it with random data and deleting the file after use (for small files you even can delete it after the image viewer finished loading).
From what you’re writing, it seems that you want to avoid writing the decrypted data to the hard disk, which is fine because data written to the hard disk will still be there after a shutdown, while data in RAM won’t survive. But as JasonD pointed out in his comment, this can lead to a false sense of security – the OS is free to move memory regions into virtual memory (and so to the hard disk) at any time.
EDIT: Opening a memory region might be possible, e.g. you can try out the hex editor HxD – it can open and edit memory regions allocated by processes, although I don’t know how it does it.