Fixed unprotect_buffer().
This commit is contained in:
parent
b06aeaf9dc
commit
550aebf08c
|
@ -16,18 +16,19 @@ int ExecutableValid(const char *executable_filename)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
void unprotect_buf(char *buffer, size_t buffer_len)
|
char *unprotect_buffer(char *buffer, size_t buffer_len)
|
||||||
{
|
{
|
||||||
char *end_p = buffer+buffer_len, previous = 0x11;
|
char *p = buffer, *end_p = p+buffer_len-1, previous = 0x11;
|
||||||
while (buffer < end_p)
|
while (p < end_p)
|
||||||
{
|
{
|
||||||
char current = *buffer;
|
char current = *p;
|
||||||
*buffer ^= previous;
|
*p ^= previous;
|
||||||
previous = current;
|
previous = current;
|
||||||
*buffer -= 25;
|
*p -= 25;
|
||||||
*buffer ^= 0x87;
|
*p ^= 0x87;
|
||||||
++buffer;
|
++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)
|
||||||
|
|
|
@ -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);
|
||||||
void unprotect_buf(char *buffer, size_t buffer_len)
|
char *unprotect_buffer(char *buffer, size_t buffer_len);
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue