You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The **/DEPENDENTLOADFLAG** option requires Visual Studio 2017 or later.
13
+
14
+
::: moniker-end
15
+
16
+
::: moniker range=">=vs-2017"
17
+
10
18
Sets the default load flags used when the imports of the module are resolved.
11
19
12
20
## Syntax
@@ -16,15 +24,17 @@ Sets the default load flags used when the imports of the module are resolved.
16
24
### Arguments
17
25
18
26
*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).
20
28
21
29
## Remarks
22
30
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.
24
34
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).
26
36
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.
28
38
29
39
### To set the DEPENDENTLOADFLAG linker option in the Visual Studio development environment
30
40
@@ -47,3 +57,5 @@ This flag can be used to make [DLL planting attacks](/windows/win32/dlls/dynamic
0 commit comments