How to Fix Windows Visual C++ Runtime Errors

本文介绍了如何解决Windows Vista中出现的explorer.exe问题,通过调整Windows Search服务设置、禁用可能引起冲突的壳扩展以及修复或重新安装Visual C++运行时库等方法,帮助用户定位并解决此类错误。

Shared libraries in Windows make programming much more efficient for the programmer who does not need to reinvent the wheel every time he needs to perform a common task. They also make it easier to plug security holes in shared code when they are found since it needs to be patched in fewer places and does not require that every application be recompiled.

Despite these positive aspects, they can pose their own problems when attempting to troubleshoot the root cause of error messages they may generate.

Our Reader’s Question:

How to do I fix a Windows Vista 32-bit C:\Windows\explorer.exe problem on a Dell Inspiron 530?

After clicking the OK button in the dialog shown in the screenshot, the screen will blacken out and return to normal running, but it will not allow me to access the C, D, and, at times, the E drive when trying to access them from My Computer.

Running sfc /scannow doesn’t find any errors. I downloaded updates from both the Dell and Microsoft websites trying to fix this problem. I have also installed the Microsoft Visual C++ 2010 Redistributable Package (x86). The PC is completely up-to-date according to Windows Update.

runtime-error

Bruce’s Reply:

Note: Discussions about Windows Explorer in Windows 7 and earlier versions also apply to File Explorer in Windows 8 and later versions. If there is a notable difference between them, it will be explicitly stated.

The Windows Shell

Windows Explorer is the shell and runs as the explorer.exe process as seen in Task Manager or Sysinternals’ Process Explorer. Like many other Windows programs, all of the functionality provided by the shell is not incorporated into that single executable file. There are dozens of other EXE and DLL files used to implement property sheets, property handlers, preview handlers, context menus, and many other elements you use in Windows Explorer every day.Process Explorer - The Most Powerful Task Manager Replacement [Windows] Process Explorer - The Most Powerful Task Manager Replacement [Windows]Let’s be honest, the Windows Task Manager isn’t that great for understanding and managing the processes running on your computer. Even on Windows 8, where it’s much-improved, the task manager can’t come close to the...READ MORE

Extensible Shell

Shell extensions allow programmers to easily add functionality to Windows Explorer by writing a DLL to perform the task and registering the DLL with the operating system, so Explorer knows where to find the code to accomplish the task. For example, 7-Zip adds a sub-menu to the standard context menu, giving quick access to archive handling tasks, Hard Disk Sentinel adds icon overlays to the standard drive icons, so you can see drive health status at a glance, and HashTab adds a new property sheet, to calculate and display hashes of the selected file.

context-menu

Many of these shell extensions are implemented as in-process Component Object Model (COM) servers. This means that when a process, in this case Windows Explorer, uses the extension, it will not appear in Task Manager or Process Explorer as a separate running process with its own process identifier (PID). Instead, it is executing inside the calling explorer.exe process.

Default Single-Instance Process

Windows Explorer is written to be capable of running as two separate processes, but — in its default configuration — it will only run a single instance. When it is first executed as part of the startup process, it creates the Windows desktop environment. Executing it again creates a new thread in the existing process, which displays the familiar file management window, instead of starting a new process.

This behavior allows a reduced memory footprint, but can also bring its own little twist when troubleshooting problems. A critical error or unhandled exception in code being executed in the explorer.exe process, including in-process servers provided by DLLs, will cause the entire desktop environment to go down with it.

In most cases, the desktop process will be automatically restarted. If it does not restart, you should still be able to use Ctrl-Shift-Esc to bring up the Task Manager. From there, go to File > New Task (Run…) > type explorer.exe > OK to restart the process.

This can be avoided with a simple change. Open Windows Explorer > Organize > Folder and search options in Vista/7. For Windows 8 and later, open File Explorer > View > Options > Change folder and search options. Select the View tab and check Launch folder windows in a separate process.

folder-options

Changing this setting isolates your desktop process from all of the other Windows Explorer windows you have open. If any of those Explorer windows crashes, your desktop will remain unscathed.

Microsoft Visual C++ Runtime Library (CRT)

The Microsoft Visual C++ Runtime Library provides routines for programming Windows that automate many tasks, such as input/output, file manipulation, memory allocation, system calls, and many others.

Every Windows installation will have at least two different versions of the CRT installed. A freshly built Vista SP2 through Windows 10 machine will have both version 8.0 and 9.0 (VC 2005 and VC 2008, respectively) present. When additional software is installed, it may also include more recent versions of the runtimes, depending on which version of Visual C++ was used to create the program or any of its components.

Runtime Errors

When an error or exception is encountered in a piece of code, ideally it will be handled as soon as possible in the currently executing procedure, and either be corrected or allow for a graceful failure. If the error is not handled locally, it gets passed up to the code that called the currently executing code, and the process continues until the exception is handled. If it completes its run to the top of the chain and it still is not handled, it will generate a runtime error as seen above.

When the user clicks on the OK button, the process will be terminated. If the program has a defined failure behavior, such as critical services, or its run state is monitored by another process, it may be automatically respawned. This is what is happening in this instance. The screen blacks out when the explorer.exe process is terminated, then the desktop comes back when the explorer.exe process is restarted.

Although the error message above clearly indicates it came from the explorer.exe process, it is not likely to be a problem with explorer.exe itself. It is much more likely the culprit lies elsewhere, such as a third-party extension that is being used by Explorer.

Other Considerations

With our reader’s description of the issue above, there are a couple of additional items we need to take into account:

  • At the time of the crash, Explorer was trying, but unable, to populate the listview.
  • The inability to access drives after the desktop has respawned, may indicate another process has one or more of those devices locked, thereby preventing access from the newly created explorer.exe process.
  • Running sfc /scannow and getting a clean bill of health, drops Windows protected resources to the bottom of the list for consideration. Other causes are far more likely.

The Fixes Are In

In this particular case, there are three areas where I would look for a solution. The first involves the Windows Search service, the second involves investigating shell extensions, and the last would be the VC++ redistributables themselves.

Windows Search

Because the original screenshot shows the crash happening when Explorer is attempting to populate the listview, it is possible that the Windows Search service is blocking access to the required resources. I have seen this happen when the service crashes and does not have the correct restart parameters.

Press Win+R > type services.msc > OK to start the management console with the services module. Scroll down to Windows Search and double-click on the entry to open the Properties dialog. Ensure the settings on the Recovery tab match the image below.

windows-search-properties

The most common problem is the “Restart service after:” setting. This error frequently occurs when this setting is non-zero.

Problematic Shell Extensions

Download Nirsoft’s ShellExView for your system architecture (x86 or x64), install and run it. It will take a bit of time to examine the system and fill the table with data. Scroll across to the CLSID Modified Time column and click on the header to sort on this field. If you wish to exclude the modules provided by Microsoft, you can go to Options > Hide All Microsoft Extensions. For those using a 64-bit version of Windows, you may also want to show the 32-bit extensions on the system by going to Options > Show 32-bit Shell Extensions.

Look for extensions that were added just before the symptoms began. Select one or more and press F7 or go to File > Disable Selected Items, or click on the red LED icon in the toolbar. Ideally, this should be done one at a time.

Test to see if the symptoms persist. If they do, you can re-enable the previously disabled extension(s) by using F8File > Enable Selected Items, or the green LED toolbar icon. From here, disable a different extension and repeat the testing process until you find the one causing the problem.

Repair/Reinstall VC++ Redistributables

I use this one as a last resort, if only one program is kicking out errors. If you have multiple programs that are having problems with VC++ runtime errors, you may want to try this first.

When looking at the installed programs on my system (Control Panel > Programs and Features), it shows every version of the redistributable packages (and some of their updates) ranging from version 8 through version 12 (VC++ 2005 through VC++ 2013). I have them installed because of the Microsoft programming tools I use. Most users will not have all of these.

installed-vcpp-redist

You can find the latest downloads for supported versions of Visual C++ from Microsoft. For our purposes here, you only need to be concerned with those that are labeled as “redistributable” packages. Links that are classified as service packs are for the programming tools, not simply the runtimes. You will only need the ones that are currently listed in the installed programs on your system. Installing other versions will not help out in this case. Users of 64-bit operating systems may need both the x86 and x64 versions of the CRT.

Windows Update checks to see if your computer has the latest updates for these packages installed, but it does not check to ensure that it is properly installed and has not been broken. The installers can check to ensure that all of the runtime files are the proper ones and all registry entries are correct.

Once you have downloaded the appropriate installers, run them on the system. The 2005 versions will prompt you to accept a license agreement before reinstalling the package. All of the others have a GUI that will ask you if you want to repair or uninstall the existing installation. In most cases, a repair operation will fix any issues.

If you want to try the most extreme method, you can uninstall the runtimes, reboot the machine, then reinstall them. I do not recommend this method with the 2005 and 2008 runtimes. Without them, Windows will generate a lot of errors and a great deal of functionality will not be there for you when you reboot.

Conclusion

With a little bit of observation, a touch of trial and error, and some understanding of how errors are generated from runtimes on the system, software issues can be found and resolved without resorting to complicated debugging tools and logs.

Have you run into runtime errors on your system? What was required to solve them? Let me know in the comments below.


转载:http://www.makeuseof.com/tag/fix-windows-visual-c-runtime-errors/

1. What is an IDE (Integrated Development Environment), and what are its main components? 2. What is the role of a compiler in the C++ development process? 3. What is the difference between source code (e.g., a .cpp file) and an executable file? 4. In the "Hello, World!" program, what is the purpose of the line #include <iostream>? 5. What is special about the main() function in a C++ program? 6. Why do computers fundamentally operate using the binary (base-2) system? 7. What is the base of the hexadecimal system? Why is it often used by programmers as a shorthand for binary numbers? 8. Explain the "triad" method for converting an octal number to binary. 9. Briefly describe the "division by 2" method for converting a decimal number to binary. 10. What is the decimal value of the binary number 1011? 1. What is the purpose of the std::cout object? Which header file must be included to use it? 2.What is the difference between an escape sequence like \n and a manipulator like std::endl? (Hint: Both create a new line, but they have a subtle difference). 3.How would you print the following text to the console, including the quotes and the backslash: He said: "The file is in C:\Users\"? 4.Is it possible to write an entire multi-line text output using only one std::cout statement? If yes, how? 5.What is a syntax error? Give an example of a syntax error from Task 2. (Task 2: Debugging The following program contains several syntax errors. Copy the code into your IDE, identify the errors, fix them, and run the program to ensure it works correctly. Incorrect Code: */ Now you should not forget your glasses // #include <stream> int main { cout << "If this text" , cout >> " appears on your display, cout << " endl;" cout << 'you can pat yourself on ' << " the back!" << endl. return 0; "; ) Hint: Pay close attention to comments, header files, brackets ({}), operators (<<), semicolons, and how strings and manipulators are written.) 1. What is the difference between variable declaration and initialization? 2.What will be the result of the expression 7 / 2 in C++? Why? 3.What will be the result of the expression 10 % 3? What is the main purpose of the modulus operator? 4. What is the purpose of std::cin and the >> operator? 5. A beginner tries to swap two integer variables a and b with the code a = b; b = a;. Why will this not work correctly? 1. What is an algorithm? Name the primary ways to represent an algorithm. 2.List the main flowchart symbols and explain their purpose. 3.What are the three fundamental types of algorithm structures? Briefly describe each. 4.In a branching algorithm, what determines the flow of execution? 5.What is the key characteristic of a linear algorithm? 6.When is a cyclic algorithm structure used?7. 8. 9. 7.Explain the purpose of a connector in a flowchart. 8.What is the difference between a predefined process block and a standard process block? 9.In the context of solving a quadratic equation algorithm, what condition must be checked before calculating the roots? Why? 1. What are the three main approaches to data input and output offered by C++? 2. What is the purpose of the SetConsoleOutputCP(65001) and SetConsoleCP(65001)
functions in the provided C++ program example? 3. Explain the difference between the cin and cout objects in Stream 1/0. 4. When using formatted 1/0, which header file must be included to use manipulators like setw and setprecision? 5. List three manipulators used for data output in C++ and briefly describe what each one does. 6. In Formatted I/0 using printf), what are the conversion specifications for a decimal integer and a real number in exponential form? 7. What is the difference in how the & (address-of) operator is used when inputting a value for an integer variable versus a string variable using the scanf() function? 8. Which Character I/O function is used to output a single character to the screen, and which is used to output a string? 9. Describe the syntax and function of the ternary operator in C++. 10. What is the difference between the logical AND (&&) and logical OR (I|) operators when combining multiple conditions? 11. When is the default label executed in a C++ switch statement? 12. What is the primary purpose of the break statement within a switch block? 1. What is the main purpose of using loops in programming? 2. Explain the key difference between the for, while, and do while loops. 3. What happens if you forget to include the increment/decrement statement in a while loop? 4. How can you interrupt an infinite loop during program execution? 5. What is the role of the setw() and setfill) manipulators in C++? 6. In a nested loop, how does the inner loop behave relative to the outer loop? 7. What is type casting, and why is it used in loop calculations? 8. How does the do while loop differ from the while loop in terms of condition checking? 9. What output formatting options can be used to align numerical results in columns? 10*. How would you modify a loop to skip certain iterations based on a condition? 1. List the six main biwise operators in C++ and explain the function of each. 2. Why cannot bitwise operations be applied to variables of floating-point type? 3. Explain the purpose of the << (left shift) and >> (right shift) operators. What is the typical effect on the decimal value of a number when it is shifted left by 1? Shifted right by 1? 4. Describe the process of using a mask to check the value of a specific bit within an
integer. 5. How can you use the bitwise AND operator (&) to check if a number is even or odd?
Explain the logic. 6. What is the difference between the logical AND (&&) and the bitwise AND (&)? Provide an example scenario for each. 7. Explain the purpose of the ~ (bitwise NOT) operator. What is the result of applying it to a mask, and how can this be useful? 1. What is the primary goal of program debugging? What types of errors can it help identify? 2. Describe the difference between Step Over (F10) and Step Into (F11) debugging commands. When would you choose one over the other? 3. What is the purpose of a breakpoint in planned debugging? How do you set and remove a breakpoint in Visual Studio? 4. Explain the utility of the "Watch" window compared to the "Autos" or "Locals" windows during a debugging session. 5. What is the key difference between the Debug and Release configurations when building a project? Why is it necessary to create a Release version after successful debugging? 6. List at least three types of files commonly found in a project's Debug folder and briefly state their purpose (e.g., *.pdb). 7. During debugging, you notice a variable has an incorrect value. How can you change its value during runtime to test a hypothesis without modifying the source code? 8. What command is used to exit the debug mode and stop the current debugging session? 1. What is an array in C++? List its three main characteristics. 2. How are array elements numbered in C++? What is the valid index range for an array declared as int data[25];? 3. Explain the difference between array declaration and initialization. Provide an example of each. 4. What is an initializer list? What happens if the initializer list is shorter than the array size? 5. How can you let the compiler automatically determine the size of an array during initialization? 6. What values do elements of a local array contain if it is declared but not explicitly initialized? How does this differ from a global array? 7. What is an array out-of-bounds error? Why is it dangerous, and what are its potential consequences? 8. How do you calculate the number of elements in an array using the sizeof operator?
Provide the formula. What is a significant limitation of this method? 9. Why is it impossible to copy the contents of one array into another using the assignment
operator (arrayB = arrayA;)? What is the correct way to perform this operation? 10. Why does comparing two arrays using the equality operator (arrayA == arrayB) not check if their elements are equal? How should array comparison be done correctly? 11. What does the name of an array represent in terms of memory? 1. What is a pointer in C++ and what are its two main attributes? 2. Explain the difference between the & and * operators when working with pointers. 3. Why is pointer initialization critical and what dangers do uninitialized pointers pose? 4. What is the fundamental relationship between arrays and pointers in C++? 5. How does pointer arithmetic work and why does ptr + 1 advance by the size of the pointed type rather than 1 byte? 6. What is the difference between an array name and a pointer variable? Why can't you increment an array name? 7. What are the differences between const int*, int* const, and const int* const? 8. How can you safely iterate through an array using pointers, and what are the boundary risks? 9. What is a null pointer and why should you check for nullptr before dereferencing? 10. How do you access array elements using pointer syntax, and how does the compiler translate arr[i] internally? 1. What is a multidimensional array? How is a two-dimensional array structured in memory? 2. Explain the concept of an "array of arrays". How does this relate to the declaration int arr/ROWS//COLS;? 3. The name of a two-dimensional array without indices is a pointer constant. What does this pointer point to? What do the expressions *(A + i) and *(*(A + i) +j) mean for a two-dimensional array A? 4. Describe the different ways to access the element A/1/[2/ of a two-dimensional array
using pointers. 5. What is the rule for omitting the size of dimensions when initializing and when passing a multidimensional array to a function? Why is it allowed to omit only the first dimension? 6. Explain the principle of "row-major order" for storing two-dimensional arrays in memory.How does this affect element access? 7. Why are nested loops the standard tool for processing multidimensional arrays?
Describe the typical pattern for iterating through a matrix. 1. How is a character string stored in memory in C++? What is the role of the null terminator (10), and why is it critical for C-style strings? 2. Why must the size of a char array declared to hold a string be at least one greater than the number of characters you intend to store? 3. The array name without an index is a pointer constant. What does the name of a char array point to? 4. What are the two main ways to initialize a C-style string? What is a common mistake when using the initializer list method, and what is its consequence? 5. Why is it necessary to add _CRT_SECURE_NO_WARNINGS to the preprocessor definitions in Visual Studio when working with many standard C library functions?
What is the alternative approach? 6. What is the key difference between stropy and strncpy? Why might strncpy be considered safer? 7. How does the stremp function determine if one string is "less than" another? Why can't you use the == operator to compare two C-style strings for content equality? 8. Describe the purpose and parameters of the strok function. How do you get all tokens from a string? 9. What do the functions strchr and strrchr do? How do they differ? 10. Explain what the strstr function returns and what it is commonly used for. 11. What is the purpose of the functions in the < cctype> header? Give three examples of such functions and their use. 12. What is the difference between tolower(c) and_tolower(c)? When should you use each? 1. What is a function in C++? Name the three core benefits of using functions in a program. 2. What is the difference between a function declaration (prototype) and a function definition? Provide examples. 3. What is a function signature? Which elements are part of the signature, and which are not? 4. What methods of passing parameters to a function do you know? Explain the difference between pass-by-value, pass-by-pointer, and pass-by-reference. 5. Why can't you pass an array to a function by value? What is the correct way to pass an array to a function? 6. What is variable scope? How is it related to functions? 7. How does a function return a value? What happens if a function with a non-void return type does not return a value on all control paths? 8. Can you use multiple return statements in a single function? Provide an example. 9. What is function overloading? What is it based on? 10. How is interaction between functions organized in a program? Provide an example program with several functions. 11. What are default parameters? How are they specified, and in what cases are they useful? 12. How can you prevent a function from modifying the data passed to it? What modifiers are used for this? 13. What is recursion? Provide an example of a recursive function. 14. What common errors occur when working with functions? How can they be avoided? 15. How do you use pointers to functions? Provide an example of declaring and calling a function through a pointer. 用中文解答
最新发布
11-28
wampserver安装缺失vcruntime140.dll, --- Visual C++ Packages --- The MSVC runtime libraries VC9, VC10, VC11 are required for Wampserver 2.4, 2.5 and 3.0, even if you use only Apache and PHP versions with VC11. Runtimes VC13, VC14 is required for PHP 7 and Apache 2.4.17 or more -- VC9 Packages (Visual C++ 2008 SP1) http://www.microsoft.com/en-us/download/details.aspx?id=5582 http://www.microsoft.com/en-us/download/details.aspx?id=2092 -- VC10 Packages (Visual C++ 2010 SP1) http://www.microsoft.com/en-us/download/details.aspx?id=8328 http://www.microsoft.com/en-us/download/details.aspx?id=13523 -- VC11 Packages (Visual C++ 2012 Update 4) The two files VSU4\vcredist_x86.exe and VSU4\vcredist_x64.exe to be download are on the same page: http://www.microsoft.com/en-us/download/details.aspx?id=30679 -- VC13 Packages] (Visual C++ 2013) The two files VSU4\vcredist_x86.exe and VSU4\vcredist_x64.exe to be download are on the same page: https://www.microsoft.com/en-us/download/details.aspx?id=40784 -- VC14 Packages (Visual C++ 2015 Update 3) The two files vcredist_x86.exe and vcredist_x64.exe to be download are on the same page: http://www.microsoft.com/fr-fr/download/details.aspx?id=53840 - VC15 Redistribuable (Visual C++ 2017) https://go.microsoft.com/fwlink/?LinkId=746571 Visual C++ Redistributable Packages for Visual Studio 2017 x86 https://go.microsoft.com/fwlink/?LinkId=746572 Visual C++ Redistributable Packages for Visual Studio 2017 x64 VC2017 (VC15) is backward compatible to VC2015 (VC14). That means, a VC14 module can be used inside a VC15 binary. Because this compatibility the version number of the Redistributable is 14.1x.xx and after you install the Redistributable VC2017, VC2015 is removed but you can still use VC14. If you have a 64-bit Windows, you must install both 32 and 64bit versions of each VisualC++ package, even if you do not use Wampserver 64 bit. Warning: Sometimes Microsoft may update the VC ++ package by breaking the download links and without redirect to the new. If the case happens to you, remember that item number 20 below will be updated and the page http://wampserver.aviatechno.net/ section Visual C++ Redistribuable Packages is up to date. This is item number 20 of TROUBLESHOOTING TIPS of Wampserver: http://forum.wampserver.com/read.php?2,134915
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值