• <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 肥仔 閱讀(448) 評論(0)  編輯 收藏 引用 所屬分類: Windows開發

            波多野结衣中文字幕久久| 国产精品久久久天天影视香蕉| 国产精品九九九久久九九| 伊人久久一区二区三区无码| 色综合色天天久久婷婷基地| 久久亚洲AV成人无码电影| 久久青青草原精品国产软件| 久久久九九有精品国产| 99久久精品国产免看国产一区| 超级97碰碰碰碰久久久久最新| 久久精品成人| 久久99精品国产麻豆不卡| 亚洲国产精品久久66| 国产精品久久影院| …久久精品99久久香蕉国产| 人妻少妇久久中文字幕| 久久人人爽爽爽人久久久| 一本久久a久久精品vr综合| 精品久久亚洲中文无码| 97视频久久久| 亚洲午夜久久久影院伊人| 久久天天躁狠狠躁夜夜躁2014| 久久精品国产亚洲AV久| 久久精品一区二区三区AV| 中文国产成人精品久久不卡| 国产69精品久久久久9999APGF | 人妻精品久久久久中文字幕一冢本| 香蕉久久夜色精品国产尤物| 97视频久久久| 久久久免费精品re6| 婷婷综合久久中文字幕| 久久e热在这里只有国产中文精品99 | 久久这里只精品99re66| 久久婷婷人人澡人人爽人人爱| 亚洲第一极品精品无码久久| 亚洲国产精品高清久久久| 久久久久久人妻无码| 久久99精品国产| 久久久久亚洲AV综合波多野结衣 | 国产精品禁18久久久夂久| 99久久精品毛片免费播放|