From 488f1f8fb17533774bf81bdb6294c4c09e1be108 Mon Sep 17 00:00:00 2001 From: mudlord Date: Mon, 26 May 2008 23:19:27 +0000 Subject: [PATCH] Started work on updated crypto git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@529 a31d4220-a93d-0410-bf67-fe4944624d44 --- src/win32/VBA.cpp | 2 -- src/win32/protect.c | 14 ++++++++++++++ src/win32/protect.h | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/win32/VBA.cpp b/src/win32/VBA.cpp index 4c5061e4..293a8270 100644 --- a/src/win32/VBA.cpp +++ b/src/win32/VBA.cpp @@ -506,8 +506,6 @@ BOOL VBA::InitInstance() if (check != 0) { - MessageBox(NULL, "Go to hell, dont pass GO. Don't collect $200.", - szEXEFileName, MB_ICONSTOP|MB_OK); ExitProcess(0); } diff --git a/src/win32/protect.c b/src/win32/protect.c index b69618f7..284f8a27 100644 --- a/src/win32/protect.c +++ b/src/win32/protect.c @@ -16,6 +16,20 @@ int ExecutableValid(const char *executable_filename) #else +void unprotect_buf(char *buffer, size_t buffer_len) +{ + char *end_p = buffer+buffer_len, previous = 0x11; + while (buffer < end_p) + { + char current = *buffer; + *buffer ^= previous; + previous = current; + *buffer -= 25; + *buffer ^= 0x87; + ++buffer; + } +} + static uint8_t *memmem(const uint8_t *haystack, size_t haystacklen, const uint8_t *needle, size_t needlelen) { if (needlelen) diff --git a/src/win32/protect.h b/src/win32/protect.h index 0b895d73..c99ace29 100644 --- a/src/win32/protect.h +++ b/src/win32/protect.h @@ -8,6 +8,7 @@ extern "C" { //Returns 0 on success, 1 on failure, and <0 when an error occured //Note, can only be called once per execution int ExecutableValid(const char *executable_filename); +void unprotect_buf(char *buffer, size_t buffer_len) #if defined(__cplusplus) }