1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
4 
5 using System;
6 using System.Runtime.InteropServices;
7 
8 internal partial class Interop
9 {
10     internal partial class Shell32
11     {
12         [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
13         internal unsafe struct SHELLEXECUTEINFO
14         {
15             public uint cbSize;
16             public uint fMask;
17             public IntPtr hwnd;
18             public char* lpVerb;
19             public char* lpFile;
20             public char* lpParameters;
21             public char* lpDirectory;
22             public int nShow;
23             public IntPtr hInstApp;
24             public IntPtr lpIDList;
25             public IntPtr lpClass;
26             public IntPtr hkeyClass;
27             public uint dwHotKey;
28             // This is a union of hIcon and hMonitor
29             public IntPtr hIconMonitor;
30             public IntPtr hProcess;
31         }
32 
33         internal const int SW_HIDE = 0;
34         internal const int SW_SHOWNORMAL = 1;
35         internal const int SW_SHOWMINIMIZED = 2;
36         internal const int SW_SHOWMAXIMIZED = 3;
37 
38         internal const int SE_ERR_FNF = 2;
39         internal const int SE_ERR_PNF = 3;
40         internal const int SE_ERR_ACCESSDENIED = 5;
41         internal const int SE_ERR_OOM = 8;
42         internal const int SE_ERR_DLLNOTFOUND = 32;
43         internal const int SE_ERR_SHARE = 26;
44         internal const int SE_ERR_ASSOCINCOMPLETE = 27;
45         internal const int SE_ERR_DDETIMEOUT = 28;
46         internal const int SE_ERR_DDEFAIL = 29;
47         internal const int SE_ERR_DDEBUSY = 30;
48         internal const int SE_ERR_NOASSOC = 31;
49 
50         internal const uint SEE_MASK_FLAG_DDEWAIT = 0x00000100;
51         internal const uint SEE_MASK_NOCLOSEPROCESS = 0x00000040;
52         internal const uint SEE_MASK_FLAG_NO_UI = 0x00000400;
53 
54         [DllImport(Libraries.Shell32, ExactSpelling = true, CharSet = CharSet.Unicode, SetLastError = true)]
ShellExecuteExW( SHELLEXECUTEINFO* pExecInfo)55         internal unsafe static extern bool ShellExecuteExW(
56             SHELLEXECUTEINFO* pExecInfo);
57     }
58 }