-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
185 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#include "nodefaultlib.h" | ||
#define DEBUG_FILE L"debug.log" | ||
|
||
void * __cdecl memset(void *pTarget, int value, size_t cbTarget) | ||
{ | ||
unsigned char *p = (unsigned char *)(pTarget); | ||
while (cbTarget-- > 0) { | ||
*p++ = (unsigned char)(value); | ||
} | ||
return pTarget; | ||
} | ||
int __cdecl memcmp(void const* _Buf1, void const* _Buf2, size_t _Size) | ||
{ | ||
unsigned char u1, u2; | ||
unsigned char *b1 = (unsigned char *)_Buf1; | ||
unsigned char *b2 = (unsigned char *)_Buf2; | ||
|
||
for (; _Size--; b1++, b2++) { | ||
u1 = *b1; | ||
u2 = *b2; | ||
if (u1 != u2) { | ||
return (u1 - u2); | ||
} | ||
} | ||
return 0; | ||
} | ||
|
||
/* Print a log message */ | ||
void debug(char *message, ...) { | ||
#ifdef DEBUG | ||
DWORD temp; | ||
HANDLE file; | ||
va_list args; | ||
char buf[1024]; | ||
|
||
memset(buf, 0, sizeof(buf)); | ||
va_start(args, message); | ||
wvsprintfA(buf, message, args); | ||
|
||
file = CreateFile(DEBUG_FILE, GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); | ||
SetFilePointer(file, 0, 0, FILE_END); | ||
WriteFile(file, buf, (DWORD)strlen(buf), &temp, NULL); | ||
CloseHandle(file); | ||
#endif | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#pragma once | ||
#pragma comment(linker, "/entry:DllMain") | ||
#include <windows.h> | ||
#include <stdio.h> | ||
#include <Winternl.h> | ||
#include <winnt.h> | ||
#include <Shlwapi.h> | ||
#pragma intrinsic(strlen) | ||
#pragma function(memset, memcmp) | ||
int __cdecl memcmp(void const* _Buf1, void const* _Buf2, size_t _Size); | ||
void * __cdecl memset(void *pTarget, int value, size_t cbTarget); | ||
void __cdecl debug(char *, ...); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.