diff options
Diffstat (limited to 'src/api/burn/WixToolset.BootstrapperApplicationApi/NativeMethods.cs')
| -rw-r--r-- | src/api/burn/WixToolset.BootstrapperApplicationApi/NativeMethods.cs | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/api/burn/WixToolset.BootstrapperApplicationApi/NativeMethods.cs b/src/api/burn/WixToolset.BootstrapperApplicationApi/NativeMethods.cs new file mode 100644 index 00000000..4ef9f35e --- /dev/null +++ b/src/api/burn/WixToolset.BootstrapperApplicationApi/NativeMethods.cs | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | namespace WixToolset.BootstrapperApplicationApi | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.Runtime.InteropServices; | ||
| 7 | |||
| 8 | /// <summary> | ||
| 9 | /// Contains native constants, functions, and structures for this assembly. | ||
| 10 | /// </summary> | ||
| 11 | internal static class NativeMethods | ||
| 12 | { | ||
| 13 | #region Error Constants | ||
| 14 | internal const int S_OK = 0; | ||
| 15 | internal const int E_MOREDATA = unchecked((int)0x800700ea); | ||
| 16 | internal const int E_INSUFFICIENT_BUFFER = unchecked((int)0x8007007a); | ||
| 17 | internal const int E_CANCELLED = unchecked((int)0x800704c7); | ||
| 18 | internal const int E_ALREADYINITIALIZED = unchecked((int)0x800704df); | ||
| 19 | internal const int E_NOTFOUND = unchecked((int)0x80070490); | ||
| 20 | internal const int E_NOTIMPL = unchecked((int)0x80004001); | ||
| 21 | internal const int E_UNEXPECTED = unchecked((int)0x8000ffff); | ||
| 22 | #endregion | ||
| 23 | |||
| 24 | #region Functions | ||
| 25 | [DllImport("shell32.dll", ExactSpelling = true, SetLastError = true)] | ||
| 26 | internal static extern IntPtr CommandLineToArgvW( | ||
| 27 | [MarshalAs(UnmanagedType.LPWStr)] string lpCmdLine, | ||
| 28 | out int pNumArgs | ||
| 29 | ); | ||
| 30 | |||
| 31 | [DllImport("kernel32.dll", ExactSpelling = true, SetLastError = true)] | ||
| 32 | internal static extern IntPtr LocalFree( | ||
| 33 | IntPtr hMem | ||
| 34 | ); | ||
| 35 | #endregion | ||
| 36 | } | ||
| 37 | |||
| 38 | #region SafeHandles | ||
| 39 | internal abstract class SafeHandleZeroIsDefaultAndInvalid : SafeHandle | ||
| 40 | { | ||
| 41 | public SafeHandleZeroIsDefaultAndInvalid() : base(IntPtr.Zero, true) { } | ||
| 42 | |||
| 43 | public override bool IsInvalid | ||
| 44 | { | ||
| 45 | get { return this.handle == IntPtr.Zero; } | ||
| 46 | } | ||
| 47 | } | ||
| 48 | #endregion | ||
| 49 | } | ||
