--- /dev/null
+++ b/MSVC/secp256k1.vcxproj
@@ -0,0 +1,252 @@
+﻿<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{F9B2C8DE-71B0-401B-84FB-57EA34E9CB6C}</ProjectGuid>
+    <RootNamespace>secp256k1</RootNamespace>
+    <WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v141</PlatformToolset>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v141</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v141</PlatformToolset>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v141</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="Shared">
+  </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 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 Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <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|x64'">
+    <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)'=='Release|x64'">
+    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <SDLCheck>true</SDLCheck>
+      <ProgramDataBaseFileName>$(OutDir)\lib\x86\$(ProjectName).pdb</ProgramDataBaseFileName>
+      <AdditionalIncludeDirectories>$(ProjectDir)..\;$(ProjectDir)..\include;$(OutDir)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalOptions>/sdl- %(AdditionalOptions)</AdditionalOptions>
+      <DisableSpecificWarnings>4244;4267;4146;</DisableSpecificWarnings>
+      <PreprocessorDefinitions>VERIFY;USE_NUM_GMP;USE_FIELD_10X26;USE_FIELD_INV_NUM;USE_SCALAR_8X32;USE_SCALAR_INV_NUM;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Lib>
+      <OutputFile>$(OutDir)\lib\x86\$(TargetName)$(TargetExt)</OutputFile>
+    </Lib>
+    <PostBuildEvent>
+      <Command>mkdir "$(OutDir)"include
+
+xcopy /S /Y $(ProjectDir)..\include\*.h "$(OutDir)"include
+
+</Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <SDLCheck>true</SDLCheck>
+      <ProgramDataBaseFileName>$(OutDir)\lib\x64\$(ProjectName).pdb</ProgramDataBaseFileName>
+      <AdditionalIncludeDirectories>$(ProjectDir)..\;$(ProjectDir)..\include;$(OutDir)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalOptions>/sdl- %(AdditionalOptions)</AdditionalOptions>
+      <DisableSpecificWarnings>4244;4267;4146;</DisableSpecificWarnings>
+      <PreprocessorDefinitions>USE_NUM_GMP;USE_FIELD_10X26;USE_FIELD_INV_NUM;USE_SCALAR_8X32;USE_SCALAR_INV_NUM;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Lib>
+      <OutputFile>$(OutDir)\lib\x64\$(TargetName)$(TargetExt)</OutputFile>
+    </Lib>
+    <PostBuildEvent>
+      <Command>mkdir "$(OutDir)"include
+
+xcopy /S /Y $(ProjectDir)..\include\*.h "$(OutDir)"include
+
+</Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <ProgramDataBaseFileName>$(OutDir)\lib\x86\$(ProjectName).pdb</ProgramDataBaseFileName>
+      <AdditionalIncludeDirectories>$(ProjectDir)..\;$(ProjectDir)..\include;$(OutDir)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalOptions>/sdl- %(AdditionalOptions)</AdditionalOptions>
+      <DisableSpecificWarnings>4244;4267;4146;</DisableSpecificWarnings>
+      <PreprocessorDefinitions>VERIFY;USE_NUM_GMP;USE_FIELD_10X26;USE_FIELD_INV_NUM;USE_SCALAR_8X32;USE_SCALAR_INV_NUM;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+    </Link>
+    <Lib>
+      <OutputFile>$(OutDir)\lib\x86\$(TargetName)$(TargetExt)</OutputFile>
+    </Lib>
+    <PostBuildEvent>
+      <Command>mkdir "$(OutDir)"include
+
+xcopy /S /Y $(ProjectDir)..\include\*.h "$(OutDir)"include
+
+</Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <AdditionalIncludeDirectories>$(ProjectDir)..\;$(ProjectDir)..\include;$(OutDir)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>USE_NUM_GMP;USE_FIELD_10X26;USE_FIELD_INV_NUM;USE_SCALAR_8X32;USE_SCALAR_INV_NUM;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <DisableSpecificWarnings>4244;4267;4146;</DisableSpecificWarnings>
+      <AdditionalOptions>/sdl- %(AdditionalOptions)</AdditionalOptions>
+      <ProgramDataBaseFileName>$(OutDir)\lib\x64\$(ProjectName).pdb</ProgramDataBaseFileName>
+    </ClCompile>
+    <Link>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+    </Link>
+    <PostBuildEvent>
+      <Command>mkdir "$(OutDir)"include
+
+xcopy /S /Y $(ProjectDir)..\include\*.h "$(OutDir)"include
+
+</Command>
+    </PostBuildEvent>
+    <Lib>
+      <OutputFile>$(OutDir)\lib\x64\$(TargetName)$(TargetExt)</OutputFile>
+    </Lib>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="..\src\bench_ecdh.c">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\src\bench_internal.c">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\src\bench_recover.c">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\src\bench_sign.c">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\src\bench_verify.c">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\src\gen_context.c" />
+    <ClCompile Include="..\src\secp256k1.c" />
+    <ClCompile Include="..\src\tests.c">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\src\tests_exhaustive.c">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="..\src\basic-config.h" />
+    <ClInclude Include="..\src\bench.h" />
+    <ClInclude Include="..\src\ecdsa.h" />
+    <ClInclude Include="..\src\ecdsa_impl.h" />
+    <ClInclude Include="..\src\eckey.h" />
+    <ClInclude Include="..\src\eckey_impl.h" />
+    <ClInclude Include="..\src\ecmult.h" />
+    <ClInclude Include="..\src\ecmult_const.h" />
+    <ClInclude Include="..\src\ecmult_const_impl.h" />
+    <ClInclude Include="..\src\ecmult_gen.h" />
+    <ClInclude Include="..\src\ecmult_gen_impl.h" />
+    <ClInclude Include="..\src\ecmult_impl.h" />
+    <ClInclude Include="..\src\field.h" />
+    <ClInclude Include="..\src\field_10x26.h" />
+    <ClInclude Include="..\src\field_10x26_impl.h" />
+    <ClInclude Include="..\src\field_5x52.h" />
+    <ClInclude Include="..\src\field_5x52_asm_impl.h" />
+    <ClInclude Include="..\src\field_5x52_impl.h" />
+    <ClInclude Include="..\src\field_5x52_int128_impl.h" />
+    <ClInclude Include="..\src\field_impl.h" />
+    <ClInclude Include="..\src\group.h" />
+    <ClInclude Include="..\src\group_impl.h" />
+    <ClInclude Include="..\src\hash.h" />
+    <ClInclude Include="..\src\hash_impl.h" />
+    <ClInclude Include="..\src\num.h" />
+    <ClInclude Include="..\src\num_gmp.h" />
+    <ClInclude Include="..\src\num_gmp_impl.h" />
+    <ClInclude Include="..\src\num_impl.h" />
+    <ClInclude Include="..\src\scalar.h" />
+    <ClInclude Include="..\src\scalar_4x64.h" />
+    <ClInclude Include="..\src\scalar_4x64_impl.h" />
+    <ClInclude Include="..\src\scalar_8x32.h" />
+    <ClInclude Include="..\src\scalar_8x32_impl.h" />
+    <ClInclude Include="..\src\scalar_impl.h" />
+    <ClInclude Include="..\src\scalar_low.h" />
+    <ClInclude Include="..\src\scalar_low_impl.h" />
+    <ClInclude Include="..\src\testrand.h" />
+    <ClInclude Include="..\src\testrand_impl.h" />
+    <ClInclude Include="..\src\util.h" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file
--- a/src/bench.h
+++ b/src/bench.h
@@ -9,7 +9,46 @@
 
 #include <stdio.h>
 #include <math.h>
+#ifdef _WIN32
+#include <time.h>
+#include <winsock2.h>
+
+struct timezone
+{
+	int  tz_minuteswest; /* minutes W of Greenwich */
+	int  tz_dsttime;     /* type of dst correction */
+};
+
+static __inline int gettimeofday(struct timeval *tp, struct timezone * tzp)
+{
+	FILETIME    file_time;
+	SYSTEMTIME  system_time;
+	ULARGE_INTEGER ularge;
+	static int tzflag;
+
+	GetSystemTime(&system_time);
+	SystemTimeToFileTime(&system_time, &file_time);
+	ularge.LowPart = file_time.dwLowDateTime;
+	ularge.HighPart = file_time.dwHighDateTime;
+
+	tp->tv_sec = (long)((ularge.QuadPart - 116444736000000000Ui64) / 10000000L);
+	tp->tv_usec = (long)(system_time.wMilliseconds * 1000);
+
+	if (NULL != tzp)
+	{
+		if (!tzflag)
+		{
+			_tzset();
+			tzflag++;
+		}
+		tzp->tz_minuteswest = _timezone / 60;
+		tzp->tz_dsttime = _daylight;
+	}
+	return 0;
+}
+#else
 #include "sys/time.h"
+#endif
 
 static double gettimedouble(void) {
     struct timeval tv;
--- a/src/gen_context.c
+++ b/src/gen_context.c
@@ -33,7 +33,7 @@ int main(int argc, char **argv) {
     (void)argc;
     (void)argv;
 
-    fp = fopen("src/ecmult_static_context.h","w");
+    fopen_s(&fp, "src/ecmult_static_context.h","w");
     if (fp == NULL) {
         fprintf(stderr, "Could not open src/ecmult_static_context.h for writing!\n");
         return -1;
-- 
2.10.2.windows.1

