Click here to Skip to main content
15,881,559 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Sir, I have several doubts(especially in C/C++) in programming could you please help me.Here are my doubts,

Doubt 1:
Is there any way to store a data inside an executable on run time.
For example in C If I create a simple database which asks an employee to enter his details and can see his profile whenever he wants.

what I have did?
To my knowledge(at present) I would create a file for every employee and whenever he types his Id it can open the specific file and show the details using file handling.But how can I store the employee details within the executable.

Is there any function to use?

Doubt 2:
How to make my program get installed on the computer?
For example if I build a simple program it creates an executable(.exe). I copied all the imports of my executable using dependency walker and made my program to run on another computer or even the same computer in which I build the program.But in neither of this computer it does install.

What I have did?
1. Manually created a folder in program files folder but I cant find my program in the uninstall window of my control panel.
2. I did the same using program but of no use.

Doubt 3:

How to make my program certified?

For example when I manifest my program it prompts the user for administrator permission.In that I found "publisher: unknown" How can I give my name ?

what I have did?

I admit it. It is beyond my knowledge(at present).

Since my English is poor I could not find exactly what I want.

Kindly help me with this.

Thank you.
Posted

  1. No way. It was possible in some obsolete OS, but hardly in some modern widely used OS. What is stored in an executable module can only be read-only. When any executable module is loaded for execution (any PE file; there is no difference between .EXE, .DLL and other kinds of PE files, it's all the same), its file is locked and cannot be modified by any means; this locking is not related to file system permissions or anything like that.

    You should understand that this is very important and fundamental safety feature.
  2. First thing to consider is to avoid installation. In most cases, you can deploy the product by copying the content of you output directory (excluding some files used for debugging, if any). Actually, this is the best way of deployment; later, even Microsoft started to encourage it. In modern culture, this kind of deployment is often called "portable", especially when installation option is required. It is portable, because one can always keep a copy on a USB drive or a SD card and use on any computer immediately, but can also be "deployed" by copying elsewhere.

    You really need installation only if you have to change something essential in system configuration. Installation is important only when the uninstallation is important to clean up the system from your product. For example, you may register some file types, modify system menu, create an exclusion in the local firewall, and so on.

    For development of installations, I strongly recommend open-source WiX:
    WiX - Wikipedia, the free encyclopedia[^],
    WiX Toolset[^].

    This is a first official Microsoft open-source project, the first one released on an external Web site; and this is really legitimate product, fully compliant with the official standard for MSBuild project type. It's Visual Studio integration is also very good.

    I would like you to warn about using many other installation tools, but first of all, the "Setup" project type bundled with older versions of Visual Studio. Microsoft phased it out from later version for some very good reasons. It works, but not really belongs to Visual Studio, from the point of view of standards and robustness.
  3. It depends on what you call "certification". It could be just bуреаurocracy, which I would not pay attention, or t could be the use of digital certificate based on public-key cryptography. In this case, this is an important feature of an installation which helps your user to identify your product as trusted. Technically speaking, you can easily generate a certificate by yourself and certify your installation (and some of your assemblies or other components as well). But how a user can know that this certification is not fake? In principle, some malicious artist can create a fake version of your software and use it for some malicious activity on the user's system, such as spying. To avoid such things, the user needs a way of checking up your certificate against some authority.

    That's why, if you really want a certificate used by general-public users, you have to purchase the certificate from certificate authority. You can read on this matter here:
    Public key certificate - Wikipedia, the free encyclopedia[^],
    Public key infrastructure - Wikipedia, the free encyclopedia[^],
    Public-key cryptography - Wikipedia, the free encyclopedia[^],
    Certificate authority - Wikipedia, the free encyclopedia[^].


—SA
 
Share this answer
 
v3
Comments
[no name] 5-Jan-16 11:12am    
Sir, a very good explanation.My vote of 5. But still now I see some latest software(even antivirus) which gets installed on computer? As per your solution installation tools are not trustworthy,then what to do. kindly help me.I mean everyone uses the opensource application?
[no name] 5-Jan-16 11:20am    
Does the future world would have no software which gets installed on the computer?
Sergey Alexandrovich Kryukov 5-Jan-16 11:51am    
I strongly advise to use Wix. No, you can trust many other installation tools, but WiX means reliable maintainability. Many use other tools, by different reasons: 1) legacy, not enough time or justification for migration, 2) not having enough information, 3) other reasons I'm not aware of.

As to the future word... If the development of technology was purely rational, perhaps I would take a risk of predicting something. But this development is quite irrational. So far, I managed to avoid waste time on too much trash, but it does not mean I can take a risk of giving advice and take the responsibility.

—SA
[no name] 5-Jan-16 12:27pm    
Thank you very much sir for your very kind help and a very small doubt:

I see pop-up of some software like "cleaning can save disk space","Databases are out of date" so to my knowledge portable executable is to be executed by the user.Does the portable executable(which requires no installation) gives real time monitoring like this?I mean it runs on the background?

Once again Thank you for your help sir
Sergey Alexandrovich Kryukov 5-Jan-16 13:29pm    
You are very welcome.

Generally, having the choice "installed" vs "portable" applications makes no difference. There is no any difference in "executed by the user". Normally, all applications are "executed by the users", except some services which has to be hosted by the service controller (services are always installed, in different sense of this word, even when installation is done manually; they are registered in the system Registry; let's set them aside).

I already explained the reasons why some applications should be installed. Typically, this is related to having changes in system Registry; which are important to be undone by uninstallation. As to "real-time monitoring", it depends on what it is. It's possible that you need installation just for registering some storage for monitoring, or something like that. If you want to monitor something, we can discuss it, but it may take a separate question (if you want me to participate, comment on this comment and provide a link to the page of your new question, it will give me the notification). Likewise, the issue of background vs foreground (threads) is a separate one, totally unrelated to your original question. If you think it is related, please clarify.

—SA
Quote:
Doubt 1:
Is there any way to store a data inside an executable on run time.
For example in C If I create a simple database which asks an employee to enter his details and can see his profile whenever he wants.

No. Executables are locked while they are running. There is no way to write to the file while the code is running.

Also, the problem of writing data to the .EXE is hideously complex.

Quote:
what I have did?
To my knowledge(at present) I would create a file for every employee and whenever he types his Id it can open the specific file and show the details using file handling.But how can I store the employee details within the executable.

This makes no sense at all. I have no idea what the "types his ID it can open the specific file..." means. Types an ID where? In the application that is in this .EXE you're customizing?

Quote:
Doubt 3:

How to make my program certified?

For example when I manifest my program it prompts the user for administrator permission.In that I found "publisher: unknown" How can I give my name ?

Certified by who and for what purpose? The application apparently requires admin privileges to run, but what did you do to make that happen? Did you create a manifest in the project? Did you do something in the code, like try to write something to the HKEY_LOCAL_MACHINE registry? What does this app do?

Signing your code so that the publisher field is filled in does not mean that it won't ask for admin permissions.
 
Share this answer
 
Comments
[no name] 5-Jan-16 10:52am    
Doubt 1:
Using file handling function in C/C++ I would create a file when an new employee added.Employee Id is the name of the file.If one wishes to open his information he can type his employee id so my program would display His/Her information.This is also achieved by file handling in read mode.

Question for doubt 1:

Sir, Then how does an antivirus program updates daily and shows an increased amount of signatures. For example: JRT (Junkware Removal Tool) Has only a single executable file.When one runs it updates.How is it possible. Could you please explain me?

Thank you sir for helping me.
Dave Kreskowiak 5-Jan-16 10:58am    
This should be done in a database, not by tons of individual .EXE files!

Virus scanners do NOT modify their own .EXE's with virus definitions. Their definitions are stored in data files or some database somewhere.
[no name] 5-Jan-16 11:02am    
Thank you sir for your kind help my problem has finally solved. And my 5!
1. No, bad idea, use a database, one single file that holds all the information in a form that is easy to search, sort, update etc.

2. List of installation software - Wikipedia, the free encyclopedia[^].

3. Digitally Signed Software[^].
 
Share this answer
 
Comments
[no name] 5-Jan-16 11:03am    
Thank you sir for your kind help my problem has finally solved. And my 5!
Doubt 1:
There are ways to do so but it makes no sense. Executables are usually stored in the program folder where normal users have no write permission and can't therefore change the executable. Instead use per user files that are stored somewhere in the user's directory.

Doubt 2:
Just use some kind of Windows installer. These will handle installation and removal. There are free and commercial versions available. Examples are Inno Setup, InstallAware, InstallShield.

Doubt 3:
Add the corresponding resources to your project (e.g. in Visual Studio). These will be shown when right clicking on the exe file and choosing properties. The publisher and update URL's are set during program installation. Again, the common installer utilities provide options to specify these.
 
Share this answer
 
Comments
[no name] 5-Jan-16 11:08am    
Thank you sir for your kind help my problem has finally solved.

Someone has down-voted your solution but I feel This is also an good explanation.My 5! Thank you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900