Skip to content
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

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Features
* [#567](https://github.com/java-native-access/jna/pull/567): Added `PrintWindow`, `IsWindowEnabled`, `IsWindow`, `FindWindowEx`, `GetAncestor`, `GetCursorPos`, `SetCursorPos`, `SetWinEventHook`, `UnhookWinEvent`, `CopyIcon`, and `GetClassLong` to `com.sun.jna.platform.win32.User32` and supporting constants to `com.sun.jna.platform.win32.WinUser` - [@mlfreeman2](https://github.com/mlfreeman2).
* [#573](https://github.com/java-native-access/jna/pull/573): Added `EnumProcessModules`, `GetModuleInformation`, and `GetProcessImageFileName` to `com.sun.jna.platform.win32.Psapi` and added `ExtractIconEx` to `com.sun.jna.platform.win32.Shell32` - [@mlfreeman2](https://github.com/mlfreeman2).
* [#574](https://github.com/java-native-access/jna/pull/574): Using static final un-modifiable List of field names for structure(s) [@lgoldstein](https://github.com/lgoldstein)
* [#251](https://github.com/java-native-access/jna/pull/251): Added CfgMgr32 constants, Ntddk constants, SetupApi constants CM_DEVCAP_EJECTSUPPORTED and SPDRP_FRIENDLYNAME. Added SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX, MEMORY_BASIC_INFORMATION64, STORAGE_DEVICE_DESCRIPTOR, DISK_GEOMETRY_EX, and related structures - [@tmyroadctfig](https://github.com/tmyroadctfig)

Bug Fixes
---------
Expand Down Expand Up @@ -123,7 +124,7 @@ Bug Fixes
* Fix compiler warnings OSX - [@twall](https://github.com/twall).
* Remove unsupported JAWT from OSX build - [@twall](https://github.com/twall).
* Disable WebStart tests - [@twall](https://github.com/twall).
* Dispose all native resources when JNA's native library is unloaded - Paul Grütter, [@twall](https://github.com/twall).
* Dispose all native resources when JNA's native library is unloaded - Paul Gr�tter, [@twall](https://github.com/twall).
* Weakly hold registered direct-mapped classes - [@twall](https://github.com/twall).
* [#382](https://github.com/java-native-access/jna/pull/382): Fixed memory allocation in `com.sun.jna.platform.win32.WTypes.LPWSTR` and `LPSTR` constructors - [@junak-michal](https://github.com/junak-michal).
* Fix publish doc links - [@bhamail](https://github.com/bhamail).
Expand Down
74 changes: 74 additions & 0 deletions contrib/platform/src/com/sun/jna/platform/win32/CfgMgr32.java
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;
}
67 changes: 67 additions & 0 deletions contrib/platform/src/com/sun/jna/platform/win32/Ntddk.java
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 interface Ntddk {
int FILE_DEVICE_8042_PORT = 0x00000027;
int FILE_DEVICE_ACPI = 0x00000032;
int FILE_DEVICE_BATTERY = 0x00000029;
int FILE_DEVICE_BEEP = 0x00000001;
int FILE_DEVICE_BUS_EXTENDER = 0x0000002a;
int FILE_DEVICE_CD_ROM = 0x00000002;
int FILE_DEVICE_CD_ROM_FILE_SYSTEM = 0x00000003;
int FILE_DEVICE_CHANGER = 0x00000030;
int FILE_DEVICE_CONTROLLER = 0x00000004;
int FILE_DEVICE_DATALINK = 0x00000005;
int FILE_DEVICE_DFS = 0x00000006;
int FILE_DEVICE_DFS_FILE_SYSTEM = 0x00000035;
int FILE_DEVICE_DFS_VOLUME = 0x00000036;
int FILE_DEVICE_DISK = 0x00000007;
int FILE_DEVICE_DISK_FILE_SYSTEM = 0x00000008;
int FILE_DEVICE_DVD = 0x00000033;
int FILE_DEVICE_FILE_SYSTEM = 0x00000009;
int FILE_DEVICE_FIPS = 0x0000003a;
int FILE_DEVICE_FULLSCREEN_VIDEO = 0x00000034;
int FILE_DEVICE_INPORT_PORT = 0x0000000a;
int FILE_DEVICE_KEYBOARD = 0x0000000b;
int FILE_DEVICE_KS = 0x0000002f;
int FILE_DEVICE_KSEC = 0x00000039;
int FILE_DEVICE_MAILSLOT = 0x0000000c;
int FILE_DEVICE_MASS_STORAGE = 0x0000002d;
int FILE_DEVICE_MIDI_IN = 0x0000000d;
int FILE_DEVICE_MIDI_OUT = 0x0000000e;
int FILE_DEVICE_MODEM = 0x0000002b;
int FILE_DEVICE_MOUSE = 0x0000000f;
int FILE_DEVICE_MULTI_UNC_PROVIDER = 0x00000010;
int FILE_DEVICE_NAMED_PIPE = 0x00000011;
int FILE_DEVICE_NETWORK = 0x00000012;
int FILE_DEVICE_NETWORK_BROWSER = 0x00000013;
int FILE_DEVICE_NETWORK_FILE_SYSTEM = 0x00000014;
int FILE_DEVICE_NETWORK_REDIRECTOR = 0x00000028;
int FILE_DEVICE_NULL = 0x00000015;
int FILE_DEVICE_PARALLEL_PORT = 0x00000016;
int FILE_DEVICE_PHYSICAL_NETCARD = 0x00000017;
int FILE_DEVICE_PRINTER = 0x00000018;
int FILE_DEVICE_SCANNER = 0x00000019;
int FILE_DEVICE_SCREEN = 0x0000001c;
int FILE_DEVICE_SERENUM = 0x00000037;
int FILE_DEVICE_SERIAL_MOUSE_PORT = 0x0000001a;
int FILE_DEVICE_SERIAL_PORT = 0x0000001b;
int FILE_DEVICE_SMARTCARD = 0x00000031;
int FILE_DEVICE_SMB = 0x0000002e;
int FILE_DEVICE_SOUND = 0x0000001d;
int FILE_DEVICE_STREAMS = 0x0000001e;
int FILE_DEVICE_TAPE = 0x0000001f;
int FILE_DEVICE_TAPE_FILE_SYSTEM = 0x00000020;
int FILE_DEVICE_TERMSRV = 0x00000038;
int FILE_DEVICE_TRANSPORT = 0x00000021;
int FILE_DEVICE_UNKNOWN = 0x00000022;
int FILE_DEVICE_VDM = 0x0000002c;
int FILE_DEVICE_VIDEO = 0x00000023;
int FILE_DEVICE_VIRTUAL_DISK = 0x00000024;
int FILE_DEVICE_WAVE_IN = 0x00000025;
int FILE_DEVICE_WAVE_OUT = 0x00000026;
}
10 changes: 10 additions & 0 deletions contrib/platform/src/com/sun/jna/platform/win32/SetupApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ public interface SetupApi extends StdCallLibrary {
*/
int SPDRP_REMOVAL_POLICY = 0x0000001F;

/**
* Eject supported.
*/
int CM_DEVCAP_EJECTSUPPORTED = 0x00000002;

/**
* Removable.
*/
Expand Down Expand Up @@ -120,6 +125,11 @@ public interface SetupApi extends StdCallLibrary {
*/
int SPDRP_DEVICEDESC = 0x00000000;

/**
* The function retrieves a REG_SZ string that contains the friendly name of a device.
*/
int SPDRP_FRIENDLYNAME = 0xc;

/**
* The SetupDiGetClassDevs function returns a handle to a device information set that contains requested device
* information elements for a local computer.
Expand Down
15 changes: 15 additions & 0 deletions contrib/platform/src/com/sun/jna/platform/win32/WinBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,21 @@ public interface WinBase extends WinDef, BaseTSD {
int WAIT_ABANDONED = ((NTStatus.STATUS_ABANDONED_WAIT_0 ) + 0 );
int WAIT_ABANDONED_0 = ((NTStatus.STATUS_ABANDONED_WAIT_0 ) + 0 );

/**
* The standard input device. Initially, this is the console input buffer, CONIN$.
*/
DWORD STD_INPUT_HANDLE = new DWORD(-10);

/**
* The standard output device. Initially, this is the active console screen buffer, CONOUT$.
*/
DWORD STD_OUTPUT_HANDLE = new DWORD(-11);

/**
* The standard error device. Initially, this is the active console screen buffer, CONOUT$.
*/
DWORD STD_ERROR_HANDLE = new DWORD(-12);

/**
* Maximum computer name length.
* The value is 15 on Mac, 31 on everything else.
Expand Down
Loading