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

            93精91精品国产综合久久香蕉| 久久亚洲av无码精品浪潮| 狠狠色婷婷久久综合频道日韩| 久久人人爽人人人人片av| 久久99国产综合精品女同| 亚洲国产精品久久久久网站| 久久久久这里只有精品| 日韩AV无码久久一区二区 | 久久久久久久综合日本| 久久人人爽人人爽人人片AV不| 久久精品毛片免费观看| 亚洲国产成人精品女人久久久 | 久久天天躁狠狠躁夜夜2020老熟妇| 色99久久久久高潮综合影院| 亚洲AV成人无码久久精品老人| 国产精品久久自在自线观看| 久久精品国产色蜜蜜麻豆| 国产成人久久777777| 无码伊人66久久大杳蕉网站谷歌| 99久久精品国产毛片| 国产V亚洲V天堂无码久久久| 热RE99久久精品国产66热| 青青草原1769久久免费播放| 无码超乳爆乳中文字幕久久| 性高湖久久久久久久久AAAAA| 久久免费精品视频| av无码久久久久久不卡网站 | 久久青青草原精品国产| 日韩欧美亚洲综合久久影院Ds | 一本色道久久99一综合| 久久综合久久鬼色| 久久久久国产精品嫩草影院 | 久久人妻少妇嫩草AV蜜桃| 久久青青草原国产精品免费| 国产∨亚洲V天堂无码久久久| 久久亚洲AV成人出白浆无码国产| 久久这里的只有是精品23| 久久免费视频1| 亚洲欧美成人久久综合中文网 | 午夜精品久久久久久| 亚洲人AV永久一区二区三区久久|