
目前程式中偶爾會彈出R6034錯誤,網上搜索都說是匯出manifest檔案的問題,如果是這個原因,這個錯誤應該是必現的,但是目前這個問題偶現,有點奇怪。在彈出錯誤的時候,抓了一個dmp檔案,發現加載了一個當前目錄下的msvcr90.dll,這肯定是不合理的,因為行程已經加載了WinSXS下的CRT庫,而且就算要加載當前目錄下的CRT,對于VC2008來說,CRT庫一定要有配套的manifest檔案才可以。難道彈出R6034就是因為加載了這個錯誤的msvcr90.dll?可是為什么會加載這個不正確的msvcr90.dll?
uj5u.com熱心網友回復:
C Run-Time Libraries https://msdn.microsoft.com/en-us/library/abx4dbyh.aspx學會使用depends.exe查看exe依賴的dll
uj5u.com熱心網友回復:
查看過了,我的行程是MT選項編譯的,使用了一個MD編譯的CxImage庫,depends.exe查看是依賴于WinSXS下的CRT,這肯定是正確的,這個行程不可能加載同級目錄下的CRT,很奇怪,不知道為什么加載了。觀察了以下,正常情況下只加載WinSXS下的CRT,也不會出錯,不明白什么場景下竟然加載同級目錄下的msvcr90.dll,然后就出錯了,直接掛在crtmain,這肯定是和環境有關系的
uj5u.com熱心網友回復:
Dynamic-Link Library Search OrderA system can contain multiple versions of the same dynamic-link library (DLL). Applications can control the location from which a DLL is loaded by specifying a full path, using DLL redirection, or by using a manifest. If none of these methods are used, the system searches for the DLL at load time as described in this topic.
Standard Search Order
The dynamic-link library (DLL) search order used by the system depends on whether safe DLL search mode is enabled or disabled.
Windows Vista, Windows Server 2003, and Windows XP SP2: Safe DLL search mode is enabled by default. To disable this feature, create the HKLM\System\CurrentControlSet\Control\Session Manager\SafeDllSearchMode registry value and set it to 0. Calling the SetDllDirectory function effectively disables SafeDllSearchMode while the specified directory is in the search path and changes the search order as described in this topic.
Windows XP and Windows 2000 SP4: Safe DLL search mode is disabled by default. To enable this feature, create the SafeDllSearchMode registry value and set it to 1.
If SafeDllSearchMode is enabled, the search order is as follows:
The directory from which the application loaded.
The system directory. Use the GetSystemDirectory function to get the path of this directory.
The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched.
The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
The current directory.
The directories that are listed in the PATH environment variable. Note that this does not include the per-application path specified by the App Paths registry key.
If SafeDllSearchMode is disabled, the search order is as follows:
The directory from which the application loaded.
The current directory.
The system directory. Use the GetSystemDirectory function to get the path of this directory.
The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched.
The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
The directories that are listed in the PATH environment variable. Note that this does not include the per-application path specified by the App Paths registry key.
Note that versions of Windows prior to the ones listed at the beginning of this section do not support SafeDllSearchMode. For more information, see Legacy Search Order below.
Alternate Search Order
The standard search order used by the system can be changed by calling the LoadLibraryEx function with LOAD_WITH_ALTERED_SEARCH_PATH. The standard search order can also be changed by calling the SetDllDirectory function.
Windows XP/2000 and Windows 2000 Server: Changing the standard search order by calling SetDllDirectory is not supported until Windows XP SP1 and Windows Server 2003.
If you specify an alternate search strategy, its behavior continues until all associated executable modules have been located. After the system starts processing DLL initialization routines, the system reverts to the standard search strategy.
The LoadLibraryEx function supports an alternate search order if the call specifies LOAD_WITH_ALTERED_SEARCH_PATH and the lpFileName parameter specifies an absolute path.
Note that the standard search strategy and the alternate search strategy specified by LoadLibraryEx with LOAD_WITH_ALTERED_SEARCH_PATH differ in just one way: The standard search begins in the calling application's directory, and the alternate search begins in the directory of the executable module that LoadLibraryEx is loading.
If SafeDllSearchMode is enabled, the alternate search order is as follows:
The directory specified by lpFileName.
The system directory. Use the GetSystemDirectory function to get the path of this directory.
The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched.
The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
The current directory.
The directories that are listed in the PATH environment variable. Note that this does not include the per-application path specified by the App Paths registry key.
If SafeDllSearchMode is disabled, the alternate search order is as follows:
The directory specified by lpFileName.
The current directory.
The system directory. Use the GetSystemDirectory function to get the path of this directory.
The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched.
The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
The directories that are listed in the PATH environment variable. Note that this does not include the per-application path specified by the App Paths registry key.
The SetDllDirectory function supports an alternate search order if the lpPathName parameter specifies a path. The alternate search order is as follows:
The directory from which the application loaded.
The directory specified by lpPathName.
The system directory. Use the GetSystemDirectory function to get the path of this directory. The name of this directory is System32.
The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched. The name of this directory is System.
The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
The directories that are listed in the PATH environment variable.
If the lpPathName parameter is an empty string, the call removes the current directory from the search order.
SetDllDirectory effectively disables safe DLL search mode while the specified directory is in the search path. To restore safe DLL search mode based on the SafeDllSearchMode registry value and restore the current directory to the search order, call SetDllDirectory with lpPathName as NULL.
Legacy Search Order
Versions of Windows earlier than the ones listed under Standard Search Order do not support the SafeDllSearchMode value. The DLL search order is as follows:
The directory from which the application loaded.
The current directory.
The system directory. Use the GetSystemDirectory function to get the path of this directory.
The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched.
The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
The directories that are listed in the PATH environment variable. Note that this does not include the per-application path specified by the App Paths registry key.
See Also
Dynamic-Link Library Redirection
LoadLibrary
LoadLibraryEx
SetDllDirectory
Side-by-side Components
Send comments about this topic to Microsoft
Build date: 8/15/2007
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/102712.html
標籤:Windows客戶端使用
上一篇:服務器{...}沒有在限定的時間內用DCOM注冊, 請問這類報錯怎樣解決?
下一篇:WDK10 安裝問題
