mirror of
https://github.com/rapid7/metasploit-framework
synced 2024-11-12 11:52:01 +01:00
Fix error with recording on certain Windows versions.
git-svn-id: file:///home/svn/framework3/trunk@11311 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
parent
b30270e742
commit
599df0a71a
Binary file not shown.
Binary file not shown.
@ -3,6 +3,9 @@
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
|
|
||||||
|
//Handle used for synchronization. Main thread waits for event to be signalled to clean up
|
||||||
|
HANDLE recordMicEvent;
|
||||||
|
|
||||||
//All these default values should be overwritten
|
//All these default values should be overwritten
|
||||||
UINT buffersize = 0;
|
UINT buffersize = 0;
|
||||||
UINT riffsize = 0;
|
UINT riffsize = 0;
|
||||||
@ -15,6 +18,7 @@ void CALLBACK waveInProc(HWAVEIN hwi, UINT uMsg, DWORD_PTR dwInstance, DWORD_PTR
|
|||||||
if(uMsg != WIM_DATA)
|
if(uMsg != WIM_DATA)
|
||||||
return;
|
return;
|
||||||
memcpy(dataBuffer, recordBuffer, buffersize);
|
memcpy(dataBuffer, recordBuffer, buffersize);
|
||||||
|
SetEvent(recordMicEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -91,9 +95,15 @@ DWORD request_ui_record_mic( Remote * remote, Packet * request ){
|
|||||||
wh.dwFlags = 0;
|
wh.dwFlags = 0;
|
||||||
waveInPrepareHeader(hWavIn, &wh, sizeof(wh));
|
waveInPrepareHeader(hWavIn, &wh, sizeof(wh));
|
||||||
waveInAddBuffer(hWavIn, &wh, sizeof(wh));
|
waveInAddBuffer(hWavIn, &wh, sizeof(wh));
|
||||||
|
recordMicEvent = CreateEvent(
|
||||||
|
NULL, // default security attributes
|
||||||
|
FALSE, // auto-reset event
|
||||||
|
FALSE, // initial state is nonsignaled
|
||||||
|
NULL); // no object name
|
||||||
dwResult = waveInStart(hWavIn);
|
dwResult = waveInStart(hWavIn);
|
||||||
if(dwResult != MMSYSERR_NOERROR)
|
if(dwResult != MMSYSERR_NOERROR)
|
||||||
BREAK_WITH_ERROR("request_ui_record_mic: WaveInStart failed", dwResult)
|
BREAK_WITH_ERROR("request_ui_record_mic: WaveInStart failed", dwResult)
|
||||||
|
WaitForSingleObject(recordMicEvent, seconds * 1000 + 1000);
|
||||||
dwResult = waveInStop(hWavIn);//seems to wait for buffer to complete
|
dwResult = waveInStop(hWavIn);//seems to wait for buffer to complete
|
||||||
if(dwResult != MMSYSERR_NOERROR)
|
if(dwResult != MMSYSERR_NOERROR)
|
||||||
BREAK_WITH_ERROR("request_ui_record_mic: WaveInStop failed", dwResult)
|
BREAK_WITH_ERROR("request_ui_record_mic: WaveInStop failed", dwResult)
|
||||||
|
Loading…
Reference in New Issue
Block a user