11. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 5/13/2019 2:40:10 PM Central 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.

11.1 Files compared

# Location File Last Modified
1 C:\AraxisMergeCompare\Pri_un\MPDU\Code\BCMA-master-20181214\BCMA-master\BCMA VHA_Objects.pas Wed Nov 21 17:43:20 2018 UTC
2 C:\AraxisMergeCompare\Pri_re\MPDU\MPDU\Code\BCMA-master-20181214\BCMA-master\BCMA VHA_Objects.pas Tue May 7 17:54:05 2019 UTC

11.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 8 1920
Changed 7 14
Inserted 0 0
Removed 0 0

11.3 Comparison options

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

11.4 Active regular expressions

No regular expressions were active.

11.5 Comparison detail

  1   unit VHA_O bjects;
  2   {
  3   ========== ========== ========== ========== ========== ========== ========== ==========
  4   *       Fi le:  VHA_O bjects.PAS
  5   *
  6   *       Ap plication:   Bar Code  Medicatio n Administ ration
  7   *       Re vision:      $Revisio n: 23 $  $ Modtime: 5 /08/02 3:5 0p $
  8   *
  9   *       De scription:   This is  a unit whi ch contain s VHA Obje cts develo ped for th e
  10   *                BCMA  applicati on.
  11   *
  12   *       No tes:  Need  to docume nt PSB USE RLOAD Resu lts rows.
  13   *
  14   *
  15   ========== ========== ========== ========== ========== ========== ========== ==========
  16   }
  17  
  18   interface
  19  
  20   uses
  21     SysUtils ,
  22     Classes,
  23     Controls ,
  24     Windows,
  25     Forms,
  26     TRPCB,
  27   //  DN S      BELLC Remo ve MOB2 de fine. stic k with sha red broker  for the t ime being
  28   {$IFDEF MO B2}
  29   // when re ady to use  new order com.dll, u se normal  rpc broker ; rpk 3/21 /2016
  30     CCOWRPCB roker,
  31   {$ELSE}
  32   // 2FA  Sh aredRPCBro ker,
  33     VERGENCE CONTEXTORL ib_TLB,
  34   {$ENDIF}
  35     ComOBJ;
  36  
  37   const
  38     VersionI nfoKeys: a rray[1..10 ] of strin g = (
  39       'Compa nyName', ' FileDescri ption', 'F ileVersion ', 'Intern alName',
  40       'Legal CopyRight' , 'Origina lFileName' , 'Product Name', 'Pr oductVersi on',
  41       'Comme nts', 'Rel easeDate'
  42       );
  43  
  44     USEnglis h = $04090 4E4;
  45  
  46   type
  47     PTransBu ffer = ^TT ransBuffer ;
  48     TTransBu ffer = arr ay[1..13]  of smallin t;
  49  
  50   const
  51     CInfoStr : array[1. .13] of st ring =
  52     ('FileVe rsion',
  53       'Compa nyName',
  54       'FileD escription ',
  55       'Inter nalName',
  56       'Legal Copyright' ,
  57       'Legal TradeMarks ',
  58       'Origi nalFileNam e',
  59       'Produ ctName',
  60       'Produ ctVersion' ,
  61       'Comme nts',
  62       'Curre ntProgramV ersion',
  63       'Curre ntDatabase Version',
  64       'Versi onDetails' );
  65  
  66   function B rokerError Messages(e rrorCode:  integer; d efString:  string): s tring;
  67   (*
  68     A functi on which t ranslates  numerical  Error Code s into Eng lish.
  69   *)
  70   type
  71     TLogErro rProc = pr ocedure(ms g: string;  ex: excep tion; Msg2 : TStrings  = nil);
  72  
  73     EBrokerC onnectionE rror = cla ss(Excepti on)
  74       (*
  75         A re placement  for EBroke rError whi ch display s English  error mess ages
  76         inst ead of acr onyms.  Wr ites all m essages to  an error  log file,  if one
  77         exis ts.
  78       *)
  79       ErrorC ode: integ er;
  80       Mnemon ic: string ;
  81  
  82       constr uctor Crea te(eCode:  integer; s hortMsg, l ongMsg: st ring;
  83         LogE rrorProc:  TLogErrorP roc);
  84       (*
  85        Alloc ates memor y for the  exception,  uses meth od BrokerE rrorMessag es to
  86        repla ce errorco des with E nglish, wr ites error s to a log  file, if  one is
  87        assig ned, and d isplays th e English  error mess ages.
  88       *)
  89     end;
  90  
  91     TVersion Info = cla ss(TCompon ent)
  92     private
  93       FFileN ame: strin g;
  94       FLangu ageID: DWo rd;
  95       FInfo:  pointer;
  96       FInfoS ize: longi nt;
  97       FCtlCo mpanyName:  TControl;
  98       FCtlFi leDescript ion: TCont rol;
  99       FCtlFi leVersion:  TControl;
  100       FCtlIn ternalName : TControl ;
  101       FCtlLe galCopyRig ht: TContr ol;
  102       FCtlOr iginalFile Name: TCon trol;
  103       FCtlPr oductName:  TControl;
  104       FCtlPr oductVersi on: TContr ol;
  105       FCtlCo mments: TC ontrol;
  106       FCtlRe leaseDate:  TControl;
  107  
  108       proced ure SetFil eName(Valu e: string) ;
  109       proced ure SetVer Prop(index : integer;  value: TC ontrol);
  110       functi on GetVerP rop(index:  integer):  TControl;
  111       functi on GetInde xKey(index : integer) : string;
  112       functi on GetKey( const KNam e: string) : string;
  113       proced ure Refres h;
  114     protecte d
  115       proced ure Notifi cation(ACo mponent: T Component;  Operation : TOperati on);
  116         over ride;
  117     public
  118       proper ty Company Name: stri ng index 1  read GetI ndexKey;
  119       proper ty FileDes cription:  string ind ex 2 read  GetIndexKe y;
  120       proper ty FileVer sion: stri ng index 3  read GetI ndexKey;
  121       proper ty Interna lName: str ing index  4 read Get IndexKey;
  122       proper ty LegalCo pyRight: s tring inde x 5 read G etIndexKey ;
  123       proper ty Origina lFileName:  string in dex 6 read  GetIndexK ey;
  124       proper ty Product Name: stri ng index 7  read GetI ndexKey;
  125       proper ty Product Version: s tring inde x 8 read G etIndexKey ;
  126       proper ty Comment s: string  index 9 re ad GetInde xKey;
  127       proper ty Release Date: stri ng index 1 0 read Get IndexKey;
  128       proper ty FileNam e: string  read FFile Name write  SetFileNa me;
  129       proper ty Languag eID: DWord  read FLan guageID wr ite FLangu ageID;
  130  
  131       constr uctor Crea te(AOwner:  TComponen t); overri de;
  132       (*
  133         Allo cates memo ry and ini tializes v ariables f or the obj ect.
  134       *)
  135  
  136       destru ctor Destr oy; overri de;
  137       (*
  138         Rele ases all m emory allo cated for  the object .
  139       *)
  140  
  141       proced ure OpenFi le(FName:  string);
  142       (*
  143         Uses  method Ge tFileVersi onInfo to  retrieve v ersion inf ormation f or file
  144         FNam e.  If FNa me is blan k, version  informati on is obta ined for t he
  145         curr ent execut able (Appl ication.Ex eName).
  146       *)
  147  
  148       proced ure Close;
  149       (*
  150         Rele ases memor y allocate d and clea rs all sto rage varia bles.
  151       *)
  152  
  153     publishe d
  154       proper ty CtlComp anyName: T Control in dex 1 read  GetVerPro p write Se tVerProp;
  155       proper ty CtlFile Descriptio n: TContro l index 2  read GetVe rProp writ e
  156         SetV erProp;
  157       proper ty CtlFile Version: T Control in dex 3 read  GetVerPro p write Se tVerProp;
  158       proper ty CtlInte rnalName:  TControl i ndex 4 rea d GetVerPr op write S etVerProp;
  159       proper ty CtlLega lCopyRight : TControl  index 5 r ead GetVer Prop write
  160         SetV erProp;
  161       proper ty CtlOrig inalFileNa me: TContr ol index 6  read GetV erProp wri te
  162         SetV erProp;
  163       proper ty CtlProd uctName: T Control in dex 7 read  GetVerPro p write Se tVerProp;
  164       proper ty CtlProd uctVersion : TControl  index 8 r ead GetVer Prop write
  165         SetV erProp;
  166       proper ty CtlComm ents: TCon trol index  9 read Ge tVerProp w rite SetVe rProp;
  167       proper ty CtlRele aseDate: T Control in dex 10 rea d GetVerPr op write S etVerProp;
  168     end;
  169  
  170   //    TBCM A_Broker =  class (tR PCBroker)
  171       (*
  172         A de scendant o f TRPCBrok er that pr ovides enh anced RPC  parameter  handling,
  173         debu gging and  error trap ping capab ilities.
  174       *)
  175   //  TBCMA_ Broker = c lass(TCCOW RPCBroker)
  176  
  177   ////  DN S      BELLC Remo ve MOB2 de fine. stic k with sha red broker  for the t ime being
  178   // use rpc  broker on ly with ne w ordercom .dll; rpk  2/29/2016
  179   //  TBCMA_ Broker = c lass(TRPCB roker)
  180   {$IFDEF MO B2}
  181     TBCMA_Br oker = cla ss(TCCOWRP CBroker)
  182   {$ELSE}
  183   // 2FA:    TBCMA_Brok er = class (TSharedRP CBroker)
  184     TBCMA_Br oker = cla ss(TRPCBro ker)
  185   {$ENDIF}
  186     private
  187       {Priva te Stuff}
  188       FLogEr rorProc: T LogErrorPr oc;
  189   {$IFNDEF M OB2}
  190       FConte xtor: TCon textorCont rol;  //CC OW
  191   {$ENDIF}
  192     public
  193       {Publi c Stuff}
  194       proper ty LogErro rProc: TLo gErrorProc  read FLog ErrorProc  write FLog ErrorProc;
  195       (*
  196        Point er to an o ptional, e xternal pr ocedure wh ich writes  error inf ormation
  197        into  an applica tion error log file.
  198       *)
  199   {$IFNDEF M OB2}
  200       proper ty   Conte xtor: TCon textorCont rol
  201                               read  Fcontexto r write FC ontextor;   //CCOW
  202   {$ENDIF}
  203  
  204       functi on CallSer ver(RPC: s tring; cal lingParams : array of  string; M ultList:
  205         TStr ings; True Null: Bool ean = Fals e): boolea n;
  206       (*
  207        Uses:       Tfrm Debug = cl ass(TForm) ;
  208  
  209        This  is a wrapp er around  the inheri ted Call p rocedure.   Enhanceme nts are:
  210         - Th is is a fu nction, ra ther than  a procedur e, which r eturns a T rue value
  211          onl y if there  are no Br oker Error s.
  212         - If  DebugMode  is True,  then Call  input argu ments are  displayed  and
  213          the n the outp ut results  shown.
  214         - Th e Call its elf is in  a try/exce pt block s o that Bro ker Errors  can
  215          be  trapped an d handled  in a user  friendly f orm and de tailed err or
  216          inf o can be e ntered int o an appli cation err or log fil e, if one  has
  217          bee n assigned .
  218       *)
  219     end;
  220  
  221     TBCMA_Us er = class (TObject)
  222       (*
  223         An c lass that  holds User  data and  handles al l User int eraction w ith the
  224         Vist A server.
  225       *)
  226     private
  227       FRPCBr oker: TBCM A_Broker;
  228       FDUZ:  string;
  229       FUserN ame: strin g;
  230       FIsMan ager: Bool ean;
  231       FIsStu dent: Bool ean;
  232       FIsMOB uttonUser:  Boolean;
  233       FIsRea dOnly,
  234         FUna bleToScanK ey: Boolea n;
  235       FOrder Role: Inte ger;
  236  
  237       FDivis ionIEN,
  238       //
  239       // Sit eIEN is al so known a s facility  division  number in  BCMA Param eters
  240       // (PS B USERLOAD : piece 2  of results [7])
  241       // It  is used in  setting t he CCOW co ntext.
  242       //
  243       FSiteI EN,
  244         FDiv isionName,
  245         FIns tructorDUZ : string;             //If this  is a stude nt, then t his contai ns the DUZ  of the in structor
  246  
  247       // FAg encyCode h olds the v alue defin ed in the  AGENCY COD E field (9 5) of the
  248       // INS TITUTION F ile (4) an d set into  the DUZ(“ AG”) array  variable.
  249       FAgenc yCode: str ing;                  // rpk 8/6 /2009
  250  
  251       FESigR equired: b oolean;
  252       FOnLin e: boolean ;
  253       FDTime : string;                        //User tim eout inter val in sec onds.
  254  
  255       FChang ed: boolea n;
  256       FProdu ctionAccou nt: Boolea n;
  257  
  258     protecte d
  259       functi on getDTim e: integer ;
  260  
  261     public
  262       proper ty DUZ: st ring read  FDUZ;
  263       proper ty UserNam e: string  read FUser Name;
  264       proper ty IsManag er: Boolea n read FIs Manager;
  265       proper ty IsStude nt: Boolea n read FIs Student;
  266       proper ty IsMOBut tonUser: B oolean rea d FIsMOBut tonUser;
  267       proper ty IsReadO nly: Boole an read FI sReadOnly  write FIsR eadOnly;
  268       proper ty UnableT oScanKey:  Boolean re ad FUnable ToScanKey;
  269       proper ty Divisio nIEN: stri ng read FD ivisionIEN ;
  270       proper ty Product ionAccount : Boolean  read FProd uctionAcco unt;
  271       proper ty SiteIEN : string r ead FSiteI EN;
  272       proper ty Divisio nName: str ing read F DivisionNa me;
  273       proper ty Instruc torDUZ: st ring read  FInstructo rDUZ write  FInstruct orDUZ;
  274       proper ty AgencyC ode: strin g read FAg encyCode;  // rpk 8/6 /2009
  275       proper ty ESigReq uired: boo lean read  FESigRequi red;
  276       proper ty OnLine:  boolean r ead FOnLin e;
  277       proper ty DTime:  integer re ad getDTim e; //User  Timeout in terval
  278   {$IFDEF TE ST_ON}
  279       proper ty OrderRo le: intege r read FOr derRole wr ite FOrder Role; // f or debug
  280   {$ELSE}
  281       proper ty OrderRo le: intege r read FOr derRole;
  282   {$ENDIF}
  283       proper ty Changed : boolean  read FChan ged;
  284  
  285       constr uctor Crea te(RPCBrok er: TBCMA_ Broker); v irtual;
  286       (*
  287         Allo cates memo ry, initia lizes stor age variab les and sa ves a poin ter
  288         to a  global co py of the  TBCMA_Brok er object
  289       *)
  290  
  291       destru ctor Destr oy; overri de;
  292       (*
  293         Deal locates me mory and s ets FRPCBr oker := ni l;
  294       *)
  295  
  296       proced ure Clear;
  297       (*
  298         Inti talizes in ternal sto rage varia bles.
  299       *)
  300  
  301       functi on LoadDat a: boolean ;
  302       (*
  303         Crea tes user c ontext 'PS B GUI CONT EXT - USER ' then use s RPC
  304         'PSB  USERLOAD'  to retrie ve user da ta fron th e server,
  305       *)
  306  
  307       proced ure SaveDa ta;
  308       (*
  309         If a ny of the  User prope rties have  changed,  the change s will be  saved
  310         to t he server.
  311       *)
  312  
  313       functi on isValid ESig(ESig:  string):  boolean;
  314       (*
  315         Uses  RPC 'PSB  VALIDATE E SIG' to va lidate an  Electronic  Signature ,
  316         ESig .  If vali d, the ret urn value  is True.
  317       *)
  318  
  319     end;
  320  
  321   implementa tion
  322  
  323   uses
  324     Dialogs,  TypInfo,  Debug,
  325   //  MFunSt r,
  326     BCMA_Sta rtup, {2FA :Hash}XWBH ash, BCMA_ Util
  327   {.$IFDEF Z Z_RPC_LOG}
  328       , uZZ_RPCE vent, fZZ_ EventLog            //  DNS     andria 201 5-01-29 == ========== ========
  329   {.$ENDIF}
  330     ;
  331  
  332   function B rokerError Messages(e rrorCode:  integer; d efString:  string): s tring;
  333   begin
  334     case Err orCode of
  335       10013:  result :=  'Winsock  Error!' +  #13 + 'Per mission de nied.';
  336       10048:  result :=  'Winsock  Error!' +  #13 + 'Add ress alrea dy in use. ';
  337       10049:  result :=  'Winsock  Error!' +  #13 +
  338         'Can not assign  requested  address.' ;
  339       10047:  result :=  'Winsock  Error!' +  #13 +
  340         'Add ress famil y not supp orted by p rotocol fa mily.';
  341       10037:  result :=  'Winsock  Error!' +  #13 + 'Ope ration alr eady in pr ogress.';
  342       10053:  result :=  'Winsock  Error!' +  #13 + 'Con nection ab orted by h ost.';
  343       10061:  result :=  'Winsock  Error!' +  #13 + 'Con nection re fused by h ost.';
  344       10054:  result :=  'Winsock  Error!' +  #13 + 'Con nection re set by hos t.';
  345       10039:  result :=  'Winsock  Error!' +  #13 + 'Des tination a ddress req uired.';
  346       10014:  result :=  'Winsock  Error!' +  #13 + 'Bad  address.' ;
  347       10064:  result :=  'Winsock  Error!' +  #13 + 'Hos t is down. ';
  348       10065:  result :=  'Winsock  Error!' +  #13 + 'No  route to h ost.';
  349       10036:  result :=  'Winsock  Error!' +  #13 + 'Ope ration now  in progre ss.';
  350       10004:  result :=  'Winsock  Error!' +  #13 + 'Int errupted f unction ca ll.';
  351       10022:  result :=  'Winsock  Error!' +  #13 + 'Inv alid argum ent.';
  352       10056:  result :=  'Winsock  Error!' +  #13 + 'Soc ket alread y connecte d.';
  353       10024:  result :=  'Winsock  Error!' +  #13 + 'Too  many open  files.';
  354       10040:  result :=  'Winsock  Error!' +  #13 + 'Mes sage too l ong.';
  355       10050:  result :=  'Winsock  Error!' +  #13 + 'Net work is do wn.';
  356       10052:  result :=  'Winsock  Error!' +  #13 +
  357         'Net work dropp ed connect ion on res et.';
  358       10051:  result :=  'Winsock  Error!' +  #13 + 'Net work is un reachable. ';
  359       10055:  result :=  'Winsock  Error!' +  #13 + 'No  buffer spa ce availab le.';
  360       10042:  result :=  'Winsock  Error!' +  #13 + 'Bad  protocol  option.';
  361       10057:  result :=  'Winsock  Error!' +  #13 + 'Soc ket is not  connected .';
  362       10038:  result :=  'Winsock  Error!' +  #13 + 'Soc ket operat ion on non -socket.';
  363       10045:  result :=  'Winsock  Error!' +  #13 + 'Ope ration not  supported .';
  364       10046:  result :=  'Winsock  Error!' +  #13 + 'Pro tocol fami ly not sup ported.';
  365       10067:  result :=  'Winsock  Error!' +  #13 + 'Too  many proc esses.';
  366       10043:  result :=  'Winsock  Error!' +  #13 + 'Pro tocol not  supported. ';
  367       10041:  result :=  'Winsock  Error!' +  #13 + 'Pro tocol wron g type for  socket.';
  368       10058:  result :=  'Winsock  Error!' +  #13 +
  369         'Can not send a fter socke t shutdown .';
  370       10044:  result :=  'Winsock  Error!' +  #13 + 'Soc ket type n ot support ed.';
  371       10060:  result :=  'Winsock  Error!' +  #13 + 'Con nection ti med out.';
  372       10035:  result :=  'Winsock  Error!' +  #13 +
  373         'Res ource temp orarily un available. ';
  374       11001:  result :=  'Winsock  Error!' +  #13 + 'Hos t not foun d.';
  375       10093:  result :=  'Winsock  Error!' +  #13 +
  376         'Suc cessful WS AStartup()  not yet p erformed.' ;
  377       11004:  result :=  'Winsock  Error!' +  #13 +
  378         'Val id name, n o data rec ord of req uested typ e.';
  379       11003:  result :=  'Winsock  Error!' +  #13 +
  380         'Thi s is a non -recoverab le error.' ;
  381       10091:  result :=  'Winsock  Error!' +  #13 +
  382         'Net work subsy stem is un available. ';
  383       11002:  result :=  'Winsock  Error!' +  #13 +
  384         'Non -authorita tive host  not found. ';
  385       10092:  result :=  'Winsock  Error!' +  #13 +
  386         'WIN SOCK.DLL v ersion out  of range. ';
  387       10094:  result :=  'Winsock  Error!' +  #13 + 'Gra ceful shut down in pr ogress.';
  388     else
  389       result  := defStr ing;
  390     end;
  391   end;
  392  
  393   //////////  EBrokerCo nnectionEr ror Mthods  ///////// ////////// /////////
  394  
  395   constructo r EBrokerC onnectionE rror.Creat e(eCode: i nteger; sh ortMsg, lo ngMsg:
  396     string;
  397     LogError Proc: TLog ErrorProc) ;
  398   begin
  399     ErrorCod e := eCode ;
  400     Message  := longMsg ;
  401  
  402     Mnemonic  := Broker ErrorMessa ges(ErrorC ode, short Msg);
  403     if Mnemo nic = '' t hen
  404       Mnemon ic := 'Bro ker Connec tion Error ';
  405     if Messa ge = '' th en
  406       Messag e := Mnemo nic;
  407  
  408     case Err orCode of
  409       10013,
  410         1004 8,
  411         1004 9,
  412         1004 7,
  413         1003 7,
  414         1005 3,
  415         1006 1,
  416         1005 4,
  417         1003 9,
  418         1001 4,
  419         1006 4,
  420         1006 5,
  421         1003 6,
  422         1000 4,
  423         1002 2,
  424         1005 6,
  425         1002 4,
  426         1004 0,
  427         1005 0,
  428         1005 2,
  429         1005 1,
  430         1005 5,
  431         1004 2,
  432         1005 7,
  433         1003 8,
  434         1004 5,
  435         1004 6,
  436         1006 7,
  437         1004 3,
  438         1004 1,
  439         1005 8,
  440         1004 4,
  441         1006 0,
  442         1003 5,
  443         1100 1,
  444         1009 3,
  445         1100 4,
  446         1100 3,
  447         1009 1,
  448         1100 2,
  449         1009 2,
  450         1009 4:
  451         Mess age := Mne monic + #1 3 + Messag e;
  452     else
  453     end;
  454  
  455     if assig ned(LogErr orProc) th en
  456     begin
  457       LogErr orProc('Co nnection t o server n ot establi shed!', se lf);
  458       DefMes sageDlg(Mn emonic, mt Error, [mb OK], 0);
  459     end;
  460   end;
  461  
  462   ///// TVer sionInfo M ethods /// ////////// ////////// ////////// /////////
  463  
  464   constructo r TVersion Info.Creat e(AOwner:  TComponent );
  465   begin
  466     inherite d Create(A Owner);
  467     FLanguag eID := USE nglish;
  468     SetFileN ame(EmptyS tr);
  469   end;
  470  
  471   destructor  TVersionI nfo.Destro y;
  472   begin
  473     if FInfo Size > 0 t hen
  474       FreeMe m(FInfo, F InfoSize);
  475     inherite d Destroy;
  476   end;
  477  
  478   procedure  TVersionIn fo.SetFile Name(Value : string);
  479   begin
  480     FFileNam e := Value ;
  481     if Value  = EmptySt r then                // default  to self
  482       FFileN ame := Ext ractFileNa me(Applica tion.ExeNa me);
  483     //             FFil eName := E xtractFile Path(Appli cation.Exe Name);
  484     if csDes igning in  ComponentS tate then
  485     begin
  486       Refres h
  487     end
  488     else
  489       OpenFi le(Value);
  490   end;
  491  
  492   procedure  TVersionIn fo.OpenFil e(FName: s tring);
  493   var
  494     vlen: DW ord;
  495   begin
  496     if FInfo Size > 0 t hen
  497       FreeMe m(FInfo, F InfoSize);
  498     if Lengt h(FName) < = 0 then
  499       FName  := Applica tion.ExeNa me;
  500     FInfoSiz e := GetFi leVersionI nfoSize(pc har(fname) , vlen);
  501     if FInfo Size > 0 t hen
  502     begin
  503       GetMem (FInfo, FI nfoSize);
  504       if not  GetFileVe rsionInfo( pchar(fnam e), vlen,  FInfoSize,  FInfo) th en
  505         rais e Exceptio n.Create(' Cannot ret rieve Vers ion Inform ation for  ' +
  506           fn ame);
  507       Refres h;
  508     end;
  509   end;
  510  
  511   procedure  TVersionIn fo.Close;
  512   begin
  513     if FInfo Size > 0 t hen
  514       FreeMe m(FInfo, F InfoSize);
  515     FInfoSiz e := 0;
  516     FFileNam e := Empty Str;
  517   end;
  518  
  519   const
  520     vqvFmt =  '\StringF ileInfo\%8 .8x\%s';
  521  
  522   function T VersionInf o.GetKey(c onst KName : string):  string;
  523   var
  524     //vptr:  pchar;
  525     vlen: DW ord;
  526     //Added  the follow ing
  527     transStr : string;
  528     vptr: PT ransBuffer ;
  529     value: P Char;
  530  
  531   begin
  532     Result : = EmptyStr ;
  533     if FInfo Size <= 0  then
  534       exit;
  535  
  536     //  If V erQueryVal ue(FInfo,  pchar(Form at(vqvFmt,  [FLanguag eID, KName ])), point er(vptr),  vlen) Then
  537     if VerQu eryValue(F Info, PCha r('\VarFil eInfo\Tran slation'),  Pointer(v ptr), vlen )
  538       then
  539     begin
  540       //Adde d the foll owing two  lines:
  541       transS tr := IntT oHex(vptr^ [1], 4) +  IntToHex(v ptr^[2], 4 );
  542       if Ver QueryValue (FInfo, pc har('Strin gFileInfo\ ' + transS tr + '\' +  KName),
  543         poin ter(value) , vlen) th en
  544         //Re sult := vp tr;
  545         Resu lt := Valu e;
  546     end;
  547   end;
  548  
  549   function T VersionInf o.GetIndex Key(index:  integer):  string;
  550   begin
  551     Result : = GetKey(V ersionInfo Keys[index ]);
  552   end;
  553  
  554   function T VersionInf o.GetVerPr op(index:  integer):  TControl;
  555   begin
  556     case ind ex of
  557       1: Res ult := FCt lCompanyNa me;
  558       2: Res ult := FCt lFileDescr iption;
  559       3: Res ult := FCt lFileVersi on;
  560       4: Res ult := FCt lInternalN ame;
  561       5: Res ult := FCt lLegalCopy Right;
  562       6: Res ult := FCt lOriginalF ileName;
  563       7: Res ult := FCt lProductNa me;
  564       8: Res ult := FCt lProductVe rsion;
  565       9: Res ult := FCt lComments;
  566       10: Re sult := FC tlReleaseD ate;
  567     else
  568       Result  := nil;
  569     end;
  570   end;
  571  
  572   procedure  TVersionIn fo.SetVerP rop(index:  integer;  value: TCo ntrol);
  573   begin
  574     case ind ex of
  575       1: FCt lCompanyNa me := Valu e;
  576       2: FCt lFileDescr iption :=  Value;
  577       3: FCt lFileVersi on := Valu e;
  578       4: FCt lInternalN ame := Val ue;
  579       5: FCt lLegalCopy Right := V alue;
  580       6: FCt lOriginalF ileName :=  Value;
  581       7: FCt lProductNa me := Valu e;
  582       8: FCt lProductVe rsion := V alue;
  583       9: FCt lComments  := Value;
  584       10: FC tlReleaseD ate := Val ue;
  585     end;
  586     Refresh;
  587   end;
  588  
  589   procedure  TVersionIn fo.Notific ation(ACom ponent: TC omponent;  Operation:
  590     TOperati on);
  591   begin
  592     if Opera tion = opR emove then
  593     begin
  594       if ACo mponent =  FCtlCompan yName then
  595         FCtl CompanyNam e := nil
  596       else i f ACompone nt = FCtlF ileDescrip tion then
  597         FCtl FileDescri ption := n il
  598       else i f ACompone nt = FCtlF ileVersion  then
  599         FCtl FileVersio n := nil
  600       else i f ACompone nt = FCtlI nternalNam e then
  601         FCtl InternalNa me := nil
  602       else i f ACompone nt = FCtlL egalCopyRi ght then
  603         FCtl LegalCopyR ight := ni l
  604       else i f ACompone nt = FCtlO riginalFil eName then
  605         FCtl OriginalFi leName :=  nil
  606       else i f ACompone nt = FCtlP roductName  then
  607         FCtl ProductNam e := nil
  608       else i f ACompone nt = FCtlP roductVers ion then
  609         FCtl ProductVer sion := ni l
  610       else i f ACompone nt = FCtlC omments th en
  611         FCtl Comments : = nil
  612       else i f ACompone nt = FCtlR eleaseDate  then
  613         FCtl ReleaseDat e := nil;
  614     end;
  615   end;
  616  
  617   procedure  TVersionIn fo.Refresh ;
  618   var
  619     PropInfo : PPropInf o;
  620  
  621     procedur e AssignTe xt(Actl: T Component;  txt: stri ng);
  622     begin
  623       if Ass igned(ACtl ) then
  624       begin
  625         Prop Info := Ge tPropInfo( ACtl.Class Info, 'Cap tion');
  626         if P ropInfo <>  nil then
  627           Se tStrProp(A Ctl, PropI nfo, txt)
  628         else
  629         begi n
  630           Pr opInfo :=  GetPropInf o(ACtl.Cla ssInfo, 'T ext');
  631           if  PropInfo  <> nil the n
  632              SetStrProp (ACtl, Pro pInfo, txt )
  633         end;
  634       end;
  635     end;
  636  
  637   begin
  638     if csDes igning in  ComponentS tate then
  639     begin
  640       Assign Text(FCtlC ompanyName , VersionI nfoKeys[1] );
  641       Assign Text(FCtlF ileDescrip tion, Vers ionInfoKey s[2]);
  642       Assign Text(FCtlF ileVersion , VersionI nfoKeys[3] );
  643       Assign Text(FCtlI nternalNam e, Version InfoKeys[4 ]);
  644       Assign Text(FCtlL egalCopyRi ght, Versi onInfoKeys [5]);
  645       Assign Text(FCtlO riginalFil eName, Ver sionInfoKe ys[6]);
  646       Assign Text(FCtlP roductName , VersionI nfoKeys[7] );
  647       Assign Text(FCtlP roductVers ion, Versi onInfoKeys [8]);
  648       Assign Text(FCtlC omments, V ersionInfo Keys[9]);
  649       Assign Text(FCtlR eleaseDate , VersionI nfoKeys[10 ]);
  650     end
  651     else
  652     begin
  653       Assign Text(FCtlC ompanyName , CompanyN ame);
  654       Assign Text(FCtlF ileDescrip tion, File Descriptio n);
  655       Assign Text(FCtlF ileVersion , FileVers ion);
  656       Assign Text(FCtlI nternalNam e, Interna lName);
  657       Assign Text(FCtlL egalCopyRi ght, Legal CopyRight) ;
  658       Assign Text(FCtlO riginalFil eName, Ori ginalFileN ame);
  659       Assign Text(FCtlP roductName , ProductN ame);
  660       Assign Text(FCtlP roductVers ion, Produ ctVersion) ;
  661       Assign Text(FCtlC omments, C omments);
  662       Assign Text(FCtlR eleaseDate , ReleaseD ate);
  663     end;
  664   end;
  665  
  666   ////////// ////////// /////////  TBCMA_Brok er
  667  
  668   function T BCMA_Broke r.CallServ er(RPC: st ring; call ingParams:  array of  string;
  669     MultList : TStrings ; TrueNull : Boolean  = False):  boolean;
  670   const
  671     ParamTyp eStrings:  array[TPar amType] of  string =
  672     ('Litera l', 'Refer ence', 'Li st', 'Glob al', 'Empt y', 'Strea m', 'Undef ined');
  673  
  674   var
  675   //  DNS     andria 201 5-01-29 == ========== ========== ========== ========== ========== =
  676   {.$IFDEF Z Z_RPC_LOG}
  677     aStart,  aStop: TDa teTime;
  678     anEvent:  TRPCEvent Item;
  679   {.$ENDIF}
  680   //  DNS     andria 201 5-01-29 == ========== ========== ========== ========== ========== =
  681     i, j: in teger;
  682     emsg: st ring;
  683   begin
  684     result : = False;
  685     if socke t = -1 the n
  686       DefMes sageDlg('N o VistA se rver conne ction!', m tWarning,  [mbOK], 0)
  687     else if  connected  = False th en
  688       exit
  689     else
  690     begin
  691       // NOT E: Applica tion.Proce ssMessages  is incorr ect usage.
  692       // All ows interr upt of lis t handling  and sorts  which lea ds
  693       // to  exceptions .  Also al lows show  / hide act ions at in appopriate  times.
  694       // Sho ws mostly  in switchi ng from Co versheet t o other ta bs.
  695   //    Appl ication.Pr ocessMessa ges;  // r pk 4/18/20 11
  696  
  697       Screen .Cursor :=  crHourgla ss;
  698       Remote Procedure  := RPC;
  699       if Tru eNull = fa lse then
  700       begin
  701  
  702         //an  empty arr ay can't b e passed,  if we rece ive #127#1 27#, don't  create an y literals
  703         if c allingPara ms[0] <> ' ~!#null#~! ' then
  704           fo r i := 0 t o High(cal lingParams ) do
  705           be gin
  706              Param[i].V alue := ca llingParam s[i];
  707              Param[i].P Type := Li teral;
  708           en d;
  709  
  710         eMsg  := 'RPC:  ' + RPC;
  711         for  i := 0 to  Param.coun t - 1 do
  712           eM sg := eMsg  + #13#10  + 'Param['  + intToSt r(i) + ']= ' +
  713              ParamTypeS trings[Par am[i].ptyp e] + #9 +  Param[i].v alue;
  714  
  715         i :=  Param.Cou nt;                   // In case  we have t o add a li st to the  end....
  716  
  717         if M ultList <>  nil then
  718         begi n
  719           fo r j := 0 t o MultList .Count - 1  do
  720           be gin
  721   {.$IFDEF Z Z_RPC_LOG}
  722              if pos('=' , MultList [j]) = 0 t hen
  723                Param[i] .Mult[IntT oStr(j)] : = MultList [j]
  724              else
  725                Param[i] .Mult['"'  + trim(pie ce(MultLis t[j], '=',  1)) + '"' ] :=
  726                  trim(p iece(MultL ist[j], '= ', 2));
  727   {.$ELSE}
  728   //           Param[i] .Mult[IntT oStr(j)] : = MultList [j];
  729   {.$ENDIF}
  730              eMsg := eM sg + #13#1 0 + 'List[ ' + intToS tr(j) + '] =' + #9 +
  731                MultList [j];
  732           en d;
  733           Pa ram[i].PTy pe := List ;
  734         end;
  735       end;
  736       if Deb ugMode the n
  737         frmD ebug.Execu te('Callin g RPC Brok er', eMsg,  nil);
  738  
  739       if use DebugLog t hen
  740       begin
  741         writ eLogMessag eProc('',  nil);
  742         writ eLogMessag eProc(eMsg , nil);
  743       end;
  744   {.$IFDEF Z Z_RPC_LOG}                         //  DNS     andria 201 5-01-29 == ========== ========== =========
  745       anEven t := nil;
  746       try
  747         aSta rt := Now;
  748         anEv ent := get TRPCBEvent Item(Self) ;
  749         Call ;
  750         aSto p := Now;
  751         anEv ent.Append Results(Se lf.Results , aStart,  aStop);
  752         addR PCEvent(an Event);
  753   {.$ELSE}
  754   //    try
  755   //      ca ll;
  756   {.$ENDIF}                                     //  DNS     andria 201 5-01-29 == ========== ========== =========
  757         if D ebugMode t hen
  758           fr mDebug.Exe cute('RPC  Broker Ret urn Values ', 'RPC Ca ll: ' + RP C,
  759              Results);
  760  
  761         if u seDebugLog  then
  762         begi n
  763           wr iteLogMess ageProc('' , nil);
  764           wr iteLogMess ageProc(RP C + ', RPC  Return Va lues:', ni l, Results );
  765         end;
  766  
  767         resu lt := True ;
  768       except
  769         on E : EBrokerE rror do
  770         begi n
  771           re sult := Fa lse;
  772           eM sg := eMsg  + #13#10  + BrokerEr rorMessage s(E.Code,  E.Mnemonic ) +
  773              #13 + E.Me ssage +
  774              #13#13 + ' BCMA faile d to commu nicate wit h VistA an d is unabl e' +
  775              #13#10 + ' to continu e.  BCMA w ill now te rminate.';
  776           De fMessageDl g('Broker  RPC Error: ' + #13 +  eMsg, mtEr ror, [mbOK ], 0);
  777           E. message :=  eMsg + #1 3#10 + E.m essage;
  778   {.$IFDEF Z Z_RPC_LOG}
  779           if  Assigned( anEvent) t hen
  780              anEvent.Ap pendError( E.Message) ;
  781           ad dRPCEvent( anEvent);
  782   {.$ELSE}
  783   //         if assigne d(FLogErro rProc) the n
  784   //           FLogErro rProc('Bro ker RPC Er ror:', E);
  785   //         Connected  := False;
  786   //         ShutDown : = True;
  787   //         applicatio n.terminat e;
  788   //         abort;
  789   {.$ENDIF}
  790         end;
  791       end;
  792       Screen .Cursor :=  crDefault ;
  793     end;
  794   end;
  795  
  796   ////////// ////////// /////////  TBCMA_User
  797  
  798   constructo r TBCMA_Us er.Create( RPCBroker:  TBCMA_Bro ker);
  799   begin
  800     inherite d Create;
  801  
  802     if RPCBr oker <> ni l then
  803       FRPCBr oker := RP CBroker;
  804  
  805     Clear;
  806   end;
  807  
  808   destructor  TBCMA_Use r.Destroy;
  809   begin
  810     (*
  811      if FCha nged then
  812       if Def MessageDlg ('The Curr ent User d ata has be en changed !'+#13#13+ 'Do you wi sh save yo ur changes ?',
  813               mtConfirm ation, [mb Yes, mbNo] , 0) = idY es then
  814        SaveD ata;
  815     *)
  816     inherite d Destroy;
  817   end;
  818  
  819   procedure  TBCMA_User .Clear;
  820   begin
  821     FDUZ :=  '';
  822     FUserNam e := '';
  823     FIsManag er := Fals e;
  824     FIsStude nt := Fals e;
  825     FIsMOBut tonUser :=  False;
  826     FIsReadO nly := Fal se;
  827     FUnableT oScanKey : = False;
  828     FDivisio nIEN := '' ;
  829     FSiteIEN  := '';
  830     FDivisio nName := ' ';
  831     FAgencyC ode := '';                       // rpk 8/6 /2009
  832     FESigReq uired := F alse;
  833     FOnLine  := False;
  834     FDTime : = '';
  835     FOrderRo le := -1;
  836  
  837     FChanged  := False;
  838     FProduct ionAccount  := False;
  839   end;
  840  
  841   function T BCMA_User. LoadData:  boolean;
  842   begin
  843     result : = False;
  844     try
  845       if FRP CBroker <>  nil then
  846         with  FRPCBroke r do
  847         begi n
  848           if  FChanged  then
  849              if DefMess ageDlg('Th e Current  User data  has been c hanged!' +  #13#13 +
  850                'Do you  wish save  your chang es?',
  851                mtConfir mation, [m bYes, mbNo ], 0) = mr Yes then
  852                SaveData ;
  853  
  854           Cl ear;
  855  
  856           if  CreateCon text('PSB  GUI CONTEX T - USER')  then // t his is a u ser
  857           be gin
  858              if CheckVe rsion then
  859                exit;
  860              if CallSer ver('PSB U SERLOAD',  [''], nil)  then
  861              begin
  862                if piece (FRPCBroke r.Results[ 0], '^', 1 ) = '-1' t hen
  863                begin
  864                  DefMes sageDlg('C annot load  user para meters', m tError, [m bOK], 0);
  865                  Exit;
  866                end;
  867                FDUZ :=  Results[0] ;
  868                FUserNam e := Resul ts[1];
  869                FIsMOBut tonUser :=  (StrToInt Def(Result s[4], 0) =  1);
  870                FIsReadO nly := (St rToIntDef( Results[18 ], 0) = 1) ;
  871                FIsStude nt := (Str ToIntDef(R esults[2],  0) = 1);
  872  
  873                //msf di sable
  874   {$IFDEF MS F_ON}
  875                FUnableT oScanKey : = (StrToIn tDef(Resul ts[24], 0)  = 1);
  876   {$ENDIF}
  877                if FIsSt udent then
  878                begin
  879                  // Loa d as a stu dent
  880                  FIsMan ager := Fa lse;
  881                  FIsMOB uttonUser  := False;
  882                  FUnabl eToScanKey  := False;
  883                end
  884                else
  885                begin
  886                  // Man ager?
  887                  FIsMan ager := (S trToIntDef (Results[3 ], 0) = 1) ;
  888                end;
  889  
  890                FDivisio nIEN := pi ece(Result s[7], '^',  1);
  891                FSiteIEN  := piece( Results[7] , '^', 2);    // fdiv isionnum i n bcma par ameters; w hat is pie ce 2?
  892                FProduct ionAccount  := (StrTo IntDef(pie ce(Results [7], '^',  3), 0) =
  893                  1);
  894                FDivisio nName := R esults[8];
  895                FESigReq uired := ( Results[9]  = '1');
  896                FOnLine  := (Result s[10] = '1 ');
  897                FDTime : = Results[ 11];
  898                // SDD f or PSB USE RLOAD AG i s returned  in 27,
  899                // S RES ULTS(27)=$ G(DUZ("AG" ))  ;IHS/M SC/PLS
  900  
  901                // setIH S is an ov erride to  force the  agency cod e to IHS w hen setIHS  is true
  902                if setIH S then                // rpk 6/2 3/2010
  903                  FAgenc yCode := ' I'
  904                else beg in
  905                  // Res ults[27] d oes not ex ist in PSB *3*28
  906                  if Res ults.Count  > 27 then
  907                    FAge ncyCode :=  Results[2 7]
  908                  else
  909                    // d efault to  VistA
  910                    FAge ncyCode :=  'V';
  911                end;
  912                Result : = True;               // User is  considere d loaded
  913  
  914                FChanged  := False;
  915                if CallS erver('ORW UBCMA USER INFO', ['' ], nil, Tr ue) then
  916                  FOrder Role := St rToIntDef( Piece(Resu lts[0], '^ ', 6), 0);
  917  
  918              end
  919           en d
  920           el se begin
  921              if assigne d(FLogErro rProc) the n
  922                FLogErro rProc('Use r Does Not  Have Acce ss To BCMA !', nil);
  923              DefMessage Dlg('User  Does Not H ave Access  To BCMA!' , mtError,  [mbok],
  924                0);
  925           en d;
  926         end;
  927     except
  928       on e:  EOleExcept ion do
  929       begin
  930         DefM essageDlg( e.message,  mtError,  [mbok], 0) ;
  931         if a ssigned(FR PCBroker.F LogErrorPr oc) then
  932           FR PCBroker.F LogErrorPr oc(e.messa ge, nil);
  933         Resu lt := Fals e;
  934       end;
  935     end;
  936   end;                                        // LoadDat a
  937  
  938   procedure  TBCMA_User .SaveData;
  939   begin
  940     if FRPCB roker <> n il then
  941       if FCh anged then
  942       begin
  943         (*
  944            N eed an RPC  to save V istA data  for curren t user.
  945         *)
  946         FCha nged := Fa lse;
  947       end;
  948   end;
  949  
  950   function T BCMA_User. isValidESi g(ESig: st ring): boo lean;
  951   begin
  952     result : = False;
  953     if FRPCB roker <> n il then
  954       with F RPCBroker  do
  955         if C allServer( 'PSB VALID ATE ESIG',  ['^' + en crypt(ESig )], nil) t hen
  956           re sult := (p iece(Resul ts[0], '^' , 1) = '1' );
  957   end;
  958  
  959   function T BCMA_User. getDTime:  integer;
  960   begin
  961     result : = 0;
  962     if FDTim e <> '' th en
  963       result  := strToI ntDef(FDTi me, 0);
  964   end;
  965  
  966   end.
  967