File: System\Deployment\Application\NativeMethods.cs
Project: System.Deployment.dll (System.Deployment)
#region Assembly System.Deployment, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Deployment.dll
#endregion
 
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.ComTypes;
using System.Security;
using System.Text;
 
namespace System.Deployment.Application
{
    internal static class NativeMethods
    {
        public const ushort PROCESSOR_ARCHITECTURE_AMD64 = 9;
        public const ushort PROCESSOR_ARCHITECTURE_IA64 = 6;
        public const ushort PROCESSOR_ARCHITECTURE_INTEL = 0;
 
        public static uint CoCreateInstance(ref Guid clsid, object punkOuter, int context, ref Guid iid, out object o);
        public static IntPtr FindResource(IntPtr hModule, string lpName, string lpType);
        public static bool FreeLibrary(IntPtr hModule);
        public static IAssemblyCache GetAssemblyCacheInterface(string CLRVersionString, bool FetchRuntimeHost, out CCorRuntimeHost RuntimeHost);
        public static uint GetCurrentThreadId();
        [SecurityCritical]
        public static void GetFileVersion(string szFileName, StringBuilder szBuffer, uint cchBuffer, out uint dwLength);
        public static int GetModuleFileName(IntPtr module, StringBuilder fileName, int size);
        public static IntPtr GetModuleHandle(string moduleName);
        public static void GetNativeSystemInfo(ref SYSTEM_INFO sysInfo);
        public static void GetRequestedRuntimeInfo(string pExe, string pwszVersion, string pConfigurationFile, uint startupFlags, uint runtimeInfoFlags, StringBuilder pDirectory, uint dwDirectory, out uint dwDirectoryLength, StringBuilder pVersion, uint cchBuffer, out uint dwLength);
        public static void GetSystemInfo(ref SYSTEM_INFO sysInfo);
        public static bool InternetGetCookieW(string url, string cookieName, StringBuilder cookieData, ref uint bytes);
        public static IntPtr LoadLibraryEx(string lpModuleName, IntPtr hFile, uint dwFlags);
        public static IntPtr LoadResource(IntPtr hModule, IntPtr handle);
        public static IntPtr LockResource(IntPtr hglobal);
        public static void SHChangeNotify(int eventID, uint flags, IntPtr item1, IntPtr item2);
        public static uint SHCreateItemFromParsingName(string pszPath, IntPtr pbc, Guid riid, out object ppv);
        public static uint SizeofResource(IntPtr hModule, IntPtr handle);
        public static bool VerifyVersionInfo(OSVersionInfoEx osvi, uint dwTypeMask, ulong dwConditionMask);
        public static ulong VerSetConditionMask(ulong ConditionMask, uint TypeMask, byte Condition);
 
        public enum CacheEntryFlags : uint
        {
            Normal = 1,
            Sticky = 4,
            Edited = 8,
            TrackOffline = 16,
            TrackOnline = 32,
            Sparse = 65536,
            Cookie = 1048576,
            UrlHistory = 2097152
        }
        [Flags]
        [SecurityCritical]
        public enum MetaHostPolicyFlags
        {
            MetaHostPolicyHighCompatibility,
            MetaHostPolicyApplyUpgradePolicy = 8,
            MetaHostPolicyEmulateExeLaunch = 15
        }
        public enum SHChangeNotifyEventID
        {
            SHCNE_ASSOCCHANGED = 134217728
        }
        public enum SHChangeNotifyFlags : uint
        {
            SHCNF_IDLIST
        }
        public enum tagCOINITEE : uint
        {
            COINITEE_DEFAULT,
            COINITEE_DLL,
            COINITEE_MAIN
        }
 
        [Guid("D332DB9E-B9B3-4125-8207-A14884F53216")]
        [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
        [SecurityCritical]
        public interface IClrMetaHost
        {
            IEnumUnknown EnumerateInstalledRuntimes();
            IEnumUnknown EnumerateLoadedRuntimes(IntPtr processHandle);
            object GetRuntime(string version, Guid interfaceId);
            void GetVersionFromFile(string filePath, StringBuilder buffer, ref uint bufferLength);
            int Reserved01(IntPtr reserved1);
        }
        [Guid("E2190695-77B2-492E-8E14-C4B3A7FDD593")]
        [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
        [SecurityCritical]
        public interface IClrMetaHostPolicy
        {
            object GetRequestedRuntime([ComAliasName("Microsoft.Runtime.Hosting.Interop.MetaHostPolicyFlags")] MetaHostPolicyFlags policyFlags, string binaryPath, IStream configStream, StringBuilder version, ref int versionLength, StringBuilder imageVersion, ref int imageVersionLength, out int pdwConfigFlags, Guid interfaceId);
        }
        [Guid("BD39D1D2-BA2F-486A-89B0-B4B0CB466891")]
        [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
        [SecurityCritical]
        public interface IClrRuntimeInfo
        {
            object GetInterface(Guid coClassId, Guid interfaceId);
            IntPtr GetProcAddress(string procName);
            void GetRuntimeDirectory(StringBuilder buffer, ref int bufferLength);
            void GetVersionString(StringBuilder buffer, ref int bufferLength);
            bool IsLoaded(IntPtr processHandle);
            [LCIDConversion(3)]
            void LoadErrorString(int resourceId, StringBuilder buffer, ref int bufferLength);
            IntPtr LoadLibrary(string dllName);
        }
        [Guid("00000100-0000-0000-C000-000000000046")]
        [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
        [SecurityCritical]
        public interface IEnumUnknown
        {
            void Clone(out IEnumUnknown enumerator);
            int Next(int elementArrayLength, object[] elementArray, out int fetchedElementCount);
            void Reset();
            int Skip(int count);
        }
        [Guid("43826d1e-e718-42ee-bc55-a1e261c37bfe")]
        [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
        public interface IShellItem
        {
            void BindToHandler(IntPtr pbc, Guid bhid, Guid riid, out IntPtr ppv);
            void Compare(IShellItem psi, uint hint, out int piOrder);
            void GetAttributes(uint sfgaoMask, out uint psfgaoAttribs);
            void GetDisplayName(SIGDN sigdnName, out IntPtr ppszName);
            void GetParent(out IShellItem ppsi);
        }
        [Guid("4CD19ADA-25A5-4A32-B3B7-347BEE5BE36B")]
        [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
        public interface IStartMenuPinnedList
        {
            void RemoveFromList(IShellItem psi);
        }
 
        public struct SYSTEM_INFO
        {
            public IntPtr dwActiveProcessorMask;
            public uint dwAllocationGranularity;
            public uint dwNumberOfProcessors;
            public uint dwPageSize;
            public uint dwProcessorLevel;
            public uint dwProcessorRevision;
            public uint dwProcessorType;
            public IntPtr lpMaximumApplicationAddress;
            public IntPtr lpMinimumApplicationAddress;
        }
        public struct _PROCESSOR_INFO_UNION
        {
        }
 
        public sealed class CCorRuntimeHost : IDisposable
        {
            public CCorRuntimeHost(IClrRuntimeInfo RuntimeInfo);
 
            public string ApplyPolicyInOtherRuntime(string name);
            public void Dispose();
        }
        public class OSVersionInfoEx
        {
            public byte bProductType;
            public byte bReserved;
            public uint dwBuildNumber;
            public uint dwMajorVersion;
            public uint dwMinorVersion;
            public uint dwOSVersionInfoSize;
            public uint dwPlatformId;
            public string szCSDVersion;
            public ushort wServicePackMajor;
            public ushort wServicePackMinor;
            public ushort wSuiteMask;
 
            public OSVersionInfoEx();
        }
    }
}