aboutsummaryrefslogtreecommitdiff
path: root/src/dtf/WixToolset.Dtf.Resources/NativeMethods.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/dtf/WixToolset.Dtf.Resources/NativeMethods.cs55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/dtf/WixToolset.Dtf.Resources/NativeMethods.cs b/src/dtf/WixToolset.Dtf.Resources/NativeMethods.cs
new file mode 100644
index 00000000..bf1bd1dc
--- /dev/null
+++ b/src/dtf/WixToolset.Dtf.Resources/NativeMethods.cs
@@ -0,0 +1,55 @@
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
3namespace WixToolset.Dtf.Resources
4{
5 using System;
6 using System.IO;
7 using System.Text;
8 using System.Reflection;
9 using System.Collections;
10 using System.Globalization;
11 using System.Runtime.InteropServices;
12
13 internal static class NativeMethods
14 {
15 [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
16 internal static extern IntPtr LoadLibraryEx(string fileName, IntPtr hFile, uint flags);
17 internal const uint LOAD_LIBRARY_AS_DATAFILE = 2;
18 [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)]
19 internal static extern bool FreeLibrary(IntPtr module);
20 [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)]
21 internal static extern bool EnumResourceTypes(IntPtr module, EnumResTypesProc enumFunc, IntPtr param);
22 [return: MarshalAs(UnmanagedType.Bool)]
23 internal delegate bool EnumResTypesProc(IntPtr module, IntPtr type, IntPtr param);
24 [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)]
25 internal static extern bool EnumResourceNames(IntPtr module, IntPtr type, EnumResNamesProc enumFunc, IntPtr param);
26 [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)]
27 internal static extern bool EnumResourceNames(IntPtr module, string type, EnumResNamesProc enumFunc, IntPtr param);
28 [return: MarshalAs(UnmanagedType.Bool)]
29 internal delegate bool EnumResNamesProc(IntPtr module, IntPtr type, IntPtr name, IntPtr param);
30 [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)]
31 internal static extern bool EnumResourceLanguages(IntPtr module, IntPtr type, IntPtr name, EnumResLangsProc enumFunc, IntPtr param);
32 [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)]
33 internal static extern bool EnumResourceLanguages(IntPtr module, string type, string name, EnumResLangsProc enumFunc, IntPtr param);
34 [return: MarshalAs(UnmanagedType.Bool)]
35 internal delegate bool EnumResLangsProc(IntPtr module, IntPtr type, IntPtr name, ushort langId, IntPtr param);
36 [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
37 internal static extern IntPtr FindResourceEx(IntPtr module, string type, string name, ushort langId);
38 [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
39 internal static extern IntPtr LoadResource(IntPtr module, IntPtr resourceInfo);
40 [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
41 internal static extern IntPtr LockResource(IntPtr resourceData);
42 [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
43 internal static extern uint SizeofResource(IntPtr module, IntPtr resourceInfo);
44 [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
45 internal static extern IntPtr BeginUpdateResource(string fileName, [MarshalAs(UnmanagedType.Bool)] bool deleteExistingResources);
46 [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)]
47 internal static extern bool UpdateResource(IntPtr updateHandle, IntPtr type, IntPtr name, ushort lcid, IntPtr data, uint dataSize);
48 [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)][return: MarshalAs(UnmanagedType.Bool)]
49 internal static extern bool UpdateResource(IntPtr updateHandle, IntPtr type, string name, ushort lcid, IntPtr data, uint dataSize);
50 [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)]
51 internal static extern bool UpdateResource(IntPtr updateHandle, string type, string name, ushort lcid, IntPtr data, uint dataSize);
52 [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)]
53 internal static extern bool EndUpdateResource(IntPtr updateHandle, [MarshalAs(UnmanagedType.Bool)] bool discardChanges);
54 }
55}