new *dbgprintf macros that have fname(line): prefix

This commit is contained in:
zeffy
2017-06-20 03:48:43 -07:00
parent ebe8b3e492
commit 0d29958560
4 changed files with 16 additions and 8 deletions

View File

@@ -111,13 +111,12 @@ BOOL PatchWUAgentHMODULE(HMODULE hModule) {
if (*lpbFirstRun) { if (*lpbFirstRun) {
*lpbFirstRun = FALSE; *lpbFirstRun = FALSE;
_tdbgprintf(_T("Changed first run to FALSE. (%p=%08x)"), lpbFirstRun, *lpbFirstRun); _tdbgprintf(_T("Unset first run var. (%p=%08x)"), lpbFirstRun, *lpbFirstRun);
result = TRUE; result = TRUE;
} }
if (!*lpbIsCPUSupportedResult) { if (!*lpbIsCPUSupportedResult) {
*lpbIsCPUSupportedResult = TRUE; *lpbIsCPUSupportedResult = TRUE;
_tdbgprintf(_T("Changed cached result to TRUE. (%p=%08x)."), _tdbgprintf(_T("Set cached result. (%p=%08x)"), lpbIsCPUSupportedResult, *lpbIsCPUSupportedResult);
lpbIsCPUSupportedResult, *lpbIsCPUSupportedResult);
result = TRUE; result = TRUE;
} }
return result; return result;

View File

@@ -51,7 +51,7 @@ void CALLBACK Rundll32Entry(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int n
} }
} while (Module32Next(hSnap, &me)); } while (Module32Next(hSnap, &me));
HANDLE hThread = CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)GetProcAddress(me.hModule, _CRT_STRINGIZE(LoadLibrary)), lpBaseAddress, 0, NULL); HANDLE hThread = CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)GetProcAddress(me.hModule, STRINGIZE(LoadLibrary)), lpBaseAddress, 0, NULL);
CloseHandle(hThread); CloseHandle(hThread);
} }
CloseHandle(hSnap); CloseHandle(hSnap);

View File

@@ -96,7 +96,7 @@ BOOL IsOperatingSystemSupported(LPBOOL lpbIsWindows7, LPBOOL lpbIsWindows8Point1
#endif #endif
} }
VOID _wdbgprintf(LPCWSTR format, ...) { VOID wdbgprintf(LPCWSTR format, ...) {
WCHAR buffer[0x1000]; WCHAR buffer[0x1000];
va_list argptr; va_list argptr;
va_start(argptr, format); va_start(argptr, format);
@@ -105,7 +105,7 @@ VOID _wdbgprintf(LPCWSTR format, ...) {
OutputDebugStringW(buffer); OutputDebugStringW(buffer);
} }
VOID _dbgprintf(LPCSTR format, ...) { VOID dbgprintf(LPCSTR format, ...) {
CHAR buffer[0x1000]; CHAR buffer[0x1000];
va_list argptr; va_list argptr;
va_start(argptr, format); va_start(argptr, format);

View File

@@ -12,8 +12,8 @@ VOID ResumeAndCloseThreads(HANDLE *lphThreads, SIZE_T dwSize);
BOOL CompareWindowsVersion(BYTE Operator, DWORD dwMajorVersion, DWORD dwMinorVersion, WORD wServicePackMajor, WORD wServicePackMinor, DWORD dwTypeMask); BOOL CompareWindowsVersion(BYTE Operator, DWORD dwMajorVersion, DWORD dwMinorVersion, WORD wServicePackMajor, WORD wServicePackMinor, DWORD dwTypeMask);
BOOL IsOperatingSystemSupported(LPBOOL lpbIsWindows7, LPBOOL lpbIsWindows8Point1); BOOL IsOperatingSystemSupported(LPBOOL lpbIsWindows7, LPBOOL lpbIsWindows8Point1);
VOID _wdbgprintf(LPCWSTR format, ...); VOID wdbgprintf(LPCWSTR format, ...);
VOID _dbgprintf(LPCSTR format, ...); VOID dbgprintf(LPCSTR format, ...);
#define DETOUR_IAT(x, y) \ #define DETOUR_IAT(x, y) \
LPVOID _LPORIGINAL##y; \ LPVOID _LPORIGINAL##y; \
@@ -21,6 +21,15 @@ VOID _dbgprintf(LPCSTR format, ...);
#define RESTORE_IAT(x, y) \ #define RESTORE_IAT(x, y) \
DetourIAT(x, #y, NULL, _LPORIGINAL##y) DetourIAT(x, #y, NULL, _LPORIGINAL##y)
#define STRINGIZEW_(x) L#x
#define STRINGIZEW(x) STRINGIZEW_(x)
#define __LINEWSTR__ STRINGIZEW(__LINE__)
#define _wdbgprintf(format, ...) wdbgprintf(__FILEW__ L"(" __LINEWSTR__ L"): " format, ##__VA_ARGS__)
#define STRINGIZE_(x) #x
#define STRINGIZE(x) STRINGIZE_(x)
#define __LINESTR__ STRINGIZE(__LINE__)
#define _dbgprintf(format, ...) dbgprintf(__FILE__ "(" __LINESTR__ "): " format, ##__VA_ARGS__)
#ifdef UNICODE #ifdef UNICODE
#define _tdbgprintf _wdbgprintf #define _tdbgprintf _wdbgprintf
#else #else