Authenticating a Windows application without using a separate program

I am looking for ways to enable automatic updates for my Windows application. The update process should be such that only modified files are downloaded and replaced. So, I planned to integrate it with my application. Given the fact that renaming / moving an executable executable file (or its folder) is possible, is it good to use the application for self-service ?. Is renaming / moving an executable executable dangerous ?. What are the advantages of using a separate update program using the application itself to update it?

Thanks!.

+4
source share
2 answers

I think that the main drawback that allows you to update the application yourself is that it is becoming increasingly difficult for him to make sure that all actions are stopped, for example, that all asynchronous I / O operations are completed, all user interface elements are closed and all data is reddened to disk. Typically, with a separate update, the application process ends before the update starts, so you can be sure that nothing is happening, which will interfere (or interfere) with the update process.

If you are just trying to avoid creating a separate assembly, you can create the application in such a way that after downloading the new content, it makes a copy of itself (or, if the update component itself has been updated, it extracts a new version) in a temporary place and launches this copy in update mode . An application that solves during startup, whether it is an update instance or a regular instance, is easy to design and does not have the problem mentioned above.

+1
source

The Windows operating system will not allow you to overwrite a running application. For this you need another application. One of the processes that I have is that I have download files for the downloadable application, but if they are used, they are given the .update extension.

Then my application at startup searches for any files with this extension in the folder and subfolders. If he finds one, he will launch the patcher application and terminate himself. Patcher waits for the program files to become free, and then moves the .update files over the application files and restarts the application.

It takes an extra second to start when there are updates, but the user does not notice.

In addition: The advantage of a separate updater is its modularity and cleanliness. You can reuse the software for updating, and its code is probably not the foundation of what your application does. Plus, if you don't make it multithreaded, it will affect the interactivity of your application while it is running.

I have seen many programmers take a monolithic approach to deployment (with static assemblies), but modularity still has important advantages if you ask me.

0
source

Source: https://habr.com/ru/post/1398471/


All Articles