-
Notifications
You must be signed in to change notification settings - Fork 0
/
log.h
111 lines (93 loc) · 2.15 KB
/
log.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <fstream>
#include <stdio.h>
#include <time.h>
int iLogged = 0;
int fLogged = 0;
#pragma warning(disable:4996)
using namespace std;
ofstream ofile;
char dlldirectory[320];
char *GetDirectoryFile(char *filename)
{
static char path[320];
strcpy(path, dlldirectory);
strcat(path, filename);
return path;
}
void __cdecl Writelog(const char *fmt, ...)
{
if(ofile != NULL)
{
if(!fmt) { return; }
va_list va_alist;
char logbuf[256] = {0};
va_start (va_alist, fmt);
_vsnprintf (logbuf+strlen(logbuf), sizeof(logbuf) - strlen(logbuf), fmt, va_alist);
va_end (va_alist);
ofile << logbuf << endl;
}}
void logging(HMODULE hDll){
DisableThreadLibraryCalls(hDll);
GetModuleFileNameA(hDll, dlldirectory, 512);
for(int i = strlen(dlldirectory); i > 0; i--) { if(dlldirectory[i] == '\\') { dlldirectory[i+1] = 0; break; } }
DeleteFileA(GetDirectoryFile("xXRusSXxAddresses.txt"));
ofile.open(GetDirectoryFile("xXRusSXxAddresses.txt"), ios::app);
}
void WriteLogX(LPCSTR szDescription,DWORD dwAddress)
{
if ( dwAddress )
{
Writelog(szDescription,dwAddress);
iLogged ++;
}
else
{
Writelog(szDescription,0x00);
fLogged++;
}
}
//
//using namespace std;
//
//ofstream ofile;
//char dlldir[320];
//
//char *GoToDirectoryFile(char *filename)
//{
//static char path[320];
//strcpy(path, dlldir);
//strcat(path, filename);
//return path;
//}
//
//char *GetDirectoryFile(char *filename)
//{
//static char path[320];
//strcpy(path, dlldir);
//strcat(path, filename);
//return path;
//}
//void __cdecl AddLog (const char *fmt, ...){
//if(ofile != NULL){
//if(!fmt) { return; }
//va_list va_alist;
//char logbuf[256] = {0};
//va_start (va_alist, fmt);
//_vsnprintf (logbuf+strlen(logbuf), sizeof(logbuf) - strlen(logbuf), fmt, va_alist);
//va_end (va_alist);
//ofile << logbuf << endl;
//}}
DWORD dwSize;
DWORD dwStartAddress;
BOOL bCompare(const BYTE* pData, const BYTE* bMask, const char* szMask)
{
for(;*szMask;++szMask,++pData,++bMask)
{
if(*szMask == 'x' && *pData != *bMask)
return 0;
}
return (*szMask)==NULL;
}