HANDLE hFile;
WAVE_HEADER wh;
wh.szRiff = 'FFIR';
wh.szWave = 'EVAW';
wh.szFmt = ' tmf';
wh.FmtSize = sizeof(PCMWAVEFORMAT);
CopyMemory(&wh.Fmt, lpFormat, sizeof(PCMWAVEFORMAT));
wh.szData = 'atad';
DWORD dwOpt;
WriteFile(hFile, &wh, sizeof(wh), &dwOpt, NULL);
//写入PCM数据后
DWORD dwFileSize = GetFileSize(hFile, NULL);
DWORD dwOpt;
SetFilePointer(hFile, 0x04, NULL, FILE_BEGIN);
dwFileSize = dwFileSize - sizeof(UINT) * 3;
WriteFile(hFile, &dwFileSize, 4, &dwOpt, NULL);
SetFilePointer(hFile, 0x28, NULL, FILE_BEGIN);
dwFileSize = dwFileSize + sizeof(UINT) * 3 - sizeof(WAVE_HEADER);
WriteFile(hFile, &dwFileSize, 4, &dwOpt, NULL);
CloseHandle(hFile);
typedef struct _WAVE_HEADER
{
UINT szRiff;
UINT FileSize;
UINT szWave;
UINT szFmt;
UINT FmtSize;
PCMWAVEFORMAT Fmt;
UINT szData;
UINT DataSize;
}WAVE_HEADER, *PWAVE_HEADER;