[Forensics-changes] [yara] 259/368: Fix some issues while building for Windows
Hilko Bengen
bengen at moszumanska.debian.org
Sat Jul 1 10:30:45 UTC 2017
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to annotated tag v3.5.0
in repository yara.
commit cb51bfe66159728d673b1f39ee858abe8bdc87bf
Author: Victor M. Alvarez <plusvic at gmail.com>
Date: Fri Apr 22 15:32:45 2016 +0200
Fix some issues while building for Windows
---
libyara/include/yara/object.h | 8 ++++++++
libyara/threading.c | 24 +++++++++++++++++++++---
windows/vs2015/libyara/libyara.vcxproj | 5 +++--
yara.c | 4 ++--
4 files changed, 34 insertions(+), 7 deletions(-)
diff --git a/libyara/include/yara/object.h b/libyara/include/yara/object.h
index 6b57b15..c7e4714 100644
--- a/libyara/include/yara/object.h
+++ b/libyara/include/yara/object.h
@@ -18,12 +18,20 @@ limitations under the License.
#define YR_OBJECT_H
#ifdef _MSC_VER
+
#include <float.h>
#define isnan _isnan
+
+#ifndef INFINITY
#define INFINITY (DBL_MAX + DBL_MAX)
+#endif
+
+#ifndef NAN
#define NAN (INFINITY-INFINITY)
#endif
+#endif
+
#include <yara/types.h>
diff --git a/libyara/threading.c b/libyara/threading.c
index 4de4918..76cd111 100644
--- a/libyara/threading.c
+++ b/libyara/threading.c
@@ -40,7 +40,7 @@ int yr_mutex_create(
int yr_mutex_destroy(
YR_MUTEX* mutex)
{
- if (CloseHandle(&mutex) == FALSE)
+ if (CloseHandle(*mutex) == FALSE)
return ERROR_INTERNAL_FATAL_ERROR;
return ERROR_SUCCESS;
@@ -50,7 +50,7 @@ int yr_mutex_destroy(
int yr_mutex_lock(
YR_MUTEX* mutex)
{
- if (WaitForSingleObject(&mutex, INFINITE) == WAIT_FAILED)
+ if (WaitForSingleObject(*mutex, INFINITE) == WAIT_FAILED)
return ERROR_INTERNAL_FATAL_ERROR;
return ERROR_SUCCESS;
@@ -60,7 +60,7 @@ int yr_mutex_lock(
int yr_mutex_unlock(
YR_MUTEX* mutex)
{
- if (ReleaseMutex(&mutex) == FALSE)
+ if (ReleaseMutex(*mutex) == FALSE)
return ERROR_INTERNAL_FATAL_ERROR;
return ERROR_SUCCESS;
@@ -89,6 +89,24 @@ int yr_thread_storage_destroy(
}
+int yr_thread_storage_set_value(
+ YR_THREAD_STORAGE_KEY* storage,
+ void* value)
+{
+ if (TlsSetValue(*storage, value) == FALSE)
+ return ERROR_INTERNAL_FATAL_ERROR;
+
+ return ERROR_SUCCESS;
+}
+
+
+void* yr_thread_storage_get_value(
+ YR_THREAD_STORAGE_KEY* storage)
+{
+ return TlsGetValue(*storage);
+}
+
+
#else // POSIX implementation
diff --git a/windows/vs2015/libyara/libyara.vcxproj b/windows/vs2015/libyara/libyara.vcxproj
index 3eabc4c..88023a6 100644
--- a/windows/vs2015/libyara/libyara.vcxproj
+++ b/windows/vs2015/libyara/libyara.vcxproj
@@ -38,7 +38,7 @@
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
@@ -164,7 +164,7 @@
</Lib>
<Link>
<AdditionalDependencies>advapi32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
+ <LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
@@ -200,6 +200,7 @@
<ClCompile Include="..\..\..\libyara\sizedstr.c" />
<ClCompile Include="..\..\..\libyara\stream.c" />
<ClCompile Include="..\..\..\libyara\strutils.c" />
+ <ClCompile Include="..\..\..\libyara\threading.c" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
diff --git a/yara.c b/yara.c
index 7f23bac..051777b 100644
--- a/yara.c
+++ b/yara.c
@@ -421,9 +421,9 @@ static char cescapes[] =
void print_escaped(
uint8_t* data,
- int length)
+ size_t length)
{
- int i;
+ size_t i;
for (i = 0; i < length; i++)
{
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/forensics/yara.git
More information about the forensics-changes
mailing list