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 | XWBut1.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 | XWBut1.pas | Tue Oct 17 19:58:09 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 684 |
| 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: XW But1 conta ins utilit ies used b y the BDK. | |
| 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. Added REG_IAM K ey for obt aining Ide ntity and Access Man agement (I AM) | |
| 14 | Secur e Token Se rvice (STS ) URL from Windows r egistry. | |
| 15 | ||
| 16 | Changes in v1.1.60 (HGW 05/0 8/2014) XW B*1.1*60 | |
| 17 | 1. Chang e to set a ccess perm issions wh en reading from or w riting | |
| 18 | to Wi ndows regi stry. | |
| 19 | 2. Fixed deletion of key val ues (was t rying to d elete a ke y). | |
| 20 | ||
| 21 | Changes in v1.1.47 (JLI 06/1 7/2008) XW B*1.1*47 | |
| 22 | 1. Delet ed unused code. | |
| 23 | ********** ********** ********** ********** ********** } | |
| 24 | ||
| 25 | unit XWBut 1; | |
| 26 | ||
| 27 | interface | |
| 28 | ||
| 29 | uses | |
| 30 | {System} | |
| 31 | System.S ysutils, S ystem.Clas ses, Syste m.IniFiles , | |
| 32 | {System. Win} | |
| 33 | System.W in.Registr y, | |
| 34 | {WinApi} | |
| 35 | WinApi.M essages, W inProcs, | |
| 36 | {Vcl} | |
| 37 | Vcl.Dial ogs; | |
| 38 | ||
| 39 | const | |
| 40 | xwb_Conn ectAction = wm_User + 200; | |
| 41 | IniFile = 'VISTA.I NI'; // This is n o longer u sed. | |
| 42 | BrokerSe ction = 'R PCBroker'; | |
| 43 | BrokerSe rverSectio n = 'RPCBr oker_Serve rs'; | |
| 44 | TAB = #9 ; | |
| 45 | {For Reg istry inte raction} | |
| 46 | {Roots } | |
| 47 | HKCR = HKEY_CLAS SES_ROOT; | |
| 48 | HKCU = HKEY_CURR ENT_USER; | |
| 49 | HKLM = HKEY_LOCA L_MACHINE; | |
| 50 | HKU = HKEY_USER S; | |
| 51 | HKCC = HKEY_CURR ENT_CONFIG ; | |
| 52 | HKDD = HKEY_DYN_ DATA; | |
| 53 | {Keys} | |
| 54 | REG_IA M = 'Softw are\Vista\ Common\IAM '; | |
| 55 | REG_BR OKER = 'So ftware\Vis ta\Broker' ; | |
| 56 | REG_VI STA = 'So ftware\Vis ta'; | |
| 57 | REG_SI GNON = 'So ftware\Vis ta\Signon' ; | |
| 58 | REG_SE RVERS = 'S oftware\Vi sta\Broker \Servers'; | |
| 59 | ||
| 60 | var | |
| 61 | RetryLim it: intege r; | |
| 62 | ||
| 63 | ||
| 64 | function BuildSect( s1: string ; s2: stri ng): strin g; | |
| 65 | procedure GetHostLis t(HostList : TStrings ); | |
| 66 | function GetHostsPa th : Strin g; | |
| 67 | function GetIniValu e(Value, D efault: st ring): str ing; | |
| 68 | function Iff(Condit ion: boole an; strTru e, strFals e: string) : string; | |
| 69 | function Sizer (s1: string; s 2: string) : string; | |
| 70 | function ReadRegDat a(Root : H KEY; Key, Name : str ing) : str ing; | |
| 71 | procedure WriteRegDa ta(Root: H KEY; Key, Name, Valu e : string ); | |
| 72 | procedure DeleteRegD ata(Root: HKEY; Key, Name : st ring); | |
| 73 | function ReadRegDat aDefault(R oot: HKEY; Key, Name , Default : string) : string; | |
| 74 | procedure ReadRegVal ues(Root: HKEY; Key : string; var RegVal ues : TStr ingList); | |
| 75 | procedure ReadRegVal ueNames(Ro ot:HKEY; K ey : strin g; var Reg Names : TS tringlist) ; | |
| 76 | ||
| 77 | implementa tion | |
| 78 | ||
| 79 | ||
| 80 | ||
| 81 | {--------- ---------- --------- BuildSect ---------- ---------- ------- | |
| 82 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 83 | Function B uildSect(s 1: string; s2: strin g): string ; | |
| 84 | var | |
| 85 | s, x: St ring; // JLI 090804 | |
| 86 | begin | |
| 87 | if s2 <> '' then | |
| 88 | s := s 1 + s2 | |
| 89 | else | |
| 90 | s := s 1; | |
| 91 | x := Int ToStr(leng th(s)); | |
| 92 | if lengt h(x) = 1 t hen x := ' 00' + x; | |
| 93 | if lengt h(x) = 2 t hen x := ' 0' + x; | |
| 94 | Result : = x + s; | |
| 95 | end; | |
| 96 | ||
| 97 | ||
| 98 | ||
| 99 | {--------- ---------- -------- G etHostList --------- ---------- ------- | |
| 100 | Reads HOST S file and fills the passed Ho stList wit h all | |
| 101 | entries fr om that fi le. | |
| 102 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 103 | procedure GetHostLis t(HostList : TStrings ); | |
| 104 | var | |
| 105 | I, Space Pos: integ er; | |
| 106 | IP, Host Name: stri ng; | |
| 107 | S : stri ng; //Indivi dual line from Hosts file. | |
| 108 | WholeLis t: TString List; | |
| 109 | begin | |
| 110 | ||
| 111 | HostList .Clear; | |
| 112 | WholeLis t := nil; | |
| 113 | try | |
| 114 | WholeL ist := TSt ringList.C reate; { create tem p buffer} | |
| 115 | WholeL ist.LoadFr omFile(Get HostsPath + '\HOSTS' ); {read in the fil e} | |
| 116 | for I := 0 to Wh oleList.Co unt - 1 do | |
| 117 | begin | |
| 118 | S := WholeList [I]; | |
| 119 | {ign ore lines that start with '#' and empty lines} | |
| 120 | if ( Copy(S,1,1 ) <> '#') and (Lengt h(S) > 0) then | |
| 121 | begi n | |
| 122 | wh ile Pos(TA B, S) > 0 do //Co nvert tabs to spaces | |
| 123 | S[Pos(TAB, S)] := ' '; | |
| 124 | IP := Copy(S ,1,pos(' ' , S)-1); {get IP ad dr} | |
| 125 | {p arse out H ost name} | |
| 126 | Sp acePos := Length(IP) + 1; | |
| 127 | wh ile Copy(S ,SpacePos, 1) = ' ' d o | |
| 128 | inc(SpaceP os); | |
| 129 | Ho stName := Copy(S,Spa cePos,255) ; | |
| 130 | if pos(' ',H ostName) > 0 then | |
| 131 | HostName : = Copy(Hos tName,1,po s(' ',Host Name)-1); | |
| 132 | if pos('#',H ostName) > 0 then | |
| 133 | HostName : = Copy(Hos tName,1,po s('#',Host Name)-1); | |
| 134 | Ho stList.Add (HostName+ ' [' + I P + ']'); | |
| 135 | end{ if}; | |
| 136 | end{fo r}; | |
| 137 | finally | |
| 138 | WholeL ist.Free; | |
| 139 | end{try} ; | |
| 140 | end; | |
| 141 | ||
| 142 | {GetHostsP ath return s path to host file without te rminating '\'. | |
| 143 | If path in VISTA.INI that is u sed. Othe rwise, pat h is deter mined base d | |
| 144 | on default windows d irectory a nd Windows OS.} | |
| 145 | function GetHostsPa th : Strin g; | |
| 146 | var | |
| 147 | OsInfo : TOSVersio nInfo; //Ty pe for OS info | |
| 148 | HostsPat h : String ; | |
| 149 | WinDir : PChar; | |
| 150 | begin | |
| 151 | Result : = ''; | |
| 152 | OSInfo.d wOSVersion InfoSize : = SizeOf(O sInfo); | |
| 153 | GetVersi onEx(OSInf o); // Retriev e OS info | |
| 154 | WinDir : = StrAlloc (MAX_PATH + 1); | |
| 155 | GetWindo wsDirector y(WinDir, MAX_PATH); //Retieve windows di rectory | |
| 156 | HostsPat h := StrPa s(WinDir); | |
| 157 | StrDispo se(WinDir) ; | |
| 158 | {Now che ck OS. VE R_PLATFORM _WIN32_WIN DOWS indic ates Windo ws 95. | |
| 159 | If Wind ows 95, ho sts defaul t director y is windo ws directo ry. | |
| 160 | Else as sume NT an d append N T's direct ory for ho sts to win dows direc tory.} | |
| 161 | if OSInf o.dwPlatfo rmID <> VE R_PLATFORM _WIN32_WIN DOWS then | |
| 162 | HostsP ath := Hos tsPath + ' \system32\ drivers\et c'; | |
| 163 | HostsPat h := GetIn iValue('Ho stsPath',H ostsPath); | |
| 164 | if Copy( HostsPath, Length(Ho stsPath), 1) = '\' t hen //Str ip termina ting '\' | |
| 165 | HostsP ath := Cop y(HostsPat h, 1, Leng th(HostsPa th)-1); | |
| 166 | Result : = HostsPat h; | |
| 167 | end; | |
| 168 | ||
| 169 | ||
| 170 | {--------- ---------- ------- Ge tIniValue ---------- ---------- ------ | |
| 171 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 172 | function G etIniValue (Value, De fault: str ing): stri ng; | |
| 173 | var | |
| 174 | DhcpIni: TIniFile; | |
| 175 | pchWinDi r: array[0 ..100] of char; | |
| 176 | begin | |
| 177 | GetWindo wsDirector y(pchWinDi r, SizeOf( pchWinDir) ); | |
| 178 | DhcpIni := TIniFil e.Create(I niFile); | |
| 179 | Result : = DhcpIni. ReadString (BrokerSec tion, Valu e, 'Could not find!' ); | |
| 180 | if Resul t = 'Could not find! ' then | |
| 181 | begin | |
| 182 | {durin g Broker i nstall Ins talling=1 so warning s should n ot display } | |
| 183 | if ((V alue <> 'I nstalling' ) and (Get IniValue(' Installing ','0') <> '1')) then | |
| 184 | begin | |
| 185 | Dhcp Ini.WriteS tring(Brok erSection, Value, De fault); | |
| 186 | end; | |
| 187 | Result := Defaul t; | |
| 188 | end; | |
| 189 | DhcpIni. Free; | |
| 190 | end; | |
| 191 | ||
| 192 | ||
| 193 | ||
| 194 | {--------- ---------- ---------- - Iff ---- ---------- ---------- ------ | |
| 195 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 196 | function I ff(Conditi on: boolea n; strTrue , strFalse : string): string; | |
| 197 | begin | |
| 198 | if Condi tion then Result := strTrue el se Result := strFals e; | |
| 199 | end; | |
| 200 | ||
| 201 | ||
| 202 | {--------- ---------- ---------- - Sizer -- ---------- ---------- ------- | |
| 203 | This funct ion is use d in conju nction wit h the List SetUp func tion. It returns | |
| 204 | the number of charac ters found in the st ring passe d in. The string is | |
| 205 | returned w ith a lead ing 0 for the 3 char acter numb er format required b y the | |
| 206 | broker cal l. | |
| 207 | ---------- ---------- ---------- ---------- ---------- ---------- ------} | |
| 208 | function S izer (s1: string; s2 : string): string; | |
| 209 | var | |
| 210 | x: inte ger; | |
| 211 | st: str ing; | |
| 212 | begin | |
| 213 | st := s1 + s2; | |
| 214 | x := Len gth(st); | |
| 215 | st := In tToStr(x); | |
| 216 | if lengt h(st) < 3 then | |
| 217 | Result := '0' + st | |
| 218 | else | |
| 219 | Result := st; | |
| 220 | end; | |
| 221 | ||
| 222 | {Function to retriev e a data v alue from the Window s Registry . | |
| 223 | If Key or Name does not exist, null retu rned.} | |
| 224 | function ReadRegDat a(Root: HK EY; Key, N ame : stri ng) : stri ng; | |
| 225 | var | |
| 226 | Registry : TRegistr y; | |
| 227 | begin | |
| 228 | Result : = ''; | |
| 229 | Registry := TRegis try.Create (KEY_READ) ; | |
| 230 | try | |
| 231 | Regist ry.RootKey := Root; | |
| 232 | Regist ry.Access := KEY_REA D; //p60 | |
| 233 | if Reg istry.Open Key(Key, F alse) then | |
| 234 | begin | |
| 235 | Resu lt := Regi stry.ReadS tring(Name ); | |
| 236 | Regi stry.Close Key; | |
| 237 | end; | |
| 238 | finally | |
| 239 | Regist ry.Free; | |
| 240 | end; | |
| 241 | end; | |
| 242 | ||
| 243 | {Function to set a d ata value into the W indows Reg istry. | |
| 244 | If Key or Name does not exist, it is cre ated. | |
| 245 | p60 - Chan ge to set high-level access to Windows r egistry} | |
| 246 | procedure WriteRegD ata(Root: HKEY; Key, Name, Val ue : strin g); | |
| 247 | var | |
| 248 | Registry : TRegistr y; | |
| 249 | begin | |
| 250 | Registry := TRegis try.Create (KEY_WRITE ); //p60 | |
| 251 | try | |
| 252 | Regist ry.RootKey := Root; | |
| 253 | Regist ry.Access := KEY_WRI TE; //p60 | |
| 254 | if Reg istry.Open Key(Key, T rue) then | |
| 255 | Regi stry.Write String(Nam e, Value); | |
| 256 | Regist ry.CloseKe y; | |
| 257 | finally | |
| 258 | Regist ry.Free; | |
| 259 | end; | |
| 260 | end; | |
| 261 | ||
| 262 | {Procedure to delete a data va lue into t he Windows Registry. | |
| 263 | p60 - Chan ge to set high-level access to Windows r egistry} | |
| 264 | procedure DeleteReg Data(Root: HKEY; Key , Name : s tring); | |
| 265 | var | |
| 266 | Registry : TRegistr y; | |
| 267 | begin | |
| 268 | Registry := TRegis try.Create (KEY_WRITE ); //p60 | |
| 269 | try | |
| 270 | Regist ry.RootKey := Root; | |
| 271 | Regist ry.Access := KEY_WRI TE; //p60 | |
| 272 | if Reg istry.Open Key(Key, T rue) then | |
| 273 | Regi stry.Delet eValue(Nam e); | |
| 274 | Regist ry.CloseKe y; | |
| 275 | finally | |
| 276 | Regist ry.Free; | |
| 277 | end; | |
| 278 | end; | |
| 279 | ||
| 280 | {Returns s tring valu e from reg istry. If value is '', then D efault | |
| 281 | value is f iled in Re gistry and Default i s returned .} | |
| 282 | function ReadRegDat aDefault(R oot: HKEY; Key, Name , Default : string) : string; | |
| 283 | begin | |
| 284 | Result : = ReadRegD ata(Root, Key, Name) ; | |
| 285 | if Resul t = '' the n | |
| 286 | begin | |
| 287 | WriteR egData(Roo t, Key, Na me, Defaul t); | |
| 288 | Result := Defaul t; | |
| 289 | end; | |
| 290 | end; | |
| 291 | ||
| 292 | {Returns n ame=value pairs for a key. Fo rmat retur ned same a s found in .ini | |
| 293 | files. Us eful with the Values method of TStringLi st.} | |
| 294 | procedure ReadRegVa lues(Root: HKEY; Key : string; var RegVa lues : TSt ringList); | |
| 295 | var | |
| 296 | RegNames : TString List; | |
| 297 | Registry : TRegis try; | |
| 298 | i : intege r; | |
| 299 | begin | |
| 300 | RegNames := TStrin glist.Crea te; | |
| 301 | Registry := TRegi stry.Creat e(KEY_READ ); //p60 | |
| 302 | try | |
| 303 | Regist ry.RootKey := Root; | |
| 304 | Regist ry.Access := KEY_REA D; //p60 | |
| 305 | if Reg istry.Open Key(Key, F alse) then | |
| 306 | begin | |
| 307 | Regi stry.GetVa lueNames(R egNames); | |
| 308 | for i := 0 to (RegNames. Count - 1) do | |
| 309 | Re gValues.Ad d(RegNames .Strings[i ] + '=' | |
| 310 | + Registry. ReadString (RegNames. Strings[i] )); | |
| 311 | end | |
| 312 | else | |
| 313 | RegV alues.Add( ''); | |
| 314 | finally | |
| 315 | Regist ry.Free; | |
| 316 | RegNam es.Free; | |
| 317 | end; | |
| 318 | end; | |
| 319 | ||
| 320 | procedure ReadRegVal ueNames(Ro ot:HKEY; K ey : strin g; var Reg Names : TS tringlist) ; | |
| 321 | var | |
| 322 | Registry : TRegis try; | |
| 323 | Returned Names : TS tringList; | |
| 324 | begin | |
| 325 | RegNames .Clear; | |
| 326 | Registry := TRegi stry.Creat e(KEY_READ ); //p60 | |
| 327 | Returned Names := T StringList .Create; | |
| 328 | try | |
| 329 | Regist ry.RootKey := Root; | |
| 330 | Regist ry.Access := KEY_REA D; //p60 | |
| 331 | if Reg istry.Open Key(Key, F alse) then | |
| 332 | begin | |
| 333 | Regi stry.GetVa lueNames(R eturnedNam es); | |
| 334 | RegN ames.Assig n(Returned Names); | |
| 335 | end; | |
| 336 | finally | |
| 337 | Regist ry.Free; | |
| 338 | Return edNames.Fr ee; | |
| 339 | end; | |
| 340 | end; | |
| 341 | ||
| 342 | end. | |
| 343 |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.