File tree Expand file tree Collapse file tree
contrib/platform/test/com/sun/jna/platform/win32 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -519,7 +519,16 @@ public void testReportEvent() {
519519 String applicationEventLog = "SYSTEM\\ CurrentControlSet\\ Services\\ EventLog\\ Application" ;
520520 String jnaEventSource = "JNADevEventSource" ;
521521 String jnaEventSourceRegistryPath = applicationEventLog + "\\ " + jnaEventSource ;
522- Advapi32Util .registryCreateKey (WinReg .HKEY_LOCAL_MACHINE , jnaEventSourceRegistryPath );
522+ // ignore test if not able to create key (need to be administrator to do this).
523+ try {
524+ final boolean keyCreated = Advapi32Util .registryCreateKey (WinReg .HKEY_LOCAL_MACHINE , jnaEventSourceRegistryPath );
525+ if (!keyCreated ) {
526+ return ;
527+ }
528+ } catch (Win32Exception e ) {
529+ return ;
530+ }
531+
523532 HANDLE h = Advapi32 .INSTANCE .RegisterEventSource (null , jnaEventSource );
524533 IntByReference before = new IntByReference ();
525534 assertTrue (Advapi32 .INSTANCE .GetNumberOfEventLogRecords (h , before ));
You can’t perform that action at this time.
0 commit comments