954,492 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

how to run a dos command from windows service

Hi,

I have created a windows service in Visual studio 2005 C++, which will encrypt a file and send it to a server using socket.

For this I am using OpenSSL, I am running in to following issues

1) I could not find the library method of OpenSSL which can be invoked to do the encryption, so I used System( ) to execute the command line OpenSSL
2) this works well in console application, but when I convert the application to windows service, System( ) is not executing
following gives me

_get_errno(&err);


'9' as the error.

Can someone suggest a way of executing OpenSSL using System( ) or even better the lib call for OpenSSL

Thanks in advance.
Vikas

vikaschndr
Newbie Poster
2 posts since May 2009
Reputation Points: 10
Solved Threads: 0
 

Does the service program have permissions to do that? You might have to have the service log in with an administrator account.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

Thanks Ancient Dragon

That was the problem, installed it from Admin a/c and worked just fine.

Thanks a lot :)

vikaschndr
Newbie Poster
2 posts since May 2009
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You