Produced by Araxis Merge on 10/18/2017 11:37:30 AM Eastern Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | OSCIF_CPRS v32 Phase 2 Build 2OR3.0405_August_2017.zip\OR_30_405V36_SRC.zip\XE8\Broker\Source | XlfSid.pas | Wed Oct 11 20:08:07 2017 UTC |
| 2 | OSCIF_CPRS v32 Phase 2 Build 2OR3.0405_August_2017.zip\OR_30_405V36_SRC.zip\XE8\Broker\Source | XlfSid.pas | Tue Oct 17 19:58:08 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 306 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | { ******** ********** ********** ********** ********** ********** **** | |
| 2 | Pa ckage: XWB - Kernel RPCBroker | |
| 3 | Da te Created : Sept 18, 1997 (Ver sion 1.1) | |
| 4 | Si te Name: O akland, OI Field Off ice, Dept of Veteran Affairs | |
| 5 | De velopers: PII, PII, PII | |
| 6 | De scription: Contains TRPCBroker and relat ed compone nts. | |
| 7 | Unit: Xl fSid Threa d or Proce ss securit y in Windo ws. | |
| 8 | Cu rrent Rele ase: Versi on 1.1 Pat ch 65 | |
| 9 | ********** ********** ********** ********** ********** ********** *** } | |
| 10 | ||
| 11 | { ******** ********** ********** ********** ********** ** | |
| 12 | Changes in v1.1.65 (HGW 08/0 5/2015) XW B*1.1*65 | |
| 13 | 1. None. | |
| 14 | ||
| 15 | Changes in v1.1.60 (HGW 07/1 6/2013) XW B*1.1*60 | |
| 16 | 1. None. | |
| 17 | ||
| 18 | Changes in v1.1.50 (JLI 09/0 1/2011) XW B*1.1*50 | |
| 19 | 1. None. | |
| 20 | ********** ********** ********** ********** ********** } | |
| 21 | ||
| 22 | unit XlfSi d; | |
| 23 | //******** ********** ********** ********** ********** ******* | |
| 24 | //These fu nctions ge t their da ta from th e Thread | |
| 25 | // or Proc ess securi ty ID in W indows. | |
| 26 | // GetNTLo gonUser re turns the Domain\Use rname that | |
| 27 | // authen ticated th e user/ | |
| 28 | // GetNTLo gonSid ret urns a str ing with t he users S ID. | |
| 29 | //******** ********** ********** ********** ********** ******** | |
| 30 | ||
| 31 | interface | |
| 32 | ||
| 33 | uses | |
| 34 | {System} | |
| 35 | SysUtils , | |
| 36 | {WinApi} | |
| 37 | Windows; | |
| 38 | type {Fro m MSDN} | |
| 39 | ||
| 40 | StringSi d = ^LPTST R; | |
| 41 | ||
| 42 | function C onvertSidT oStringSid (Sid: {THa ndle}PSID; var StrSi d: LPTSTR) : BOOL std call; | |
| 43 | ||
| 44 | function G etNTLogonU ser(): str ing; | |
| 45 | function G etNTLogonS id(): stri ng; | |
| 46 | ||
| 47 | implementa tion | |
| 48 | ||
| 49 | ||
| 50 | function C onvertSidT oStringSid ; external advapi32 name 'Conv ertSidToSt ringSidA'; | |
| 51 | ||
| 52 | function G etNTLogonU ser(): str ing; | |
| 53 | var | |
| 54 | hToken: THANDLE; | |
| 55 | tic: TTo kenInforma tionClass; | |
| 56 | ptkUser: PSIDAndA ttributes; | |
| 57 | P: point er; | |
| 58 | buf: PCh ar; | |
| 59 | cbti: DW ORD; | |
| 60 | Name: PC har; | |
| 61 | cbName: DWORD; | |
| 62 | RDN: PCh ar; | |
| 63 | cbRDN: D WORD; | |
| 64 | snu: DWO RD; | |
| 65 | begin | |
| 66 | Result : = ''; | |
| 67 | tic := T okenUser; | |
| 68 | Name := ''; | |
| 69 | RDN := ' '; | |
| 70 | ||
| 71 | try | |
| 72 | //Get the callin g thread's access to ken | |
| 73 | if not OpenThrea dToken(Get CurrentThr ead(), TOK EN_QUERY, longbool(t rue), hTok en) then | |
| 74 | if ( GetLastErr or() <> ER ROR_NO_TOK EN) then e xit | |
| 75 | // Ret ry against process t oken if no thread to ken exist. | |
| 76 | else | |
| 77 | if n ot OpenPro cessToken( GetCurrent Process(), TOKEN_QUER Y, hToken) then exit ; | |
| 78 | // Obt ain the si ze of the user info in the tok en | |
| 79 | // Cal l should f ail due to zero-leng th buffer | |
| 80 | if Get TokenInfor mation(hTo ken, tic, nil, 0, cb ti) then e xit; | |
| 81 | ||
| 82 | // All ocate buff er for use r Info | |
| 83 | buf := StrAlloc( cbti); | |
| 84 | ||
| 85 | // Ret rive the u ser info f rom the to ken. | |
| 86 | if not GetTokenI nformation (hToken, t ic, buf, c bti, cbti) then exit ; | |
| 87 | cbName := 0; | |
| 88 | cbRDN := 0; | |
| 89 | snu := 0; | |
| 90 | P := b uf; //Use pointer t o recast P Char | |
| 91 | ptkUse r := PSIDA ndAttribut es(P); | |
| 92 | //call to get th e size of name and R DN. | |
| 93 | Lookup AccountSid ( nil, ptk User.Sid, Name, cbNa me | |
| 94 | , RDN, cbRDN , snu); | |
| 95 | Name : = StrAlloc (cbName); | |
| 96 | RDN := StrAlloc( cbRDN); | |
| 97 | //Call to fillin Name and RDN | |
| 98 | Lookup AccountSid ( nil, ptk User.Sid, Name, cbNa me | |
| 99 | , RDN, cbRDN , snu); | |
| 100 | Result := string (RDN) + '\ ' + string (Name); | |
| 101 | StrDis pose(Name) ; | |
| 102 | StrDis pose(RDN); | |
| 103 | finall y | |
| 104 | if (hT oken <> 0) then Clos eHandle(hT oken); | |
| 105 | end; | |
| 106 | ||
| 107 | end; | |
| 108 | ||
| 109 | function G etNTLogonS id(): stri ng; | |
| 110 | var | |
| 111 | hToken: THANDLE; | |
| 112 | tic: TTo kenInforma tionClass; | |
| 113 | ptkUser: PSIDAndA ttributes; | |
| 114 | P: point er; | |
| 115 | buf: PCh ar; | |
| 116 | StrSid: PChar; | |
| 117 | cbti: DW ORD; | |
| 118 | // cbNa me: DWORD; | |
| 119 | // cbRD N: DWORD; | |
| 120 | // snu: DWORD; | |
| 121 | begin | |
| 122 | Result : = ''; | |
| 123 | tic := T okenUser; | |
| 124 | ||
| 125 | try | |
| 126 | //Get the callin g thread's access to ken | |
| 127 | if not OpenThrea dToken(Get CurrentThr ead(), TOK EN_QUERY, longbool(t rue), hTok en) then | |
| 128 | if ( GetLastErr or() <> ER ROR_NO_TOK EN) then e xit | |
| 129 | // Ret ry against process t oken if no thread to ken exist. | |
| 130 | else | |
| 131 | if n ot OpenPro cessToken( GetCurrent Process(), TOKEN_QUER Y, hToken) then exit ; | |
| 132 | // Obt ain the si ze of the user info in the tok en | |
| 133 | // Cal l should f ail due to zero-leng th buffer | |
| 134 | if Get TokenInfor mation(hTo ken, tic, nil, 0, cb ti) then e xit; | |
| 135 | ||
| 136 | // All ocate buff er for use r Info | |
| 137 | buf := StrAlloc( cbti); | |
| 138 | ||
| 139 | // Ret rive the u ser info f rom the to ken. | |
| 140 | if not GetTokenI nformation (hToken, t ic, buf, c bti, cbti) then exit ; | |
| 141 | P := b uf; //Use pointer t o recast P Char | |
| 142 | ptkUse r := PSIDA ndAttribut es(P); | |
| 143 | // P := nil; | |
| 144 | if Con vertSidToS tringSid(p tkUser.sid , StrSid) = true the n | |
| 145 | begin | |
| 146 | Resu lt := PCha r(StrSid); | |
| 147 | loca lFree(Card inal(StrSi d)); | |
| 148 | end; | |
| 149 | finally | |
| 150 | if (hT oken <> 0) then Clos eHandle(hT oken); | |
| 151 | end; | |
| 152 | ||
| 153 | end; | |
| 154 | end. |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.