From 58f53575eba53bdffef24ac82e6412c03a6fe0b8 Mon Sep 17 00:00:00 2001 From: MASES Public Developers Team <94312179+masesdevelopers@users.noreply.github.com> Date: Mon, 23 Dec 2024 01:22:28 +0100 Subject: [PATCH] https://github.com/masesgroup/JNet/issues/582#issuecomment-2558645189: Update documentation (#584) --- src/README.md | 1 + src/documentation/articles/usage.md | 12 +++++++++++- src/documentation/articles/usageCLI.md | 6 ++++++ src/documentation/articles/usageReflector.md | 15 ++++++++++++--- 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/README.md b/src/README.md index 31c44a0a9e..fdc013bd53 100644 --- a/src/README.md +++ b/src/README.md @@ -36,6 +36,7 @@ The configuration is: "java.awt.peer" ], "ClassesToBeListener": [ + "java.lang.Runnable", "javax.swing.Action", "javax.management.NotificationFilter" ], diff --git a/src/documentation/articles/usage.md b/src/documentation/articles/usage.md index e618bbd8ed..1ec1a71bd3 100644 --- a/src/documentation/articles/usage.md +++ b/src/documentation/articles/usage.md @@ -60,7 +60,7 @@ From .NET 9 preview 6, [CET is enabled by default on supported hardware](https:/ If the application, upon startup, fails with the error 0xc0000409 (subcode 0x30) it was compiled with CET enabled and it fails during JVM initialization. -To solve the issue there are three possible solutions: +To solve the issue there are four possible solutions: 1. use a .NET version, e.g. 8, that does not enable CET by default 2. Add the following snippet to disable CET on executable (templates available for JNet are ready made and solve this issue): @@ -81,6 +81,16 @@ To solve the issue there are three possible solutions: MyApplication.exe ``` +4. If you want to run the classic application execute the following command: + + ```sh + reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\MyApplication.exe" /v MitigationOptions /t REG_BINARY /d "0000000000000000000000000000002000" /f +``` +then run: + ```sh + MyApplication.exe +``` + ## Basic example Below a basic example which demonstrates how to create a program based on JNet and some other features available like generics and exception handling. diff --git a/src/documentation/articles/usageCLI.md b/src/documentation/articles/usageCLI.md index 5ea9d00fe4..2c96fcf6bf 100644 --- a/src/documentation/articles/usageCLI.md +++ b/src/documentation/articles/usageCLI.md @@ -24,6 +24,12 @@ To use the CLI interface (JNetCLI) runs a command like the following: jnet -i ``` +> [!IMPORTANT] +> If the previous command raises the error described in [Intel CET and KNet](usage.md#intel-cet-and-knet) the only solution is to apply the following workaround and disable CET: +> ```sh +> reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\jnet.exe" /v MitigationOptions /t REG_BINARY /d "0000000000000000000000000000002000" /f +> ``` + - **Docker image** ```sh diff --git a/src/documentation/articles/usageReflector.md b/src/documentation/articles/usageReflector.md index 6b180e2b5e..cdb47d0f8a 100644 --- a/src/documentation/articles/usageReflector.md +++ b/src/documentation/articles/usageReflector.md @@ -21,9 +21,15 @@ To use JNetReflector runs a command like the following: jnetreflector -OriginRootPath C:\\myJars -OriginJavadocUrl \"https://thehost/javadoc/\" -JavadocVersion 11 -DestinationRootPath C:\\ReflectionDestination ``` +> [!IMPORTANT] +> If the previous command raises the error described in [Intel CET and KNet](usage.md#intel-cet-and-knet) the only solution is to apply the following workaround and disable CET: +> ```sh +> reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\jnetreflector.exe" /v MitigationOptions /t REG_BINARY /d "0000000000000000000000000000002000" /f +> ``` + ## Command switches available -_jnr_ accepts the following command-line switch: +_jnetreflector_ accepts the following command-line switch: * **ConfigurationFile**: The path where is stored a JSON file containing the tool configuration properties; the JSON items shall be written using the same command-line property names * **CopyrightFile**: The path where the tool will locate copyright info @@ -107,14 +113,17 @@ The options used are: "java.awt.peer" ], "ClassesToBeListener": [ + "java.lang.Runnable", "javax.swing.Action", "javax.management.NotificationFilter" ], + "ClassesManuallyDeveloped": [ + "java.util.Comparator", + "java.util.EventListener" + ], "ClassesToAvoid": [ "java.lang.ProcessBuilder$Redirect$Type", "java.lang.Thread$UncaughtExceptionHandler", - "java.util.Comparator", - "java.util.EventListener", "java.util.stream.DoubleStream$Builder", "java.util.stream.IntStream$Builder", "java.util.stream.LongStream$Builder",