Skip to content

Commit 93a7166

Browse files
committed
Remove ifdefs
1 parent cd8d6fe commit 93a7166

11 files changed

+5
-69
lines changed

src/libraries/Common/src/Interop/Windows/Advapi32/Interop.GetTokenInformation.cs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,39 +9,24 @@ internal static partial class Interop
99
{
1010
internal static partial class Advapi32
1111
{
12-
#if DLLIMPORTGENERATOR_ENABLED
1312
[GeneratedDllImport(Interop.Libraries.Advapi32, SetLastError = true)]
1413
internal static partial bool GetTokenInformation(
15-
#else
16-
[DllImport(Interop.Libraries.Advapi32, SetLastError = true)]
17-
internal static extern bool GetTokenInformation(
18-
#endif
1914
SafeAccessTokenHandle TokenHandle,
2015
uint TokenInformationClass,
2116
SafeLocalAllocHandle TokenInformation,
2217
uint TokenInformationLength,
2318
out uint ReturnLength);
2419

25-
#if DLLIMPORTGENERATOR_ENABLED
2620
[GeneratedDllImport(Interop.Libraries.Advapi32, SetLastError = true)]
2721
internal static partial bool GetTokenInformation(
28-
#else
29-
[DllImport(Interop.Libraries.Advapi32, SetLastError = true)]
30-
internal static extern bool GetTokenInformation(
31-
#endif
3222
IntPtr TokenHandle,
3323
uint TokenInformationClass,
3424
SafeLocalAllocHandle TokenInformation,
3525
uint TokenInformationLength,
3626
out uint ReturnLength);
3727

38-
#if DLLIMPORTGENERATOR_ENABLED
39-
[GeneratedDllImport(Interop.Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
28+
[GeneratedDllImport(Interop.Libraries.Advapi32, SetLastError = true)]
4029
internal static partial bool GetTokenInformation(
41-
#else
42-
[DllImport(Interop.Libraries.Advapi32, CharSet = CharSet.Unicode, SetLastError = true)]
43-
internal static extern bool GetTokenInformation(
44-
#endif
4530
IntPtr TokenHandle,
4631
uint TokenInformationClass,
4732
IntPtr TokenInformation,

src/libraries/Common/src/Interop/Windows/Advapi32/Interop.RegConnectRegistry.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,8 @@ internal static partial class Interop
1414
{
1515
internal static partial class Advapi32
1616
{
17-
#if DLLIMPORTGENERATOR_ENABLED
1817
[GeneratedDllImport(Libraries.Advapi32, EntryPoint = "RegConnectRegistryW", CharSet = CharSet.Unicode)]
1918
internal static partial int RegConnectRegistry(
20-
#else
21-
[DllImport(Libraries.Advapi32, EntryPoint = "RegConnectRegistryW", CharSet = CharSet.Unicode, BestFitMapping = false)]
22-
internal static extern int RegConnectRegistry(
23-
#endif
2419
string machineName,
2520
SafeRegistryHandle key,
2621
out SafeRegistryHandle result);

src/libraries/Common/src/Interop/Windows/Kernel32/Interop.CreateFileMapping.cs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,17 @@ internal static partial class Interop
1010
{
1111
internal static partial class Kernel32
1212
{
13-
#if DLLIMPORTGENERATOR_ENABLED
14-
[GeneratedDllImport(Libraries.Kernel32, EntryPoint = "CreateFileMappingW", CharSet = CharSet.Unicode, SetLastError = true)]
13+
[GeneratedDllImport(Libraries.Kernel32, EntryPoint = "CreateFileMappingW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
1514
internal static partial SafeMemoryMappedFileHandle CreateFileMapping(
16-
#else
17-
[DllImport(Libraries.Kernel32, EntryPoint = "CreateFileMappingW", CharSet = CharSet.Unicode, SetLastError = true)]
18-
internal static extern SafeMemoryMappedFileHandle CreateFileMapping(
19-
#endif
2015
SafeFileHandle hFile,
2116
ref SECURITY_ATTRIBUTES lpFileMappingAttributes,
2217
int flProtect,
2318
int dwMaximumSizeHigh,
2419
int dwMaximumSizeLow,
2520
string? lpName);
2621

27-
#if DLLIMPORTGENERATOR_ENABLED
28-
[GeneratedDllImport(Libraries.Kernel32, EntryPoint = "CreateFileMappingW", CharSet = CharSet.Unicode, SetLastError = true)]
22+
[GeneratedDllImport(Libraries.Kernel32, EntryPoint = "CreateFileMappingW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
2923
internal static partial SafeMemoryMappedFileHandle CreateFileMapping(
30-
#else
31-
[DllImport(Libraries.Kernel32, EntryPoint = "CreateFileMappingW", CharSet = CharSet.Unicode, SetLastError = true)]
32-
internal static extern SafeMemoryMappedFileHandle CreateFileMapping(
33-
#endif
3424
IntPtr hFile,
3525
ref SECURITY_ATTRIBUTES lpFileMappingAttributes,
3626
int flProtect,

src/libraries/Common/src/Interop/Windows/Kernel32/Interop.DuplicateHandle_SafeWaitHandle.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,8 @@ internal static partial class Interop
99
{
1010
internal static partial class Kernel32
1111
{
12-
#if DLLIMPORTGENERATOR_ENABLED
1312
[GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
1413
internal static partial bool DuplicateHandle(
15-
#else
16-
[DllImport(Libraries.Kernel32, SetLastError = true)]
17-
internal static extern bool DuplicateHandle(
18-
#endif
1914
IntPtr hSourceProcessHandle,
2015
SafeHandle hSourceHandle,
2116
IntPtr hTargetProcess,

src/libraries/Common/src/Interop/Windows/Kernel32/Interop.GetProcessTimes.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,8 @@ internal static partial class Interop
88
{
99
internal static partial class Kernel32
1010
{
11-
#if DLLIMPORTGENERATOR_ENABLED
1211
[GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
1312
internal static partial bool GetProcessTimes(
14-
#else
15-
[DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
16-
internal static extern bool GetProcessTimes(
17-
#endif
1813
SafeProcessHandle handle, out long creation, out long exit, out long kernel, out long user);
1914
}
2015
}

src/libraries/Common/src/Interop/Windows/Kernel32/Interop.MapViewOfFile.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,8 @@ internal static partial class Interop
99
{
1010
internal static partial class Kernel32
1111
{
12-
#if DLLIMPORTGENERATOR_ENABLED
1312
[GeneratedDllImport(Libraries.Kernel32, EntryPoint = "MapViewOfFile", CharSet = CharSet.Unicode, SetLastError = true)]
1413
internal static partial SafeMemoryMappedViewHandle MapViewOfFile(
15-
#else
16-
[DllImport(Libraries.Kernel32, EntryPoint = "MapViewOfFile", CharSet = CharSet.Unicode, SetLastError = true)]
17-
internal static extern SafeMemoryMappedViewHandle MapViewOfFile(
18-
#endif
1914
SafeMemoryMappedFileHandle hFileMappingObject,
2015
int dwDesiredAccess,
2116
int dwFileOffsetHigh,

src/libraries/Common/src/Interop/Windows/Kernel32/Interop.OpenFileMapping.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,8 @@ internal static partial class Interop
88
{
99
internal static partial class Kernel32
1010
{
11-
#if DLLIMPORTGENERATOR_ENABLED
12-
[GeneratedDllImport(Libraries.Kernel32, EntryPoint = "OpenFileMappingW", CharSet = CharSet.Unicode, SetLastError = true)]
11+
[GeneratedDllImport(Libraries.Kernel32, EntryPoint = "OpenFileMappingW", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = true)]
1312
internal static partial SafeMemoryMappedFileHandle OpenFileMapping(
14-
#else
15-
[DllImport(Libraries.Kernel32, EntryPoint = "OpenFileMappingW", CharSet = CharSet.Unicode, SetLastError = true)]
16-
internal static extern SafeMemoryMappedFileHandle OpenFileMapping(
17-
#endif
1813
int dwDesiredAccess,
1914
[MarshalAs(UnmanagedType.Bool)] bool bInheritHandle,
2015
string lpName);

src/libraries/Common/src/Interop/Windows/Kernel32/Interop.OpenProcess.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,8 @@ internal static partial class Interop
88
{
99
internal static partial class Kernel32
1010
{
11-
#if DLLIMPORTGENERATOR_ENABLED
1211
[GeneratedDllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
1312
internal static partial SafeProcessHandle OpenProcess(
14-
#else
15-
[DllImport(Libraries.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
16-
internal static extern SafeProcessHandle OpenProcess(
17-
#endif
1813
int access, bool inherit, int processId);
1914
}
2015
}

src/libraries/Common/src/Interop/Windows/Kernel32/Interop.UnmapViewOfFile.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,7 @@ internal static partial class Interop
88
{
99
internal static partial class Kernel32
1010
{
11-
#if DLLIMPORTGENERATOR_ENABLED
1211
[GeneratedDllImport(Libraries.Kernel32, SetLastError = true)]
1312
internal static partial bool UnmapViewOfFile(IntPtr lpBaseAddress);
14-
#else
15-
[DllImport(Libraries.Kernel32, SetLastError = true)]
16-
internal static extern bool UnmapViewOfFile(IntPtr lpBaseAddress);
17-
#endif
1813
}
1914
}

src/libraries/Common/src/Interop/Windows/Kernel32/Interop.VirtualQuery.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,8 @@ internal static partial class Interop
88
{
99
internal static partial class Kernel32
1010
{
11-
#if DLLIMPORTGENERATOR_ENABLED
1211
[GeneratedDllImport(Libraries.Kernel32, ExactSpelling = true, SetLastError = true)]
1312
internal static partial UIntPtr VirtualQuery(
14-
#else
15-
[DllImport(Libraries.Kernel32, ExactSpelling = true, SetLastError = true)]
16-
internal static extern UIntPtr VirtualQuery(
17-
#endif
1813
SafeHandle lpAddress,
1914
ref MEMORY_BASIC_INFORMATION lpBuffer,
2015
UIntPtr dwLength);

0 commit comments

Comments
 (0)