diff --git a/build-windows/generate_code.cmd b/build-windows/generate_code.cmd
index a1bc1adb..fd83acd5 100644
--- a/build-windows/generate_code.cmd
+++ b/build-windows/generate_code.cmd
@@ -8,6 +8,7 @@ SET engine_directory=%current_directory:~0,-14%
:: YML2 directory is ...\pEpForWindowsAdapterSolution\yml2\
SET yml2_directory=%engine_directory:~0,-11%\yml2
+SET YML2PROC="%yml2_directory%\yml2proc"
:: Create the system.db
PUSHD %engine_directory%\db
@@ -16,15 +17,36 @@ IF NOT EXIST "%ProgramData%\pEp" "MKDIR %ProgramData%\pEp"
DEL "%ProgramData%\pEp\system.db"
MOVE system.db "%ProgramData%\pEp\system.db"
-:: Generate code in ...\pEpEngine\codegen
-CD ..\codegen
-
:: Make sure YML2 is installed
PY -m pip install --upgrade pip
PY -m pip install wheel
PY -m pip install yml2
-SET YML2PROC="%yml2_directory%\yml2proc"
+:: Generate code in ...\libpEpTransport\src
+CD ..\..\libpEpTransport\src
+
+IF NOT EXIST generated MKDIR generated
+
+PY %YML2PROC% -E utf-8 -y gen_c.ysl2 transport_status_code.yml2 -o generated\transport_status_code.h
+IF %ERRORLEVEL% NEQ 0 GOTO end
+
+PY %YML2PROC% -E utf-8 -y gen_strings.ysl2 transport_status_code.yml2 -o generated\transport_status_code.c
+IF %ERRORLEVEL% NEQ 0 GOTO end
+
+PY %YML2PROC% -E utf-8 -y gen_objc.ysl2 transport_status_code.yml2 -o generated\PEPTransportStatusCode.h
+IF %ERRORLEVEL% NEQ 0 GOTO end
+
+PY %YML2PROC% -E utf-8 -y gen_kotlin.ysl2 transport_status_code.yml2 -o generated\TransportStatusCode.kt
+IF %ERRORLEVEL% NEQ 0 GOTO end
+
+PY %YML2PROC% -E utf-8 -y gen_cs.ysl2 transport_status_code.yml2 -o generated\TransportStatusCode.cs
+IF %ERRORLEVEL% NEQ 0 GOTO end
+
+XCOPY /y generated\*.c ..\..\pEpEngine\src\
+XCOPY /y generated\*.h ..\..\pEpEngine\src\
+
+:: Generate code in ...\pEpEngine\codegen
+CD ..\..\pEpEngine\codegen
:: Generate the Sync code
IF NOT EXIST generated MKDIR generated
@@ -66,10 +88,20 @@ CD %engine_directory%\asn.1
DEL *.h
DEL *.c
-..\..\Tools\asn1c\bin\asn1c -S ../../Tools/asn1c/share/asn1c -gen-PER -fincludes-quoted -fcompound-names -pdu=auto pEp.asn1 keysync.asn1 sync.asn1 trustsync.asn1 groupsync.asn1 managedgroup.asn1 keyreset.asn1 distribution.asn1 exploration.asn1
+..\..\Tools\asn1c\bin\asn1c -S ../../Tools/asn1c/share/asn1c -gen-PER -fincludes-quoted -fcompound-names -pdu=auto pEp.asn1 sync.asn1 keysync.asn1 trustsync.asn1 groupsync.asn1 distribution.asn1 keyreset.asn1 managedgroup.asn1 exploration.asn1
+type nul >> "Sync.c"
+IF %ERRORLEVEL% NEQ 0 GOTO end
+
+..\..\Tools\asn1c\bin\asn1c -S ../../Tools/asn1c/share/asn1c -gen-PER -fincludes-quoted -fcompound-names -pdu=auto pEp.asn1 sync.asn1 keysync.asn1 trustsync.asn1 groupsync.asn1
+type nul >> "Distribution.c"
+IF %ERRORLEVEL% NEQ 0 GOTO end
+
+..\..\Tools\asn1c\bin\asn1c -S ../../Tools/asn1c/share/asn1c -gen-PER -fincludes-quoted -fcompound-names -pdu=auto pEp.asn1 storage.asn1 messagestorage.asn1
+type nul >> "Storage.c"
IF %ERRORLEVEL% NEQ 0 GOTO end
-..\..\Tools\asn1c\bin\asn1c -S ../../Tools/asn1c/share/asn1c -gen-PER -fincludes-quoted -fcompound-names -pdu=auto pEp.asn1 keyreset.asn1 distribution.asn1 managedgroup.asn1 exploration.asn1
+..\..\Tools\asn1c\bin\asn1c -S ../../Tools/asn1c/share/asn1c -gen-PER -fincludes-quoted -fcompound-names -pdu=auto pEp.asn1 message.asn1
+type nul >> "ASN1Message.c"
IF %ERRORLEVEL% NEQ 0 GOTO end
DEL *-sample.c
@@ -77,6 +109,7 @@ DEL *-sample.c
CD %engine_directory%\..
MKDIR pEp
XCOPY pEpEngine\src\*.h pEp\ /Y/F/I
+XCOPY libpEpAdapter\src\*.h pEp\ /Y/F/I
XCOPY libpEpAdapter\src\*.hh pEp\ /Y/F/I
XCOPY libpEpAdapter\src\*.hxx pEp\ /Y/F/I
diff --git a/build-windows/libpEpasn1/libpEpasn1.vcxproj b/build-windows/libpEpasn1/libpEpasn1.vcxproj
index 687df776..bc9ceaef 100644
--- a/build-windows/libpEpasn1/libpEpasn1.vcxproj
+++ b/build-windows/libpEpasn1/libpEpasn1.vcxproj
@@ -55,7 +55,7 @@
Level3
Disabled
WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)
- $(ProjectDir)..\..\asn.1
+ $(ProjectDir)..\..\asn.1;$(SolutionDir)pEp
Windows
diff --git a/build-windows/pEpEngine.vcxproj b/build-windows/pEpEngine.vcxproj
index e5a6ac10..d649c106 100644
--- a/build-windows/pEpEngine.vcxproj
+++ b/build-windows/pEpEngine.vcxproj
@@ -72,7 +72,7 @@
WIN32;_DEBUG;_WINDOWS;_USRDLL;PEPENGINE_EXPORTS;_CRT_SECURE_NO_WARNINGS;USE_SEQUOIA;%(PreprocessorDefinitions)
true
false
- $(SolutionDir)libetpan\build-windows\include;$(SolutionDir)Tools\asn1c\share\asn1c;$(SolutionDir)sequoia\openpgp-ffi\include;%(AdditionalIncludeDirectories)
+ $(SolutionDir)pEpEngine\asn.1;$(SolutionDir);$(SolutionDir)libetpan\build-windows\include;$(SolutionDir)Tools\asn1c\share\asn1c;$(SolutionDir)sequoia\openpgp-ffi\include;%(AdditionalIncludeDirectories)
Default
4703
@@ -103,7 +103,7 @@
WIN32;NDEBUG;_WINDOWS;_USRDLL;PEPENGINE_EXPORTS;USE_SEQUOIA;%(PreprocessorDefinitions)
false
false
- $(SolutionDir)libetpan\build-windows\include;$(SolutionDir)Tools\asn1c\share\asn1c;$(SolutionDir)sequoia\openpgp-ffi\include;%(AdditionalIncludeDirectories)
+ $(SolutionDir);$(SolutionDir)libetpan\build-windows\include;$(SolutionDir)Tools\asn1c\share\asn1c;$(SolutionDir)sequoia\openpgp-ffi\include;%(AdditionalIncludeDirectories)
Default
true
Guard
diff --git a/src/platform_windows.h b/src/platform_windows.h
index 3c7be772..4621721f 100644
--- a/src/platform_windows.h
+++ b/src/platform_windows.h
@@ -41,6 +41,8 @@
#include
#include "timestamp.h"
+#define timezone _timezone
+
// pEp files and directories
#ifndef PER_USER_DIRECTORY