Provide complete information about the problem
- Version of JNA and related jars: 5.8.0
- Version and vendor of the java virtual machine: Java-11 AdoptOpenJDK
- Operating system: Windows 10
- System architecture (CPU type, bitness of the JVM): JVM: 64-bit, processor Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz, 3301 MHz, 4 Kern(e), 4 logische(r) Prozessor(en)
- Complete description of the problem:
Starting with Windows 8, the additional notification filter constant REG_NOTIFY_THREAD_AGNOSTIC has been added, which is used as possible control argument for RegNotifyChangeKeyValue's dwNotifyFilter function argument (see nf-winreg-regnotifychangekeyvalue) and whose underlying integral value has the value 0x10000000 (specified on the page linked above). This constant is currently missing in the existing set of REG_NOTIFY_CHANGE_* constants in com.sun.jna.platform.win32.WinNT. In addition to the lack of the constant, the second problem is, that for Windows systems of at least Windows 8, the existing combined constant, which is currently defined as
int REG_LEGAL_CHANGE_FILTER = REG_NOTIFY_CHANGE_NAME
| REG_NOTIFY_CHANGE_ATTRIBUTES | REG_NOTIFY_CHANGE_LAST_SET
| REG_NOTIFY_CHANGE_SECURITY;
is incorrect, because it needs to take the additional value of REG_NOTIFY_THREAD_AGNOSTIC into account.
6. Steps to reproduce:
Try to compile the following Java code:
final int notifyFilter = WinNT.REG_NOTIFY_THREAD_AGNOSTIC;
The code is rejected.
The suggested fix consists of two changes:
a) Add the following additional constant to com.sun.jna.platform.win32.WinNT:
int REG_NOTIFY_CHANGE_NAME = 0x00000001;
int REG_NOTIFY_CHANGE_ATTRIBUTES = 0x00000002;
int REG_NOTIFY_CHANGE_LAST_SET = 0x00000004;
int REG_NOTIFY_CHANGE_SECURITY = 0x00000008;
+ int REG_NOTIFY_THREAD_AGNOSTIC = 0x10000000;
b) Update the value of the existing constant REG_LEGAL_CHANGE_FILTER in com.sun.jna.platform.win32.WinNT:
int REG_LEGAL_CHANGE_FILTER = REG_NOTIFY_CHANGE_NAME
| REG_NOTIFY_CHANGE_ATTRIBUTES | REG_NOTIFY_CHANGE_LAST_SET
- | REG_NOTIFY_CHANGE_SECURITY;
+ | REG_NOTIFY_CHANGE_SECURITY | REG_NOTIFY_THREAD_AGNOSTIC;
Provide complete information about the problem
Starting with Windows 8, the additional notification filter constant
REG_NOTIFY_THREAD_AGNOSTIChas been added, which is used as possible control argument forRegNotifyChangeKeyValue'sdwNotifyFilterfunction argument (see nf-winreg-regnotifychangekeyvalue) and whose underlying integral value has the value0x10000000(specified on the page linked above). This constant is currently missing in the existing set ofREG_NOTIFY_CHANGE_*constants incom.sun.jna.platform.win32.WinNT. In addition to the lack of the constant, the second problem is, that for Windows systems of at least Windows 8, the existing combined constant, which is currently defined asis incorrect, because it needs to take the additional value of
REG_NOTIFY_THREAD_AGNOSTICinto account.6. Steps to reproduce:
Try to compile the following Java code:
The code is rejected.
The suggested fix consists of two changes:
a) Add the following additional constant to
com.sun.jna.platform.win32.WinNT:int REG_NOTIFY_CHANGE_NAME = 0x00000001; int REG_NOTIFY_CHANGE_ATTRIBUTES = 0x00000002; int REG_NOTIFY_CHANGE_LAST_SET = 0x00000004; int REG_NOTIFY_CHANGE_SECURITY = 0x00000008; + int REG_NOTIFY_THREAD_AGNOSTIC = 0x10000000;b) Update the value of the existing constant
REG_LEGAL_CHANGE_FILTERincom.sun.jna.platform.win32.WinNT:int REG_LEGAL_CHANGE_FILTER = REG_NOTIFY_CHANGE_NAME | REG_NOTIFY_CHANGE_ATTRIBUTES | REG_NOTIFY_CHANGE_LAST_SET - | REG_NOTIFY_CHANGE_SECURITY; + | REG_NOTIFY_CHANGE_SECURITY | REG_NOTIFY_THREAD_AGNOSTIC;