Function

sCardReady

Module

XuDsigS

Last Modified

7/15/2014 3:26:44 PM

Scope

Interfaced

Declaration

function sCardReady: boolean;

Calls Hierarchy


sCardReady
 ├SCardEstablishContext
 ├SCardListReadersA
 └SCardConnectA

Called-By Hierarchy


                                                          sCardReady
                                              tCryptography.Create┤ 
                                                          SetSAN┤ │ 
                           TfrmFrame.DigitalSigningSetup1Click┤ │ │ 
                                             ExecuteSignOrders┤ │ │ 
                                  TfrmOrders.mnuActSignClick┘ │ │ │ 
                                         TfrmReview.cmdOKClick┘ │ │ 
                                               ReviewChanges┘   │ │ 
                           TfrmFrame.AllowContextChangeAll┤     │ │ 
                                TfrmFrame.FormCloseQuery┤ │     │ │ 
                              TfrmFrame.mnuFileNextClick┤ │     │ │ 
                            TfrmFrame.mnuFileOpenClick┤ │ │     │ │ 
                                TfrmFrame.UMInitiate┤ │ │ │     │ │ 
                       TfrmFrame.mnuFileNextClick...┤ │ │ │     │ │ 
                       TfrmFrame.mnuFileRefreshClick┤ │ │ │     │ │ 
                       TfrmOrders.CheckOrderStatus┤ │ │ │ │     │ │ 
                   TfrmOrders.mnuActChgEvntClick┤ │ │ │ │ │     │ │ 
                      TfrmOrders.mnuActHoldClick┤ │ │ │ │ │     │ │ 
                    TfrmOrders.mnuActUnholdClick┤ │ │ │ │ │     │ │ 
                     TfrmOrders.mnuActRenewClick┤ │ │ │ │ │     │ │ 
                    TfrmOrders.mnuActChangeClick┤ │ │ │ │ │     │ │ 
                      TfrmOrders.mnuActCopyClick┘ │ │ │ │ │     │ │ 
                            TfrmMeds.mnuActDCClick┤ │ │ │ │     │ │ 
                           TfrmMeds.CheckMedStatus┘ │ │ │ │     │ │ 
                        TfrmMeds.mnuActHoldClick┤   │ │ │ │     │ │ 
                       TfrmMeds.mnuActRenewClick┤   │ │ │ │     │ │ 
                      TfrmMeds.mnuActUnholdClick┤   │ │ │ │     │ │ 
                      TfrmMeds.mnuActChangeClick┤   │ │ │ │     │ │ 
                        TfrmMeds.mnuActCopyClick┤   │ │ │ │     │ │ 
                      TfrmMeds.mnuActRefillClick┘   │ │ │ │     │ │ 
                                  TfrmFrame.ViewInfo┘ │ │ │     │ │ 
                               TfrmDCSumm.ViewInfo┤   │ │ │     │ │ 
                             TfrmConsults.ViewInfo┤   │ │ │     │ │ 
                     TfrmFrame.pnlRemindersMouseUp┤   │ │ │     │ │ 
                      TfrmFrame.RemindersChanged┘ │   │ │ │     │ │ 
                          TfrmFrame.FormCreate┘   │   │ │ │     │ │ 
                            TfrmFrame.pnlCIRNClick┤   │ │ │     │ │ 
                      TfrmFrame.pnlVistaWebClick┤ │   │ │ │     │ │ 
                           TfrmFrame.FormKeyDown┘ │   │ │ │     │ │ 
                         TfrmFrame.pnlPatientClick┤   │ │ │     │ │ 
                           TfrmFrame.pnlVisitClick┤   │ │ │     │ │ 
                     TfrmFrame.pnlPrimaryCareClick┤   │ │ │     │ │ 
                       TfrmFrame.pnlRemindersClick┤   │ │ │     │ │ 
                        TfrmFrame.pnlPostingsClick┤   │ │ │     │ │ 
                            TfrmFrame.pnlFlagClick┤   │ │ │     │ │ 
                              TfrmFrame.laMHVClick┤   │ │ │     │ │ 
                             TfrmFrame.laVAA2Click┤   │ │ │     │ │ 
                               TfrmOrders.ViewInfo┤   │ │ │     │ │ 
                                 TfrmMeds.ViewInfo┤   │ │ │     │ │ 
                              TfrmSurgery.ViewInfo┤   │ │ │     │ │ 
                                TfrmNotes.ViewInfo┤   │ │ │     │ │ 
                             TfrmProblems.ViewInfo┘   │ │ │     │ │ 
                     TfrmFrame.mnuFileNotifRemoveClick┤ │ │     │ │ 
                             TfrmFrame.NextButtonClick┘ │ │     │ │ 
                           TfrmFrame.SetUpNextButton┘   │ │     │ │ 
                     TfrmFrame.mnuFileOpenClick...┤     │ │     │ │ 
                              TfrmFrame.FormResize┘     │ │     │ │ 
                            TfrmFrame.ChangeFont┘       │ │     │ │ 
                    TfrmFrame.LoadSizesForUser┤         │ │     │ │ 
               TfrmFrame.LoadUserPreferences┘ │         │ │     │ │ 
                      TfrmFrame.UMInitiate┘   │         │ │     │ │ 
                    TfrmFrame.mnuFontSizeClick┘         │ │     │ │ 
                           TfrmFrame.mnuFileOpenClick...┤ │     │ │ 
                           TfrmFrame.ctxContextorPending┤ │     │ │ 
                          TfrmFrame.StartCCOWContextor┘ │ │     │ │ 
                                TfrmFrame.FormCreate┘   │ │     │ │ 
                         TfrmFrame.ctxContextorCommitted┤ │     │ │ 
                       TfrmFrame.StartCCOWContextor...┘ │ │     │ │ 
                  TfrmFrame.mnuFileResumeContextGetClick┤ │     │ │ 
                  TfrmFrame.mnuFileResumeContextSetClick┘ │     │ │ 
                                  TfrmFrame.FormCloseQuery┤     │ │ 
                              TfrmFrame.mnuFileReviewClick┤     │ │ 
                                           UpdateEncounter┘     │ │ 
                         TfrmFrame.mnuFileEncounterClick┤       │ │ 
                                 TfrmFrame.ViewInfo...┤ │       │ │ 
                    TfrmODMedIV.SetValuesFromResponses┤ │       │ │ 
                             TfrmODMedIV.SetupDialog┤ │ │       │ │ 
                   TfrmODMedIV.cboSolutionMouseClick┘ │ │       │ │ 
                       TfrmODMedIV.cboSolutionExit┘   │ │       │ │ 
                  TfrmODMedIV.cboSolutionMouseClick...┤ │       │ │ 
                     TfrmODMedIV.cboAdditiveMouseClick┤ │       │ │ 
                         TfrmODMedIV.cboAdditiveExit┘ │ │       │ │ 
                                TfrmODAuto.SetupDialog┤ │       │ │ 
                                   ActivateOrderDialog┤ │       │ │ 
                           TfrmRemDlg.btnFinishClick┤ │ │       │ │ 
           TfrmConsults.mnuActNewConsultRequestClick┤ │ │       │ │ 
                   TfrmConsults.cmdNewConsultClick┘ │ │ │       │ │ 
                TfrmConsults.mnuActNewProcedureClick┤ │ │       │ │ 
                      TfrmConsults.cmdNewProcClick┘ │ │ │       │ │ 
                                        ChangeOrders┤ │ │       │ │ 
                      TfrmOrders.mnuActChangeClick┤ │ │ │       │ │ 
                        TfrmMeds.mnuActChangeClick┘ │ │ │       │ │ 
                                     ChangeOrdersEvt┤ │ │       │ │ 
                                          CopyOrders┤ │ │       │ │ 
                        TfrmOrders.mnuActCopyClick┤ │ │ │       │ │ 
                          TfrmMeds.mnuActCopyClick┤ │ │ │       │ │ 
                           TfrmODActive.btnOKClick┘ │ │ │       │ │ 
                                      TransferOrders┤ │ │       │ │ 
                        TfrmOrders.mnuActCopyClick┤ │ │ │       │ │ 
                          TfrmMeds.mnuActCopyClick┤ │ │ │       │ │ 
                           TfrmODActive.btnOKClick┘ │ │ │       │ │ 
                            TfrmOrders.lstWriteClick┤ │ │       │ │ 
               TfrmOrders.PlaceOrderForDefaultDialog┤ │ │       │ │ 
                  TfrmOrders.DisplayDefaultDlgList┤ │ │ │       │ │ 
                       TfrmOrders.ResetOrderPage┘ │ │ │ │       │ │ 
               TfrmOrders.btnDelayedOrderClick┘   │ │ │ │       │ │ 
                                 DisplayEvntDialog┤ │ │ │       │ │ 
                             SetDelayEventForMed┘ │ │ │ │       │ │ 
                      TfrmMeds.mnuActCopyClick┘   │ │ │ │       │ │ 
                                 DisplayEvntDialog┤ │ │ │       │ │ 
                                  SetViewForCopy┘ │ │ │ │       │ │ 
                    TfrmOrders.mnuActCopyClick┘   │ │ │ │       │ │ 
                                 DisplayEvntDialog┘ │ │ │       │ │ 
                                ExecuteChangeEvt┘   │ │ │       │ │ 
                 TfrmOrders.mnuActChgEvntClick┘     │ │ │       │ │ 
                             TfrmMeds.mnuActNewClick┤ │ │       │ │ 
                           TfrmOMNavA.ActivateDialog┤ │ │       │ │ 
                         TfrmOMNavA.grdMenuKeyDown┤ │ │ │       │ │ 
                         TfrmOMNavA.grdMenuMouseUp┘ │ │ │       │ │ 
                                TfrmOMSet.DoNextItem┘ │ │       │ │ 
                              TfrmOMSet.InsertList┤   │ │       │ │ 
                               ActivateOrderList┘ │   │ │       │ │ 
                     TfrmRemDlg.btnFinishClick┤   │   │ │       │ │ 
                             ActivateOrderHTML┤   │   │ │       │ │ 
                    TfrmOrders.lstWriteClick┤ │   │   │ │       │ │ 
    TfrmOrders.PlaceOrderForDefaultDialog...┘ │   │   │ │       │ │ 
                              ActivateOrderSet┤   │   │ │       │ │ 
                   TfrmRemDlg.btnFinishClick┤ │   │   │ │       │ │ 
TfrmConsults.mnuActNewConsultRequestClick...┤ │   │   │ │       │ │ 
     TfrmConsults.mnuActNewProcedureClick...┤ │   │   │ │       │ │ 
                    TfrmOrders.lstWriteClick┤ │   │   │ │       │ │ 
    TfrmOrders.PlaceOrderForDefaultDialog...┤ │   │   │ │       │ │ 
                     TfrmMeds.mnuActNewClick┤ │   │   │ │       │ │ 
                TfrmOMNavA.ActivateDialog...┤ │   │   │ │       │ │ 
                     TfrmOMSet.DoNextItem...┘ │   │   │ │       │ │ 
                       TfrmOMNavA.DoSelectList┘   │   │ │       │ │ 
                     TfrmOMNavA.grdMenuKeyUp┤     │   │ │       │ │ 
                   TfrmOMNavA.grdMenuMouseUp┘     │   │ │       │ │ 
                                        SkipToNext┤   │ │       │ │ 
                         TfrmOMSet.DoNextItem...┘ │   │ │       │ │ 
                            TfrmOMSet.UMDelayEvent┘   │ │       │ │ 
                               TfrmOMSet.InsertList...┤ │       │ │ 
                                TfrmODMeds.SetupDialog┤ │       │ │ 
                             TfrmODMeds.btnSelectClick┤ │       │ │ 
                             TfrmODMeds.UMDelayClick┘ │ │       │ │ 
                                    ExecuteRenewOrders┘ │       │ │ 
                         TfrmOrders.mnuActRenewClick┤   │       │ │ 
                           TfrmMeds.mnuActRenewClick┘   │       │ │ 
                                        EncounterPresent┤       │ │ 
                                      ReadyForNewOrder┤ │       │ │ 
                           TfrmRemDlg.btnFinishClick┤ │ │       │ │ 
        TfrmConsults.mnuActNewConsultRequestClick...┤ │ │       │ │ 
             TfrmConsults.mnuActNewProcedureClick...┤ │ │       │ │ 
                                     ChangeOrders...┤ │ │       │ │ 
                                     ChangeOrdersEvt┤ │ │       │ │ 
                                       CopyOrders...┤ │ │       │ │ 
                                   TransferOrders...┤ │ │       │ │ 
                            TfrmOrders.lstWriteClick┤ │ │       │ │ 
                             TfrmMeds.mnuActNewClick┘ │ │       │ │ 
                                     ReadyForNewOrder1┤ │       │ │ 
            TfrmOrders.PlaceOrderForDefaultDialog...┘ │ │       │ │ 
                              TfrmOrders.mnuActDCClick┤ │       │ │ 
                             TfrmOrders.mnuActRelClick┤ │       │ │ 
                            TfrmOrders.mnuActHoldClick┤ │       │ │ 
                          TfrmOrders.mnuActUnholdClick┤ │       │ │ 
                           TfrmOrders.mnuActRenewClick┤ │       │ │ 
                         TfrmOrders.mnuActReleaseClick┤ │       │ │ 
                         TfrmOrders.mnuActOnChartClick┤ │       │ │ 
                            TfrmOrders.mnuActSignClick┤ │       │ │ 
                                TfrmMeds.mnuActDCClick┤ │       │ │ 
                              TfrmMeds.mnuActHoldClick┤ │       │ │ 
                             TfrmMeds.mnuActRenewClick┤ │       │ │ 
                            TfrmMeds.mnuActUnholdClick┤ │       │ │ 
                              TfrmMeds.mnuActCopyClick┤ │       │ │ 
                            TfrmMeds.mnuActRefillClick┘ │       │ │ 
                                     EncounterPresentEDO┤       │ │ 
                                   ReadyForNewOrder...┤ │       │ │ 
                         TfrmOrders.mnuActChgEvntClick┤ │       │ │ 
                          TfrmOrders.mnuActChangeClick┤ │       │ │ 
                            TfrmOrders.mnuActCopyClick┤ │       │ │ 
                       TfrmOrders.btnDelayedOrderClick┤ │       │ │ 
                            TfrmMeds.mnuActChangeClick┤ │       │ │ 
                              TfrmMeds.mnuActCopyClick┘ │       │ │ 
                                             UpdateVisit┤       │ │ 
                                           EditPCEData┤ │       │ │ 
                             TfrmSurgery.cmdPCEClick┤ │ │       │ │ 
                                 UpdateEncounterInfo┘ │ │       │ │ 
                             TfrmNotes.cmdPCEClick┘   │ │       │ │ 
                        TfrmVitals.btnEnterVitalsClick┘ │       │ │ 
                                             UpdateVisit┤       │ │ 
                                        EncounterPresent┘       │ │ 
                         TfrmProblems.lstProbActsClick┘         │ │ 
                     TfrmProblems.wgProbDataDblClick┤           │ │ 
                           TfrmProblems.lstViewClick┘           │ │ 
                   TfrmProblems.HighlightDuplicate┘             │ │ 
                         TfrmProblems.AddProblem┤               │ │ 
              TfrmProblems.lstProbActsClick...┤ │               │ │ 
                 TfrmProblems.lstProbPickClick┤ │               │ │ 
              TfrmProblems.lstProbPickDblClick┤ │               │ │ 
              TfrmProblems.edProbEntKeyPress┘ │ │               │ │ 
                      TfrmProblems.UMPLLexicon┘ │               │ │ 
                   TfrmdlgProb.bbChangeProbClick┘               │ │ 
                                            ExecuteSignOrders...┤ │ 
                                        TfrmReview.cmdOKClick...┘ │ 
                                                     checkPINValue┘ 
                                                  getSANFromCard┤   
                                                     SetSAN...┘ │   
                                            ExecuteSignOrders...┤   
                                        TfrmReview.cmdOKClick...┘   

Calls

Name Declaration Comments
SCardConnectA function SCardConnectA(hContext: LongInt; szReader: LPStr; dwShareMode: LongInt; dwPreferredProtocols: LongInt; var phCard: LongInt; pdwActiveProtocol: PDword): LongInt; stdcall; -
SCardEstablishContext function SCardEstablishContext(dwScope: DWORD; pvReserved1: Pointer; pvReserved2: Pointer; phContext: Pointer): LongInt; stdcall; -
SCardListReadersA function SCardListReadersA(SCARDCONTEXT: LongInt; mszGroups: LPStr; mszReaders: LPStr; var pcchReaders: LongInt): LongInt; stdcall; -

Called-By

Name Declaration Comments
checkPINValue function checkPINValue(InputForm: TComponent): TPINResult; -
tCryptography.Create constructor Create; -


Source

1372  function sCardReady: boolean;
1373  const
1374      MAX_SCARD_READERS = 10;
1375  var
1376      szReaders: string;
1377      dwI: DWORD;
1378      cch: integer;
1379      Str: String;
1380      ActiveProtocol: DWORD;
1381      fhSC: SCARDCONTEXT;
1382      fhCard: longint;
1383      offset, index: Integer;
1384      done: Boolean;
1385      charval: Char;
1386  begin
1387      Result := False;
1388      dwi := SCardEstablishContext(SCARD_SCOPE_USER,
1389          nil,
1390          nil, @fhSC);
1391      //See if we got a handle
1392      if dwi <> SCARD_S_SUCCESS then
1393      begin
1394        exit;
1395      end;
1396  //    dwi := SCardListReadersA(fhSC,   hint fix
1397      SCardListReadersA(fhSC,
1398          nil,
1399          nil,
1400          cch);
1401      setlength(szReaders, cch);
1402      dwi := SCardListReadersA(fhSC,
1403          nil,
1404          PChar(szReaders),
1405          cch);
1406      if dwi = SCARD_S_SUCCESS then
1407        Result := True;
1408      // check for card in reader
1409      offset := 1;
1410      done := false;
1411      Str := StrPas(PChar(szReaders));
1412      while not done do
1413      begin
1414        dwi := SCardConnectA(fhSC, PChar(Str), SCARD_SHARE_SHARED, 3, fhCard, @ActiveProtocol);
1415        if dwi = SCARD_S_SUCCESS then
1416          done := true
1417        else
1418        begin
1419          for index := offset to cch do
1420          begin
1421            offset := index;
1422            charval := szReaders[index];
1423            if charval = #0 then
1424              break;
1425          end;
1426          offset := offset + 1;
1427          if szReaders[offset] = #0 then
1428            done := true
1429          else
1430          begin
1431            for index := 1 to cch-offset+1 do
1432            begin
1433              szReaders[index] := szReaders[index+offset-1];
1434            end;
1435            Str := StrPas(PChar(szReaders));
1436            offset := 1;
1437          end;
1438        end;
1439      end;
1440      if not (dwi = SCARD_S_SUCCESS) then
1441      begin
1442        Result := false;
1443        Str := SysErrorMessage(dwi);
1444        ShowMessage(Str);
1445      end;
1446  end;