mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-25 01:57:47 +01:00
add timestamp to logs
This commit is contained in:
parent
892494718a
commit
9a308dcf1b
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
HMODULE WINAPI util_enumerate_modules(_In_opt_ HMODULE hModuleLast);
|
HMODULE WINAPI util_enumerate_modules(_In_opt_ HMODULE hModuleLast);
|
||||||
void util_pull_messages();
|
void util_pull_messages();
|
||||||
|
DWORD util_get_timestamp(HMODULE mod);
|
||||||
FARPROC util_get_iat_proc(HMODULE mod, char* module_name, char* function_name);
|
FARPROC util_get_iat_proc(HMODULE mod, char* module_name, char* function_name);
|
||||||
BOOL util_caller_is_ddraw_wrapper(void* return_address);
|
BOOL util_caller_is_ddraw_wrapper(void* return_address);
|
||||||
BOOL util_is_bad_read_ptr(void* p);
|
BOOL util_is_bad_read_ptr(void* p);
|
||||||
|
11
src/debug.c
11
src/debug.c
@ -2,6 +2,7 @@
|
|||||||
#include <dbghelp.h>
|
#include <dbghelp.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <d3d9.h>
|
#include <d3d9.h>
|
||||||
|
#include <time.h>
|
||||||
#include "ddraw.h"
|
#include "ddraw.h"
|
||||||
#include "dd.h"
|
#include "dd.h"
|
||||||
#include "ddsurface.h"
|
#include "ddsurface.h"
|
||||||
@ -11,6 +12,8 @@
|
|||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "git.h"
|
#include "git.h"
|
||||||
#include "versionhelpers.h"
|
#include "versionhelpers.h"
|
||||||
|
#include "utils.h"
|
||||||
|
#include "dllmain.h"
|
||||||
|
|
||||||
|
|
||||||
double g_dbg_frame_time = 0;
|
double g_dbg_frame_time = 0;
|
||||||
@ -159,6 +162,8 @@ void dbg_init()
|
|||||||
GIT_COMMIT,
|
GIT_COMMIT,
|
||||||
GIT_BRANCH);
|
GIT_BRANCH);
|
||||||
|
|
||||||
|
TRACE("cnc-ddraw = %p\n", g_ddraw_module);
|
||||||
|
|
||||||
HKEY hkey;
|
HKEY hkey;
|
||||||
LONG status =
|
LONG status =
|
||||||
RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", 0L, KEY_READ, &hkey);
|
RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion", 0L, KEY_READ, &hkey);
|
||||||
@ -196,6 +201,12 @@ void dbg_init()
|
|||||||
|
|
||||||
TRACE("Wine sysname = %s, release = %s\n", sysname, release);
|
TRACE("Wine sysname = %s, release = %s\n", sysname, release);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DWORD timestamp = util_get_timestamp(GetModuleHandleA(NULL));
|
||||||
|
if (timestamp)
|
||||||
|
{
|
||||||
|
TRACE("timestamp = %s", _ctime32((const long*)×tamp));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,6 @@ BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
|
|||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
dbg_init();
|
dbg_init();
|
||||||
TRACE("cnc-ddraw = %p\n", hDll);
|
|
||||||
g_dbg_exception_filter = real_SetUnhandledExceptionFilter((LPTOP_LEVEL_EXCEPTION_FILTER)dbg_exception_handler);
|
g_dbg_exception_filter = real_SetUnhandledExceptionFilter((LPTOP_LEVEL_EXCEPTION_FILTER)dbg_exception_handler);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
16
src/utils.c
16
src/utils.c
@ -89,6 +89,22 @@ void util_pull_messages()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DWORD util_get_timestamp(HMODULE mod)
|
||||||
|
{
|
||||||
|
if (!mod || mod == INVALID_HANDLE_VALUE)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
PIMAGE_DOS_HEADER dos_header = (PIMAGE_DOS_HEADER)mod;
|
||||||
|
if (dos_header->e_magic != IMAGE_DOS_SIGNATURE)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
PIMAGE_NT_HEADERS nt_headers = (PIMAGE_NT_HEADERS)((DWORD)dos_header + (DWORD)dos_header->e_lfanew);
|
||||||
|
if (nt_headers->Signature != IMAGE_NT_SIGNATURE)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return nt_headers->FileHeader.TimeDateStamp;
|
||||||
|
}
|
||||||
|
|
||||||
FARPROC util_get_iat_proc(HMODULE mod, char* module_name, char* function_name)
|
FARPROC util_get_iat_proc(HMODULE mod, char* module_name, char* function_name)
|
||||||
{
|
{
|
||||||
if (!mod || mod == INVALID_HANDLE_VALUE)
|
if (!mod || mod == INVALID_HANDLE_VALUE)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user