• <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開發

            草草久久久无码国产专区| 无码人妻久久一区二区三区免费丨 | 久久精品中文字幕一区| 久久亚洲AV无码精品色午夜麻豆| 久久人人爽人人人人片av| 久久99精品久久久久久| 精品国产婷婷久久久| 亚洲va久久久噜噜噜久久天堂| 一本大道加勒比久久综合| 亚洲伊人久久综合中文成人网| 久久精品国产亚洲AV无码麻豆 | 久久久久亚洲AV无码永不| 国产精品99久久久久久猫咪| 一本大道久久东京热无码AV | 久久国产香蕉视频| 国产亚洲精久久久久久无码| 久久综合偷偷噜噜噜色| 精品久久久久久无码人妻蜜桃 | 久久精品国产亚洲欧美| 日本五月天婷久久网站| 久久露脸国产精品| 色综合久久最新中文字幕| 亚洲国产精品无码久久SM| 久久成人小视频| 亚洲欧美国产日韩综合久久| 久久精品无码专区免费| 亚洲一区二区三区日本久久九| 无码日韩人妻精品久久蜜桃| 国色天香久久久久久久小说 | 久久精品一区二区| 青青青青久久精品国产 | 色欲综合久久躁天天躁| 国产精品免费久久久久影院 | 久久精品国产2020| 成人综合久久精品色婷婷| 一级做a爰片久久毛片看看| 亚洲精品无码久久不卡| 国产成人综合久久精品红| 国产偷久久久精品专区| 亚洲精品国精品久久99热一| 亚洲精品国产美女久久久|