Toast Notification in Windows Service Win10 - c++

Im developing a software and im considering it as a Service because i need it to listen to ports 24X7 and notify when new client got connected(Toast Notification). I was able to send Toast notification from classic Win32 c++ application but i can't send it through Windows Service even when i check 'Allow Service to Interact with UI'. What do you think about the software Architecture?! Do you think i should reconsider the software Architecture or there is any other way to send Toast notification through Windows Service?!

"Allow Service to Interact with UI" only has an effect until XP. Up to then, the first user logged in runs in Session 0, the same Session that services run in. But from Vista onwards, Session 0 is now isolated, users run in Session 1 and higher only, so services can no longer interact with users.
When you want your service to display a toast, have the service use CreateProcessAsUser() to spawn a separate process in an available user Session (plenty of examples floating around demonstrating how to do that), and then that process can display the toast as needed.

Related

phone gap apps - How can i detect thet a login web service request is genuine

We r finally taking a leap into writing a mobile application for some of our platforms core functionality.
After spending some time - narrowed down that it is a HTML 5 application, CSS and Apache Phone gap to support different platforms mainly IOS and Android
We are writing WCF based REST services and have a question about securing the web service calls - specially ones for new user creation and login.
How can we ensure that the web service call to create a new user account or subsequently to log into the app is genuinely originating from a mobile device and not via a brute attack or someone trying to execute a service if they do discover the URL? Is there some kind of device identifier that we can depend on as part of the request (or something we embed into the app) etc or are there other more reliable techniques.
Any help would be appreciated.
Regards
Sid
Good question: I use the device plugin to get the device uuid and then hash it with the user email and the timestamp of the registration to create a key. One way hashing is your friend in this scenario. Keep all of your communication on https secure socket layer and create keys based on the UUID and you should be able to solve this problem.

Mini Filter driver communication with windows service

I am creating a mini-filter driver. In that i communicate with user mode application to get the some of the data form user. i communicate with user mode using "communication port". i tried to communicate with user mode application it worked fine.
One the suggestion i got form others is to use windows service to fetch the data since it will always be running and we want user mode application to run always.
My question is
1) Can i create "communication port" in windows service?
2) If i create windows service, how to get specific user information. i mean, when i send the request to service how service come to know from which user session data needs to be fetched?
3) which one is better, i mean user mode or windows service is better solution.
1) Can i create "communication port" in windows service?
Yes you can create it in service.
2) If i create windows service, how to get specific user information. i mean, when i send the request to service how service come to know from which user session data needs to be fetched?
Service does runs under system account and not under any logged in user. So to show popup or dialog to current logged in user, you can look at WTSGetActiveConsoleSessionId() or similar api to get console session.
3) which one is better, i mean user mode or windows service is better solution.
Depends upon your design. As you mentioned service is always running to if your driver depends upon such requirement then do with service. But it will take more efforts to actually interact with user.
But if your driver can work without any service/app connection as such then go with application.

User Interactive Service in Windows 7

We have developed a network based C++ application that should run as a service for Windows XP, 7 32-bit system.
The application is console based.
User should be able to see the logs in console once the app is up and running.
To make application run as a service , we used XYNTService
The application is working as a service and it works fine under XP.
But I am not able to see the console under Windows 7, Since the service is running under the local SERVICE account, probably we can not see the GUI or access it in any way, because it is running in another winlogon session.
So can some one please suggest how can we make the service interactive so that user can see logs on the console while the app is running as a service?
Else
What if I make it a tray based application, is there a way to redirect logs a window?
Actually you can subscribe to logon/logoff events and then use WTSEnumerateSessions with CreateProcessAsUser to create GUI each time user logs into system, however it's not a good choice.
Making a tray app that automatically runs when user logs into system is better idea, you can use any of IPC mechanisms (named pipes, shared memory, sockets) to sent logs from service to tray app.

Does SendNotifyMessage API work across user sessions?

Say, I have a Windows service application and also windowed client applications running in each logged on user session. If I call RegisterWindowMessage in each client app and try to trap that message there. And then also call RegisterWindowMessage with the same message name in the service app and then use it in a call to SendNotifyMessage again from the service to notify each client app of a single-fire event, will that work?
PS. I program using C++/MFC and native WinAPIs.
If your service application is running under the system account it cannot send messages to the user account's application.
Your can try the following approach:
Go through all the sessions (WTSEnumerateSessions) to get all
WindowStation,
Open these stations (OpenWindowStation),
Per station
Associate your process with the station (SetProcessWindowStation),
Go through all station desktops (Enumdesktops),
Go through all windows (EnumdesktopWindows) until your found one of your
application's window
You probably will have issues with UAC though.

attaching windows service to skype Public Api

I need to capture the Skype Event through Windows Service.Skype like Call etc.
I am trying to register the Skype Notification but it failing.
Whether Windows Service allows Registering Skype Event or not?If not how can we achieve this.
Windows service in general allows to register events from Skype but first you must define:
1) Are you going to use Skype4COM (Desktop API) to communicate with one of standard Skype clients.
2) OR are you going to build your own Skype client using SkypeKit SDK?
The case 1 allows exchanging data only if some Skype client is running
but case 2 can work even while no user is logged in but it requires much more effort.
it is not possible to have Skype4COM in windows service