Skip to content

Conversation

@arvindshmicrosoft
Copy link
Member

In some cases, dbghelp / symsrv may pop up UI dialogs, such as to authenticate to a symbol server. We want those dialogs to be modal so that they are clearly visible to the user. Calling SymSetParentWindow ensures the modal nature of such possible UI elements.

In some cases, dbghelp / symsrv may pop up UI dialogs, such as to
authenticate to a symbol server. We want those dialogs to be modal so
that they are clearly visible to the user. Calling SymSetParentWindow
ensures the modal nature of such possible UI elements.
Contract.Requires(null != syms);
Contract.Requires(null != parent);

if (!SafeNativeMethods.SymSetParentWindow(System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle)) return retval;

Check notice

Code scanning / CodeQL

Calls to unmanaged code

Replace this call with a call to managed code if possible.

[DllImport("dbghelp.dll", CharSet = CharSet.Unicode)] public static extern bool SymInitialize(IntPtr hProcess, [MarshalAs(UnmanagedType.LPWStr)] string UserSearchPath, bool fInvadeProcess);

[DllImport("dbghelp.dll")] public static extern bool SymSetParentWindow(IntPtr hWnd);

Check notice

Code scanning / CodeQL

Unmanaged code

Minimise the use of unmanaged code.
@arvindshmicrosoft arvindshmicrosoft merged commit 8559ad2 into main Jun 22, 2024
@arvindshmicrosoft arvindshmicrosoft deleted the symsrv-auth branch June 22, 2024 04:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants