2uzhan.com
Advertisement
Now Place:2uzhan.com » How to get domain in service mode.

How to get domain in service mode.

Network Programming @ February 12, 2006   Views:0

Hi Friends,
In my application, I get domain name of a computer using NetWkstaUserGetInfo API function (In C Win32 APIs). It works fine in application mode. But when I use the application as a Service, it returns empty string or garbage.
After some time, I found that when I run my service with Administrator’s account (Service Properties -> Logon, selecting ”This Account” radio box, and entering the local or domain (if computer is part of domain) administrator’s username and password), It works fine.
But when I run my service from “Local System Account” it returns nothing or garbage.
On consulting with MSDN, I found that this function works in the context of currently logged in user. It means when I run the application with some user account it returns the domain name for that user.
Now I have two questions
1- Is there no domain for “System” user (which is default user in services).
2- How can I get domain name in service mode? Because my application has to work as a service.
Thanks,
Sohail

--------------Solutions-------------

any one?

Tags:
© 2018 2uzhan.com Contact