How to add a file to your C exe win32 - c

I have a chrome extension that works with my exe file. I want to deliver just one exe file to my client. I tried converting the zip file into hex, but then I get a string with 25 thousand lines. I don't think that's the right way to do it.
How can I deliver my zip file with my exe?

What you are trying to do is definitely doable, I've seen it being done many times.
If you have MinGW installed, you can use xxd tool that will do the trick for you.
xxd -i your_zip_filename embedded_zip_data.h
Now you simply add #include "embedded_zip_data.h" in your source code and it will be right there in the application data.

Related

My Java zipped file not supported in Junzip C program

I have written a Java program to zip files and to unzip them in an unzipping C program called Junzip.
https://github.com/jokkebk/JUnzip. I'm able to unzip the file using 7zip file extractor. But when using C Junzip, its not unzipping.
But when I'm unzipping the file, which was zipped using normal file compressor, I'm able to unzip it using the same jUnzip library.
Author of the JUnzip library here, just came across this question. Did I understand correctly that .zip files made by your program unzip correctly with 7zip, but not with JUnzip, whereas JUnzip seems to be able to uncompress .zip files made by others?
Without further info, it's hard to say if there's a .zip feature you are using that JUnzip does not support, or if there's a bug in JUnzip. One possible reason is that the library and junzip.exe only supports a limited set of compression methods, namely Deflate that is supported by zlib library it uses. The code base is rather small so you could probably add a few debug statements to see where it goes wrong.
You can check out https://codeandlife.com/2014/01/01/unzip-library-for-c/ for some details regarding JUnzip.

Is there a way to get Aginity Workbench to write Unix files rather than Windows files (LF only rather than CR\LF)

Is there a way to get Aginity Workbench to write Unix files rather than Windows files (LF only rather than CR\LF)?
"My" developers check their code into SVN on Windows, and then we check it out into a development environment, and it's ... complicated, but doing a tr -d \r on every file on checkout is problematic.
Thanks.
Why don't you use dos2unix utility to get proper file encoding?
Anyway, there is Aginity Support portal by the link below. You can submit your question there:
https://support.aginity.com/hc/en-us/community/topics
In Workbench you can actually recode a text file to convert it from one encoding to another. Tools menu -> File Utilities -> Re-code a text file.

Decompressing .lz file

Curiosity is one of my personal keys. I got a folder of an executable c application, this folder include many files some are files.so , files.ini and other files.lz and I decided to try do some kind of reverse engineering, so I have used a reverse engineering online tool for the files.so and files.ini are already opened via notepad as we all know, but now my problem is about opening files.lz, which i already know that it contains libraries to be used for functions on files.so
This is what i want to know and to have some help in it how can I decompress it via a desktop tool or even an online tool?
Should be Lzip.
When you are in the linux-world, one very usefull commands is file:
$ file myFile.lz
myFile.lz: lzip compressed data, version: 1

Makefile compiling C files on Windows8 and files with no file extension/s

I have gcc in my Win8 path and can compile C files from the Windows command prompt which is great and I have been compiling regularly in this way but just now I have been looking at creating a makefile to use and compile with.
My first makefile failed as I created makefile.txt but when I removed the file .txt extension the compile worked successfully with the make command at the cursor in cmd console.
The makefile then has no file extension and my query is how the xxxx does this work? Windows obviously knows what this file is and uses it with gcc to compile but how/why? This leads on to another question ...are there other files made with no file extension that do stuff on Windows (or other OS)? I'm perplexed and intrigued and would appreciate a technical explanation if possible.
Thanks.
EDIT...Sat 291114
I am working through Learning C the hard way by Zed Shaw and this image shows Ex2 creating a makefile on my Win8 PC..
It works because the make program is written to look for files named makefile, not files named makefile.txt.
Extensions are important on Windows so that Windows can guess what "type" of file it is, so if you tried to open that file Windows could guess at what program should be used to open it.
However, this is really a problematic solution. First, just because two files have an extension of "foo" doesn't mean both are the same type of file; there's no central authority of file extensions (that I'm aware of) to guarantee there are no conflicts. Second, just because a file has an extension "foo" doesn't mean the contents are of that type: I'm sure you're familiar with viruses and scams where a file of one type is created with a different extension to trick Windows into running an unexpected program.
On traditional UNIX-based systems the "type" of a file is usually derived from the contents of the file, not the extension. There are some obvious exceptions, for example source files are all plain text files so they have the type of code it is (C, C++, Java, Python, etc.) marked by the extension. But on UNIX systems, for example, programs do not have .exe extensions: for example it's just make, not make.exe. Also a shell script doesn't have to end in .bat or .com: it can be just named foo as well if you want. For executable files the operating system looks at the first two bytes of the file to tell what kind of executable it is. For scripts the first two bytes must be #!: then the operating system knows it needs to run an interpreter (like the shell, or Python, or whatever) for the script.
For non-executable files like JPG or whatever, programs can determine their type by examining the contents. Most file types have some format to their content that can be used to say "this is a JPG file", "this is a MP3 music file", etc.

How to retrive binary version number from binary files

I am using Eclipse IDE for developing the c programs. Through terminal I can see the file info using file filename .But I need to print only the version number of a binary file through the same code.I think the eclipse IDE keeps the build and debugging versions .How to retrive binary version number from binary files ?.
Thanks .
The "file" utility is a non-trivial implementation, ie., no straight-forward system calls for getting all those information. You have two options:
Get the source code of "file" utility (here) and manipulate it
for your goal
Easier: use popen(), run file command, retrieve the
output and parse it to get the information you want. The command file <filename> | cut -d"," -f3 should directly give you the version of the executable.
An example of using popen() here
Hope this helps.

Resources