Article

From:
To:
Jan Doggen
Subject:
Re: Note: Solved: Impersonate user from service
Newsgroup:
embarcadero.public.delphi.nativeapi

Re: Note: Solved: Impersonate user from service

Jan Doggen schrieb:
> As noted at the top of the xbwLogion unit:
> We only use some of the code, so the rest is UNTESTED.
> 
> If anyone uses this code and improves/corrects it I would like to get notified.
> 
> Thansk
> Jan

Sorry, I have to tell you: this code looks horrible and I advise not to
use it. There are a lot of missing error checks (WTSQueryUserToken),
some error checks are done but there is only a boolean value set to true
(bError) and then the processing is continued,
and some CPAU and other handles (pi, regkeys) are leaking. Furthermore
CPAU is called incorrectly which definitely creates problems with the
UNICODE version (constant strings are not allowed there). Handles are
closed using an empty try/except block. There are a lot of try/except
blocks which are not necessary. ...and more.

90% of your code is already implemented in JWSCL. Have a look at it https://sourceforge.net/projects/jedi-apilib/ http://blog.delphi-jedi.net/ and http://jwscldoc.delphi-jedi.net/
Christian Wimmer
FYI: Phrase searches are enclosed in either single or double quotes
 
 
Originally created by
Tamarack Associates
Mon, 20 May 2024 00:46:58 UTC
Copyright © 2009-2024
HREF Tools Corp.