. Net 4.0 new feature: mscoree. dll + mscoreei. dll = fewer reboot (on)

Source: Internet
Author: User

OnceReboot = 975.Year

Before starting this article, I will make a small investigation: How many friends like reboot? Answer A: I like it. I need to reboot n times every day. Answer B: I don't like it. Do not reboot for a week. If there is no accident, I believe most people will be in B's category. After all, few people will be willing to interrupt what they do and save the articles and codes being edited, then restart and wait for a few minutes before re-opening the document and code editing.

However, it is a pity that the new version. net installation in Vista and above (later expressed in Vista +) operating systems usually requires a restart, 2003, XP or below is not required. Some friends may wonder: why does XP not need to be restarted, but Vista needs to be restarted? Isn't it worse? To solve this problem, you must start with mscoree. dll. Mostly used. NET Programming friends may not be familiar with mscoree. DLL, but, in fact, mscoree. dll can be said to be. net/CLR is one of the most core components. Without mscoree, CLR cannot be loaded at all. When you execute an. Net EXE, the first load is not the clr dll (mscorwks. dll), but the mscoree. dll. For more information, see an article I wrote earlier: . NetBehind-the-scenes hero in:Mscoree. dll

Mscoree. dll is a core component of. net. It is conceivable that mscoree. dll will be updated every time a new version of. NET is installed to add new functions or bug fixes. The main problem during the update is: If mscoree. dll is being used, how to update mscoree. dll? Before Vista, that is, 2003, XP, or even the previous operating system, the installer (Admin can also) can be directly renamed mscoree. DLL (this operation even if mscoree. DLL is in use or can be used successfully), and then copy the new mscoree. DLL to the system directory. However, in Windows Vista +, mscoree. dll is considered to be one of the core components of windows and is protected by wrp (Windows resource protection. If you want to update, you must update it through a mechanism called CBS (component based servicing) (Note: I am not familiar with these installation-related technologies, if any error occurs in the detailed description, correct it ). Although this mechanism is more secure and robust, it also has one more restriction: If mscoree. dll is in use, the system must restart to complete mscoree. dll update. In other words, in Windows Vista +, install 3.5, 4.0, 5.0 ,... . Net has to be restarted every time. For example, if 0.1 billion million users have installed net 4.0 and need to be restarted, it may take 5 minutes to restart the system (including preparation for disk storage ), this restart will waste everyone 500000000 minutes = 975 !!! If the installation of each. Net version is the same, the total waste of time can be said to be astronomical! This may be a bit alarmist, but in any case, one thing is clear: for the image.. Net, a widely used program platform (note that I am talking about it. net, neither SDK nor ,. net is a runtime, virtual machine, used by the program running by the end user), any small detail may have a huge impact. Although the. Net user base has not reached this scale, we do not want to influence the. NET penetration rate because of this problem.

. Net 4.0Solution

Our goal is to reduce the number of restarts. The restart mentioned here is a restart caused by mscoree. dll modification. To solve this problem, we can start with the essence of DLL. DLL is a code sharing mechanism in windows. This sharing is achieved through DLL output functions, and other EXE/DLL calls the functions output by DLL directly. In other words, the most important thing for a DLL to be external is its output function, including its interfaces and functions. Each DLL modification is nothing more than interface changes and functional changes. Because of the compatibility requirements, the changes of interfaces are generally not reduced or modified, but increased. In terms of functionality, the change is usually not too big, and it is generally a bug fix. Likewise, it is also because of compatibility requirements. Of course, except for new functions of the new interface. Is there a way to freely modify the functions and interfaces of mscoree. DLL without modifying the content of mscoree. dll? It seems impossible to complete the task, but if we think about it carefully, it is hard to realize that if we put mscoree. the DLL code is located again in another DLL. This dll is not restricted by windows and can be freely modified. Is the problem solved? The answer is yes. This is the origin of mscoreei. dll. Of course, the details are much more complicated than discussed here. I will talk about it this time. Welcome to discuss how mscoree and mscoreei work together. Because this project is not completely completed yet, I cannot disclose all details for the moment. At the right time, I will release the sequel to this article and announce the answer for everyone.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.