From 33af8c9962681fdd4304854e7c055faa26fa9526 Mon Sep 17 00:00:00 2001 From: n-a-c-h Date: Mon, 19 May 2008 15:29:59 +0000 Subject: [PATCH] Some fixes. --- src/win32/protect.c | 7 ++++--- src/win32/protect.h | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/win32/protect.c b/src/win32/protect.c index 5de43695..0e026903 100644 --- a/src/win32/protect.c +++ b/src/win32/protect.c @@ -2,10 +2,11 @@ #include #include #include +#include #include #include "protect.h" -static void *memmem(uint8_t *haystack, size_t haystacklen, uint8_t *needle, size_t needlelen) +static uint8_t *memmem(const uint8_t *haystack, size_t haystacklen, const uint8_t *needle, size_t needlelen) { if (needlelen <= haystacklen) { @@ -14,7 +15,7 @@ static void *memmem(uint8_t *haystack, size_t haystacklen, uint8_t *needle, size { if (!memcmp(haystack, needle, needlelen)) { - return((char *)haystack); + return((uint8_t *)haystack); } ++haystack; } @@ -64,7 +65,7 @@ int ExecutableValid(const char *executable_filename) rewind(fp); fread(buffer, 1, file_size, fp); - if ((p = memmem(buffer, file_size, (const void *)data, sizeof(data)))) + if ((p = memmem(buffer, file_size, (const uint8_t *)data, sizeof(data)))) { size_t length_till_data = p-buffer; uint32_t crc1, crc2, crc3, crc4; diff --git a/src/win32/protect.h b/src/win32/protect.h index 0457c90b..3344b047 100644 --- a/src/win32/protect.h +++ b/src/win32/protect.h @@ -1,5 +1,5 @@ -//#ifdef PROTECT_H -//#define PROTECT_H +#ifdef ___PROTECT_H_ +#define ___PROTECT_H_ #if defined(__cplusplus) extern "C" { @@ -13,4 +13,4 @@ int ExecutableValid(const char *executable_filename); } #endif -//#endif +#endif