how to turn on SSDP and Universal Plug And play Windows servicesprogrammatically?

  • Thread starter Thread starter Lonewolf
  • Start date Start date
L

Lonewolf

Hi,
could someone please enlighten me on how I could turn on the above
mentioned two windows services programmatically? Reason is i am writing
a program which needs to turn on these two services in order to access
the UPnP router to turn on port forwarding programmatically, and turn it
off after that. Can someone please enlighten me on the functions or
Win32 API to call to achieve it ? thank you so much for enlightening me
on this.
 
Lonewolf said:
could someone please enlighten me on how I could turn on the above
mentioned two windows services programmatically? Reason is i am writing a
program which needs to turn on these two services in order to access the
UPnP router to turn on port forwarding programmatically, and turn it off
after that. Can someone please enlighten me on the functions or Win32 API
to call to achieve it ? thank you so much for enlightening me on this.

There are more than a few calls you need to use in a proper solution.

// Once

OpenSCManager();

// Repeat for each service

OpenService();
StartService();
CloseServiceHandle();

// Once

CloseServiceHandle();

Note that you will generally need to run in the context of an account with
administrative privileges.

Regards,
Will
 
Back
Top