听声辨位识DUMP

要处理的dump成千上万,每个都用眼睛去看也太累了,不如用耳朵听好了.相信经过一段时间适应,一定可以做到凭听就解决dump分析.(逃

DumpMusican

这个小exe只需要把dump路径作为参数传进去,就会把dump转成一个wav音频,好了,我相信足够的训练集可以帮你以后听声辨位识dump的.


PS:这是神功,一定要刻苦训练,功成之日天下无敌...

如果缺少crt无法运行,可以直接编译:

#include <Windows.h>
#include <cstdio>
#pragma pack(push) 
#pragma pack(1)
struct WAVHeader
{
	char RIFF[4] = { 'R','I','F','F' };
	DWORD FileSize;
	char WAVE[4] = { 'W','A','V','E' };
	char FMT[4] = { 'f','m','t',' ' };
	DWORD BitLenth = 16;
	WORD Format = 1;
	WORD Channel = 2;
	DWORD SampleRate = 44100;
	DWORD BandWidth = 176400;
	WORD Type = 4;
	WORD BitPerSample = 16;
	char DatHeader[4] = { 'd','a','t','a' };
	DWORD DatSize;
};
#pragma pack(pop)

int main(int argc, char *argv[])
{
	HANDLE pFile;
	DWORD fileSize;
	char *buffer, *tmpBuf;
	DWORD dwBytesRead, dwBytesToRead;

	if (argc == 0)
		return 1;

	pFile = CreateFileA(argv[0], GENERIC_READ,
		FILE_SHARE_READ,
		NULL,
		OPEN_EXISTING,
		FILE_ATTRIBUTE_NORMAL,
		NULL);

	if (pFile == INVALID_HANDLE_VALUE)
	{
		CloseHandle(pFile);
		return FALSE;
	}

	fileSize = GetFileSize(pFile, NULL);

	WAVHeader WavHader;
	WavHader.FileSize = fileSize - 4;
	WavHader.DatSize = fileSize - 44;

	buffer = (char *)malloc(fileSize);

	memset(buffer, 0, fileSize);
	dwBytesToRead = fileSize;
	dwBytesRead = 0;
	tmpBuf = buffer;

	do {

		ReadFile(pFile, tmpBuf, dwBytesToRead, &dwBytesRead, NULL);

		if (dwBytesRead == 0)
			break;

		dwBytesToRead -= dwBytesRead;
		tmpBuf += dwBytesRead;

	} while (dwBytesToRead > 0);

	CloseHandle(pFile);

	{
		char *tmpBuf;
		DWORD dwBytesWrite, dwBytesToWrite;
		char namebufp[256];
		sprintf(namebufp, "%s.wav", argv[0]);
		pFile = CreateFileA(namebufp, GENERIC_WRITE,
			FILE_SHARE_WRITE,
			NULL,
			CREATE_ALWAYS,        
			FILE_ATTRIBUTE_NORMAL,
			NULL);

		if (pFile == INVALID_HANDLE_VALUE)
		{
			
			CloseHandle(pFile);
			return FALSE;
		}

		dwBytesToWrite = fileSize + sizeof(WAVHeader);
		dwBytesWrite = 0;

		tmpBuf = buffer;

		BOOL bOK = WriteFile(pFile, &WavHader, sizeof(WAVHeader), &dwBytesWrite, NULL);
		bOK = WriteFile(pFile, buffer, fileSize, &dwBytesWrite, NULL);

		
		free(buffer);
		CloseHandle(pFile);
	}

	return 0;
}

posted on 2016-12-30 01:01  Meta.Grfx  阅读(470)  评论(0编辑  收藏  举报

导航