Browse Source

Initial commit

pEpMIME_windows
Thomas 3 years ago
parent
commit
33d5110297
4 changed files with 188 additions and 42 deletions
  1. +145
    -17
      build-windows/pEpEngine.vcxproj
  2. +27
    -21
      build-windows/pEpEngine.vcxproj.filters
  3. +4
    -0
      build-windows/packages.config
  4. +12
    -4
      src/pgp_sequoia.c

+ 145
- 17
build-windows/pEpEngine.vcxproj View File

@ -5,10 +5,18 @@
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{146E69F8-E1DA-456A-B048-6DD29D9ACF6B}</ProjectGuid>
@ -23,6 +31,12 @@
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
@ -30,56 +44,127 @@
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<RunCodeAnalysis>false</RunCodeAnalysis>
<IncludePath>$(ProjectDir)\..\..\libetpan\build-windows\include;C:\Program Files %28x86%29\GnuPG\include;$(IncludePath);$(ProjectDir)\asn.1;%ASN1C%\share\asn1c</IncludePath>
<LibraryPath>$(ProjectDir)\..\..\libetpan\build-windows\Debug;$(LibraryPath)</LibraryPath>
<IncludePath>$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
<PreBuildEventUseInBuild>true</PreBuildEventUseInBuild>
<PreLinkEventUseInBuild>true</PreLinkEventUseInBuild>
<PostBuildEventUseInBuild>true</PostBuildEventUseInBuild>
<CodeAnalysisRuleSet>C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\Rule Sets\NativeRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Linkage-libiconv>
</Linkage-libiconv>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<RunCodeAnalysis>false</RunCodeAnalysis>
<IncludePath>$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
<PreBuildEventUseInBuild>true</PreBuildEventUseInBuild>
<PreLinkEventUseInBuild>true</PreLinkEventUseInBuild>
<PostBuildEventUseInBuild>true</PostBuildEventUseInBuild>
<CodeAnalysisRuleSet>C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\Rule Sets\NativeRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Linkage-libiconv>
</Linkage-libiconv>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(ProjectDir)\..\..\libetpan\build-windows\include;C:\Program Files %28x86%29\GnuPG\include;$(IncludePath);$(ProjectDir)\asn.1;%ASN1C%\share\asn1c</IncludePath>
<LibraryPath>$(ProjectDir)\..\..\libetpan\build-windows\Release;$(LibraryPath)</LibraryPath>
<IncludePath>$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
<PreBuildEventUseInBuild>true</PreBuildEventUseInBuild>
<PreLinkEventUseInBuild>true</PreLinkEventUseInBuild>
<PostBuildEventUseInBuild>true</PostBuildEventUseInBuild>
<CodeAnalysisRuleSet>C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\Rule Sets\NativeRecommendedRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>false</RunCodeAnalysis>
<Linkage-libiconv>
</Linkage-libiconv>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath>
<PreBuildEventUseInBuild>true</PreBuildEventUseInBuild>
<PreLinkEventUseInBuild>true</PreLinkEventUseInBuild>
<PostBuildEventUseInBuild>true</PostBuildEventUseInBuild>
<CodeAnalysisRuleSet>C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\Rule Sets\NativeRecommendedRules.ruleset</CodeAnalysisRuleSet>
<RunCodeAnalysis>false</RunCodeAnalysis>
<Linkage-libiconv>
</Linkage-libiconv>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;PEPENGINE_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;PEPENGINE_EXPORTS;_CRT_SECURE_NO_WARNINGS;USE_SEQUOIA;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<EnablePREfast>false</EnablePREfast>
<AdditionalIncludeDirectories>$(SolutionDir)Tools\asn1c\share\asn1c;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)Tools\asn1c\share\asn1c;$(SolutionDir)sequoia\openpgp-ffi\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>4703</DisableSpecificWarnings>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>sequoia_openpgp_ffi.lib;gmp.lib;nettle.lib;hogweed.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ShowProgress>NotSet</ShowProgress>
<AdditionalLibraryDirectories>$(SolutionDir)sequoia\target\debug;$(SolutionDir)Dependencies\sequoia\lib</AdditionalLibraryDirectories>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<SuppressStartupBanner>false</SuppressStartupBanner>
</Link>
<PreBuildEvent>
<Command>
</Command>
<Command>cargo build --manifest-path="$(SolutionDir)sequoia\Cargo.toml" -p sequoia-openpgp-ffi</Command>
<Message>
</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;PEPENGINE_EXPORTS;_CRT_SECURE_NO_WARNINGS;USE_SEQUOIA;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<EnablePREfast>false</EnablePREfast>
<AdditionalIncludeDirectories>$(SolutionDir)Tools\asn1c\share\asn1c;$(SolutionDir)libetpan\build-windows\include;$(SolutionDir)sequoia\openpgp-ffi\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>4703</DisableSpecificWarnings>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>sequoia_openpgp_ffi.lib;gmp.lib;nettle.lib;hogweed.lib;ws2_32.lib;userenv.lib;dbghelp.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ShowProgress>NotSet</ShowProgress>
<AdditionalLibraryDirectories>$(SolutionDir)sequoia\target\debug;$(SolutionDir)Dependencies\sequoia\lib</AdditionalLibraryDirectories>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<SuppressStartupBanner>false</SuppressStartupBanner>
</Link>
<PreBuildEvent>
<Command>cargo build --manifest-path="$(SolutionDir)sequoia\Cargo.toml" -p sequoia-openpgp-ffi</Command>
<Message>
</Message>
</PreBuildEvent>
@ -91,25 +176,57 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;PEPENGINE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;PEPENGINE_EXPORTS;USE_SEQUOIA;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>false</SDLCheck>
<TreatWarningAsError>false</TreatWarningAsError>
<AdditionalIncludeDirectories>$(SolutionDir)Tools\asn1c\share\asn1c;$(SolutionDir)sequoia\openpgp-ffi\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>Default</CompileAs>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ControlFlowGuard>Guard</ControlFlowGuard>
<EnablePREfast>false</EnablePREfast>
<DisableSpecificWarnings>4703</DisableSpecificWarnings>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>sequoia_openpgp_ffi.lib;gmp.lib;nettle.lib;hogweed.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)sequoia\target\release;$(SolutionDir)Dependencies\sequoia\lib</AdditionalLibraryDirectories>
</Link>
<PreBuildEvent>
<Command>cargo build --manifest-path="$(SolutionDir)sequoia\Cargo.toml" --release -p sequoia-openpgp-ffi</Command>
<Message>
</Message>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;PEPENGINE_EXPORTS;USE_SEQUOIA;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>false</SDLCheck>
<TreatWarningAsError>false</TreatWarningAsError>
<AdditionalIncludeDirectories>$(SolutionDir)Tools\asn1c\share\asn1c;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)Tools\asn1c\share\asn1c;$(SolutionDir)libetpan\build-windows\include;$(SolutionDir)sequoia\openpgp-ffi\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CompileAs>Default</CompileAs>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ControlFlowGuard>Guard</ControlFlowGuard>
<EnablePREfast>false</EnablePREfast>
<DisableSpecificWarnings>4703</DisableSpecificWarnings>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>sequoia_openpgp_ffi.lib;gmp.lib;nettle.lib;hogweed.lib;ws2_32.lib;userenv.lib;dbghelp.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(SolutionDir)sequoia\target\release;$(SolutionDir)Dependencies\sequoia\lib</AdditionalLibraryDirectories>
</Link>
<PreBuildEvent>
<Command>
</Command>
<Command>cargo build --manifest-path="$(SolutionDir)sequoia\Cargo.toml" --release -p sequoia-openpgp-ffi</Command>
<Message>
</Message>
</PreBuildEvent>
@ -135,7 +252,7 @@
<ClCompile Include="..\src\openpgp_compat.c" />
<ClCompile Include="..\src\pEpEngine.c" />
<ClCompile Include="..\src\pEp_string.c" />
<ClCompile Include="..\src\pgp_gpg.c" />
<ClCompile Include="..\src\pgp_sequoia.c" />
<ClCompile Include="..\src\platform_windows.cpp" />
<ClCompile Include="..\src\resource_id.c" />
<ClCompile Include="..\src\sqlite3.c" />
@ -161,6 +278,7 @@
<ClInclude Include="..\src\dynamic_api.h" />
<ClInclude Include="..\src\email.h" />
<ClInclude Include="..\src\etpan_mime.h" />
<ClInclude Include="..\src\fsm_common.h" />
<ClInclude Include="..\src\growing_buf.h" />
<ClInclude Include="..\src\identity_list.h" />
<ClInclude Include="..\src\keymanagement.h" />
@ -175,8 +293,8 @@
<ClInclude Include="..\src\pEpEngine.h" />
<ClInclude Include="..\src\pEp_internal.h" />
<ClInclude Include="..\src\pEp_string.h" />
<ClInclude Include="..\src\pgp_gpg.h" />
<ClInclude Include="..\src\pgp_gpg_internal.h" />
<ClInclude Include="..\src\pgp_sequoia.h" />
<ClInclude Include="..\src\pgp_sequoia_internal.h" />
<ClInclude Include="..\src\platform.h" />
<ClInclude Include="..\src\platform_windows.h" />
<ClInclude Include="..\src\resource.h" />
@ -205,7 +323,17 @@
<Project>{9a67164d-b8f8-4601-a24b-28afe774d41c}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\..\packages\boost.1.70.0.0\build\boost.targets" Condition="Exists('..\..\packages\boost.1.70.0.0\build\boost.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\boost.1.70.0.0\build\boost.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\boost.1.70.0.0\build\boost.targets'))" />
</Target>
</Project>

+ 27
- 21
build-windows/pEpEngine.vcxproj.filters View File

@ -33,9 +33,6 @@
<ClCompile Include="..\src\cryptotech.c">
<Filter>Quelldateien</Filter>
</ClCompile>
<ClCompile Include="..\src\pgp_gpg.c">
<Filter>Quelldateien</Filter>
</ClCompile>
<ClCompile Include="..\src\email.c">
<Filter>Quelldateien</Filter>
</ClCompile>
@ -54,9 +51,6 @@
<ClCompile Include="..\src\bloblist.c">
<Filter>Quelldateien</Filter>
</ClCompile>
<ClCompile Include="..\src\etpan_mime.c">
<Filter>Quelldateien</Filter>
</ClCompile>
<ClCompile Include="..\src\identity_list.c">
<Filter>Quelldateien</Filter>
</ClCompile>
@ -120,6 +114,12 @@
<ClCompile Include="..\src\base64.c">
<Filter>Quelldateien</Filter>
</ClCompile>
<ClCompile Include="..\src\pgp_sequoia.c">
<Filter>Quelldateien</Filter>
</ClCompile>
<ClCompile Include="..\src\etpan_mime.c">
<Filter>Quelldateien</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\src\keymanagement.h">
@ -140,15 +140,9 @@
<ClInclude Include="..\src\cryptotech.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="..\src\pgp_gpg.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="..\src\pEp_internal.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="..\src\pgp_gpg_internal.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="..\src\resource.h">
<Filter>Ressourcendateien</Filter>
</ClInclude>
@ -176,9 +170,6 @@
<ClInclude Include="..\src\dynamic_api.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="..\src\etpan_mime.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="..\src\identity_list.h">
<Filter>Headerdateien</Filter>
</ClInclude>
@ -236,12 +227,6 @@
<ClInclude Include="..\src\Sync_event.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="..\src\Sync_func.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="..\src\Sync_impl.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="..\src\growing_buf.h">
<Filter>Headerdateien</Filter>
</ClInclude>
@ -257,8 +242,29 @@
<ClInclude Include="..\src\KeySync_fsm.h">
<Filter>Quelldateien</Filter>
</ClInclude>
<ClInclude Include="..\src\fsm_common.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="..\src\pgp_sequoia.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="..\src\pgp_sequoia_internal.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="..\src\Sync_func.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="..\src\Sync_impl.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="..\src\etpan_mime.h">
<Filter>Headerdateien</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Text Include="..\LICENSE.txt" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
</Project>

+ 4
- 0
build-windows/packages.config View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="boost" version="1.70.0.0" targetFramework="native" />
</packages>

+ 12
- 4
src/pgp_sequoia.c View File

@ -7,7 +7,7 @@
#include "platform.h"
#include "pEp_internal.h"
#include "pgp_gpg.h"
#include "pgp_sequoia.h"
#include <limits.h>
#include <sys/stat.h>
@ -124,18 +124,26 @@ PEP_STATUS pgp_init(PEP_SESSION session, bool in_first)
PEP_STATUS status = PEP_STATUS_OK;
// Create the home directory.
char *home_env = getenv("HOME");
#ifdef _WIN32
char *home_env = getenv("LOCALAPPDATA");
#else
char *home_env = getenv("HOME");
#endif
if (!home_env)
ERROR_OUT(NULL, PEP_INIT_GPGME_INIT_FAILED, "HOME unset");
// Create the DB and initialize it.
size_t path_size = strlen(home_env)+13+1;
size_t path_size = strlen(home_env)+18;
char *path = (char *) calloc(1, path_size);
assert(path);
if (!path)
ERROR_OUT(NULL, PEP_OUT_OF_MEMORY, "out of memory");
int r = snprintf(path, path_size, "%s/.pEp_keys.db", home_env);
#ifdef _WIN32
int r = snprintf(path, path_size, "%s\\pEp\\.pEp_keys.db", home_env);
#else
int r = snprintf(path, path_size, "%s/.pEp_keys.db", home_env);
#endif
assert(r >= 0 && r < path_size);
if (r < 0)
ERROR_OUT(NULL, PEP_UNKNOWN_ERROR, "snprintf");


Loading…
Cancel
Save