This repository has been archived by the owner on Jul 26, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 219
Add Kernel32.GetNativeSystemInfo #499
Merged
AArnott
merged 2 commits into
dotnet:master
from
qmfrederik:features/kernel32-native-system-info
Jul 8, 2020
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright © .NET Foundation and Contributors. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace PInvoke | ||
{ | ||
using System; | ||
|
||
/// <content> | ||
/// Contains the <see cref="ProcessorArchitecture"/> nested type. | ||
/// </content> | ||
public partial class Kernel32 | ||
{ | ||
/// <summary> | ||
/// The processor architecture of the installed operating system. | ||
/// </summary> | ||
public enum ProcessorArchitecture : ushort | ||
{ | ||
/// <summary> | ||
/// x64 (AMD or Intel) | ||
/// </summary> | ||
PROCESSOR_ARCHITECTURE_AMD64 = 9, | ||
|
||
/// <summary> | ||
/// ARM | ||
/// </summary> | ||
PROCESSOR_ARCHITECTURE_ARM = 5, | ||
|
||
/// <summary> | ||
/// ARM64 | ||
/// </summary> | ||
PROCESSOR_ARCHITECTURE_ARM64 = 12, | ||
|
||
/// <summary> | ||
/// Intel Itanium-based | ||
/// </summary> | ||
PROCESSOR_ARCHITECTURE_IA64 = 6, | ||
|
||
/// <summary> | ||
/// x86 | ||
/// </summary> | ||
PROCESSOR_ARCHITECTURE_INTEL = 0, | ||
|
||
/// <summary> | ||
/// Unknown architecture. | ||
/// </summary> | ||
PROCESSOR_ARCHITECTURE_UNKNOWN = 0xFFFF | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright © .NET Foundation and Contributors. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace PInvoke | ||
{ | ||
using System; | ||
|
||
/// <content> | ||
/// Contains the <see cref="ProcessorType"/> nested type. | ||
/// </content> | ||
public partial class Kernel32 | ||
{ | ||
public enum ProcessorType | ||
{ | ||
PROCESSOR_INTEL_386 = 386, | ||
PROCESSOR_INTEL_486 = 486, | ||
PROCESSOR_INTEL_PENTIUM = 586, | ||
PROCESSOR_INTEL_IA64 = 2200, | ||
PROCESSOR_AMD_X8664 = 8664, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// Copyright © .NET Foundation and Contributors. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
namespace PInvoke | ||
{ | ||
/// <content> | ||
/// Contains the <see cref="SYSTEM_INFO"/> nested type. | ||
/// </content> | ||
public partial class Kernel32 | ||
{ | ||
/// <summary> | ||
/// Contains information about the current computer system. This includes the architecture and type of | ||
/// the processor, the number of processors in the system, the page size, and other such information. | ||
/// </summary> | ||
public unsafe struct SYSTEM_INFO | ||
{ | ||
/// <summary> | ||
/// The processor architecture of the installed operating system. | ||
/// </summary> | ||
public ProcessorArchitecture wProcessorArchitecture; | ||
|
||
/// <summary> | ||
/// This member is reserved for future use. | ||
/// </summary> | ||
public short wReserved; | ||
|
||
/// <summary> | ||
/// The page size and the granularity of page protection and commitment. | ||
/// This is the page size used by the <c>VirtualAlloc</c> function. | ||
/// </summary> | ||
public int dwPageSize; | ||
|
||
/// <summary> | ||
/// A pointer to the lowest memory address accessible to applications and dynamic-link libraries (DLLs). | ||
/// </summary> | ||
public void* lpMinimumApplicationAddress; | ||
|
||
/// <summary> | ||
/// A pointer to the highest memory address accessible to applications and DLLs. | ||
/// </summary> | ||
public void* lpMaximumApplicationAddress; | ||
|
||
/// <summary> | ||
/// A mask representing the set of processors configured into the system. | ||
/// Bit 0 is processor 0; bit 31 is processor 31. | ||
/// </summary> | ||
public int* dwActiveProcessorMask; | ||
|
||
/// <summary> | ||
/// The number of logical processors in the current group. | ||
/// </summary> | ||
public int dwNumberOfProcessors; | ||
|
||
/// <summary> | ||
/// An obsolete member that is retained for compatibility. | ||
/// </summary> | ||
public ProcessorType dwProcessorType; | ||
|
||
/// <summary> | ||
/// The granularity for the starting address at which virtual memory can be allocated. | ||
/// </summary> | ||
public int dwAllocationGranularity; | ||
|
||
/// <summary> | ||
/// The architecture-dependent processor level. It should be used only for display purposes. | ||
/// </summary> | ||
public short wProcessorLevel; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
/// <summary> | ||
/// The architecture-dependent processor revision. | ||
/// </summary> | ||
public short wProcessorRevision; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't really a pointer. It's just a pointer-sized field. Let's use
IntPtr
here to make that clear.