diff --git a/.gitignore b/.gitignore
index 4dc216c..1b8fd1b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -89,5 +89,12 @@ org.tar.gz
android/external/[?]*
android/external/build
+
+# Ignore Windows build
+build-windows/Debug
+build-windows/Release
+build-windows/.vs
+build-windows/pEpJNIAdapter.vcxproj.user
+
# Default ignored files
?idea/
diff --git a/build-windows/generate_code.cmd b/build-windows/generate_code.cmd
new file mode 100644
index 0000000..230158a
--- /dev/null
+++ b/build-windows/generate_code.cmd
@@ -0,0 +1,38 @@
+@ECHO OFF
+
+SET current_directory=%~dp0
+SET dist_directory=%current_directory:~0,-15%\dist
+SET marker_dir=%current_directory:~0,-15%\build\marker
+SET exceptions_directory=%current_directory:~0,-15%\src\java\foundation\pEp\jniadapter\exceptions
+SET java_build_root=%current_directory:~0,-15%\build\java
+SET java_pkg_basename=foundation\pEp\jniadapter
+
+:: Create directories as necessary
+MKDIR %marker_dir%
+MKDIR %exceptions_directory%
+
+:: Generate YML2 code
+PUSHD ..
+CD src
+CD codegen
+
+@ECHO ON
+PY -m yml2.yml2proc -E utf-8 -y gen_java_Engine.ysl2 pEp.yml2
+PY -m yml2.yml2proc -E utf-8 -y gen_java_Message.ysl2 pEp.yml2
+PY -m yml2.yml2proc -E utf-8 -y gen_cpp_Engine.ysl2 pEp.yml2
+PY -m yml2.yml2proc -E utf-8 -y gen_cpp_Message.ysl2 pEp.yml2
+PY -m yml2.yml2proc -E utf-8 -y gen_throw_pEp_exception.ysl2 pEp.yml2
+@ECHO OFF
+
+:: Compile the Java part
+CD ..
+CD java
+
+javac -encoding UTF-8 -d "%java_build_root%" -h ..\cxx %java_pkg_basename%\*.java
+javac -encoding UTF-8 -d "%java_build_root%" %java_pkg_basename%\*.java
+javac -encoding UTF-8 -d "%java_build_root%" %java_pkg_basename%\exceptions\*.java
+javac -encoding UTF-8 -d "%java_build_root%" %java_pkg_basename%\interfaces\*.java
+
+"C:\Program Files\Java\jdk-16\bin\jar" -cvf ..\..\build\java\pEp.jar -C "%java_build_root%" foundation
+
+POPD
diff --git a/build-windows/pEpJNIAdapter.sln b/build-windows/pEpJNIAdapter.sln
new file mode 100644
index 0000000..0ca7783
--- /dev/null
+++ b/build-windows/pEpJNIAdapter.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31410.357
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pEpJNIAdapter", "pEpJNIAdapter.vcxproj", "{2A1167BE-F438-4E08-B32E-25F130D97C33}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {2A1167BE-F438-4E08-B32E-25F130D97C33}.Debug|x64.ActiveCfg = Debug|x64
+ {2A1167BE-F438-4E08-B32E-25F130D97C33}.Debug|x64.Build.0 = Debug|x64
+ {2A1167BE-F438-4E08-B32E-25F130D97C33}.Debug|x86.ActiveCfg = Debug|Win32
+ {2A1167BE-F438-4E08-B32E-25F130D97C33}.Debug|x86.Build.0 = Debug|Win32
+ {2A1167BE-F438-4E08-B32E-25F130D97C33}.Release|x64.ActiveCfg = Release|x64
+ {2A1167BE-F438-4E08-B32E-25F130D97C33}.Release|x64.Build.0 = Release|x64
+ {2A1167BE-F438-4E08-B32E-25F130D97C33}.Release|x86.ActiveCfg = Release|Win32
+ {2A1167BE-F438-4E08-B32E-25F130D97C33}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {429CC90F-89C3-4737-918E-5BCEC8C5C485}
+ EndGlobalSection
+EndGlobal
diff --git a/build-windows/pEpJNIAdapter.vcxproj b/build-windows/pEpJNIAdapter.vcxproj
new file mode 100644
index 0000000..7745414
--- /dev/null
+++ b/build-windows/pEpJNIAdapter.vcxproj
@@ -0,0 +1,210 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {ec44fec9-2f3a-4a0c-b60e-0f22aa43ef58}
+
+
+ {146e69f8-e1da-456a-b048-6dd29d9acf6b}
+
+
+
+ 16.0
+ Win32Proj
+ {2a1167be-f438-4e08-b32e-25f130d97c33}
+ pEpJNIAdapter
+ 10.0
+
+
+
+ DynamicLibrary
+ true
+ v142
+ Unicode
+
+
+ DynamicLibrary
+ false
+ v142
+ true
+ Unicode
+
+
+ DynamicLibrary
+ true
+ v142
+ Unicode
+
+
+ DynamicLibrary
+ false
+ v142
+ true
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ $(ProjectDir)..\..\pEpForWindowsAdapterSolution\Debug\;$(LibraryPath)
+
+
+ false
+
+
+ true
+
+
+ false
+
+
+
+ Level3
+ true
+ __LP64__;WIN32;_DEBUG;PEPJNIADAPTER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ true
+ NotUsing
+
+
+ C:\Program Files\Java\jdk-16\include\win32;C:\Program Files\Java\jdk-16\include;$(ProjectDir)..\..\pEpForWindowsAdapterSolution\
+
+
+ Windows
+ true
+ false
+
+
+ IF NOT EXIST "..\build" CALL generate_code.cmd
+
+
+
+
+ Level3
+ true
+ true
+ true
+ __LP64__;WIN32;NDEBUG;PEPJNIADAPTER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ true
+ NotUsing
+
+
+ C:\Program Files\Java\jdk-16\include\win32;C:\Program Files\Java\jdk-16\include;$(ProjectDir)..\..\pEpForWindowsAdapterSolution\
+
+
+ Windows
+ true
+ true
+ true
+ false
+
+
+ IF NOT EXIST "..\build" CALL generate_code.cmd
+
+
+
+
+ Level3
+ true
+ _DEBUG;PEPJNIADAPTER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ true
+ NotUsing
+
+
+ C:\Program Files\Java\jdk-16\include\win32;C:\Program Files\Java\jdk-16\include;$(ProjectDir)..\..\pEpForWindowsAdapterSolution\
+
+
+ Windows
+ true
+ false
+
+
+ IF NOT EXIST "..\build" CALL generate_code.cmd
+
+
+
+
+ Level3
+ true
+ true
+ true
+ NDEBUG;PEPJNIADAPTER_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ true
+ NotUsing
+
+
+ C:\Program Files\Java\jdk-16\include\win32;C:\Program Files\Java\jdk-16\include;$(ProjectDir)..\..\pEpForWindowsAdapterSolution\
+
+
+ Windows
+ true
+ true
+ true
+ false
+
+
+ IF NOT EXIST "..\build" CALL generate_code.cmd
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/build-windows/pEpJNIAdapter.vcxproj.filters b/build-windows/pEpJNIAdapter.vcxproj.filters
new file mode 100644
index 0000000..952024d
--- /dev/null
+++ b/build-windows/pEpJNIAdapter.vcxproj.filters
@@ -0,0 +1,75 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+
\ No newline at end of file
diff --git a/src/cxx/jniutils.cc b/src/cxx/jniutils.cc
index 3d3b2ad..82b1de4 100644
--- a/src/cxx/jniutils.cc
+++ b/src/cxx/jniutils.cc
@@ -237,7 +237,6 @@ jbyteArray from_string(JNIEnv *env,
const char *str)
{
if (str && str[0]) {
- jboolean isCopy;
size_t l = strlen(str);
jbyteArray _str = env->NewByteArray(l);
env->SetByteArrayRegion(_str, 0, l, (jbyte *) str);
diff --git a/src/cxx/jniutils.hh b/src/cxx/jniutils.hh
index 747d55a..0b346b1 100644
--- a/src/cxx/jniutils.hh
+++ b/src/cxx/jniutils.hh
@@ -10,6 +10,7 @@
#include
#include
#include
+#include
#if 0 // Enable if log needed
#include