Some fixes.

This commit is contained in:
n-a-c-h 2008-05-19 15:29:59 +00:00
parent ea1221605d
commit 33af8c9962
2 changed files with 7 additions and 6 deletions

View File

@ -2,10 +2,11 @@
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <time.h>
#include <zlib.h>
#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;

View File

@ -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