[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

setting time under NT from non Administrator Accounting

Posted on 2000-03-09
6
Medium Priority
?
257 Views
Last Modified: 2010-04-02
i need to set the sistem time without using NT Security (because my program will run on NT under non Admin login and it must have the possibility to set the system time!)

how can i do this?
and it's possible to do it?
(samples of source code are needed)

thanks

Cristian Bertoldi

i've posted the question under C section too. I will assign 500 points to the first correct answer.....
0
Comment
Question by:crisbert
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 2600576
This is possible by using an account that holds the 'SeSystemtimePrivilege' - there is no need to have an admin login. This privilege is usually granted to Administrators and Power Users, but can also be granted to 'normal' users, but granting privileges indeed needs an admin account (e.g. your installation program could do it).

If you could go this way, I could offer some samples.

Another alternative would be to use a service that sets the time, but this is much more work...
0
 

Author Comment

by:crisbert
ID: 2601704
ok , i'll try this way if you send me a sample...

thanks
0
 
LVL 86

Accepted Solution

by:
jkr earned 1000 total points
ID: 2602000
http://msdn.microsoft.com/library/devprods/vs6/visualc/vcsample/vcsmpisaprivssample.htm

and download the sample. The 'lsaprivs.c' file illustrates how to do it. Simply replace

        Status = SetPrivilegeOnAccount(
                    PolicyHandle,           // policy handle
                    pSid,                   // SID to grant privilege
                    L"SeServiceLogonRight", // Unicode privilege
                    TRUE                    // enable the privilege
                    );

from the sample with

        Status = SetPrivilegeOnAccount(
                    PolicyHandle,           // policy handle
                    pSid,                   // SID to grant privilege
                    L"SeSystemtimePrivilege", // Unicode privilege
                    TRUE                    // enable the privilege
                    );

and it should work...
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 32

Expert Comment

by:jhance
ID: 2602079
This question is also asked at:

http://www.experts-exchange.com/jsp/qShow.jsp?ta=cprog&qid=10308047 

crisbert has said there that the option of changing user rights on the machine is not an option.  

An example to do this as a service is also included there.
0
 
LVL 86

Expert Comment

by:jkr
ID: 2602244
Sorry, didn't pay attention to this Q in the C area...
0
 

Author Comment

by:crisbert
ID: 2603779
thanks anyway, i'll use this sample code in another application....

if you have anything else......

Thanks
Cristian Bertoldi

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question