Controlling power to PCMCIA slot/card - c#

I'm currently working on a project that utilizes a proprietary PCMCIA radio card to communicate with some wireless devices. I currently have a background process that handles reading data to and from the card and storing it for processing, but I'd like to be able to shut down power to the card when my application is not running. I've done some investigating, and while WMI evidently does support the CIM_PCMCIAController profile in its WIN32_PCMCIAController implementation, the SetPowerState() and Reset() functions are not implemented. Does anyone know of a way (with or without WMI) to control the power state of the slot? I need to be able to programatically both power off and power on either the slot or the card.
Edit
Several people I've spoken to have suggested adding a function to the card that would facilitate this. Unfortunately modifying the card to provide this sort of functionality really isn't an option right now.
Edit 2
I've confirmed that the device does show up in the Device Manager under the "Multifunction adapters" category, though neither disabling the device nor the PCMCIA controller itself from here has any effect on the power of the card.

Presumably, the device has it's own drivers of some sort and shows-up in Device Manager.
In which case, you could disable the device by calling devcon (Command-line equivalent of Device Manager), from inside your program. This would make windows handle shutting down the device.
devcon disable. See Example #31 for an example of how to shutdown device by a specific device id.
Am I going on the right-lines, or have I misinterpreted your question?

I'm curious, but does using the "Safely remove hardware..." button turn off the power to the device, enough to satisfy your requirement?
If that works, you could programatically register and unregister the device through Microsoft's API. Here is a page that shows a couple functions that might be helpful for this scenario: http://msdn.microsoft.com/en-us/library/aa363234(VS.85).aspx

Related

How to intercept and record or modify signals between hardware and software

My understanding of how this stuff works is very limited, as I usually just make library calls which make the audio / video magically show up.
I want to be able to do MITM "attacks" to programs on my own computer. (I'd be the guy intercepting signals between the software and the hardware). This kind of thing could be useful in a number or scenarios.
For instance, for audio:
XP doesn't have a way to change the audio for specific programs while keeping the others unchange. It only has one audio
manager across all its programs. If I could intercept the signal (and
detect which program it was coming from) I could in theory make my own audio manager.
I could record conversations, possibly testing out any audio -> text software I may have/create.
many more.
For video:
(Primary goal here): record conversations. I have used a third party program, but I'm guessing what it is doing is taking snapshots because 1) the video is choppy and 2) when the mouse or other thing gets in the way of the video, it records that too. Wouldn't it be easier just to record the signal going to the video card from the specific program of my interest, then play it back when I want to see it again?
For network traffic:
For recording traffic to and from my computer, possibly discovering
programs that are communicating that shouldn't be.
For keyboard/mouse:
This could be useful for easily creating macros to fill out forms or
whatever, and I could custom encrypt the data to make sure it's
secure rather than relying on some third party software.
I'm sure there are many other applications for which this could be useful.
Thanks.

windows 8 desktop: bluetooth event listener

I'm writing a windows 8 desktop app for the tablet that tracks the bluetooth radio status in order to monitor power consumption. Basically, I want to find out the initial radio status, as well as receive callbacks whenever the status changes. I've looked through the MSDN bluetooth functions (http://msdn.microsoft.com/en-us/library/windows/desktop/aa362927%28v=vs.85%29.aspx) but haven't been able to find anything about the event callback.
Can someone please point me in the right direction? Is there a way to do this (preferably in C#, but C/C++ is fine as well)?
Thank you
I think there is no Bluetooth event regarding radio removal. You will be able to use the general hardware events to see device removal, that set-up by function RegisterDeviceNotification. See e.g.
http://msdn.microsoft.com/en-gb/library/windows/desktop/aa363431.aspx
http://www.codeproject.com/Articles/14500/Detecting-Hardware-Insertion-and-or-Removal

Printer Communication Capture

If I need to post this elsewhere let me know.
We have some old software thats being re-written, that uses a printerdriver to a propriatery printer.
I need to rewrite the software bypassing the print driver and go directly to the printer. I do have the specs for the printer communication, thats fine, but what Id like to do is monitor the communications to the printer to view its contents (from the existing software that Im re-writing) and compare it to the specs, and what I will be sending it for validation.
I have to make sure Im not missing anything.
Any ideas on how I might be able to accomplish this?
Thanks
To capture the traffic you have to basic options.
1. Use software
If you are using ethernet, you can use a program like WireShark or USBTrace to capture the packets that are being sent out. There are similar programs for USB.
2. Use hardware
Another option would be to use an external logic analyzer. It's basically a box that sits in-between the computer and the printer that captures all the data, then uses software to decode it. There are some inexpensive options available (USBEE, Bus Pirate, and Total Phase Beagle.
I own a USBEE and I've used it to debug a simple USB device. It works well enough for that. The software is a little clunky though.

Can I turn off a screen but leave the display working for a VNC Viewer?

I have been looking around for this but I can't find out if this is possible or not. I have some software that uses Log Me In Rescue. As it stands, the software currently connects to our servers to get a pin generated by their PHP API. This pin is then sent back to the application that then posts the form with the pin in at logmein123.com. This then downloads the response application, which then runs and our Support Techs can then access the hardware, the problem is the software actively cuts control of the Windows OS behind the application: no task bar; start button or driver installation; so the software then has provide a way for our support to re-enable every thing.
So I'm looking for a way to leave the display enabled to the LogMeIn software on the tills but stop the screen from showing is there I way I can tell the screen to turn off and not stop the display from working? The hardware is powered by a Windows 7-based OS. If this is possible, could some one point me to a tutorial on how to do such a thing?

C# mute/unmute specific window/s?

I would like to know if it is possible to mute only a specific window. For example I have got Firefox open and two more windows. I want to mute everything related to Firefox but not the whole sound of my computer.
Is this possible? If so, how can it be done?
look, basically, there isn't any relation between the window handle and the sound which something in its code is playing.. the audio card can't tell who wants it to play.
theoretically, there is an option to do what you want on web browsers, but it's not easy, and not 100%. it goes like this:
most of the audio that is playing from browsers are from known objects like wmp/quick time/vlc/flash/etc..
when the user will choose to mute all audio from firefox, your application will search those known objects in the firefox tabs, and mute/unmute them using their api.
in order to do that, you will need to write an extension to firefox, so you could have an access to the tabs memory from your application.
btw, what os?
and check this out: http://www.indev.no/?p=projects#flashmute (flashmute) i believe it does what is said - only for flash.
On Vista/Windows 7:
I expect there to be some API which can change the volume on a per process basis which the audiomanager uses. Should be relatively straight forward to use.
On XP
I don't think there is any built in functionality for what you want to do. I recommend just not offering that feature on XP. But if you really want to, there are some hackish solutions:
Usermode API hooking. Intercept the calls to audioapis with your own functions. These change the volume or manipulate the audiosignal so you get what you want. You need to do this differently for any of the several available audio-apis. I guess DirectSound and DirectShow are particularly annoying. And this requires injection of a dll into any process you want to manipulate. And this dll better not require the .net runtime. Search for IAT(import address table) or EAT(export address table) hooking.
Kernel mode audio hooking. Write a driver which intercepts the audio in the kernel and changes it on a per process basis. No clue how to do that.
But as you can see both solutions aren't good.

Categories

Resources