Skip to content

Commit 839ab7f

Browse files
author
Colin Robertson
committed
Reorder some content.
1 parent b33c3f0 commit 839ab7f

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

docs/build/reference/dependentloadflag.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ helpviewer_keywords: ["LINK tool [C++], dependent load flags", "-DEPENDENTLOADFL
77
---
88
# /DEPENDENTLOADFLAG (Set default dependent load flags)
99

10+
::: moniker range="vs-2015"
11+
12+
The **/DEPENDENTLOADFLAG** option requires Visual Studio 2017 or later.
13+
14+
::: moniker-end
15+
16+
::: moniker range=">=vs-2017"
17+
1018
Sets the default load flags used when the imports of the module are resolved.
1119

1220
## Syntax
@@ -16,15 +24,17 @@ Sets the default load flags used when the imports of the module are resolved.
1624
### Arguments
1725

1826
*load_flags*<br/>
19-
An optional integer value that specifies the load flags to apply when resolving import dependencies of the module. The default value is 0. For a list of supported values, see the LOAD_LIBRARY_SEARCH entries in the [LoadLibraryEx](/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexw) documentation.
27+
An optional integer value that specifies the load flags to apply when resolving import dependencies of the module. The default value is 0. For a list of supported values, see the `LOAD_LIBRARY_SEARCH_*` entries in [LoadLibraryEx](/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexw).
2028

2129
## Remarks
2230

23-
This option is new in Visual Studio 2017. It applies only to apps running on Windows 10 RS1 and later versions. This option is ignored by other operating systems that run the app.
31+
When the operating system resolves the imports of a module, it uses the [default search order](/windows/win32/dlls/dynamic-link-library-search-order). This behavior is similar to the behavior of [LoadLibrary](/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibrarya). The **/DEPENDENTLOADFLAG** option specifies a *load_flags* value that changes the search path used to resolve imports. On supported operating systems, it makes import resolution behave more like [LoadLibraryEx](/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexa). For information on the search order set by *load_flags*, see [Search order using LOAD_LIBRARY_SEARCH flags](/windows/win32/dlls/dynamic-link-library-search-order#search-order-using-load_library_search-flags).
32+
33+
This flag can be used to make [DLL planting attacks](/windows/win32/dlls/dynamic-link-library-security) more difficult. For example, consider an app that imports a dependent DLL. An attacker could plant a DLL with the same name earlier in the import resolution search path, such as the application directory. If you specify the link option `/DEPENDENTLOADFLAG:0x800` (the value of the flag `LOAD_LIBRARY_SEARCH_SYSTEM32`), then even if safe DLL search mode is disabled on the user's computer, the module search path is limited to the %windows%\system32 directory. Protected directories are more difficult - but not impossible - for an attacker to change.
2434

25-
When the operating system resolves the imports of a module, it uses the [default search order](/windows/win32/dlls/dynamic-link-library-search-order). Its behavior is similar to the behavior of [LoadLibrary](/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibrarya). You can use **/DEPENDENTLOADFLAG** to specify a *load_flags* value that changes the search path used to resolve imports. On supported operating systems, it makes import resolution behave more like [LoadLibraryEx](/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexa). For information on the search order set by dependent load flags, see [Search order using LOAD_LIBRARY_SEARCH flags](/windows/win32/dlls/dynamic-link-library-search-order#search-order-using-load_library_search-flags).
35+
**/DEPENDENTLOADFLAG** is no substitute for defense in depth. For more information, see [Dynamic-Link Library Security](/windows/win32/dlls/dynamic-link-library-security).
2636

27-
This flag can be used to make [DLL planting attacks](/windows/win32/dlls/dynamic-link-library-security) more difficult. For example, consider an app that imports a dependent DLL. An attacker could plant a DLL with the same name earlier in the import resolution search path, such as the current directory or application directory. If you specify the link option `/DEPENDENTLOADFLAG:0x800` (the value of the flag `LOAD_LIBRARY_SEARCH_SYSTEM32`), then even if safe DLL search mode is disabled on the user's computer, the module search path is limited to the %windows%\system32 directory. Protected directories are more difficult - but not impossible - for an attacker to change.
37+
The **/DEPENDENTLOADFLAG** option is new in Visual Studio 2017. It applies only to apps running on Windows 10 RS1 and later versions. This option is ignored by other operating systems that run the app.
2838

2939
### To set the DEPENDENTLOADFLAG linker option in the Visual Studio development environment
3040

@@ -47,3 +57,5 @@ This flag can be used to make [DLL planting attacks](/windows/win32/dlls/dynamic
4757
- [LoadLibraryEx](/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexw)
4858
- [Dynamic-Link Library Search Order](/windows/win32/Dlls/dynamic-link-library-search-order)
4959
- [Dynamic-Link Library Security](/windows/win32/dlls/dynamic-link-library-security)
60+
61+
::: moniker-end

0 commit comments

Comments
 (0)