Some fixes.
git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@516 a31d4220-a93d-0410-bf67-fe4944624d44
This commit is contained in:
parent
fbaa2c86c3
commit
4e8ab56781
|
@ -2,10 +2,11 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <time.h>
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
#include "protect.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)
|
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))
|
if (!memcmp(haystack, needle, needlelen))
|
||||||
{
|
{
|
||||||
return((char *)haystack);
|
return((uint8_t *)haystack);
|
||||||
}
|
}
|
||||||
++haystack;
|
++haystack;
|
||||||
}
|
}
|
||||||
|
@ -64,7 +65,7 @@ int ExecutableValid(const char *executable_filename)
|
||||||
rewind(fp);
|
rewind(fp);
|
||||||
fread(buffer, 1, file_size, 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;
|
size_t length_till_data = p-buffer;
|
||||||
uint32_t crc1, crc2, crc3, crc4;
|
uint32_t crc1, crc2, crc3, crc4;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//#ifdef PROTECT_H
|
#ifdef ___PROTECT_H_
|
||||||
//#define PROTECT_H
|
#define ___PROTECT_H_
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -13,4 +13,4 @@ int ExecutableValid(const char *executable_filename);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue