Skip to content

Add DefaultDllImportSearchPaths to WindowsAppRuntime_EnsureIsLoaded#6240

Draft
guimafelipe wants to merge 1 commit intomainfrom
user/felipeda/dllimportsearch
Draft

Add DefaultDllImportSearchPaths to WindowsAppRuntime_EnsureIsLoaded#6240
guimafelipe wants to merge 1 commit intomainfrom
user/felipeda/dllimportsearch

Conversation

@guimafelipe
Copy link
Contributor

Summary

  • Adds [DefaultDllImportSearchPaths(DllImportSearchPath.AssemblyDirectory | DllImportSearchPath.System32)] to the WindowsAppRuntime_EnsureIsLoaded P/Invoke declaration
  • Constrains DLL search to assembly directory and System32, suppressing CA5392 code analysis warning
  • Consistent with security best practices for DLL loading

Fixes #4857

{
internal static class NativeMethods
{
[DefaultDllImportSearchPaths(DllImportSearchPath.AssemblyDirectory | DllImportSearchPath.System32)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why System32?

Does DefaultDllImportSearchPaths apply to the target or the whole DLL search order (including imports)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing DefaultDllImportSearchPaths attribute in WindowsAppRuntime_EnsureIsLoaded when WindowsAppSDKSelfContained is turned on

2 participants