• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            woaidongmao

            文章均收錄自他人博客,但不喜標題前加-[轉貼],因其丑陋,見諒!~
            隨筆 - 1469, 文章 - 0, 評論 - 661, 引用 - 0
            數據加載中……

            Dynamic-Link Library Search Order

             

            http://msdn.microsoft.com/en-us/library/ms682586(v=vs.85).aspx

             

             

            A 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.

            If a DLL with dependencies is loaded by specifying a full path, the system searches for the DLL's dependent DLLs as if they were loaded with just their module names.

            If a DLL with the same module name is already loaded in memory, the system checks only for redirection and a manifest before resolving to the loaded DLL, no matter which directory it is in. The system does not search for the DLL.

            If the DLL is on the list of known DLLs for the version of Windows on which the application is running, the system uses its copy of the known DLL (and the known DLL's dependent DLLs, if any) instead of searching for the DLL. For a list of known DLLs, see the following registry key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\KnownDLLs.

            Standard Search Order

            The DLL search order used by the system depends on whether safe DLL search mode is enabled or disabled.

            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 with SP4:  Safe DLL search mode is disabled by default. To enable this feature, create the SafeDllSearchMode registry value and set it to 1. Safe DLL search mode is enabled by default starting with Windows XP with Service Pack 2 (SP2).

            Windows 2000:  The SafeDllSearchMode value is not supported. The DLL search order is identical to the search order that occurs when safe DLL search mode is disabled. The SafeDllSearchMode value is supported starting with Windows 2000 with SP4.

            If SafeDllSearchMode is enabled, the search order is as follows:

            1. The directory from which the application loaded.
            2. The system directory. Use the GetSystemDirectory function to get the path of this directory.
            3. The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched.
            4. The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
            5. The current directory.
            6. 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 App Paths key is not used when computing the DLL search path.

            If SafeDllSearchMode is disabled, the search order is as follows:

            1. The directory from which the application loaded.
            2. The current directory.
            3. The system directory. Use the GetSystemDirectory function to get the path of this directory.
            4. The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched.
            5. The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
            6. 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 App Paths key is not used when computing the DLL search path.
            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:  Changing the standard search order by calling SetDllDirectory is not supported until Windows XP with Service Pack 1 (SP1).

            Windows 2000:  Changing the standard search order by calling SetDllDirectory is not supported.

            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:

            1. The directory specified by lpFileName.
            2. The system directory. Use the GetSystemDirectory function to get the path of this directory.
            3. The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched.
            4. The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
            5. The current directory.
            6. 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 App Paths key is not used when computing the DLL search path.

            If SafeDllSearchMode is disabled, the alternate search order is as follows:

            1. The directory specified by lpFileName.
            2. The current directory.
            3. The system directory. Use the GetSystemDirectory function to get the path of this directory.
            4. The 16-bit system directory. There is no function that obtains the path of this directory, but it is searched.
            5. The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
            6. 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 App Paths key is not used when computing the DLL search path.

            The SetDllDirectory function supports an alternate search order if the lpPathName parameter specifies a path. The alternate search order is as follows:

            1. The directory from which the application loaded.
            2. The directory specified by lpPathName.
            3. The system directory. Use the GetSystemDirectory function to get the path of this directory. The name of this directory is System32.
            4. 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.
            5. The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
            6. 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 App Paths key is not used when computing the DLL search path.

            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.

            Related Topics
            Application Registration
            Dynamic-Link Library Redirection
            LoadLibrary
            LoadLibraryEx
            SetDllDirectory
            Side-by-side Components

            Send comments about this topic to Microsoft

            Build date: 12/15/2010

            Community Content Add

            Annotations FAQ

            How about the GAC?

            From the above article, it does not seems the GAC is even searched. Is the GAC searched? When? $0 $0 $0The GAC is not searched.  Native DLLs should not be placed in the GAC.  Managed assemblies are loaded by .NET and don't use the same search order.  (Ben Voigt, Visual C++ MVP)$0$0$0 $0 $0

            posted on 2011-04-27 16:08 肥仔 閱讀(447) 評論(0)  編輯 收藏 引用 所屬分類: Windows開發

            99久久做夜夜爱天天做精品| 人妻少妇久久中文字幕| 午夜精品久久久久久影视777| 欧美国产精品久久高清| 男女久久久国产一区二区三区 | 狠狠色丁香久久婷婷综合_中| 国内精品综合久久久40p| 国产成人精品久久一区二区三区 | 久久无码一区二区三区少妇| 午夜不卡久久精品无码免费| 欧美午夜A∨大片久久| 99久久久精品免费观看国产| 伊人久久大香线蕉综合网站| 久久综合久久久| 欧美日韩精品久久免费| 国产香蕉97碰碰久久人人| 久久人人爽人人爽人人AV | 色综合久久久久网| 亚洲综合精品香蕉久久网| 久久精品无码免费不卡| 人人狠狠综合久久亚洲88| 亚洲午夜久久久影院| 日本加勒比久久精品| 国产叼嘿久久精品久久| 国产精品美女久久久久| 亚洲中文字幕久久精品无码喷水 | 久久被窝电影亚洲爽爽爽| 亚洲国产一成人久久精品| 97视频久久久| 久久亚洲AV成人无码| 一级女性全黄久久生活片免费| 久久久久久毛片免费看| 国产叼嘿久久精品久久| 99久久国产亚洲高清观看2024| 国产精品久久久久久吹潮| 亚洲午夜久久久久久噜噜噜| 2021久久精品免费观看| 囯产极品美女高潮无套久久久| 久久久久亚洲av综合波多野结衣| 伊人久久国产免费观看视频 | 91性高湖久久久久|