The above source does compile with some changes without problems in VS2010.
The Changes I made:
Added tchar.h and ks.h because VS asked for that.
#include <tchar.h>
#include <ks.h> // KS.H must be included before KSMEDIA.H
#include <ksmedia.h>
Added winmm.lib to linker options.
Changed main
int _tmain(int argc, _TCHAR* argv[])
Declarated several Text as UNICODE
TCHAR fault[256];
waveInGetErrorText(result, fault, 256);
TEXT("Failed to start recording")
No error; no warning.
After run there is a file "auddata.txt" with 2,92 MB.