473,387 Members | 1,790 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

executing a file with a byte offset? (pipe?)

Hi there,
I'm programming an archiving class and the archive is currently able
to read files, concatenate them in one and compress the archive (or
specific files that can be compressed) with the zlib.

I think I will be concatenating this archive to a binary executable that
will read itself to find its data (btw, it's an OpenGL program with
textures).

So we have:
1. OpenGL program
2. Archive
1. TextureA
2. TextureB
3. TextureC

OpenGL program (1.0) reads the archive (2.0), finds the textures and
loads TextureA (2.1), TextureB (2.2), TextureC (2.3).

Currently my program can succesfully read all textures and run the
OpenGL animation.

What I'm thinking is if it is possible to execute an archived
(uncompressed, raw binary) program in such an archive.

1. Program
2. Archive
1. DataA
2. Program I want to exec
3. DataB

Program (1.0) reads the archive (2.0), reads DataA (2.1), start the
execution of the second program in the archive (2.2), etc...

How I read the data:

Normally i open an ifstream, read the header of my archive, finds the
byte position of the start of the file I wish to read, then jump the
cursor position to that place and pass the ifstream to whatever wish to
read that file (ie, loadJPEG()).

Now I'd like to move the cursor to the start of an archived program and
start executing it as a new program or as a child of the current
program. (Doesn't matter...)

Is this possible?
My OpenGL program is running fine under linux and windows. Is this
possible for linux and windows (is the code I need compatible?)

Thanks a lot!
Xilo

Jul 22 '05 #1
1 2175
> Now I'd like to move the cursor to the start of an archived program and
start executing it as a new program or as a child of the current
program. (Doesn't matter...)


I will soon start to learn Assembler and I think it should be able to do
this for me... since the assembler doesn't know difference between data
and executable binary I think the archive (which is considered data)
could be executed this way (not using C++).

I think I could write a small "executor" at the start of the archive
like so:

1.0 - Assembly executor
2.0 - Archive (uncompressed)
2.1 - Main program (C++)
2.2 - Some Data here (compressed)
2.3 - Secondary program

I guess the assembly executor should know the address of the begining of
all programs within the archive, the addresses should be built-in and it
should be possible to start the hole program (1.0) with arguments to
tell the assembly executor which program to execute.

I'm not sure if it is easy to read files on the disk with the assembler,
nor if the whole thing is possible...

But since it is so easy for a CPU to mistake data and exe. binary I
guess there should be a function to execute data in C++, isn't there any?

If there is a function that can execute data, then I can read my program
to memory and execute the given string (char* of a few hundred kilobytes).

Thanks for any information,
Xilo

Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Joseph | last post by:
Hi, I'm having bit of questions on recursive pointer. I have following code that supports upto 8K files but when i do a file like 12K i get a segment fault. I Know it is in this line of code. ...
8
by: Eric Lilja | last post by:
Hello, I had what I thought was normal text-file and I needed to locate a string matching a certain pattern in that file and, if found, replace that string. I thought this would be simple but I had...
3
by: Richard Brookes | last post by:
Hi there i need to take a segment of a mp3 file say it has 1000 bytes i want bytes 100-300 and save it as a new file. can anyone help? cheers
5
by: Chris R. | last post by:
I'm trying to do something relatively simple - find the offset of the first - or next - occurance of a string in a file, ideally in a case- insensitive way. I've seen a few solutions that seemed...
0
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
18
by: Jen | last post by:
I'm using Microsoft's own VB.NET FTP Example: http://support.microsoft.com/default.aspx?scid=kb;en-us;832679 I can get the program to create directories, change directories, etc., but I can't...
5
by: IcingDeath via DotNetMonster.com | last post by:
I am building this SQL Server database app in which i can store files. In order to display files I want to have the app show the associated icon for the extension of the file that is in the...
6
by: J055 | last post by:
Hi I have the following code. I upload an XML file using the FileUpload object, store the stream in a session so the user gets the chance to confirm some options then pass the stream from the...
4
by: Vlad | last post by:
I am having problems using the file.create method within a function that is called when looping through an array of filepaths. If I call my function with a hardcoded file path --C:\Temp.txt the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.