Extracting an an image (JPG or PNG) from the PE - c++

First of all I have done a lot of research on how to use resources and I cannot find proper documentation or manage to make it work so please do not link documentation without explaining (I am using Visual Studio 2015).
The problem is the following I would like to extract an image (JPG or PNG) that is in the PE.
I found 2 approaches:
Using resources but I can't seem to find documentation for PNG files and on how to properly declare the resource ID.
Converting the image to a hex array and copy it to a file, this solution isn't working because Visual Studio simply doesn't allow me to paste the array (maybe too big?) And just crashes. Modifying the file directly in the project with another editor doesn't seem to work either it just reverts back for whatever reason.
I don't mind the solution to use but none is working right now.

Ok after a few more hours of researches I found this and it seems to work.
Posting it in case someone has the same problem :
https://social.msdn.microsoft.com/Forums/en-US/7d753874-2fed-4db7-8135-4e4d499bac99/how-use-rcdata?forum=Vsexpressvc

Related

Integrating an image into my executable file

I have an application that relies on many images. I have no problem loading the images on to the window. I would like to make my application have the images integrated into it where there are no actual image files in the folder. Also, I would like to know how to do this, because if I sell the application I don't want the user to be able to go to the directory my .exe is located in an get the image file (I am aware that they can print screen it). So, how can I integrate the image into my application. I am using the WinAPI with C++.
I have searched this multiple times and have not found anything on this. I have found one question on another forum, but it was asked a long time ago and was not answered. I did find one other place that had this, but It did not specifically work with my question.
You can bind images (as well as pretty much any pieces of data) as resources to your binary.

De-interlace captured video with DirectShow

(Add KSPROPERTY_CAMERACONTROL_SCANMODE into KSPROPERTY_VIDCAP_CAMERACONTROL?)
Working with a webcam I'm getting an interlaced video. The access to that webcam is done with a DirectShow using videoInput library (as part of OpenCV).
I cannot find a way to control that (interlaced) mode with the currently available options/enums in the OpenCV so I diged into MSDN and found the following:
IAMCameraControl interface can be used to get/set various properties, as long as they are listed in PROPSETID_VIDCAP_CAMERACONTROL (http://msdn.microsoft.com/en-us/library/dd389145(v=vs.85).aspx#methods)
PROPSETID_VIDCAP_CAMERACONTROL lists 3 blocks of enums (one for "prior to USB video class, one for UVC, and one for Win8) and among those values there's the one I'm interested in! It's a KSPROPERTY_CAMERACONTROL_SCANMODE (http://msdn.microsoft.com/en-us/library/ff567802(v=vs.85).aspx)
I have Windows 7.a SDK installed and in the C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include\strmif.h file what I see is a list of values that only covers the "original" set, which is pre-UVC, so it doesn't have the control for the interlaced mode. The enum in that file looks like this one from MSDN site: http://msdn.microsoft.com/en-us/library/windows/desktop/dd318253(v=vs.85).aspx
Then I've found this forum where the person claims "I had to update the CameraControlProperty enumeration" to add the needed properties and it worked for him (http://sourceforge.net/p/directshownet/discussion/460697/thread/562ef6cf/)
My question is:
How? :) What does one do to add a needed value (or a bunch of values) that are supposedly supported by the system? What am I missing?
MSDN seems to be holding the cards close to its body and not revealing much, so I'm asking the good people in here for help.
I hope someone out there has figured out how to do that and can share the wisdom.
My ultimate goal is to use the OpenCV's videoInput's setVideoSettingCamera() to control the interlacing (so that the image I get doesn't have those black lines)

Color dark scheme for ColdFusion/Dreamweaver?

Is there anyone out there who has a dark color scheme for Dreamweaver (CS6) that includes coldFusion Code?
I was not able to find any and changing the colors by hand is really painful
Would be great if you could share one.
Tks
There are colour files for Dreamweaver, but I haven't found any that actually work with Coldfusiun. You can follow this guides process. It is a manual process, but it will tell you exactly what to change and as indicated by the latest update at the bottom it does work in CS6.
Copying from link in case link dies. Do note that you will have to go to the link to download the links.
Close Dreamweaver
Browse to: %APPDATA%\Adobe\Dreamweaver 9\Configuration\CodeColoring
Rename the Colors.xml file to something different – say Colors2.xml (This will be the file you go back to if you don’t like the new colour scheme)
Download and extract the the zip at the end of this article to the location you opened at point 2.
Open Dreamweaver and go to Edit/Preferences/Code Colouring and change the default background colour to #003
As a side note. If you are only using Dreamweaver to write Coldfusion, maybe you should consider looking at CFEclipse. I've found it to be much better than Dreamweaver at writing Coldfusion. Also it's built on top of Eclipse. Which has a plugin to change the colouring. It's also easier to change it manually.

JPEG header construction

I'm trying to write a JPEG file.
After I acquire the raw image and processing it by DCT, quantization and huffman coding, I would like to save it in the correct format. I couldn't find any libraries that help me to write proper header file, insert the two tables that I used (huffman and quantization), so I started writing everything by myself.
I started with the SOI marker, frame header and so on, but when I try to open the JPEG image with a viewer, it shows nothing, even in the properties. There's no information shown (e.g. the image dimension), even if I insert this info like written in the official documentation.
How can I write a proper JPEG header?
P.S
I use C++ and Visual Studio 2010.
Simple answer - it's complicated.
I would start with libjpeg and use it to just give you the approriate header. You can also use it as a reference for what the internal header structs look like

Is it possible to change a exe's icon without recompiling it?

I have lot of executable that I have compiled (long time back) for many of which I don't have sourcecode now. But when I compiled them I didn't put any icons for them, so they all look like same dull, bald default icon. So my questions are,
(1) is it possible for me to write a software that can change the resources section of the exe and change its looks? If so, can anyone plz point me to the location where its explained? (I am a beginner, I have no idea on the exe format and all)
Also its fun to keep changing Icons without having the pain of recompiling everything just for the icon change...
(2) This is raises a natural converse question, Is it similarly possible to zap out the icon used by some file and use it for some other file? (If so, plz point me to location where I can get some details.
I am a C/C++ developers and I am looking for solution on Windows Platform...
Regards,
MicroKernel
The icon used for the executable is nothing but the first ICON resource encountered in the EXE file. You can use a tool like ResHack to extract icons from existing binaries, and (I think) you can also use it to change the icons attached to a particular resource.
It is possible to read and write resoures from an exe or DLL file. Reading the resources is easy(ish) - just use LoadLibraryEx(LOAD_AS_DATA_FILE) to load it, then you can enumerate the resources using the standard resource API's. All of this is documented on MSDN.
Writing the resources can also be done using the UpdateResource API and related functions.
You should bear in mind though that changing the resources of someone elses EXE file will invalidate any signing. Also, depending on OS resources is risky - windows has been known to remove resources without warning (since they are undocumented). Copying resources may not be legal too (although IANAL).
As far as I know you can open the EXE file in Visual Studio and edit the resources in live EXE file.
It is possible to do this. IIRC, Microangelo Librarian can do this.