[fpc-pascal]Windows ShutDown Privilege

MPDJ mpdj at btinternet.com
Sun Dec 8 12:16:45 CET 2002


I'm using Windows 2000 SP3 and I compiled under both Delphi and fpc.
The function is due to be used under Windows 95/98 and Win2000 so I'd
like to get the privileges sorted so I can shut either OS down.

I've tried under administrator but this has made no difference. I was
under the impression that application privileges are independent of
the user logged in at the time?

I'll dig out an old copy of Delphi and compile it just to be sure
there has been no change in the API functions, though I did
double-check online with MSDN and all looked OK.

Again, many thanks for all the suggestions and help so far.


Andy


Sunday, December 8, 2002, 10:36:24 AM, you wrote:


ME> Which version of Windows are you using? I assume a NT 4.X/NT 5.X variant. If
ME> it's NT 4, which service pack? if it's less than 4 I'd try SP5 or SP6 first.
ME> Just to be sure.

ME> If you're using a Win9x variant, you probably don't need all the security
ME> stuff because it's only NT that needs all of that.

ME> The code was taken from Delphi, so make sure you've compiled using the
ME> Delphi compatibility mode, just to be sure that FPC isn't ignoring
ME> something.

ME> Hope that helps,

ME> Matt

>> Thanks for the Shutdown routine. I'm starting to get really annoying
>> with this now as I compiled the routine and ran it and exactly the
>> same problem appeared with the same error message stating I don't have
>> the correct privilege.
>>
>> I added a CheckPrivilege call before and after the
>> AdjustTokenPrivileges and it appears the "SeShutdownPrivilege" has not
>> been altered.
>>
>> Is there something strange about the Privilege settings with Windows
>> that I'm missing somehow? I've searched Google and all the routines
>> are very similar to each other yet despite tweaking the function the
>> error remains. I'll have to try compiling the function in Delphi just
>> to prove to myself I'm not going mad!



ME> _______________________________________________
ME> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
ME> http://lists.freepascal.org/mailman/listinfo/fpc-pascal





More information about the fpc-pascal mailing list