-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Win32 Console API: GetStdHandle, WriteConsole, GetCurrentConsoleFont #251
Changes from 9 commits
e21d8b8
8c5798a
cefafaf
c58cc11
a00c197
4c99594
3c4cba3
93c78e6
ca73e19
51c7cc6
4d1cc1f
32f4b06
600f3cb
6ce5b73
44b6d73
3919835
5325d0f
e28bf58
44d7f28
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package com.sun.jna.platform.win32; | ||
|
||
/** | ||
* Cfgmgr32.dll Interface. | ||
* | ||
* @author Luke Quinane | ||
*/ | ||
public interface CfgMgr32 { | ||
int CR_SUCCESS = 0x00000000; | ||
int CR_DEFAULT = 0x00000001; | ||
int CR_OUT_OF_MEMORY = 0x00000002; | ||
int CR_INVALID_POINTER = 0x00000003; | ||
int CR_INVALID_FLAG = 0x00000004; | ||
int CR_INVALID_DEVNODE = 0x00000005; | ||
int CR_INVALID_DEVINST = CR_INVALID_DEVNODE; | ||
int CR_INVALID_RES_DES = 0x00000006; | ||
int CR_INVALID_LOG_CONF = 0x00000007; | ||
int CR_INVALID_ARBITRATOR = 0x00000008; | ||
int CR_INVALID_NODELIST = 0x00000009; | ||
int CR_DEVNODE_HAS_REQS = 0x0000000A; | ||
int CR_DEVINST_HAS_REQS = CR_DEVNODE_HAS_REQS; | ||
int CR_INVALID_RESOURCEID = 0x0000000B; | ||
int CR_DLVXD_NOT_FOUND = 0x0000000C; | ||
int CR_NO_SUCH_DEVNODE = 0x0000000D; | ||
int CR_NO_SUCH_DEVINST = CR_NO_SUCH_DEVNODE; | ||
int CR_NO_MORE_LOG_CONF = 0x0000000E; | ||
int CR_NO_MORE_RES_DES = 0x0000000F; | ||
int CR_ALREADY_SUCH_DEVNODE = 0x00000010; | ||
int CR_ALREADY_SUCH_DEVINST = CR_ALREADY_SUCH_DEVNODE; | ||
int CR_INVALID_RANGE_LIST = 0x00000011; | ||
int CR_INVALID_RANGE = 0x00000012; | ||
int CR_FAILURE = 0x00000013; | ||
int CR_NO_SUCH_LOGICAL_DEV = 0x00000014; | ||
int CR_CREATE_BLOCKED = 0x00000015; | ||
int CR_NOT_SYSTEM_VM = 0x00000016; | ||
int CR_REMOVE_VETOED = 0x00000017; | ||
int CR_APM_VETOED = 0x00000018; | ||
int CR_INVALID_LOAD_TYPE = 0x00000019; | ||
int CR_BUFFER_SMALL = 0x0000001A; | ||
int CR_NO_ARBITRATOR = 0x0000001B; | ||
int CR_NO_REGISTRY_HANDLE = 0x0000001C; | ||
int CR_REGISTRY_ERROR = 0x0000001D; | ||
int CR_INVALID_DEVICE_ID = 0x0000001E; | ||
int CR_INVALID_DATA = 0x0000001F; | ||
int CR_INVALID_API = 0x00000020; | ||
int CR_DEVLOADER_NOT_READY = 0x00000021; | ||
int CR_NEED_RESTART = 0x00000022; | ||
int CR_NO_MORE_HW_PROFILES = 0x00000023; | ||
int CR_DEVICE_NOT_THERE = 0x00000024; | ||
int CR_NO_SUCH_VALUE = 0x00000025; | ||
int CR_WRONG_TYPE = 0x00000026; | ||
int CR_INVALID_PRIORITY = 0x00000027; | ||
int CR_NOT_DISABLEABLE = 0x00000028; | ||
int CR_FREE_RESOURCES = 0x00000029; | ||
int CR_QUERY_VETOED = 0x0000002A; | ||
int CR_CANT_SHARE_IRQ = 0x0000002B; | ||
int CR_NO_DEPENDENT = 0x0000002C; | ||
int CR_SAME_RESOURCES = 0x0000002D; | ||
int CR_NO_SUCH_REGISTRY_KEY = 0x0000002E; | ||
int CR_INVALID_MACHINENAME = 0x0000002F; | ||
int CR_REMOTE_COMM_FAILURE = 0x00000030; | ||
int CR_MACHINE_UNAVAILABLE = 0x00000031; | ||
int CR_NO_CM_SERVICES = 0x00000032; | ||
int CR_ACCESS_DENIED = 0x00000033; | ||
int CR_CALL_NOT_IMPLEMENTED = 0x00000034; | ||
int CR_INVALID_PROPERTY = 0x00000035; | ||
int CR_DEVICE_INTERFACE_ACTIVE = 0x00000036; | ||
int CR_NO_SUCH_DEVICE_INTERFACE = 0x00000037; | ||
int CR_INVALID_REFERENCE_STRING = 0x00000038; | ||
int CR_INVALID_CONFLICT_LIST = 0x00000039; | ||
int CR_INVALID_INDEX = 0x0000003A; | ||
int CR_INVALID_STRUCTURE_SIZE = 0x0000003B; | ||
int NUM_CR_RESULTS = 0x0000003C; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package com.sun.jna.platform.win32; | ||
|
||
/** | ||
* The interface for the Ntddk.h constants. | ||
* | ||
* @author Luke Quinane | ||
*/ | ||
public class Ntddk { | ||
public static final int FILE_DEVICE_8042_PORT = 0x00000027; | ||
public static final int FILE_DEVICE_ACPI = 0x00000032; | ||
public static final int FILE_DEVICE_BATTERY = 0x00000029; | ||
public static final int FILE_DEVICE_BEEP = 0x00000001; | ||
public static final int FILE_DEVICE_BUS_EXTENDER = 0x0000002a; | ||
public static final int FILE_DEVICE_CD_ROM = 0x00000002; | ||
public static final int FILE_DEVICE_CD_ROM_FILE_SYSTEM = 0x00000003; | ||
public static final int FILE_DEVICE_CHANGER = 0x00000030; | ||
public static final int FILE_DEVICE_CONTROLLER = 0x00000004; | ||
public static final int FILE_DEVICE_DATALINK = 0x00000005; | ||
public static final int FILE_DEVICE_DFS = 0x00000006; | ||
public static final int FILE_DEVICE_DFS_FILE_SYSTEM = 0x00000035; | ||
public static final int FILE_DEVICE_DFS_VOLUME = 0x00000036; | ||
public static final int FILE_DEVICE_DISK = 0x00000007; | ||
public static final int FILE_DEVICE_DISK_FILE_SYSTEM = 0x00000008; | ||
public static final int FILE_DEVICE_DVD = 0x00000033; | ||
public static final int FILE_DEVICE_FILE_SYSTEM = 0x00000009; | ||
public static final int FILE_DEVICE_FIPS = 0x0000003a; | ||
public static final int FILE_DEVICE_FULLSCREEN_VIDEO = 0x00000034; | ||
public static final int FILE_DEVICE_INPORT_PORT = 0x0000000a; | ||
public static final int FILE_DEVICE_KEYBOARD = 0x0000000b; | ||
public static final int FILE_DEVICE_KS = 0x0000002f; | ||
public static final int FILE_DEVICE_KSEC = 0x00000039; | ||
public static final int FILE_DEVICE_MAILSLOT = 0x0000000c; | ||
public static final int FILE_DEVICE_MASS_STORAGE = 0x0000002d; | ||
public static final int FILE_DEVICE_MIDI_IN = 0x0000000d; | ||
public static final int FILE_DEVICE_MIDI_OUT = 0x0000000e; | ||
public static final int FILE_DEVICE_MODEM = 0x0000002b; | ||
public static final int FILE_DEVICE_MOUSE = 0x0000000f; | ||
public static final int FILE_DEVICE_MULTI_UNC_PROVIDER = 0x00000010; | ||
public static final int FILE_DEVICE_NAMED_PIPE = 0x00000011; | ||
public static final int FILE_DEVICE_NETWORK = 0x00000012; | ||
public static final int FILE_DEVICE_NETWORK_BROWSER = 0x00000013; | ||
public static final int FILE_DEVICE_NETWORK_FILE_SYSTEM = 0x00000014; | ||
public static final int FILE_DEVICE_NETWORK_REDIRECTOR = 0x00000028; | ||
public static final int FILE_DEVICE_NULL = 0x00000015; | ||
public static final int FILE_DEVICE_PARALLEL_PORT = 0x00000016; | ||
public static final int FILE_DEVICE_PHYSICAL_NETCARD = 0x00000017; | ||
public static final int FILE_DEVICE_PRINTER = 0x00000018; | ||
public static final int FILE_DEVICE_SCANNER = 0x00000019; | ||
public static final int FILE_DEVICE_SCREEN = 0x0000001c; | ||
public static final int FILE_DEVICE_SERENUM = 0x00000037; | ||
public static final int FILE_DEVICE_SERIAL_MOUSE_PORT = 0x0000001a; | ||
public static final int FILE_DEVICE_SERIAL_PORT = 0x0000001b; | ||
public static final int FILE_DEVICE_SMARTCARD = 0x00000031; | ||
public static final int FILE_DEVICE_SMB = 0x0000002e; | ||
public static final int FILE_DEVICE_SOUND = 0x0000001d; | ||
public static final int FILE_DEVICE_STREAMS = 0x0000001e; | ||
public static final int FILE_DEVICE_TAPE = 0x0000001f; | ||
public static final int FILE_DEVICE_TAPE_FILE_SYSTEM = 0x00000020; | ||
public static final int FILE_DEVICE_TERMSRV = 0x00000038; | ||
public static final int FILE_DEVICE_TRANSPORT = 0x00000021; | ||
public static final int FILE_DEVICE_UNKNOWN = 0x00000022; | ||
public static final int FILE_DEVICE_VDM = 0x0000002c; | ||
public static final int FILE_DEVICE_VIDEO = 0x00000023; | ||
public static final int FILE_DEVICE_VIRTUAL_DISK = 0x00000024; | ||
public static final int FILE_DEVICE_WAVE_IN = 0x00000025; | ||
public static final int FILE_DEVICE_WAVE_OUT = 0x00000026; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2840,6 +2840,108 @@ public interface LOGICAL_PROCESSOR_RELATIONSHIP { | |
int RelationAll = 0xFFFF; | ||
} | ||
|
||
/** | ||
* Contains information about the relationships of logical processors and related hardware. The | ||
* GetLogicalProcessorInformationEx function uses this structure. | ||
*/ | ||
class SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX extends Structure { | ||
/** | ||
* The type of relationship between the logical processors. | ||
*/ | ||
public WinDef.DWORD relationship; | ||
|
||
/** | ||
* The size of the structure. | ||
*/ | ||
public WinDef.DWORD size; | ||
|
||
/** | ||
* A PROCESSOR_RELATIONSHIP structure that describes processor affinity. This structure contains valid data only if | ||
* the Relationship member is RelationProcessorCore or RelationProcessorPackage. | ||
* | ||
* This is actually a union with the NUMA and other data types. | ||
*/ | ||
public PROCESSOR_RELATIONSHIP processor; | ||
|
||
public SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX() | ||
{} | ||
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. Don't leave this empty - better to add the call to super() - even though it is implicit, as this enables placing a debug breakpoint in the constructor. |
||
|
||
public SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX(Pointer pointer, int offset) { | ||
useMemory(pointer, offset); | ||
read(); | ||
} | ||
|
||
@Override | ||
protected List<String> getFieldOrder() | ||
{ | ||
return Arrays.asList("relationship", "size", "processor"); | ||
} | ||
} | ||
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. Code-style - open braces on same line as the method name... |
||
|
||
/** | ||
* Represents information about affinity within a processor group. This structure is used with the | ||
* GetLogicalProcessorInformationEx function. | ||
*/ | ||
class PROCESSOR_RELATIONSHIP extends Structure { | ||
/** | ||
* <p>If the Relationship member of the SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX structure is RelationProcessorCore, | ||
* this member is LTP_PC_SMT if the core has more than one logical processor, or 0 if the core has one logical | ||
* processor.</p> | ||
* | ||
* <p>If the Relationship member of the SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX structure is | ||
* RelationProcessorPackage, this member is always 0.</p> | ||
*/ | ||
public byte flags; | ||
|
||
/** | ||
* This member is reserved. | ||
*/ | ||
public byte[] reserved = new byte[21]; | ||
|
||
/** | ||
* This member specifies the number of entries in the GroupMask array. | ||
*/ | ||
public WinDef.WORD groupCount; | ||
|
||
/** | ||
* An array of GROUP_AFFINITY structures. The GroupCount member specifies the number of structures in the array. | ||
* Each structure in the array specifies a group number and processor affinity within the group. | ||
*/ | ||
public GROUP_AFFINITY[] groupMask = new GROUP_AFFINITY[1]; | ||
|
||
@Override | ||
protected List<String> getFieldOrder() | ||
{ | ||
return Arrays.asList("flags", "reserved", "groupCount", "groupMask"); | ||
} | ||
} | ||
|
||
/** | ||
* Represents a processor group-specific affinity, such as the affinity of a thread. | ||
*/ | ||
public class GROUP_AFFINITY extends Structure { | ||
/** | ||
* A bitmap that specifies the affinity for zero or more processors within the specified group. | ||
*/ | ||
public BaseTSD.ULONG_PTR mask; | ||
|
||
/** | ||
* The processor group number. | ||
*/ | ||
public WinDef.WORD group; | ||
|
||
/** | ||
* This member is reserved. | ||
*/ | ||
public WinDef.WORD[] reserved = new WinDef.WORD[3]; | ||
|
||
@Override | ||
protected List<String> getFieldOrder() | ||
{ | ||
return Arrays.asList("mask", "group", "reserved"); | ||
} | ||
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. Code style - open braces on same line as the method name |
||
} | ||
|
||
byte CACHE_FULLY_ASSOCIATIVE = (byte)0xFF; | ||
|
||
/** | ||
|
@@ -2996,4 +3098,74 @@ protected List getFieldOrder() { | |
}); | ||
} | ||
} | ||
|
||
/** | ||
* Contains information about a range of pages in the virtual address space of a process. | ||
*/ | ||
class MEMORY_BASIC_INFORMATION64 extends Structure { | ||
/** | ||
* A pointer to the base address of the region of pages. | ||
*/ | ||
public ULONGLONG baseAddress; | ||
|
||
/** | ||
* A pointer to the base address of a range of pages allocated by the VirtualAlloc function. | ||
* The page pointed to by the BaseAddress member is contained within this allocation range. | ||
*/ | ||
public ULONGLONG allocationBase; | ||
|
||
/** | ||
* The memory protection option when the region was initially allocated. This member can be | ||
* one of the memory protection constants or 0 if the caller does not have access. | ||
*/ | ||
public DWORD allocationProtect; | ||
|
||
public DWORD __alignment1; | ||
|
||
/** | ||
* The size of the region beginning at the base address in which all pages have identical | ||
* attributes, in bytes. | ||
*/ | ||
public ULONGLONG regionSize; | ||
|
||
/** | ||
* The state of the pages in the region. | ||
*/ | ||
public DWORD state; | ||
|
||
/** | ||
* The access protection of the pages in the region. This member is one of the values listed | ||
* for the AllocationProtect member. | ||
*/ | ||
public DWORD protect; | ||
|
||
/** | ||
* The type of pages in the region. | ||
*/ | ||
public DWORD type; | ||
public DWORD __alignment2; | ||
|
||
public static class ByReference extends MEMORY_BASIC_INFORMATION64 implements Structure.ByReference { | ||
public ByReference() { | ||
} | ||
|
||
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. Don't leave this empty - add call to (implicit) super() as this enables setting a breakpoint in the constructor |
||
public ByReference(Pointer memory) { | ||
super(memory); | ||
} | ||
} | ||
|
||
public MEMORY_BASIC_INFORMATION64() { | ||
} | ||
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. Don't leave this empty - add call to (implicit) super() as this enables setting a breakpoint in the constructor. |
||
|
||
public MEMORY_BASIC_INFORMATION64(Pointer memory) { | ||
super(memory); | ||
read(); | ||
} | ||
|
||
@Override | ||
protected List<String> getFieldOrder() { | ||
return Arrays.asList("baseAddress", "allocationBase", "allocationProtect", "__alignment1", "regionSize", | ||
"state", "protect", "type", "__alignment2"); | ||
} | ||
} | ||
} |
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.