Форум программистов, компьютерный форум, киберфорум
C++ Builder
Войти
Регистрация
Восстановить пароль
Блоги Сообщество Поиск  
 
 
Рейтинг 4.67/76: Рейтинг темы: голосов - 76, средняя оценка - 4.67
 Аватар для DrSMERTb
64 / 40 / 10
Регистрация: 12.11.2010
Сообщений: 841

Считыватель смарт карт ACR122

10.04.2014, 18:52. Показов 15924. Ответов 62
Метки нет (Все метки)

Студворк — интернет-сервис помощи студентам
Всем доброго времени суток. Кто имел дело с подобными считывателями, на диске с проектом есть Delphi проекты, работу которых я так и не смог понять, мне нужно при подносе карты к считывателю получать её 16-ти битный ключ. Кто в курсе как это можно сделать?
0
IT_Exp
Эксперт
34794 / 4073 / 2104
Регистрация: 17.06.2006
Сообщений: 32,602
Блог
10.04.2014, 18:52
Ответы с готовыми решениями:

Считыватель контактных смарт-карт на форму в HTML
Нужно внедрить систему считывания смарт карт (удос. личн.) на страницу в HTML Будьте добры, подкиньте несколько вариантов на чем это...

Ищу книги Патрик Гелль секреты программирования смарт карт Мытник Пасечник смарт карты и информационная безопасность
уже весь интернет обыскался не могу найти книги в электронном виде

Считыватель ACR122U не реагирует на смарт карту
Считыватель ACR122U не реагирует на смарт карту... Как определить интерфейс смарт карты? Схожа с той, что на картинке... Видит Mifire, ISO...

62
 Аватар для DrSMERTb
64 / 40 / 10
Регистрация: 12.11.2010
Сообщений: 841
25.04.2014, 15:15  [ТС]
Студворк — интернет-сервис помощи студентам
mimicria, и что делать?)

Добавлено через 2 минуты
Xank, ничего не изменилось.
0
Марсианин)))
713 / 46 / 15
Регистрация: 18.07.2010
Сообщений: 637
25.04.2014, 15:22
Цитата Сообщение от DrSMERTb Посмотреть сообщение
for (int index=0;index<252;index++) { SendBuff[index] = 0x00; RecvBuff[index] = 0x00; }
Там в примере идет так
Delphi
1
2
3
4
5
6
7
8
9
10
11
procedure ClearBuffers();
var index: integer;
begin
 
  for index := 0 to 262 do
    begin
      SendBuff[index] := $00;
      RecvBuff[index] := $00;
    end;
 
end;
1
 Аватар для DrSMERTb
64 / 40 / 10
Регистрация: 12.11.2010
Сообщений: 841
25.04.2014, 16:01  [ТС]
Елки палки допереводил... теперь допер разницу между функцией и процедурой...

Добавлено через 13 минут
Xank, да я 252 заменил на 262
0
Марсианин)))
713 / 46 / 15
Регистрация: 18.07.2010
Сообщений: 637
25.04.2014, 16:31
Delphi
1
2
for index := 0 to SendLen - 1 do
    tempstr := tempstr + Format('%.02X ', [SendBuff[index]]);
на С++
C++
1
2
3
4
5
6
7
8
   TVarRec args [262];
 
   for(int i=0; i<262;i++)
   {
       args[i]= SendBuff[i];
   }
 
   tempstr =Format("%.02x",args,262);
Может ошибаюсь. Вроде правильно перевел.
1
 Аватар для DrSMERTb
64 / 40 / 10
Регистрация: 12.11.2010
Сообщений: 841
25.04.2014, 18:06  [ТС]
Закоментил кусок кода с ошибкой, решил просто проверить будет ли определять сам ридер, в итоге пачка:
C++
1
2
3
4
5
[ilink32 Error] Error: Unresolved external 'SCardEstablishContext' referenced from C:\USERS\DRSMERTB.DRSMERTB-PC\DESKTOP\TEST\WIN32\DEBUG\UNIT1.OBJ
[ilink32 Error] Error: Unresolved external 'SCardListReadersA' referenced from C:\USERS\DRSMERTB.DRSMERTB-PC\DESKTOP\TEST\WIN32\DEBUG\UNIT1.OBJ
[ilink32 Error] Error: Unresolved external '__fastcall Acsmodule::GetScardErrMsg(unsigned int)' referenced from C:\USERS\DRSMERTB.DRSMERTB-PC\DESKTOP\TEST\WIN32\DEBUG\UNIT1.OBJ
[ilink32 Error] Error: Unresolved external '__fastcall Acsmodule::LoadListToControl(Vcl::Stdctrls::TComboBox *&, char *, int)' referenced from C:\USERS\DRSMERTB.DRSMERTB-PC\DESKTOP\TEST\WIN32\DEBUG\UNIT1.OBJ
[ilink32 Error] Error: Unresolved external 'SCardConnectA' referenced from C:\USERS\DRSMERTB.DRSMERTB-PC\DESKTOP\TEST\WIN32\DEBUG\UNIT1.OBJ
Добавлено через 26 минут
Вот что на данный момент получилось:
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
// ---------------------------------------------------------------------------
 
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
#include "ACSModule.hpp"
 
 
// ---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "sButton"
#pragma resource "*.dfm"
TForm1 *Form1;
 
  SCARDCONTEXT hContext;
  SCARDCONTEXT hCard;
  SCARD_IO_REQUEST ioRequest;
  long retCode;
  unsigned int dwActProtocol, BufferLen;
  Byte  SendBuff[262], RecvBuff[262];
  int SendLen, RecvLen, nBytesRet;
  char Buffer;
  bool validATS;
  const MAX_BUFFER_LEN    = 256;
// ---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner)
 {
}
// ---------------------------------------------------------------------------
void __fastcall TForm1::DisplayOut(String output,int mode)
{
 
  if (mode==1) rbOutput->SelAttributes->Color = clBlue;
  else if (mode==2) rbOutput->SelAttributes->Color = clRed;
  else if (mode==3)
        {
        rbOutput->SelAttributes->Color = clBlack;
        output = "<< " + output;
        }
  else if (mode==4)
        {
        rbOutput->SelAttributes->Color = clBlack;
        output = ">> " + output;
        }
 
 
  rbOutput->Lines->Add(output);
  rbOutput->SelAttributes->Color = clBlack;
  rbOutput->SetFocus();
 
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ClearBuffers()
{
 
  for (int index=0;index<262;index++)
    {
      SendBuff[index] = 0x00;
      RecvBuff[index] = 0x00;
    }
 
}
//---------------------------------------------------------------------------
void __fastcall TForm1::SendAPDU(int mode)
{
int index;
String tempstr;
  ioRequest.dwProtocol = dwActProtocol;
  ioRequest.cbPciLength = sizeof(SCARD_IO_REQUEST);
 
  tempstr = "";
  for (index = 0; index<SendLen - 1; index++)
    {
    String f="%.02X ";
       TVarRec args [262];
 
   for(int i=0; i<262;i++)
   {
       args[i]= SendBuff[i];
   }
 
   tempstr =Format("%.02x",args,262);
 
tempstr = tempstr + IntToHex(SendBuff[index],2);
 
    }
  DisplayOut(tempstr,3);
 
  retCode = SCardTransmit(hCard,
                           &ioRequest,
                           SendBuff,
                           SendLen,
                           Null,
                           RecvBuff,
                           &RecvLen);
  if (retCode != SCARD_S_SUCCESS) {
    DisplayOut(GetScardErrMsg(retCode),2);
    SendAPDU(retCode);
 
  }
 
  tempstr = "";
 
  if (mode==1)  {
      //for (index = 0; index<RecvLen - 1;index++)
           TVarRec args [262];
 
   for(int i=0; i<262;i++)
   {
       args[i]= SendBuff[i];
   }
 
   tempstr =Format("%.02x",args,262);
 //Format("%->02X ", [RecvBuff[index]]);
      tempstr = tempstr + IntToHex(SendBuff[index],2);
 
      DisplayOut(tempstr, 4);
      }
  else if (mode==2)  {      // Interpret SW1/SW2
      // for (index = (RecvLen-2); index<(RecvLen-1);index++)
         //tempstr = tempstr + RecvBuff[index];//Format("%->02X", [(RecvBuff[index])]);
          TVarRec args [262];
 
   for(int i=0; i<262;i++)
   {
       args[i]= SendBuff[i];
   }
 
   tempstr =Format("%.02x",args,262);
 
 
       if (Trim(tempstr) == "6A81")  {
         DisplayOut("The function is not supported->",2);
         SendAPDU( retCode);
       }
       if (Trim(tempstr) == "6300")  {
         DisplayOut("The operation failed->",2);
         SendAPDU(retCode);
       }
       validATS = True;
       }
 
 
  SendAPDU(retCode);
 
}
//---------------------------------------------------------------------------
void __fastcall TForm1::TrimInput(int TrimType,String StrIn)
{
int  index;
String tmpStr;
  tmpStr = "";
  StrIn = Trim(StrIn);
 
   if   (TrimType==0) {
       for (index = 1; index<StrIn.Length();index++)
         if ((StrIn[index] != '\n') && (StrIn[index] != ' '))
           tmpStr = tmpStr + StrIn[index];
       }
    else if (TrimType==1) {
       for (index = 1; index<StrIn.Length();index++)
         if (StrIn[index] != ' ')
           tmpStr = tmpStr + StrIn[index];
       }
 
  //TrimInput(tmpStr);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Initialize()
{
 
  btnInit->Enabled = true;
  btnConnect->Enabled = false;
  DataGroup->Enabled = false;
  SendGroup->Enabled = false;
  cbReader->Text = "";
  check1->Checked = false;
  tbCLA->Text = "";
  tbINS->Text = "";
  tbP1->Text = "";
  tbP2->Text = "";
  tbLc->Text = "";
  tbLe->Text = "";
  tbData->Text = "";
  rbOutput->Text = "";
  DisplayOut("Program ready", 1);
 
}
//---------------------------------------------------------------------------
void __fastcall TForm1::btnInitClick(TObject *Sender)
{
int index;
  retCode = SCardEstablishContext(SCARD_SCOPE_USER,
                                   NULL,
                                   NULL,
                                   &hContext);
  if (retCode != SCARD_S_SUCCESS) {
    DisplayOut(GetScardErrMsg(retCode),2);
 
  } ;
 
  //List PC/SC readers installed in the system
  BufferLen = MAX_BUFFER_LEN;
  retCode = SCardListReadersA(hContext,
                               NULL,
                               &Buffer,
                               &BufferLen);
  if (retCode != SCARD_S_SUCCESS)  {
    DisplayOut(GetScardErrMsg(retCode),2);
 
  }
 
  btnInit->Enabled = false;
  btnConnect->Enabled = true;
 
  LoadListToControl(cbReader,&Buffer,BufferLen);
  // Look for ACR128 PICC and make it the default reader in the combobox
  for (index = 0; index < cbReader->Items->Count-1;index++) {
    cbReader->ItemIndex = index;
    if (AnsiPos("ACR122U PICC", cbReader->Text) > 0) break;
 
  }
  cbReader->ItemIndex = 0;
 
}
//---------------------------------------------------------------------------
 
void __fastcall TForm1::btnConnectClick(TObject *Sender)
{
AnsiString s= cbReader->Text;
s=PChar(s.c_str());
//Connect to reader using a shared connection
  retCode = SCardConnectA(hContext,
                           s.c_str(),
                           SCARD_SHARE_SHARED,
                           SCARD_PROTOCOL_T0 || SCARD_PROTOCOL_T1,
                           &hCard,
                           &dwActProtocol);
 
  if (retCode != SCARD_S_SUCCESS)  {
    DisplayOut(GetScardErrMsg(retCode),2);
  }
  else {
    DisplayOut("Successful connection to " + cbReader->Text, 1);
  }
 
  btnConnect->Enabled = false;
  DataGroup->Enabled = true;
  SendGroup->Enabled = true;
}
//---------------------------------------------------------------------------
 
void __fastcall TForm1::btnGetDataClick(TObject *Sender)
{
int index;
String tempstr;
  validATS = False;
 
  ClearBuffers();
  //Get Data command
  SendBuff[0] = 0xFF;                             // CLA
  SendBuff[1] = 0xCA;                             // INS
  if (check1->Checked)  {
    SendBuff[2] = 0x01;                           // P1 : ISO 14443 A Card
  }
  else {
    SendBuff[2] = 0x00;                           // P1 : Other cards
  SendBuff[3] = 0x00;                             // P2
  SendBuff[4] = 0x00;                             // Le : Full Length
 
  SendLen = SendBuff[4] + 5;
  RecvLen = 0xFF;
  }
  int mode=2;
  SendAPDU(mode);
  retCode = mode;
  if (retCode != SCARD_S_SUCCESS)
  {
    //break;
  }
 
  // Interpret and display return values
  if (validATS) {
    if (check1->Checked) {
      tempstr = "UID :";
    }
    else {
      tempstr = "ATS :";
    }
 
    for (index = 0;index<(RecvLen -3 );index++)
       tempstr = tempstr + IntToHex(SendBuff[index],2);
    DisplayOut(Trim(tempstr), 4);
  }
 
}
//---------------------------------------------------------------------------
Добавлено через 25 минут
В общем вот код поправил получилось вот так:
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
// ---------------------------------------------------------------------------
 
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
#include "ACSModule.hpp"
 
 
// ---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "sButton"
#pragma resource "*.dfm"
TForm1 *Form1;
 
  SCARDCONTEXT hContext;
  SCARDCONTEXT hCard;
 SCARD_IO_REQUEST ioRequest;
  long retCode;
  unsigned int dwActProtocol, BufferLen;
  Byte  SendBuff[262], RecvBuff[262];
  unsigned int SendLen, RecvLen, nBytesRet;
  char Buffer;
  bool validATS;
  const MAX_BUFFER_LEN    = 256;
// ---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner)
 {
}
// ---------------------------------------------------------------------------
void __fastcall TForm1::DisplayOut(String output,int mode)
{
 
  if (mode==1) rbOutput->SelAttributes->Color = clBlue;
  else if (mode==2) rbOutput->SelAttributes->Color = clRed;
  else if (mode==3)
        {
        rbOutput->SelAttributes->Color = clBlack;
        output = "<< " + output;
        }
  else if (mode==4)
        {
        rbOutput->SelAttributes->Color = clBlack;
        output = ">> " + output;
        }
 
 
  rbOutput->Lines->Add(output);
  rbOutput->SelAttributes->Color = clBlack;
  rbOutput->SetFocus();
 
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ClearBuffers()
{
 
  for (int index=0;index<262;index++)
    {
      SendBuff[index] = 0x00;
      RecvBuff[index] = 0x00;
    }
 
}
//---------------------------------------------------------------------------
void __fastcall TForm1::SendAPDU(int mode)
{
int index;
String tempstr;
  ioRequest.dwProtocol = dwActProtocol;
 ioRequest.cbPciLength = sizeof(SCARD_IO_REQUEST);
 
  tempstr = "";
  for (index = 0; index<SendLen - 1; index++)
    {
    String f="%.02X ";
       TVarRec args [262];
 
   for(int i=0; i<262;i++)
   {
       args[i]= SendBuff[i];
   }
 
   tempstr =Format("%.02x",args,262);
 
tempstr = tempstr + IntToHex(SendBuff[index],2);
 
    }
  DisplayOut(tempstr,3);
 
  retCode = SCardTransmit(hCard,
                          ioRequest,
                           SendBuff,
                           SendLen,
                           RecvBuff,
                           &RecvLen);
  if (retCode != SCARD_S_SUCCESS) {
    DisplayOut(GetScardErrMsg(retCode),2);
    SendAPDU(retCode);
 
  }
 
  tempstr = "";
 
  if (mode==1)  {
      //for (index = 0; index<RecvLen - 1;index++)
           TVarRec args [262];
 
   for(int i=0; i<262;i++)
   {
       args[i]= SendBuff[i];
   }
 
   tempstr =Format("%.02x",args,262);
 //Format("%->02X ", [RecvBuff[index]]);
      tempstr = tempstr + IntToHex(SendBuff[index],2);
 
      DisplayOut(tempstr, 4);
      }
  else if (mode==2)  {      // Interpret SW1/SW2
      // for (index = (RecvLen-2); index<(RecvLen-1);index++)
         //tempstr = tempstr + RecvBuff[index];//Format("%->02X", [(RecvBuff[index])]);
          TVarRec args [262];
 
   for(int i=0; i<262;i++)
   {
       args[i]= SendBuff[i];
   }
 
   tempstr =Format("%.02x",args,262);
 
 
       if (Trim(tempstr) == "6A81")  {
         DisplayOut("The function is not supported->",2);
         SendAPDU( retCode);
       }
       if (Trim(tempstr) == "6300")  {
         DisplayOut("The operation failed->",2);
         SendAPDU(retCode);
       }
       validATS = True;
       }
 
 
  SendAPDU(retCode);
 
}
//---------------------------------------------------------------------------
void __fastcall TForm1::TrimInput(int TrimType,String StrIn)
{
int  index;
String tmpStr;
  tmpStr = "";
  StrIn = Trim(StrIn);
 
   if   (TrimType==0) {
       for (index = 1; index<StrIn.Length();index++)
         if ((StrIn[index] != '\n') && (StrIn[index] != ' '))
           tmpStr = tmpStr + StrIn[index];
       }
    else if (TrimType==1) {
       for (index = 1; index<StrIn.Length();index++)
         if (StrIn[index] != ' ')
           tmpStr = tmpStr + StrIn[index];
       }
 
  //TrimInput(tmpStr);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Initialize()
{
 
  btnInit->Enabled = true;
  btnConnect->Enabled = false;
  DataGroup->Enabled = false;
  SendGroup->Enabled = false;
  cbReader->Text = "";
  check1->Checked = false;
  tbCLA->Text = "";
  tbINS->Text = "";
  tbP1->Text = "";
  tbP2->Text = "";
  tbLc->Text = "";
  tbLe->Text = "";
  tbData->Text = "";
  rbOutput->Text = "";
  DisplayOut("Program ready", 1);
 
}
//---------------------------------------------------------------------------
void __fastcall TForm1::btnInitClick(TObject *Sender)
{
int index;
  retCode = SCardEstablishContext(SCARD_SCOPE_USER,
                                   NULL,
                                   NULL,
                                   &hContext);
  if (retCode != SCARD_S_SUCCESS) {
    DisplayOut(GetScardErrMsg(retCode),2);
 
  } ;
 
  //List PC/SC readers installed in the system
  BufferLen = MAX_BUFFER_LEN;
  retCode = SCardListReadersA(hContext,
                               NULL,
                               &Buffer,
                               &BufferLen);
  if (retCode != SCARD_S_SUCCESS)  {
    DisplayOut(GetScardErrMsg(retCode),2);
 
  }
 
  btnInit->Enabled = false;
  btnConnect->Enabled = true;
 
  LoadListToControl(cbReader,&Buffer,BufferLen);
  // Look for ACR128 PICC and make it the default reader in the combobox
  for (index = 0; index < cbReader->Items->Count-1;index++) {
    cbReader->ItemIndex = index;
    if (AnsiPos("ACR122U PICC", cbReader->Text) > 0) break;
 
  }
  cbReader->ItemIndex = 0;
 
}
//---------------------------------------------------------------------------
 
void __fastcall TForm1::btnConnectClick(TObject *Sender)
{
AnsiString s= cbReader->Text;
s=PChar(s.c_str());
//Connect to reader using a shared connection
  retCode = SCardConnectA(hContext,
                           s.c_str(),
                           SCARD_SHARE_SHARED,
                           SCARD_PROTOCOL_T0 || SCARD_PROTOCOL_T1,
                           &hCard,
                           &dwActProtocol);
 
  if (retCode != SCARD_S_SUCCESS)  {
    DisplayOut(GetScardErrMsg(retCode),2);
  }
  else {
    DisplayOut("Successful connection to " + cbReader->Text, 1);
  }
 
  btnConnect->Enabled = false;
  DataGroup->Enabled = true;
  SendGroup->Enabled = true;
}
//---------------------------------------------------------------------------
 
void __fastcall TForm1::btnGetDataClick(TObject *Sender)
{
int index;
String tempstr;
  validATS = False;
 
  ClearBuffers();
  //Get Data command
  SendBuff[0] = 0xFF;                             // CLA
  SendBuff[1] = 0xCA;                             // INS
  if (check1->Checked)  {
    SendBuff[2] = 0x01;                           // P1 : ISO 14443 A Card
  }
  else {
    SendBuff[2] = 0x00;                           // P1 : Other cards
  SendBuff[3] = 0x00;                             // P2
  SendBuff[4] = 0x00;                             // Le : Full Length
 
  SendLen = SendBuff[4] + 5;
  RecvLen = 0xFF;
  }
  int mode=2;
  SendAPDU(mode);
  retCode = mode;
  if (retCode != SCARD_S_SUCCESS)
  {
    //break;
  }
 
  // Interpret and display return values
  if (validATS) {
    if (check1->Checked) {
      tempstr = "UID :";
    }
    else {
      tempstr = "ATS :";
    }
 
    for (index = 0;index<(RecvLen -3 );index++)
       tempstr = tempstr + IntToHex(SendBuff[index],2);
    DisplayOut(Trim(tempstr), 4);
  }
 
}
//---------------------------------------------------------------------------
, но получились ошибки
C++
1
2
3
4
5
6
7
[ilink32 Error] Error: Unresolved external 'SCardTransmit' referenced from C:\USERS\DRSMERTB.DRSMERTB-PC\DESKTOP\TEST\WIN32\DEBUG\UNIT1.OBJ
[ilink32 Error] Error: Unresolved external '__fastcall Acsmodule::GetScardErrMsg(unsigned int)' referenced from C:\USERS\DRSMERTB.DRSMERTB-PC\DESKTOP\TEST\WIN32\DEBUG\UNIT1.OBJ
[ilink32 Error] Error: Unresolved external 'SCardEstablishContext' referenced from C:\USERS\DRSMERTB.DRSMERTB-PC\DESKTOP\TEST\WIN32\DEBUG\UNIT1.OBJ
[ilink32 Error] Error: Unresolved external 'SCardListReadersA' referenced from C:\USERS\DRSMERTB.DRSMERTB-PC\DESKTOP\TEST\WIN32\DEBUG\UNIT1.OBJ
[ilink32 Error] Error: Unresolved external '__fastcall Acsmodule::LoadListToControl(Vcl::Stdctrls::TComboBox *&, char *, int)' referenced from C:\USERS\DRSMERTB.DRSMERTB-PC\DESKTOP\TEST\WIN32\DEBUG\UNIT1.OBJ
[ilink32 Error] Error: Unresolved external 'SCardConnectA' referenced from C:\USERS\DRSMERTB.DRSMERTB-PC\DESKTOP\TEST\WIN32\DEBUG\UNIT1.OBJ
[ilink32 Error] Error: Unable to perform link
, что теперь делать? Что ему не нравится?
0
Марсианин)))
713 / 46 / 15
Регистрация: 18.07.2010
Сообщений: 637
25.04.2014, 18:08
Цитата Сообщение от DrSMERTb Посмотреть сообщение
[ilink32 Error] Error: Unresolved external 'SCardEstablishContext'
функции не доступны из длл.

C++
1
2
#pragma comment(lib, "Имя подключаемой либы");
//могу ошибаться вроде эта #pragma comment(lib, "Winscard.lib");
0
 Аватар для DrSMERTb
64 / 40 / 10
Регистрация: 12.11.2010
Сообщений: 841
25.04.2014, 18:10  [ТС]
подрубил библиотеку:
C++
1
#pragma comment(lib, "Winscard.lib");
ошибки:
C++
1
2
[ilink32 Error] Error: Unresolved external '__fastcall Acsmodule::GetScardErrMsg(unsigned int)' referenced from C:\USERS\DRSMERTB.DRSMERTB-PC\DESKTOP\TEST\WIN32\DEBUG\UNIT1.OBJ
[ilink32 Error] Error: Unresolved external '__fastcall Acsmodule::LoadListToControl(Vcl::Stdctrls::TComboBox *&, char *, int)' referenced from C:\USERS\DRSMERTB.DRSMERTB-PC\DESKTOP\TEST\WIN32\DEBUG\UNIT1.OBJ
0
Марсианин)))
713 / 46 / 15
Регистрация: 18.07.2010
Сообщений: 637
25.04.2014, 18:18
C++
1
#include "ACSModule.hpp"
какое содержимое.
0
 Аватар для DrSMERTb
64 / 40 / 10
Регистрация: 12.11.2010
Сообщений: 841
25.04.2014, 18:19  [ТС]
тут эти функции обе есть:
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
// Borland C++ Builder
// Copyright (c) 1995, 2002 by Borland Software Corporation
// All rights reserved
 
// (DO NOT EDIT: machine generated header) 'ACSModule.pas' rev: 6.00
 
#ifndef ACSModuleHPP
#define ACSModuleHPP
 
#pragma delphiheader begin
#pragma option push -w-
#pragma option push -Vx
#include <Menus.hpp>    // Pascal unit
#include <SysUtils.hpp> // Pascal unit
#include <StdCtrls.hpp> // Pascal unit
#include <Classes.hpp>  // Pascal unit
#include <Windows.hpp>  // Pascal unit
#include <SysInit.hpp>  // Pascal unit
#include <System.hpp>   // Pascal unit
 
//-- user supplied -----------------------------------------------------------
 
namespace Acsmodule
{
//-- type declarations -------------------------------------------------------
typedef int LONG;
 
typedef unsigned SCARDCONTEXT;
 
typedef unsigned SCARDHANDLE;
 
typedef unsigned *PSCARDCONTEXT;
 
typedef unsigned *LPSCARDCONTEXT;
 
typedef unsigned *PSCARDHANDLE;
 
typedef unsigned *LPSCARDHANDLE;
 
typedef unsigned *LPDWORD;
 
typedef void *LPCVOID;
 
typedef Byte *LPBYTE;
 
typedef bool *LPBOOL;
 
#pragma pack(push, 4)
struct SCARD_IO_REQUEST
{
    unsigned dwProtocol;
    unsigned cbPciLength;
} ;
#pragma pack(pop)
 
typedef SCARD_IO_REQUEST *PSCARD_IO_REQUEST;
 
typedef SCARD_IO_REQUEST *LPSCARD_IO_REQUEST;
 
typedef SCARD_IO_REQUEST *LPCSCARD_IO_REQUEST;
 
 
typedef void * *LPVOID;
 
#pragma pack(push, 4)
struct SCARD_READERSTATE
{
    char *szReader;
    void * *pvUserData;
    unsigned dwCurrentState;
    unsigned dwEventStates;
    unsigned cbATR;
    Byte rgbATR[36];
} ;
#pragma pack(pop)
 
typedef SCARD_READERSTATE *LPSCARD_READERSTATE;
 
#pragma pack(push, 1)
struct TAPDUCommand
{
    Byte CLA;
    Byte INS;
    Byte P1;
    Byte P2;
    Byte P3;
    Byte DataIn[256];
    Byte DataOut[256];
    Byte Status[2];
} ;
#pragma pack(pop)
 
//-- var, const, procedure ---------------------------------------------------
static const Shortint SCARD_ATR_LENGTH = 0x21;
//static const Shortint SCARD_S_SUCCESS = 0x0;
static const Shortint CT_MCU = 0x0;
static const Shortint CT_IIC_Auto = 0x1;
static const Shortint CT_IIC_1K = 0x2;
static const Shortint CT_IIC_2K = 0x3;
static const Shortint CT_IIC_4K = 0x4;
static const Shortint CT_IIC_8K = 0x5;
static const Shortint CT_IIC_16K = 0x6;
static const Shortint CT_IIC_32K = 0x7;
static const Shortint CT_IIC_64K = 0x8;
static const Shortint CT_IIC_128K = 0x9;
static const Shortint CT_IIC_256K = 0xa;
static const Shortint CT_IIC_512K = 0xb;
static const Shortint CT_IIC_1024K = 0xc;
static const Shortint CT_AT88SC153 = 0xd;
static const Shortint CT_AT88SC1608 = 0xe;
static const Shortint CT_SLE4418 = 0xf;
static const Shortint CT_SLE4428 = 0x10;
static const Shortint CT_SLE4432 = 0x11;
static const Shortint CT_SLE4442 = 0x12;
static const Shortint CT_SLE4406 = 0x13;
static const Shortint CT_SLE4436 = 0x14;
static const Shortint CT_SLE5536 = 0x15;
static const Shortint CT_MCUT0 = 0x16;
static const Shortint CT_MCUT1 = 0x17;
static const Shortint CT_MCU_Auto = 0x18;
//static const unsigned SCARD_F_INTERNAL_ERROR = 0x80100001;
/*static const unsigned SCARD_E_CANCELLED = 0x80100002;
static const unsigned SCARD_E_INVALID_HANDLE = 0x80100003;
static const unsigned SCARD_E_INVALID_PARAMETER = 0x80100004;
static const unsigned SCARD_E_INVALID_TARGET = 0x80100005;
static const unsigned SCARD_E_NO_MEMORY = 0x80100006;
static const unsigned SCARD_F_WAITED_TOO_LONG = 0x80100007;
static const unsigned SCARD_E_INSUFFICIENT_BUFFER = 0x80100008;
static const unsigned SCARD_E_UNKNOWN_READER = 0x80100009;
static const unsigned SCARD_E_TIMEOUT = 0x8010000a;
static const unsigned SCARD_E_SHARING_VIOLATION = 0x8010000b;
static const unsigned SCARD_E_NO_SMARTCARD = 0x8010000c;
static const unsigned SCARD_E_UNKNOWN_CARD = 0x8010000d;
static const unsigned SCARD_E_CANT_DISPOSE = 0x8010000e;
static const unsigned SCARD_E_PROTO_MISMATCH = 0x8010000f;
static const unsigned SCARD_E_NOT_READY = 0x80100010;
static const unsigned SCARD_E_INVALID_VALUE = 0x80100011;
static const unsigned SCARD_E_SYSTEM_CANCELLED = 0x80100012;
static const unsigned SCARD_F_COMM_ERROR = 0x80100013;
static const unsigned SCARD_F_UNKNOWN_ERROR = 0x80100014;
static const unsigned SCARD_E_INVALID_ATR = 0x80100015;
static const unsigned SCARD_E_NOT_TRANSACTED = 0x80100016;
static const unsigned SCARD_E_READER_UNAVAILABLE = 0x80100017;
static const unsigned SCARD_P_SHUTDOWN = 0x80100018;
static const unsigned SCARD_E_PCI_TOO_SMALL = 0x80100019;
static const unsigned SCARD_E_READER_UNSUPPORTED = 0x8010001a;
static const unsigned SCARD_E_DUPLICATE_READER = 0x8010001b;
static const unsigned SCARD_E_CARD_UNSUPPORTED = 0x8010001c;
static const unsigned SCARD_E_NO_SERVICE = 0x8010001d;
static const unsigned SCARD_E_SERVICE_STOPPED = 0x8010001e;
static const unsigned SCARD_W_UNSUPPORTED_CARD = 0x80100065;
static const unsigned SCARD_W_UNRESPONSIVE_CARD = 0x80100066;
static const unsigned SCARD_W_UNPOWERED_CARD = 0x80100067;
static const unsigned SCARD_W_RESET_CARD = 0x80100068;
static const unsigned SCARD_W_REMOVED_CARD = 0x80100069;
 
static const Shortint SCARD_SCOPE_TERMINAL = 0x1;
static const Shortint SCARD_SCOPE_SYSTEM = 0x2;
static const Shortint SCARD_UNKNOWN = 0x0;
static const Shortint SCARD_ABSENT = 0x1;
static const Shortint SCARD_PRESENT = 0x2;
static const Shortint SCARD_SWALLOWED = 0x3;
static const Shortint SCARD_POWERED = 0x4;
static const Shortint SCARD_NEGOTIABLE = 0x5;
static const Shortint SCARD_SPECIFIC = 0x6;
static const Shortint SCARD_SHARE_EXCLUSIVE = 0x1;
 
static const Shortint SCARD_SHARE_DIRECT = 0x3;
static const Shortint SCARD_LEAVE_CARD = 0x0;
static const Shortint SCARD_RESET_CARD = 0x1;
static const Shortint SCARD_UNPOWER_CARD = 0x2;
static const Shortint SCARD_EJECT_CARD = 0x3;
static const Shortint SCARD_PROTOCOL_UNDEFINED = 0x0;
 
static const int SCARD_PROTOCOL_RAW = 0x10000;
static const unsigned SCARD_PROTOCOL_DEFAULT = 0x80000000;
static const Shortint SCARD_STATE_UNAWARE = 0x0;
static const Shortint SCARD_STATE_IGNORE = 0x1;
static const Shortint SCARD_STATE_CHANGED = 0x2;
static const Shortint SCARD_STATE_UNKNOWN = 0x4;
static const Shortint SCARD_STATE_UNAVAILABLE = 0x8;
static const Shortint SCARD_STATE_EMPTY = 0x10;
static const Shortint SCARD_STATE_PRESENT = 0x20;
static const Shortint SCARD_STATE_ATRMATCH = 0x40;
static const Byte SCARD_STATE_EXCLUSIVE = 0x80;
static const Word SCARD_STATE_INUSE = 0x100;
static const Word SCARD_STATE_MUTE = 0x200;
static const Word SCARD_STATE_UNPOWERED = 0x400;
static const int IOCTL_SMARTCARD_DIRECT = 0x312008;
static const int IOCTL_SMARTCARD_SELECT_SLOT = 0x31200c;
static const int IOCTL_SMARTCARD_DRAW_LCDBMP = 0x312010;
static const int IOCTL_SMARTCARD_DISPLAY_LCD = 0x312014;
static const int IOCTL_SMARTCARD_CLR_LCD = 0x312018;
static const int IOCTL_SMARTCARD_READ_KEYPAD = 0x31201c;
static const int IOCTL_SMARTCARD_READ_RTC = 0x312024;
static const int IOCTL_SMARTCARD_SET_RTC = 0x312028;
static const int IOCTL_SMARTCARD_SET_OPTION = 0x31202c;
static const int IOCTL_SMARTCARD_SET_LED = 0x312030;
static const int IOCTL_SMARTCARD_LOAD_KEY = 0x312038;
static const int IOCTL_SMARTCARD_READ_EEPROM = 0x312044;
static const int IOCTL_SMARTCARD_WRITE_EEPROM = 0x312048;
static const int IOCTL_SMARTCARD_GET_VERSION = 0x31204c;
static const int IOCTL_SMARTCARD_GET_READER_INFO = 0x31200c;
static const int IOCTL_SMARTCARD_SET_CARD_TYPE = 0x312030;
static const int IOCTL_SMARTCARD_GET_SERNUM = 0x31205c;
static const int IOCTL_SMARTCARD_SET_CARDVOLTAGE = 0x312068;
static const int IOCTL_SMARTCARD_ACR128_ESCAPE_COMMAND = 0x31207c;  */
static const Shortint SCARD_SCOPE_USER = 0x0;
static const Shortint SCARD_SHARE_SHARED = 0x2;
static const Shortint SCARD_PROTOCOL_T0 = 0x1;
static const Shortint SCARD_PROTOCOL_T1 = 0x2;
extern "C" int __stdcall SCardEstablishContext(unsigned dwscope, void * pvReserved1, void * pvReserved2, LPSCARDCONTEXT phContext);
extern "C" int __stdcall SCardReleaseContext(unsigned hContext);
extern "C" int __stdcall SCardListReadersA(unsigned hContext, char * mszGroups, char * szReaders, LPDWORD pcchReaders);
extern "C" int __stdcall SCardConnectA(unsigned hContext, char * szReaders, unsigned dwShareMode, unsigned dwPreferredProtocols, LPSCARDHANDLE phCard, LPDWORD pdwActiveProtocols);
extern "C" int __stdcall SCardReconnect(unsigned hCard, unsigned dwShareMode, unsigned dwPreferredProtocols, unsigned dwInitialization, LPDWORD pdwActiveProtocols);
extern "C" int __stdcall SCardDisconnect(unsigned hCard, unsigned dwDisposition);
extern "C" int __stdcall SCardBeginTransaction(unsigned hCard);
extern "C" int __stdcall SCardEndTransaction(unsigned hCard, unsigned dwDisposition);
extern "C" int __stdcall SCardState(unsigned hCard, LPDWORD pdwState, LPDWORD pdwProtocol, System::PByte pbATR, LPDWORD pcbAtrLen);
extern "C" int __stdcall SCardGetStatusChangeA(unsigned hContext, unsigned dwTimeout, LPSCARD_READERSTATE rgReaderStates, unsigned cReaders);
extern "C" int __stdcall SCardStatusA(unsigned hCard, char * mszReaderNames, LPDWORD pcchReaderLen, LPDWORD pdwState, LPDWORD pdwProtocol, System::PByte pbATR, LPDWORD pcbAtrLen);
extern "C" int __stdcall SCardTransmit(unsigned hCard, SCARD_IO_REQUEST pioSendPci, System::PByte pbSendBuffer, unsigned cbSendLength, System::PByte pbRecvBuffer, LPDWORD pcbRecvLength);
extern "C" int __stdcall SCardControl(unsigned hCard, unsigned dwControlCode, System::PByte lpInBuffer, unsigned nInBufferSize, System::PByte lpOutBuffer, unsigned nOutBufferSize, LPDWORD lpBytesReturned);
extern "C" int __stdcall ShellExecuteA(unsigned handle, AnsiString lpOperation, AnsiString lpTargetFile, AnsiString lpParam, AnsiString lpDirectory, int ShowMode);
extern PACKAGE void __fastcall ParseReaderList(Classes::TStringList* &List, char * Buffer, int BuffLen);
extern PACKAGE void __fastcall LoadListToControl(Stdctrls::TComboBox* &ComboBoxControl, char * Buffer, int BuffLen);
extern PACKAGE void __fastcall LoadListToMenu(Menus::TMenuItem* &MenuItemControl, char * Buffer, int BuffLen);
extern PACKAGE AnsiString __fastcall GetScardErrMsg(unsigned ErrCode);
extern PACKAGE AnsiString __fastcall GetShareModeStrMsg(unsigned Code);
extern PACKAGE AnsiString __fastcall GetReaderStateStrMsg(unsigned Code);
extern PACKAGE AnsiString __fastcall GetDisposistionStrMsg(unsigned Code);
extern PACKAGE AnsiString __fastcall GetProtocolStrMsg(unsigned Code);
extern PACKAGE AnsiString __fastcall GetProtocolFlagStrMsg(unsigned Code);
 
}   /* namespace Acsmodule */
using namespace Acsmodule;
#pragma option pop  // -w-
#pragma option pop  // -Vx
 
#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif  // ACSModule
0
Марсианин)))
713 / 46 / 15
Регистрация: 18.07.2010
Сообщений: 637
25.04.2014, 18:29
где реализация этой функции.
C++
1
Function GetScardErrMsg(ErrCode : DWORD):string;
В этом же файле реализуй функцию
Delphi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Function GetScardErrMsg(ErrCode : DWORD):string;
begin
    Case ErrCode of
      SCARD_F_INTERNAL_ERROR       : GetScardErrMsg := 'An internal consistency check failed.';
      SCARD_E_CANCELLED            : GetScardErrMsg := 'The action was cancelled by an SCardCancel request.';
      SCARD_E_INVALID_HANDLE       : GetScardErrMsg := 'The supplied handle was invalid.';
      SCARD_E_INVALID_PARAMETER    : GetScardErrMsg := 'One or more of the supplied parameters could not be properly interpreted.';
      SCARD_E_INVALID_TARGET       : GetScardErrMsg := 'Registry startup information is missing or invalid.';
      SCARD_E_NO_MEMORY            : GetScardErrMsg := 'Not enough memory available to complete this command.';
      SCARD_F_WAITED_TOO_LONG      : GetScardErrMsg := 'An internal consistency timer has expired.';
      SCARD_E_INSUFFICIENT_BUFFER  : GetScardErrMsg := 'The data buffer to receive returned data is too small for the returned data.';
      SCARD_E_UNKNOWN_READER       : GetScardErrMsg := 'The specified reader name is not recognized.';
      SCARD_E_TIMEOUT              : GetScardErrMsg := 'The user-specified timeout value has expired.';
      SCARD_E_SHARING_VIOLATION    : GetScardErrMsg := 'The smart card cannot be accessed because of other connections outstanding.';
      SCARD_E_NO_SMARTCARD         : GetScardErrMsg := 'The operation requires a Smart Card, but no Smart Card is currently in the device.';
      SCARD_E_UNKNOWN_CARD         : GetScardErrMsg := 'The specified smart card name is not recognized.';
      SCARD_E_CANT_DISPOSE         : GetScardErrMsg := 'The system could not dispose of the media in the requested manner.';
      SCARD_E_PROTO_MISMATCH       : GetScardErrMsg := 'The requested protocols are incompatible with the protocol currently in use with the smart card.';
      SCARD_E_NOT_READY            : GetScardErrMsg := 'The reader or smart card is not ready to accept commands.';
      SCARD_E_INVALID_VALUE        : GetScardErrMsg := 'One or more of the supplied parameters values could not be properly interpreted.';
      SCARD_E_SYSTEM_CANCELLED     : GetScardErrMsg := 'The action was cancelled by the system, presumably to log off or shut down.';
      SCARD_F_COMM_ERROR           : GetScardErrMsg := 'An internal communications error has been detected.';
      SCARD_F_UNKNOWN_ERROR        : GetScardErrMsg := 'An internal error has been detected, but the source is unknown.';
      SCARD_E_INVALID_ATR          : GetScardErrMsg := 'An ATR obtained from the registry is not a valid ATR string.';
      SCARD_E_NOT_TRANSACTED       : GetScardErrMsg := 'An attempt was made to end a non-existent transaction.';
      SCARD_E_READER_UNAVAILABLE   : GetScardErrMsg := 'The specified reader is not currently available for use.';
      SCARD_P_SHUTDOWN             : GetScardErrMsg := 'PRIVATE -- Internal flag to force server termination.';
      SCARD_E_PCI_TOO_SMALL        : GetScardErrMsg := 'The PCI Receive buffer was too small.';
      SCARD_E_READER_UNSUPPORTED   : GetScardErrMsg := 'The reader driver does not meet minimal requirements for support.';
      SCARD_E_DUPLICATE_READER     : GetScardErrMsg := 'The reader driver did not produce a unique reader name.';
      SCARD_E_CARD_UNSUPPORTED     : GetScardErrMsg := 'The smart card does not meet minimal requirements for support.';
      SCARD_E_NO_SERVICE           : GetScardErrMsg := 'The Smart card resource manager is not running.';
      SCARD_E_SERVICE_STOPPED      : GetScardErrMsg := 'The Smart card resource manager has shut down.';
      SCARD_W_UNSUPPORTED_CARD     : GetScardErrMsg := 'The reader cannot communicate with the smart card, due to ATR configuration conflicts.';
      SCARD_W_UNRESPONSIVE_CARD    : GetScardErrMsg := 'The smart card is not responding to a reset.';
      SCARD_W_UNPOWERED_CARD       : GetScardErrMsg := 'Power has been removed from the smart card, so that further communication is not possible.';
      SCARD_W_RESET_CARD           : GetScardErrMsg := 'The smart card has been reset, so any shared state information is invalid.';
      SCARD_W_REMOVED_CARD         : GetScardErrMsg := 'The smart card has been removed, so that further communication is not possible.';
    else
      GetScardErrMsg := 'Unknown Error: ' + Format('%d', [ErrCode]);
    end; // case statement
end;
0
 Аватар для DrSMERTb
64 / 40 / 10
Регистрация: 12.11.2010
Сообщений: 841
25.04.2014, 18:36  [ТС]
Xank, вот pas файл из которого этот hpp получен:
Pascal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
///////////////////////////////////////////////////////////////////////////////
//
// COMPANY : ADVANDCED CARD SYSTEMS, LTD
//
// AUTHOR : ALCENDOR LORZANO CHAN
//
// DATE :  09 / 04 / 2001
//
// Delphi implementation of winscard.h
//
// Warning : For those using UNICODE characters. Those API's in
//           the "DECLARE" statement that end with SCARDxxxxA, you
//           must change it to SCARDxxxW. e.g SCardListReadersA() to
//           SCardListReadersW(). This is to differetiate Unicode ("W")
//           from non-Unicode API's ("A"). Look at Winscard.h for details
// Revision Trail: (Date/Author/Description)
// 1. (14 April 2003/J.I.R.Mission/Added SCardControl function, and
//           SCardControl constants)
// 2. (28 July 2003/J.I.R.Mission/Added LoadListToMenu function, and
//           APDU Command type structure)
// 3. (25 January 2004/J.I.R.Mission/Added ACR90 functions, constants,
//           and type structure)
// 4. (27 April 2004/J.I.R.Mission/Renamed file to ACSModule and added
//           ShellExecuteA function)
// 5. (08 June 2004)/J.I.R.Mission/Added IOCTL_SMARTCARD_GET_READER_INFO
//            and IOCTL_SMARTCARD_SET_CARD_TYPE constants for ACR30/38
// 6. (15 August 2005)/J.I.R.Mission/Removed ACR90 functions, constants,
//            and type structures
// 7. (15 August 2005/J.I.R.Mission/Added memory card type constants
// 8. (01 June 2006/J.I.R.Mission/IOCTL_SMARTCARD_GET_SERNUM
//             and IOCTL_SMARTCARD_SET_CARDVOLTAGE constants for ACR38
//             Input data: AUTO = 0, 5V = 1, 3V = 2, 1.8V = 3
// 9. (02 May 2008/J.I.R.Mission/Added IOCTL_SMARTCARD_ACR128_ESCAPE_COMMAND
//             constant for ACR128
///////////////////////////////////////////////////////////////////////////////
 
unit ACSModule;
 
interface
uses Windows,classes,StdCtrls, SysUtils, Menus;
 
 
Const SCARD_ATR_LENGTH = 33;  // ISO 7816-3 spec.
Const SCARD_S_SUCCESS = 0;
 
Type  LONG = LongInt;
      SCARDCONTEXT = ULONG;
      SCARDHANDLE = ULONG;
      PSCARDCONTEXT = ^SCARDCONTEXT;
      LPSCARDCONTEXT = ^SCARDCONTEXT;
 
      PSCARDHANDLE = ^SCARDHANDLE;
      LPSCARDHANDLE = ^SCARDHANDLE;
 
      LPDWORD = ^DWORD;
      LPCVOID = Pointer;
      LPBYTE = PByte;
      LPBOOL = ^Boolean;
 
 
type  SCARD_IO_REQUEST = Record
        dwProtocol :DWORD;   // Protocol identifier
        cbPciLength :DWORD;  // Protocol Control Information Length
      end;
      PSCARD_IO_REQUEST = ^SCARD_IO_REQUEST;
      LPSCARD_IO_REQUEST = ^SCARD_IO_REQUEST;
      LPCSCARD_IO_REQUEST = ^SCARD_IO_REQUEST;
 
      LPVOID = ^POINTER;
 
type  SCARD_READERSTATE = record
      szReader :LPCTSTR;
      pvUserData : LPVOID;
      dwCurrentState :DWORD;
      dwEventStates :DWORD;
      cbATR :DWORD;
      rgbATR :array[1..36] of BYTE;
end;
      LPSCARD_READERSTATE = ^SCARD_READERSTATE;
 
Type  TAPDUCommand = record
      CLA: Byte;
      INS: Byte;
      P1: Byte;
      P2: Byte;
      P3: Byte;
      DataIn: array [0..255] of Byte;
      DataOut: array [0..255] of Byte;
      Status: array [0..1] of Byte;
end;
 
///////////////////////////////////////////////////////////////////////////////
//  Memory Card type constants
///////////////////////////////////////////////////////////////////////////////
Const  CT_MCU          = $00;          // MCU
Const  CT_IIC_Auto     = $01;          // IIC (Auto Detect Memory Size)
Const  CT_IIC_1K       = $02;          // IIC (1K)
Const  CT_IIC_2K       = $03;          // IIC (2K)
Const  CT_IIC_4K       = $04;          // IIC (4K)
Const  CT_IIC_8K       = $05;          // IIC (8K)
Const  CT_IIC_16K      = $06;          // IIC (16K)
Const  CT_IIC_32K      = $07;          // IIC (32K)
Const  CT_IIC_64K      = $08;          // IIC (64K)
Const  CT_IIC_128K     = $09;          // IIC (128K)
Const  CT_IIC_256K     = $0A;          // IIC (256K)
Const  CT_IIC_512K     = $0B;          // IIC (512K)
Const  CT_IIC_1024K    = $0C;          // IIC (1024K)
Const  CT_AT88SC153    = $0D;          // AT88SC153
Const  CT_AT88SC1608   = $0E;          // AT88SC1608
Const  CT_SLE4418      = $0F;          // SLE4418
Const  CT_SLE4428      = $10;          // SLE4428
Const  CT_SLE4432      = $11;          // SLE4432
Const  CT_SLE4442      = $12;          // SLE4442
Const  CT_SLE4406      = $13;          // SLE4406
Const  CT_SLE4436      = $14;          // SLE4436
Const  CT_SLE5536      = $15;          // SLE5536
Const  CT_MCUT0        = $16;          // MCU T=0
Const  CT_MCUT1        = $17;          // MCU T=1
Const  CT_MCU_Auto     = $18;          // MCU Autodetect
 
///////////////////////////////////////////////////////////////////////////////
//  Error Messages
///////////////////////////////////////////////////////////////////////////////
Const SCARD_F_INTERNAL_ERROR           = $80100001; //  An internal consistency check failed
Const SCARD_E_CANCELLED                = $80100002; //  The action was cancelled by an SCardCancel request
Const SCARD_E_INVALID_HANDLE           = $80100003; //  The supplied handle was invalid
Const SCARD_E_INVALID_PARAMETER        = $80100004; //  One or more of the supplied parameters could not be properly interpreted
Const SCARD_E_INVALID_TARGET           = $80100005; //  Registry startup information is missing or invalid
Const SCARD_E_NO_MEMORY                = $80100006; //  Not enough memory available to complete this command
Const SCARD_F_WAITED_TOO_LONG          = $80100007; //  An internal consistency timer has expired
Const SCARD_E_INSUFFICIENT_BUFFER      = $80100008; //  The data buffer to receive returned data is too small for the returned data
Const SCARD_E_UNKNOWN_READER           = $80100009; //  The specified reader name is not recognized
Const SCARD_E_TIMEOUT                  = $8010000A; //  The user-specified timeout value has expired
Const SCARD_E_SHARING_VIOLATION        = $8010000B; //  The smart card cannot be accessed because of other connections outstanding
Const SCARD_E_NO_SMARTCARD             = $8010000C; //  The operation requires a Smart Card, but no Smart Card is currently in the device
Const SCARD_E_UNKNOWN_CARD             = $8010000D; //  The specified smart card name is not recognized
Const SCARD_E_CANT_DISPOSE             = $8010000E; //  The system could not dispose of the media in the requested manner
Const SCARD_E_PROTO_MISMATCH           = $8010000F; //  The requested protocols are incompatible with the protocol currently in use with the smart card
Const SCARD_E_NOT_READY                = $80100010; //  The reader or smart card is not ready to accept commands
Const SCARD_E_INVALID_VALUE            = $80100011; //  One or more of the supplied parameters values could not be properly interpreted
Const SCARD_E_SYSTEM_CANCELLED         = $80100012; //  The action was cancelled by the system, presumably to log off or shut down
Const SCARD_F_COMM_ERROR               = $80100013; //  An internal communications error has been detected
Const SCARD_F_UNKNOWN_ERROR            = $80100014; //  An internal error has been detected, but the source is unknown
Const SCARD_E_INVALID_ATR              = $80100015; //  An ATR obtained from the registry is not a valid ATR string
Const SCARD_E_NOT_TRANSACTED           = $80100016; //  An attempt was made to end a non-existent transaction
Const SCARD_E_READER_UNAVAILABLE       = $80100017; //  The specified reader is not currently available for use
Const SCARD_P_SHUTDOWN                 = $80100018; //  PRIVATE -- Internal flag to force server termination
Const SCARD_E_PCI_TOO_SMALL            = $80100019; //  The PCI Receive buffer was too small
Const SCARD_E_READER_UNSUPPORTED       = $8010001A; //  The reader driver does not meet minimal requirements for support
Const SCARD_E_DUPLICATE_READER         = $8010001B; //  The reader driver did not produce a unique reader name
Const SCARD_E_CARD_UNSUPPORTED         = $8010001C; //  The smart card does not meet minimal requirements for support
Const SCARD_E_NO_SERVICE               = $8010001D; //  The Smart card resource manager is not running
Const SCARD_E_SERVICE_STOPPED          = $8010001E; //  The Smart card resource manager has shut down
Const SCARD_W_UNSUPPORTED_CARD         = $80100065; //  The reader cannot communicate with the smart card, due to ATR configuration conflicts
Const SCARD_W_UNRESPONSIVE_CARD        = $80100066; //  The smart card is not responding to a reset
Const SCARD_W_UNPOWERED_CARD           = $80100067; //  Power has been removed from the smart card, so that further communication is not possible
Const SCARD_W_RESET_CARD               = $80100068; //  The smart card has been reset, so any shared state information is invalid
Const SCARD_W_REMOVED_CARD             = $80100069; //  The smart card has been removed, so that further communication is not possible
 
///////////////////////////////////////////////////////////////////////////////
//      SHARE MODES
///////////////////////////////////////////////////////////////////////////////
Const SCARD_SCOPE_USER     =0;  // The context is a user context, and any
                                // database operations are performed within the
                                // domain of the user.
Const SCARD_SCOPE_TERMINAL =1;  // The context is that of the current terminal,
                                // and any database operations are performed
                                // within the domain of that terminal.  (The
                                // calling application must have appropriate
                                // access permissions for any database actions.)
Const SCARD_SCOPE_SYSTEM   =2;  // The context is the system context, and any
                                // database operations are performed within the
                                // domain of the system.  (The calling
                                // application must have appropriate access
                                // permissions for any database actions.)
 
 
///////////////////////////////////////////////////////////////////////////////
// Reader States
///////////////////////////////////////////////////////////////////////////////
Const  SCARD_UNKNOWN     =0;   // This value implies the driver is unaware
                              // of the current state of the reader.
Const  SCARD_ABSENT      =1;   // This value implies there is no card in
                              // the reader.
Const  SCARD_PRESENT     =2;   // This value implies there is a card is
                              // present in the reader, but that it has
                              // not been moved into position for use.
Const  SCARD_SWALLOWED   =3;   // This value implies there is a card in the
                              // reader in position for use.  The card is
                              // not powered.
Const  SCARD_POWERED     =4;   // This value implies there is power is
                              // being provided to the card, but the
                              // Reader Driver is unaware of the mode of
                              // the card.
Const SCARD_NEGOTIABLE  =5;   // This value implies the card has been
                              // reset and is awaiting PTS negotiation.
Const SCARD_SPECIFIC    =6;   // This value implies the card has been
                              // reset and specific communication
                              // protocols have been established.
 
///////////////////////////////////////////////////////////////////////////////
//  Card/Reader Access Services
///////////////////////////////////////////////////////////////////////////////
Const SCARD_SHARE_EXCLUSIVE =1; // This application is not willing to share this
                                // card with other applications.
Const SCARD_SHARE_SHARED    =2; // This application is willing to share this
                                // card with other applications.
Const SCARD_SHARE_DIRECT    =3; // This application demands direct control of
                                // the reader, so it is not available to other
                                // applications.
 
///////////////////////////////////////////////////////////////////////////////
//  Card Disposition
///////////////////////////////////////////////////////////////////////////////
Const SCARD_LEAVE_CARD     = 0; // Don't do anything special on close
Const SCARD_RESET_CARD     = 1; // Reset the card on close
Const SCARD_UNPOWER_CARD   = 2; // Power down the card on close
Const SCARD_EJECT_CARD     = 3; // Eject the card on close
 
///////////////////////////////////////////////////////////////////////////////
//  Protocol Flag definitions
///////////////////////////////////////////////////////////////////////////////
Const SCARD_PROTOCOL_UNDEFINED    =$00000000;  // There is no active protocol.
Const SCARD_PROTOCOL_T0           =$00000001;  // T=0 is the active protocol.
Const SCARD_PROTOCOL_T1           =$00000002;  // T=1 is the active protocol.
Const SCARD_PROTOCOL_RAW          =$00010000;  // Raw is the active protocol.
Const SCARD_PROTOCOL_DEFAULT      =$80000000;  // Use implicit PTS.
 
 
///////////////////////////////////////////////////////////////////////////////
//  Protocol Flag definitions
///////////////////////////////////////////////////////////////////////////////
Const SCARD_STATE_UNAWARE     =$00000000;   // The application is unaware of the
                                            // current state, and would like to
                                            // know.  The use of this value
                                            // results in an immediate return
                                            // from state transition monitoring
                                            // services.  This is represented by
                                            // all bits set to zero.
Const SCARD_STATE_IGNORE      =$00000001;   // The application requested that
                                            // this reader be ignored.  No other
                                            // bits will be set.
Const SCARD_STATE_CHANGED     =$00000002;   // This implies that there is a
                                            // difference between the state
                                            // believed by the application, and
                                            // the state known by the Service
                                            // Manager.  When this bit is set,
                                            // the application may assume a
                                            // significant state change has
                                            // occurred on this reader.
Const SCARD_STATE_UNKNOWN     =$00000004;   // This implies that the given
                                            // reader name is not recognized by
                                            // the Service Manager.  If this bit
                                            // is set, then SCARD_STATE_CHANGED
                                            // and SCARD_STATE_IGNORE will also
                                            // be set.
Const SCARD_STATE_UNAVAILABLE =$00000008;   // This implies that the actual
                                            // state of this reader is not
                                            // available.  If this bit is set,
                                            // then all the following bits are
                                            // clear.
Const SCARD_STATE_EMPTY       =$00000010;   // This implies that there is not
                                            // card in the reader.  If this bit
                                            // is set, all the following bits
                                            // will be clear.
Const SCARD_STATE_PRESENT     =$00000020;   // This implies that there is a card
                                            // in the reader.
Const SCARD_STATE_ATRMATCH    =$00000040;   // This implies that there is a card
                                            // in the reader with an ATR
                                            // matching one of the target cards.
                                            // If this bit is set,
                                            // SCARD_STATE_PRESENT will also be
                                            // set.  This bit is only returned
                                            // on the SCardLocateCard() service.
Const SCARD_STATE_EXCLUSIVE   =$00000080;   // This implies that the card in the
                                            // reader is allocated for exclusive
                                            // use by another application.  If
                                            // this bit is set,
                                            // SCARD_STATE_PRESENT will also be
                                            // set.
Const SCARD_STATE_INUSE       =$00000100;   // This implies that the card in the
                                            // reader is in use by one or more
                                            // other applications, but may be
                                            // connected to in shared mode.  If
                                            // this bit is set,
                                            // SCARD_STATE_PRESENT will also be
                                            // set.
Const SCARD_STATE_MUTE       =$00000200;    // This implies that the card in the
                                            // reader is unresponsive or not
                                            // supported by the reader or
                                            // software.
Const SCARD_STATE_UNPOWERED   =$00000400;   // This implies that the card in the
                                            // reader has not been powered up.
 
///////////////////////////////////////////////////////////////////////////////
//  SCardControl Constants
///////////////////////////////////////////////////////////////////////////////
Const IOCTL_SMARTCARD_DIRECT            =(($31 shl 16) + (2050 shl 2));
Const IOCTL_SMARTCARD_SELECT_SLOT       =(($31 shl 16) + (2051 shl 2));
Const IOCTL_SMARTCARD_DRAW_LCDBMP       =(($31 shl 16) + (2052 shl 2));
Const IOCTL_SMARTCARD_DISPLAY_LCD       =(($31 shl 16) + (2053 shl 2));
Const IOCTL_SMARTCARD_CLR_LCD           =(($31 shl 16) + (2054 shl 2));
Const IOCTL_SMARTCARD_READ_KEYPAD       =(($31 shl 16) + (2055 shl 2));
Const IOCTL_SMARTCARD_READ_RTC          =(($31 shl 16) + (2057 shl 2));
Const IOCTL_SMARTCARD_SET_RTC           =(($31 shl 16) + (2058 shl 2));
Const IOCTL_SMARTCARD_SET_OPTION        =(($31 shl 16) + (2059 shl 2));
Const IOCTL_SMARTCARD_SET_LED           =(($31 shl 16) + (2060 shl 2));
Const IOCTL_SMARTCARD_LOAD_KEY          =(($31 shl 16) + (2062 shl 2));
Const IOCTL_SMARTCARD_READ_EEPROM       =(($31 shl 16) + (2065 shl 2));
Const IOCTL_SMARTCARD_WRITE_EEPROM      =(($31 shl 16) + (2066 shl 2));
Const IOCTL_SMARTCARD_GET_VERSION       =(($31 shl 16) + (2067 shl 2));
Const IOCTL_SMARTCARD_GET_READER_INFO       =(($31 shl 16) + (2051 shl 2));
Const IOCTL_SMARTCARD_SET_CARD_TYPE         =(($31 shl 16) + (2060 shl 2));
Const IOCTL_SMARTCARD_GET_SERNUM        =(($31 shl 16) + (2071 shl 2));
Const IOCTL_SMARTCARD_SET_CARDVOLTAGE   =(($31 shl 16) + (2074 shl 2));
Const IOCTL_SMARTCARD_ACR128_ESCAPE_COMMAND   =(($31 shl 16) + (2079 shl 2));
///////////////////////////////////////////////////////////////////////////////
//  Imported functions from Winscard.dll (WIN32 API)
///////////////////////////////////////////////////////////////////////////////
Function SCardEstablishContext(dwscope :DWORD;
                                pvReserved1: LPCVOID;
                                pvReserved2: LPCVOID;
                                phContext :LPSCARDCONTEXT):LONG; stdcall; external 'Winscard.dll';
 
Function SCardReleaseContext(hContext:SCARDCONTEXT):LONG; stdcall; external 'Winscard.dll';
 
Function SCardListReadersA(hContext : SCARDCONTEXT;
                           mszGroups:LPCSTR;
                           szReaders:LPSTR;
                           pcchReaders:LPDWORD):LONG; stdcall; external 'Winscard.dll';
 
//Note : ScardConnectA is for non-UNICODE characters which is only one byte.
//       For UNICODE characters it is SCardConnectW. Special processing is
//       required for UNICODE. Be careful!
Function SCardConnectA(hContext : SCARDCONTEXT;
                       szReaders:LPSTR;
                       dwShareMode : DWORD;
                       dwPreferredProtocols : DWORD;
                       phCard : LPSCARDHANDLE;
                       pdwActiveProtocols:LPDWORD):LONG; stdcall; external 'Winscard.dll';
 
Function SCardReconnect(hCard : SCARDHANDLE;
                        dwShareMode : DWORD;
                        dwPreferredProtocols : DWORD;
                        dwInitialization : DWORD;
                        pdwActiveProtocols:LPDWORD):LONG; stdcall; external 'Winscard.dll';
 
Function SCardDisconnect(hCard : SCARDHANDLE;
                         dwDisposition :DWORD):LONG; stdcall; external 'Winscard.dll';
 
 
Function SCardBeginTransaction(hCard : SCARDHANDLE):LONG; stdcall; external 'Winscard.dll';
 
Function SCardEndTransaction(hCard : SCARDHANDLE;
                             dwDisposition :DWORD):LONG; stdcall; external 'Winscard.dll';
 
Function SCardState(hCard : SCARDHANDLE;
                    pdwState :LPDWORD;
                    pdwProtocol :LPDWORD;
                    pbATR :LPBYTE;
                    pcbAtrLen :LPDWORD):LONG; stdcall; external 'Winscard.dll';
 
Function SCardGetStatusChangeA(hContext : SCARDHANDLE;
                    dwTimeout :DWORD;
                    rgReaderStates :LPSCARD_READERSTATE;
                    cReaders :DWORD):LONG; stdcall; external 'Winscard.dll';
 
Function SCardStatusA(hCard : SCARDHANDLE;
                      mszReaderNames :LPTSTR;
                      pcchReaderLen : LPDWORD;
                      pdwState :LPDWORD;
                      pdwProtocol :LPDWORD;
                      pbATR :LPBYTE;
                      pcbAtrLen :LPDWORD):LONG; stdcall; external 'Winscard.dll';
 
Function SCardTransmit(hCard : SCARDHANDLE;
                       pioSendPci : LPCSCARD_IO_REQUEST;
                       pbSendBuffer : LPBYTE;
                       cbSendLength : DWORD;
                       pioRecvPci : LPCSCARD_IO_REQUEST;
                       pbRecvBuffer : LPBYTE;
                       pcbRecvLength:LPDWORD):LONG; stdcall; external 'Winscard.dll';
 
Function SCardControl(hCard : SCARDHANDLE;
                       dwControlCode : DWORD;
                       lpInBuffer : LPBYTE;
                       nInBufferSize : DWORD;
                       lpOutBuffer : LPBYTE;
                       nOutBufferSize : DWORD;
                       lpBytesReturned : LPDWORD):LONG; stdcall; external 'Winscard.dll';
 
Function ShellExecuteA(handle : DWORD;
                       lpOperation : String;
                       lpTargetFile : String;
                       lpParam : String;
                       lpDirectory : String;
                       ShowMode : Integer):LONG; stdcall; external 'SHELL32.dll';
 
 
Procedure ParseReaderList(var List : TStringList; Buffer :PChar; BuffLen : integer);
Procedure LoadListToControl(var ComboBoxControl : TComboBox; Buffer :PChar; BuffLen : integer);
Procedure LoadListToMenu(var MenuItemControl : TMenuItem; Buffer :PChar; BuffLen : integer);
Function GetScardErrMsg(ErrCode : DWORD):string;
Function GetShareModeStrMsg(Code : DWORD):string;
Function GetReaderStateStrMsg(Code : DWORD):string;
Function GetDisposistionStrMsg(Code : DWORD):string;
Function GetProtocolStrMsg(Code : DWORD):string;
Function GetProtocolFlagStrMsg(Code : DWORD):string;
 
 
implementation
 
/////////////////////////////////////////////////////////////////////////////
//  Procedure   : ParseReaderList
//  Inputs      : TStringList - Resulting list of the parsed data.
//                Buffer - should contain readerlist separated by Null character.
//                        List is terminated by Null.
//                BuffLen - Length of Buffer including Null character(s).
//  Description : This function parses readerlist into into individual
//                readers. Buffer should contain the result after a
//                SCardReaderList function. TStringList must be created
//                before passing it to the routine. BuffLen should contain
                //                the number of characters contained in Buffer.
//
//                Example :  Procedure SomeProcedure();
//                           var List :TStringList;
//                           Buffer : array[0..255] of char;
//                           begin
//                               Buffer := 'ACS READER 1'#0#0; {Len is 14, include 2 null at the end}
//                               List := TStringList.Create;
//                               ParseReaderList(List,Buffer,14);
//                               ComboBoxControl.Items.Assign(List); {Assign content of List to Combobox}
//                               List.Free;
//                           end;
////////////////////////////////////////////////////////////////////////////
procedure ParseReaderList(var List : TStringList; Buffer :PChar; BuffLen : integer);
var indx : integer;
    sReader:string;
begin
     indx := 0;
     while (Buffer[indx] <> #0) do begin
       sReader := '';
       while (Buffer[indx] <> #0) do begin
       sReader := sReader + Buffer[indx];
       inc(indx);
       end; // while loop
       sReader := sReader + Buffer[indx];
       List.Add(sReader);
       inc(indx);
     end; // while loop
end;
 
/////////////////////////////////////////////////////////////////////////////
//  Procedure   : LoadListToControl
//  Inputs      : ComboBox - Dropdownlist box where list is loaded.
//                Buffer - should contain readerlist separated by Null character.
//                        List is terminated by Null.
//                BuffLen - Length of Buffer including Null character(s).
//  Description : This function loads the reader list in the combobox control.
//                Note : that previous entries to the control prior to the calling
//                       of this routine will clear the entries.
//                Example :  Procedure SomeProcedure();
//                           var Buffer : array[0..255] of char;
//                           begin
//                               Buffer := 'ACS READER 1'#0#0; {Len is 14, include 2 null at the end}
//                               LoadListToControl(ComboBox1,Buffer,14);
//                           end;
////////////////////////////////////////////////////////////////////////////
 
Procedure LoadListToControl(var ComboBoxControl : TComboBox; Buffer :PChar; BuffLen : integer);
var List : TStringList;
begin
     List := TStringList.Create;
     ParseReaderList(List,Buffer,BuffLen);
     ComboBoxControl.Clear;
     ComboBoxControl.Items.Assign(List);
     List.Free;
end;
 
/////////////////////////////////////////////////////////////////////////////
//  Procedure   : LoadListToMenu
//  Inputs      : MenuItem - Menu Item where list is loaded.
//                Buffer - should contain readerlist separated by Null character.
//                        List is terminated by Null.
//                BuffLen - Length of Buffer including Null character(s).
//  Description : This function loads the reader list in the menu item control.
//                Note : that previous entries to the control prior to the calling
//                       of this routine will clear the entries.
//                Example :  Procedure SomeProcedure();
//                           var Buffer : array[0..255] of char;
//                           begin
//                               Buffer := 'ACS READER 1'#0#0; {Len is 14, include 2 null at the end}
//                               LoadListToMenu(MenuItem1,Buffer,14);
//                           end;
////////////////////////////////////////////////////////////////////////////
 
Procedure LoadListToMenu(var MenuItemControl : TMenuItem; Buffer :PChar; BuffLen : integer);
var NewItem: TMenuItem;
    I : integer;
    List : TStringList;
begin
     List := TStringList.Create;
     ParseReaderList(List,Buffer,BuffLen);
     for  I := 0 to List.Count-1 do
     begin
       NewItem := TMenuItem.Create(NewItem);
       NewItem.Caption := List.Strings[I];
       NewItem.AutoCheck := True;
       NewItem.RadioItem := True;
       MenuItemControl.Add(NewItem);
     end;
 
end;
 
 
////////////////////////////////////////////////////////////////////////////
//  Function    : GetScardErrMsg
//  Inputs      : ErrCode - DWORD code.
//  Description : This function returns the string message of the
//                error code.
//
////////////////////////////////////////////////////////////////////////////
Function GetScardErrMsg(ErrCode : DWORD):string;
begin
    Case ErrCode of
      SCARD_F_INTERNAL_ERROR       : GetScardErrMsg := 'An internal consistency check failed.';
      SCARD_E_CANCELLED            : GetScardErrMsg := 'The action was cancelled by an SCardCancel request.';
      SCARD_E_INVALID_HANDLE       : GetScardErrMsg := 'The supplied handle was invalid.';
      SCARD_E_INVALID_PARAMETER    : GetScardErrMsg := 'One or more of the supplied parameters could not be properly interpreted.';
      SCARD_E_INVALID_TARGET       : GetScardErrMsg := 'Registry startup information is missing or invalid.';
      SCARD_E_NO_MEMORY            : GetScardErrMsg := 'Not enough memory available to complete this command.';
      SCARD_F_WAITED_TOO_LONG      : GetScardErrMsg := 'An internal consistency timer has expired.';
      SCARD_E_INSUFFICIENT_BUFFER  : GetScardErrMsg := 'The data buffer to receive returned data is too small for the returned data.';
      SCARD_E_UNKNOWN_READER       : GetScardErrMsg := 'The specified reader name is not recognized.';
      SCARD_E_TIMEOUT              : GetScardErrMsg := 'The user-specified timeout value has expired.';
      SCARD_E_SHARING_VIOLATION    : GetScardErrMsg := 'The smart card cannot be accessed because of other connections outstanding.';
      SCARD_E_NO_SMARTCARD         : GetScardErrMsg := 'The operation requires a Smart Card, but no Smart Card is currently in the device.';
      SCARD_E_UNKNOWN_CARD         : GetScardErrMsg := 'The specified smart card name is not recognized.';
      SCARD_E_CANT_DISPOSE         : GetScardErrMsg := 'The system could not dispose of the media in the requested manner.';
      SCARD_E_PROTO_MISMATCH       : GetScardErrMsg := 'The requested protocols are incompatible with the protocol currently in use with the smart card.';
      SCARD_E_NOT_READY            : GetScardErrMsg := 'The reader or smart card is not ready to accept commands.';
      SCARD_E_INVALID_VALUE        : GetScardErrMsg := 'One or more of the supplied parameters values could not be properly interpreted.';
      SCARD_E_SYSTEM_CANCELLED     : GetScardErrMsg := 'The action was cancelled by the system, presumably to log off or shut down.';
      SCARD_F_COMM_ERROR           : GetScardErrMsg := 'An internal communications error has been detected.';
      SCARD_F_UNKNOWN_ERROR        : GetScardErrMsg := 'An internal error has been detected, but the source is unknown.';
      SCARD_E_INVALID_ATR          : GetScardErrMsg := 'An ATR obtained from the registry is not a valid ATR string.';
      SCARD_E_NOT_TRANSACTED       : GetScardErrMsg := 'An attempt was made to end a non-existent transaction.';
      SCARD_E_READER_UNAVAILABLE   : GetScardErrMsg := 'The specified reader is not currently available for use.';
      SCARD_P_SHUTDOWN             : GetScardErrMsg := 'PRIVATE -- Internal flag to force server termination.';
      SCARD_E_PCI_TOO_SMALL        : GetScardErrMsg := 'The PCI Receive buffer was too small.';
      SCARD_E_READER_UNSUPPORTED   : GetScardErrMsg := 'The reader driver does not meet minimal requirements for support.';
      SCARD_E_DUPLICATE_READER     : GetScardErrMsg := 'The reader driver did not produce a unique reader name.';
      SCARD_E_CARD_UNSUPPORTED     : GetScardErrMsg := 'The smart card does not meet minimal requirements for support.';
      SCARD_E_NO_SERVICE           : GetScardErrMsg := 'The Smart card resource manager is not running.';
      SCARD_E_SERVICE_STOPPED      : GetScardErrMsg := 'The Smart card resource manager has shut down.';
      SCARD_W_UNSUPPORTED_CARD     : GetScardErrMsg := 'The reader cannot communicate with the smart card, due to ATR configuration conflicts.';
      SCARD_W_UNRESPONSIVE_CARD    : GetScardErrMsg := 'The smart card is not responding to a reset.';
      SCARD_W_UNPOWERED_CARD       : GetScardErrMsg := 'Power has been removed from the smart card, so that further communication is not possible.';
      SCARD_W_RESET_CARD           : GetScardErrMsg := 'The smart card has been reset, so any shared state information is invalid.';
      SCARD_W_REMOVED_CARD         : GetScardErrMsg := 'The smart card has been removed, so that further communication is not possible.';
    else
      GetScardErrMsg := 'Unknown Error: ' + Format('%d', [ErrCode]);
    end; // case statement
end;
 
////////////////////////////////////////////////////////////////////////////
//   GetShareModeStrMsg - displays the meaning or gives a brief description
////////////////////////////////////////////////////////////////////////////
Function GetShareModeStrMsg(Code : DWORD):string;
begin
   case Code of
SCARD_SCOPE_USER     : GetShareModeStrMsg := 'The context is a user context, and any database operations are performed within the domain of the user.';
SCARD_SCOPE_TERMINAL : GetShareModeStrMsg := 'The context is that of the current terminal, and any database operations are performed within the domain of that terminal.  (The calling application must have appropriate access permissions for any database actions.)';
SCARD_SCOPE_SYSTEM   : GetShareModeStrMsg := 'The context is the system context, and any database operations are performed within the domain of the system.  (The calling application must have appropriate access permissions for any database actions.)';
    end; // case statement
end;
 
 
////////////////////////////////////////////////////////////////////////////
//   GetReaderStateStrMsg - displays the meaning or gives a brief description
////////////////////////////////////////////////////////////////////////////
Function GetReaderStateStrMsg(Code : DWORD):string;
begin
   case Code of
SCARD_UNKNOWN    : GetReaderStateStrMsg := 'This value implies the driver is unaware of the current state of the reader.';
SCARD_ABSENT     : GetReaderStateStrMsg := 'This value implies there is no card in the reader.';
SCARD_PRESENT    : GetReaderStateStrMsg := 'This value implies there is a card is present in the reader, but that it has not been moved into position for use.';
SCARD_SWALLOWED  : GetReaderStateStrMsg := 'This value implies there is a card in the reader in position for use.  The card is not powered.';
SCARD_POWERED    : GetReaderStateStrMsg := 'This value implies there is power is being provided to the card, but the Reader Driver is unaware of the mode of the card.';
SCARD_NEGOTIABLE : GetReaderStateStrMsg := 'This value implies the card has been reset and is awaiting PTS negotiation.';
SCARD_SPECIFIC   : GetReaderStateStrMsg := 'This value implies the card has been reset and specific communication protocols have been established.';
    end; // case statement
end;
 
 
////////////////////////////////////////////////////////////////////////////
//   GetDisposistionStrMsg - displays the meaning or gives a brief description
////////////////////////////////////////////////////////////////////////////
Function GetDisposistionStrMsg(Code : DWORD):string;
begin
   case Code of
SCARD_LEAVE_CARD     : GetDisposistionStrMsg := 'Don''t do anything special on close';
SCARD_RESET_CARD     : GetDisposistionStrMsg := 'Reset the card on close';
SCARD_UNPOWER_CARD   : GetDisposistionStrMsg := 'Power down the card on close';
SCARD_EJECT_CARD     : GetDisposistionStrMsg := 'Eject the card on close';
    end; // case statement
end;
 
 
////////////////////////////////////////////////////////////////////////////
//   GetProtocolStrMsg - displays the meaning or gives a brief description
////////////////////////////////////////////////////////////////////////////
Function GetProtocolStrMsg(Code : DWORD):string;
begin
   case Code of
SCARD_PROTOCOL_UNDEFINED    :GetProtocolStrMsg := 'There is no active protocol.';
SCARD_PROTOCOL_T0           :GetProtocolStrMsg := 'T=0 is the active protocol.';
SCARD_PROTOCOL_T1           :GetProtocolStrMsg := 'T=1 is the active protocol.';
SCARD_PROTOCOL_RAW          :GetProtocolStrMsg := 'Raw is the active protocol.';
SCARD_PROTOCOL_DEFAULT      :GetProtocolStrMsg := 'Use implicit PTS.';
    end; // case statement
end;
 
////////////////////////////////////////////////////////////////////////////
//   GetProtocolFlagStrMsg - displays the meaning or gives a brief description
////////////////////////////////////////////////////////////////////////////
Function GetProtocolFlagStrMsg(Code : DWORD):string;
begin
   case Code of
SCARD_STATE_UNAWARE    :GetProtocolFlagStrMsg := 'The application is unaware of the current state, and would like to know.  The use of this value results in an immediate return from state transition monitoring services.  This is represented by all bits set to zero.';
SCARD_STATE_IGNORE     :GetProtocolFlagStrMsg := 'The application requested that this reader be ignored.  No other bits will be set.';
SCARD_STATE_CHANGED    :GetProtocolFlagStrMsg := 'This implies that there is a difference between the state believed by the application, and the state known by the Service Manager.  When this bit is set, the application may assume a significant state change has occurred on this reader.';
SCARD_STATE_UNKNOWN    :GetProtocolFlagStrMsg := 'This implies that the given reader name is not recognized by the Service Manager.  If this bit is set, then SCARD_STATE_CHANGED and SCARD_STATE_IGNORE will also be set.';
SCARD_STATE_UNAVAILABLE:GetProtocolFlagStrMsg := 'This implies that the actual state of this reader is not available.  If this bit is set, then all the following bits are clear.';
SCARD_STATE_EMPTY      :GetProtocolFlagStrMsg := 'This implies that there is not card in the reader.  If this bit is set, all the following bits will be clear.';
SCARD_STATE_PRESENT    :GetProtocolFlagStrMsg := 'This implies that there is a card in the reader.';
SCARD_STATE_ATRMATCH   :GetProtocolFlagStrMsg := 'This implies that there is a card in the reader with an ATR matching one of the target cards. If this bit is set, SCARD_STATE_PRESENT will also be set.  This bit is only returned on the SCardLocateCard() service.';
SCARD_STATE_EXCLUSIVE  :GetProtocolFlagStrMsg := 'This implies that the card in the reader is allocated for exclusive use by another application.  If this bit is set, SCARD_STATE_PRESENT will also be set.';
SCARD_STATE_INUSE      :GetProtocolFlagStrMsg := 'This implies that the card in the reader is in use by one or more other applications, but may be connected to in shared mode.  If this bit is set, SCARD_STATE_PRESENT will also be set.';
SCARD_STATE_MUTE       :GetProtocolFlagStrMsg := 'This implies that the card in the reader is unresponsive or not supported by the reader or software.';
SCARD_STATE_UNPOWERED  :GetProtocolFlagStrMsg := 'This implies that the card in the reader has not been powered up.';
    end; // case statement
end;
 
 
end.
Добавлено через 5 минут
Xank, в hpp?
0
Марсианин)))
713 / 46 / 15
Регистрация: 18.07.2010
Сообщений: 637
25.04.2014, 18:42
Цитата Сообщение от DrSMERTb Посмотреть сообщение
Xank, в hpp?
Описание и ее реализация, а не применение.
В котором из них. Ты здесь выложил там нет ее реализации. там только описание.

Как я понял эта функция самописная, а не из длл.

Прикрепите весь проект. Файлом.
1
 Аватар для DrSMERTb
64 / 40 / 10
Регистрация: 12.11.2010
Сообщений: 841
25.04.2014, 18:50  [ТС]
Шапка же такая?
C++
1
2
3
4
AnsiString __fastcall GetScardErrMsg(unsigned ErrCode)
{
....GetScardErrMsg = "An internal consistency check failed.";
}
0
Марсианин)))
713 / 46 / 15
Регистрация: 18.07.2010
Сообщений: 637
25.04.2014, 18:56
Цитата Сообщение от DrSMERTb Посмотреть сообщение
Шапка же такая?
Код C++
1
2
3
4
AnsiString __fastcall GetScardErrMsg(unsigned ErrCode)
{
....GetScardErrMsg = "An internal consistency check failed.";
}
У тебя там
C++
1
2
3
extern PACKAGE AnsiString __fastcall GetScardErrMsg(unsigned ErrCode);
// Может так.
AnsiString __fastcall GetScardErrMsg(unsigned ErrCode);
1
 Аватар для DrSMERTb
64 / 40 / 10
Регистрация: 12.11.2010
Сообщений: 841
25.04.2014, 19:38  [ТС]
Переделал, ругается
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//----------------------------------------------------------------------------
void __fastcall ParseReaderList(TStringList List,PChar Buffer,int BuffLen)
{
     int indx = 0;
     String sReader;
     while (Buffer[indx] != 0x0){
       sReader = "";
       while (Buffer[indx] != 0x0) {
       sReader = sReader + Buffer[indx];
       indx++; }
       //end; // while loop
       sReader = sReader + Buffer[indx];
       List.Add(sReader);
       indx++; }
}
//----------------------------------------------------------------------------
void __fastcall LoadListToControl( TComboBox ComboBoxControl,PChar Buffer , int BuffLen)
 
{
     TStringList *List=new TStringList();
     ParseReaderList(List,Buffer,BuffLen);
     ComboBoxControl.Items->Clear();
     ComboBoxControl.Items->Assign(List);
     delete List;
}
пишет ошибку на 19 строку
C++
1
2
3
4
5
[bcc32 Error] ACSModule.hpp(157): E2459 Delphi style classes must be constructed using operator new
  Full parser context
    Unit1.cpp(6): #include ACSModule.hpp
    ACSModule.hpp(25): namespace Acsmodule
    ACSModule.hpp(155): parsing: void _fastcall LoadListToControl(TComboBox,wchar_t *,int)
Добавлено через 19 минут
заменил вот так:
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
//----------------------------------------------------------------------------
void __fastcall ParseReaderList(TStringList *List,PChar Buffer,int BuffLen)
{
     int indx = 0;
     String sReader;
     while (Buffer[indx] != 0x0){
       sReader = "";
       while (Buffer[indx] != 0x0) {
       sReader = sReader + Buffer[indx];
       indx++; }
       //end; // while loop
       sReader = sReader + Buffer[indx];
       List->Add(sReader);
       indx++; }
     //end; // while loop
}
//----------------------------------------------------------------------------
void __fastcall LoadListToControl( TComboBox *ComboBoxControl,PChar Buffer , int BuffLen)
 
{
     TStringList *List=new TStringList();
     ParseReaderList(List,Buffer,BuffLen);
     ComboBoxControl->Items->Clear();
     ComboBoxControl->Items->Assign(List);
     delete List;
}
//-- var, const, procedure ---------------------------------------------------
Стала ошибка
C++
1
[ilink32 Error] Error: Unresolved external '__fastcall Acsmodule::LoadListToControl(Vcl::Stdctrls::TComboBox *, char *, int)' referenced from C:\USERS\DRSMERTB.DRSMERTB-PC\DESKTOP\TEST\WIN32\DEBUG\UNIT1.OBJ
Заголовок переделал:
C++
1
extern PACKAGE void __fastcall LoadListToControl(Stdctrls::TComboBox* ComboBoxControl, char * Buffer, int BuffLen);
0
 Аватар для kzru_hunter
1124 / 795 / 101
Регистрация: 01.02.2011
Сообщений: 1,887
Записей в блоге: 1
25.04.2014, 21:00
DrSMERTb Не мучайся Решил перековырять один из твоих проектов (чисто из-за того, что хотел немного опыта из этого получить). Попробуй проверить, вроде ошибок не должно быть
Вложения
Тип файла: rar Other PICC Programming(C++ Builder 6).rar (273.4 Кб, 106 просмотров)
4
 Аватар для DrSMERTb
64 / 40 / 10
Регистрация: 12.11.2010
Сообщений: 841
25.04.2014, 21:01  [ТС]
kzru_hunter, от души!) Я только почти свой дорубил) Уже приконектился только не мог получить данные) Теперь все проблемы кончились спс)
0
0 / 0 / 0
Регистрация: 18.08.2015
Сообщений: 11
13.10.2015, 17:32
Добрый день! Являюсь обладателем Считывателя смарт карт ACR122u. При покупке этого устройства посчитал, что наличие API в описании - это значит будет dll с которой можно будет работать по как с объектом, типа - Устройство = CreateObject("Addin.ACR122u");
СтрокаДанных = Устройство.GetData();

А в итоге на диске только примеры для создания программ... Может у кого есть эта DLL или помогите её скомпоновать. ПЛИИИИИИЗ!!
0
 Аватар для DrSMERTb
64 / 40 / 10
Регистрация: 12.11.2010
Сообщений: 841
14.10.2015, 05:08  [ТС]
Service, там в этом и весь смак, что вам сначала нужно запросить некоторые данные с него, т.е. допустим тот же UID для начала вам необходимо спросить у устройства а только потом он считает его и передаст вам. Правда я практически отказался от использования данного девайся и перешёл на Arduino nano + RFID READER на RC-522, такой вариант оказался как дешевле практически в 3 раза, так и надёжнее считывает в потоке порядка 500 -1000 карт в день, сам сдирает с них UID и сливает их в COM порт (Работает такой вариант порядка 3-х месяцев без ребутов).

Добавлено через 6 минут
А так спасибо kzru_hunter, на его переводе сделал прогу для настольного использования. А если не хотите париться с переводом кода под свой язык(
Цитата Сообщение от Service Посмотреть сообщение
CreateObject("Addin.ACR122u");
СтрокаДанных = Устройство.GetData();
не знаю что за язык) просто сделайте из выше представленного примера программку для считывания нужных вам данных и пересылки их на сокет\файл\базу а своей основной программой читайте оттуда.
0
0 / 0 / 0
Регистрация: 18.08.2015
Сообщений: 11
14.10.2015, 09:10
Это мне нужно для 1С 8.
Да - тоже вариант запускать из 1С программку, что бы она тут же при запуске считывала UID и записывала в файл. Но проблема в том, что с верху в архиве только файлы с кодом - и соединить их в проект, для изменения и последующей компиляции, у меня не получается! Дайте ссылку на проект если есть.
0
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
BasicMan
Эксперт
29316 / 5623 / 2384
Регистрация: 17.02.2009
Сообщений: 30,364
Блог
14.10.2015, 09:10

Считыватель магнитных карт для УТ 10.3
Добрый день. Конфигурация Управление торговлей 10.3. Подскажите пожалуйста, какой считыватель магнитных карт купить для подключения к...

Считыватель карт добавляет лишний символ
Добрый день. Возможно кто то встречался с подобной проблемой: Считыватель карт на POS терминале OTEK M667 добавляет следующий символ перед...

Arduino Nano v3 и заводской считыватель карт (Mifare, HID и тд)
Доброго времени суток ребята, Хочу спросить кто нибудь пробовал подключать заводской считыватель карт к Ардуино вместо готовых модулей...

Считыватель Matrix-II для бесконтактных карт PROXIMITY + AVR
Добрый день. Подскажите как получить считанную инфу на мегу16. На считыватели 3 клемы +12 GND DATA0.

Используя Arduino контролер и магнитный сканер, собрать считыватель карт
Задача: Используя Arduino контролер и магнитный сканер, собрать считыватель карт, и написать для него программу с БД хранящей информацию о...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
40
Ответ Создать тему
Новые блоги и статьи
Решил проблему с ошибкой пагинации сообщений с сервера на алгоритме обхода дерева "Эстафета хвоста".
Hrethgir 12.07.2026
Проблема была в том, что удалялась именно новая кнопка, а не старая. Ни один ИИ не обнаружил это, а сам я смог только когда с работой стало попроще и когда заставил работать будущее автономное. . .
сукцессия 25. Хронология ошибок
anaschu 12.07.2026
# От 50-тонного гриба до устойчивого леса: хроника ошибок при построении модели вековой сукцессии микоризы ## О чём эта статья В процессе построения ОДУ-модели (система дифференциальных. . .
сукцессия 24. Промежуточное общее описание модели
anaschu 12.07.2026
Хендофф: модель АМ→ЭКМ сукцессии микоризы (ризосфера, 50 лет) Содержание проекта Симуляция вековой (50 лет) экологической сукцессии в почве леса Основные участники: АМ-гриб, ЭКМ-гриб,. . .
сукцессия 23. Более физиологичная физиология, более экологичная экология, более диффурные диффуры.
anaschu 12.07.2026
Что реально нашли и починили за эти 5 часов Правило Линдемана (КПД конверсии сахара в тело, kEff) — раньше 100% полученного углерода шло прямо в биомассу гриба; теперь только kEff=0. 5 (после. . .
сукцессия 22. От артефактов к физиологии: калибровка агентной модели грибной сукцессии для воспроизведения сезонной динамики и pH-плато
anaschu 11.07.2026
Аннотация В данной работе представлена калибровка агентной модели динамики грибных сообществ (fungal-succession), направленная на устранение нефизичных артефактов (коллапс биомассы, мгновенное. . .
Сукцессия 20. Война автоботов. Делаем ставки. Лёд против "пш-пш!".
anaschu 11.07.2026
Битва ИИ в ризосфере: Как мы скрестили жесткие ОДУ, закон Фика и «подземный шантаж» Уважаемые коллеги! Хочу поделиться уникальным опытом ведения междисциплинарной компьютерной разработки. Прямо. . .
Сукцессия 19. Какие выводы я сделал из модели? Часть 2.Внутримикоризный стехиометрический буфер и хроно-дискретные зоны экспансии
anaschu 11.07.2026
Био-Инженерный Ликбез: Архитектура Модели Ризосферы Математический аппарат моделирования
Сукцессия 18. Какие выводы я сделал из войны грибов с деревьями? Часть 1- рассказ и немного про термины
anaschu 11.07.2026
Био-Инженерный Ликбез: Архитектура Модели Ризосферы Математический аппарат моделирования Система ОДУ описывает динамику изменения массы различных компонентов системы во времени. Ключевой. . .
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2026, CyberForum.ru