windows查看linux ext4内容
2020-5-19
需要工具:
simg2img.exe:img提取工具
osfmount.exe:ext4文件系统挂载到windows
osfmount.exe下载地址:https://www.osforensics.com/tools/mount-disk-images.html
步骤:
1.simg2img.exe -i rootfs_256M.ext4 -o rootfs_256M.raw
2. osfmount.exe 挂载 rootfs_256M.raw
windows程序崩溃时产生dmp
2017-12-30 C++
需求:windows程序崩溃时产生dmp
解决方案:
stdafx.h增加如下内容:
#include <Dbghelp.h>
//异常dmp捕获
void SetMyUnhandledExceptionFilter();
stdafx.cpp增加如下内容:
//生产DUMP文件
int GenerateMiniDump(HANDLE hFile, PEXCEPTION_POINTERS pExceptionPointers, PTCHAR pwAppName)
{
BOOL bOwnDumpFile = FALSE;
HANDLE hDumpFile = hFile;
MINIDUMP_EXCEPTION_INFORMATION ExpParam;
typedef BOOL(WINAPI * MiniDumpWriteDumpT)(
HANDLE,
DWORD,
HANDLE,
MINIDUMP_TYPE,
PMINIDUMP_EXCEPTION_INFORMATION,
PMINIDUMP_USER_STREAM_INFORMATION,
PMINIDUMP_CALLBACK_INFORMATION
);
MiniDumpWriteDumpT pfnMiniDumpWriteDump = NULL;
HMODULE hDbgHelp = LoadLibrary(_T("DbgHelp.dll"));
if(NULL == hDbgHelp)
{
return EXCEPTION_EXECUTE_HANDLER;
}
pfnMiniDumpWriteDump = (MiniDumpWriteDumpT)GetProcAddress(hDbgHelp, "MiniDumpWriteDump");
if(NULL == pfnMiniDumpWriteDump)
{
return EXCEPTION_EXECUTE_HANDLER;
}
if(hDumpFile == NULL || hDumpFile == INVALID_HANDLE_VALUE)
{
TCHAR szFileName[MAX_PATH] = { 0 };
TCHAR* szVersion = _T("v1.0");
int dwBufferSize = MAX_PATH;
SYSTEMTIME stLocalTime = { 0 };
GetLocalTime(&stLocalTime);
//wsprintf(szFileName, L"%s%s", szPath, szAppName);
//CreateDirectory(szFileName, NULL);
_stprintf_s(szFileName, MAX_PATH, _T("%s-%s-%04d%02d%02d-%02d%02d%02d-%ld-%ld.dmp"),
pAppName,
szVersion,
stLocalTime.wYear, stLocalTime.wMonth, stLocalTime.wDay,
stLocalTime.wHour, stLocalTime.wMinute, stLocalTime.wSecond,
GetCurrentProcessId(), GetCurrentThreadId());
hDumpFile = CreateFile(szFileName, GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_WRITE | FILE_SHARE_READ, 0, CREATE_ALWAYS, 0, 0);
}
if(hDumpFile != INVALID_HANDLE_VALUE)
{
ExpParam.ThreadId = GetCurrentThreadId();
ExpParam.ExceptionPointers = pExceptionPointers;
ExpParam.ClientPointers = FALSE;
pfnMiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(),
hDumpFile, MiniDumpWithDataSegs, (pExceptionPointers ? &ExpParam : NULL), NULL, NULL);
CloseHandle(hDumpFile);
}
if(hDbgHelp != NULL)
{
FreeLibrary(hDbgHelp);
}
return EXCEPTION_EXECUTE_HANDLER;
}
LONG WINAPI ExceptionFilter(LPEXCEPTION_POINTERS lpExceptionInfo)
{
if (IsDebuggerPresent())
{
return EXCEPTION_CONTINUE_SEARCH;
}
return GenerateMiniDump(NULL, lpExceptionInfo, _T("XXXXX"));
}
void DisableSetUnhandledExceptionFilter()
{
void *addr = (void*)GetProcAddress(LoadLibrary(_T("kernel32.dll")) ,"SetUnhandledExceptionFilter");
if(addr)
{
unsigned char code[16] = { 0 };
int size = 0;
code[size++] = 0x33;
code[size++] = 0xC0;
code[size++] = 0xC2;
code[size++] = 0x04;
code[size++] = 0x00;
DWORD dwOldFlag,dwTempFlag;
VirtualProtect(addr, size, PAGE_READWRITE, &dwOldFlag);
WriteProcessMemory(GetCurrentProcess(), addr, code, size, NULL);
VirtualProtect(addr, size, dwOldFlag ,&dwTempFlag);
}
}
void SetMyUnhandledExceptionFilter()
{
SetUnhandledExceptionFilter(NULL);
SetUnhandledExceptionFilter(&ExceptionFilter);
DisableSetUnhandledExceptionFilter();
}
程序入口添加如下内容:
SetMyUnhandledExceptionFilter();
程序所在目录添加:DbgHelp.dll文件
ado open 连接数据库卡住
2017-12-3 C++
情景:
程序采用ado访问access数据库
现象:
公司编译生成的程序在公司的电脑上运行没问题,但是到了客户的电脑上运行就卡住!
解决办法:
通过打印调试信息,发现程序是卡在数据库open的时候,就不往下走了!
对比了下ado版本,发现客户电脑上的ado版本比公司编译环境的低!
替换掉客户端电脑上的msado.dll,问题解决