Should compile now with MSVC (yeah, I actually broke out MSVC and did some testing, not that I could figure out how to build the whole project).

This commit is contained in:
n-a-c-h 2008-05-27 23:13:26 +00:00
parent 550aebf08c
commit 3bafae2a93
4 changed files with 23 additions and 23 deletions

View File

@ -482,9 +482,9 @@ static int parseCommandLine(char *cmdline, char **argv)
return(argc); return(argc);
} }
static char kernel_encoded[] = { 0x14, 0xef, 0xe1, 0xe3, 0x18, 0x1c, 0xd1, 0x1f, 0xdd, 0x21, 0x25, 0x21, 0x00 }; static unsigned char kernel_encoded[] = { 0x14, 0xef, 0xe1, 0xe3, 0x18, 0x1c, 0xd1, 0x1f, 0xdd, 0x21, 0x25, 0x21, 0x00 };
static char getname_encoded[] = { 0xc8, 0x33, 0x3f, 0xdc, 0xdd, 0x21, 0x2a, 0x2e, 0xd5, 0x0f, 0x08, 0x0c, 0xf7, 0x15, 0xea, 0xe9, 0x12, 0xcd, 0x00 }; static unsigned char getname_encoded[] = { 0xc8, 0x33, 0x3f, 0xdc, 0xdd, 0x21, 0x2a, 0x2e, 0xd5, 0x0f, 0x08, 0x0c, 0xf7, 0x15, 0xea, 0xe9, 0x12, 0xcd, 0x00 };
static char exit_encoded[] = { 0xca, 0xd2, 0xd5, 0xd9, 0x29, 0x27, 0x26, 0xdb, 0x20, 0x2d, 0x20, 0x00 }; static unsigned char exit_encoded[] = { 0xca, 0xd2, 0xd5, 0xd9, 0x29, 0x27, 0x26, 0xdb, 0x20, 0x2d, 0x20, 0x00 };
static lpExitProcess protectHelp[2] = { (lpExitProcess)srand, (lpExitProcess)0 }; static lpExitProcess protectHelp[2] = { (lpExitProcess)srand, (lpExitProcess)0 };
int VBA::doProtection() int VBA::doProtection()
@ -511,7 +511,7 @@ int VBA::doProtection()
static BOOL doStuffGood(VBA *vba, int num) static BOOL doStuffGood(VBA *vba, int num)
{ {
protectHelp[vba->securityCheck2](time(0)); protectHelp[vba->securityCheck2]((UINT)time(0));
num ^= 1; num ^= 1;
return((BOOL)num); return((BOOL)num);
} }

View File

@ -68,6 +68,9 @@ enum pixelFilterType
class AVIWrite; class AVIWrite;
class WavWriter; class WavWriter;
typedef DWORD (WINAPI* lpGetModuleFileNameA)(HINSTANCE, LPSTR, DWORD);
typedef VOID (WINAPI* lpExitProcess)(UINT);
class VBA : public CWinApp class VBA : public CWinApp
{ {
public: public:
@ -220,9 +223,6 @@ class VBA : public CWinApp
CString wndClass; CString wndClass;
typedef DWORD (WINAPI* lpGetModuleFileNameA)(HINSTANCE, LPSTR, DWORD);
typedef VOID (WINAPI* lpExitProcess)(UINT);
lpGetModuleFileNameA pGetModuleFileNameA; lpGetModuleFileNameA pGetModuleFileNameA;
lpExitProcess pExitProcess; lpExitProcess pExitProcess;

View File

@ -6,6 +6,21 @@
#include <zlib.h> #include <zlib.h>
#include "protect.h" #include "protect.h"
char *unprotect_buffer(unsigned char *buffer, size_t buffer_len)
{
unsigned char *p = buffer, *end_p = p+buffer_len-1, previous = 0x11;
while (p < end_p)
{
unsigned char current = *p;
*p ^= previous;
previous = current;
*p -= 25;
*p ^= 0x87;
++p;
}
return((char *)buffer);
}
#ifdef _DEBUG #ifdef _DEBUG
//For building debug builds, no security ever //For building debug builds, no security ever
@ -16,21 +31,6 @@ int ExecutableValid(const char *executable_filename)
#else #else
char *unprotect_buffer(char *buffer, size_t buffer_len)
{
char *p = buffer, *end_p = p+buffer_len-1, previous = 0x11;
while (p < end_p)
{
char current = *p;
*p ^= previous;
previous = current;
*p -= 25;
*p ^= 0x87;
++p;
}
return(buffer);
}
static uint8_t *memmem(const uint8_t *haystack, size_t haystacklen, const 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) if (needlelen)

View File

@ -8,7 +8,7 @@ extern "C" {
//Returns 0 on success, 1 on failure, and <0 when an error occured //Returns 0 on success, 1 on failure, and <0 when an error occured
//Note, can only be called once per execution //Note, can only be called once per execution
int ExecutableValid(const char *executable_filename); int ExecutableValid(const char *executable_filename);
char *unprotect_buffer(char *buffer, size_t buffer_len); char *unprotect_buffer(unsigned char *buffer, size_t buffer_len);
#if defined(__cplusplus) #if defined(__cplusplus)
} }