It seems that Dll injection in Windows 7 64bit could work using the same technique used in Windows XP.
The code I was using works in Windows 7 32bit but doesn't work in Windows 7 64 bit
My code is copied from sample found out in Internet and opens the process to inject a dll:
// Get a handle for the target process.
hProcess = OpenProcess(
PROCESS_CREATE_THREAD | // For CreateRemoteThread
PROCESS_VM_OPERATION | // For VirtualAllocEx/VirtualFreeEx
PROCESS_VM_WRITE, // For WriteProcessMemory
FALSE, dwProcessId);
The code above doesn't work in Windows 7 64 bit. For windows 7 64 bit it should be:
// Get a handle for the target process.
hProcess = OpenProcess(
PROCESS_ALL_ACCESS, //fix wor windows 7 64 bit
FALSE, dwProcessId);
venerdì 11 novembre 2011
mercoledì 2 novembre 2011
How to convert raw pcm data into wav files using NAUDIO library
In my project I have a third party library that produces raw PCM files and I need to play them.
Off course tools like Audacity are able to convert PCM files, but the easiest way I found out to read and play raw PCM files programmatically is using NAUDIO:
WaveFormat format = new WaveFormat(8000, 1);
using (RawSourceWaveStream reader = new RawSourceWaveStream(new FileStream (fileName, FileMode.Open), format))
{
WaveFileWriter.CreateWaveFile(Path.ChangeExtension(fileName, "wav"), reader);
}
Off course tools like Audacity are able to convert PCM files, but the easiest way I found out to read and play raw PCM files programmatically is using NAUDIO:
WaveFormat format = new WaveFormat(8000, 1);
using (RawSourceWaveStream reader = new RawSourceWaveStream(new FileStream (fileName, FileMode.Open), format))
{
WaveFileWriter.CreateWaveFile(Path.ChangeExtension(fileName, "wav"), reader);
}
Iscriviti a:
Post (Atom)