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

            一本一道久久a久久精品综合| 精品久久久久久久| 久久五月精品中文字幕| 婷婷国产天堂久久综合五月| 亚洲а∨天堂久久精品9966| 无码久久精品国产亚洲Av影片| 久久精品蜜芽亚洲国产AV| 国产精品久久久久一区二区三区 | 久久精品99无色码中文字幕| 亚洲乱码日产精品a级毛片久久| 日本久久久久亚洲中字幕| 国产69精品久久久久9999| 精品国产99久久久久久麻豆 | 欧美激情一区二区久久久| 久久精品国产亚洲精品2020 | 国产精品视频久久久| 亚洲精品无码久久久久AV麻豆| 久久狠狠爱亚洲综合影院| 久久黄视频| 精品多毛少妇人妻AV免费久久| 久久综合88熟人妻| 久久天天婷婷五月俺也去| 久久久久亚洲?V成人无码| 亚洲国产成人久久精品动漫| 亚洲成色www久久网站夜月| 婷婷久久综合| 久久午夜无码鲁丝片午夜精品| 97超级碰碰碰碰久久久久| 日韩精品久久无码中文字幕| 女人高潮久久久叫人喷水| 久久有码中文字幕| 日日狠狠久久偷偷色综合0| 91精品国产高清久久久久久91| 久久久噜噜噜久久熟女AA片| 国产A级毛片久久久精品毛片| 怡红院日本一道日本久久 | 久久精品国产亚洲AV蜜臀色欲| 久久精品无码一区二区日韩AV | 亚洲性久久久影院| 四虎影视久久久免费观看| 色欲综合久久躁天天躁|