Windows Core Audio API + WaveOutXxx API - windows

I wave written a code to play back WAV files. I'm using the WavOutxxx APIs to accomplish this. It is well documented that WavOutXxx APIs open their streams to the default session. Now for certain reasons I'm trying to control the session opened by the WaveOutXxx APIs using IAudioSessionControl API (Windows Core Audio Interfaces).
Can you tell me if this is actually possible? My code does not involve an inter-process communication for this, since everything is handled in the same code. MSDN says this is possible(http://msdn.microsoft.com/en-us/library/dd371428(v=vs.85).aspx) but I don't see how to do this or any examples. It would be very kind if someone can point me to something relevant.
Thanks.

Yes, it is possible. Look at this example.

Related

How would I update the title of a YouTube livebroadcast via a Bash script?

I have a YouTube channel that has a number of live broadcasts throughout the week, I am just looking for a way for the Title and Description to be updated via a crontab.
I have see seen the following link. https://developers.google.com/youtube/v3/live/docs/liveBroadcasts/update
To be honest I cant make any sense of it.
Any help offered greatly appreciated.
You're in front of a non-trivial API, but that should not discourage you to go ahead with it.
I'd recommend Python as implementation language: go use the Google's APIs Client Library for Python.
Basically, this library is of good quality and (compared to other client libraries) simple to use. It will, for example, insulate you from having to deal explicitly with REST API calls, JSON and the like. Your code will also work under both GNU/Linux and Windows.
You may begin your journey by reading the official getting started docs: Python Quickstart and YouTube Live Streaming API Overview. Then I recommend absorbing these two important documents: Life of a Broadcast and Understanding Broadcasts and Streams.
Then go read, understand and run the following sample program from Google: create_broadcast.py. Of course, you'll have to adapt that code to your use case.
You'll have to exercise patience and perseverance (since I imply that you have no prior experience using the YouTube Data API). Using this API will pay off to you at the end of your (programming) journey.
A special mention: for to be able to call the live streaming APIs you will first need to get acquainted with the things related to the so-called OAuth 2.0 authorization and authentication: Implementing OAuth 2.0 Authentication. There's an official document that you need absorb: OAuth 2.0 for Mobile & Desktop Apps.
A few more references: the live streaming API has an official documentation too. The main site documenting the client library is: Google API Client Library for Python Docs. Its source is public, to be found within the client library's public repo under the directory docs.
Also useful is to see the YouTube Data API's list of all instance methods.

Protocol Buffers - RPC

I'm trying to have a messaging service(over TCPIP) between windows on PC(running C# app) and linux on an SoC board(running C++ app). I went through Google's protocol buffers and thought that I can serialize the structure (data struct) into a buffer and write this buffer over sockets(saw an example too).
My question, is there another way to do this? What does protocol buffer-RPC do? I went through their documentation but they don't specify on how to do it with TCPIP. Maybe someone has examples for this or detailed documentation?
Thank you,
Karthik.
My question, is there another way to do this?
There are many ways to do this. Google Protocol Buffers is library for cross-platform object serialization. You can share this serialized data in many different ways. My recommendation for you is using ZMQ (ZMQ GUIDE) which is perfectly suited for applications like yours.
I have a similar use case to you. I wrote Linux C++ ZMQ server on Raspberry Pi and Python ZMQ client dedicated for telemetry and remote management purposes. This library is efficient, lightweight, works perfectly with Google Protocol Buffers and has binding to all major programming languages. If you decide to use this library do not hesitate to ask me about working code example.
See if the Google Developers page on how the protocol buffers wire format is encoded helps with your question: https://developers.google.com/protocol-buffers/docs/encoding

Access webcam from multiple applications simultaneously

The problem background - there are two different windows applications that are trying to access webcam on the computer at the same time. Currently, only one application is able to access to it. I want to be able to allow both applications to simultaneously access the webcam. A common example of my problem is, skype and yahoo messenger trying to access the webcam on the computer at the same time.
I found a few softwares (manycam.com, http://www.splitcamera.com/) that allow this on windows. But I am not sure how they implemented it. I want to write the code myself to achieve this since my code needs to be integrated with other APIs.
I appreciate if anyone can shed light on how to write a device wrapper to achieve this.
The kernel camera driver registers several OS-defined callbacks. One of the callbacks is used for the output stream. Dedicated Windows applications have an interface to this stream - you'll need to do some reading on this subject, it's not something that can be covered in scope of SO. You need a component that will be layered in between the client applications and the camera driver. This component should intercept your camera driver output and duplicate it for the registered clients. This can be achieved either in kernel (filter driver) or in user mode (preferable). http://msdn.microsoft.com/en-us/library/windows/hardware/ff557573%28v=vs.85%29.aspx is a good place to start.
Note: this functionality might be already supported by your camera software (though I think the chances are very slim) and in this case you should dig into the corresponding documentation.

Active-X vs Ajax Internet client-server communication

I have to use scanner on Internet site web page. As far as I know not Flash nor Silverlight is capable to communicate with such hardware nowadays. It looks like there is no alternative to Active-X at present for such operation (correct me if I'm wrong).
After image is scanned I have to send it to server via HTTPS and wait for processing result.
I have some alternatives here:
Start ajax polling with regular interval
Put polling functionality straight into active-x component
What approach would you personally preffer?
Is it possible to establish event mechanism for Active-X approach (when server pushes result back to a web-page?). Will events work for javascript/ajax approach?
Thank you in advance!
Have the client scan and upload a file. That's how it's done these days. Scanning software is a part of OS - at least, in Windows and MacOS it is.
With an ActiveX object, it will become a support nightmare. Also, think of all the Firefox/Chrome/Opera/Non-Windows users out there.
Also, I vaguely recall scanner support will be added in HTML5.

How can I reverse engineer scrambled packets in a windows app?

I have a windows exe app that used to sends packets to a server in the clear. This app (lets call it the client app) is definitely close sourced, but some clever hacker hex-edited the binary, and made it send packets that are scrambled.
Now, obviously, those packets are scrambled in a way that is decipherable (otherwise the server would not be able to understand it), but what I wanted to do is to write an emulator that emulates this binary app, sending the same packets to the server, and being able to unscramble the response (if it is scrambled).
The hex-ed client required an extra dll in order to run, which the old client did not. I am assuming that somehow the hex-ed client managed to load that dll (lets call it client.dll) and the function of that dll is to implement the scrambling/unscrambling, by hooking into some windows api that rerouted all packets sent from the client.exe process.
If there are anyone who can direct me on how to even get started on working out how this all works, and how I can reverse engineer the scrambing, that would be really appreciated.
I have no idea what kind of information to provide, but if there is any lacking, just reply, and I will post with more details, and if anyone wants the binaries, I m happy to provide it.
binary download for any interested parties:
http://dl.getdropbox.com/u/46623/client.dll
http://dl.getdropbox.com/u/46623/newClient.exe
http://dl.getdropbox.com/u/46623/originalClient.exe
These wont run because the resource files are required - they are about 3 gigs, so too big to upload anywhere. Names have been changed to protect the guilty =) , but that probably doesnt protect the name of the dll...
I'm assuming that the person which coded this hook which adds encryption to the packet I/O for the aforementioned program has either hooked the relevant Windows' socket APIs (WSASend, send, etc) or hooked the internal program functions used to send/receive data.
This being said, I'd suggest you use a hook detection program (e.g. RkUnhooker) to find out what is actually being hooked. Once you know what APIs are hooked you should also know where these hooks are going and from there on in you'll have to manually reverse engineer the hook functions.
As for the subject of learning how to do this, I couldn't direct you to just one tutorial to teach you everything but I highly suggest you look at the Tuts4You site, it has a plethora of tutorials which would meet all of your needs.
If possible, upload a copy of the edited client & the hook DLL, if I have the time I'll code you replica encryption & decryption functions.
You need to hook the functions exported by the additional DLL and look into the functions being called and the parameters being passed to them. This is not going to be easy since you do not have type information (e.g. the function signatures for the DLL exports.)
Look here for some information on API hooking. You will also need a good debugger try Windbg from microsoft.
As far as I can see the only option you have here is black box testing ie give known input to both systems and compare the responses against each other to find the differences and similarities.
+--------------+
Input--------->| Original App |--------->Response1
+--------------+
+------------+
Input--------->| Modded App |--------->Response2
+------------+
Now once you figure out how to use the functions from the additional dll you can use it yourself in the same way the original app does.

Resources