summaryrefslogtreecommitdiff
path: root/tier0/DESKey/DK2WIN32.H
blob: 440373d3442ea817739a4234b3d0a2f3a71fc112 (plain) (blame)
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
/*
 * $History: DK2WIN32.H $
 * 
 * *****************  Version 1  *****************
 * User: Alun         Date: 1/07/99    Time: 11:31
 * Created in $/DK2/Software/C Drivers/Windows/API/DLL/DK2Win32
 * Initial version added to Source Safe version control
 */
#ifdef __cplusplus
extern "C"
 {
#endif

/////////////////////////////////////////////////////////////////
// Error Codes
//
// All codes are returned from DK2GetLastError and can be formated
// into a message string by calling DK2FormatError

/////////////////////////////////////////////////////////////////
// DK2ERR_SUCCESS
//
// The command was successfull

#define DK2ERR_SUCCESS                 0x0000


/////////////////////////////////////////////////////////////////
// DK2ERR_TOOMANUUSERS
//
// One or mode DK2 network servers were found but they were all 
// full.

#define DK2ERR_TOOMANYUSERS            0x0001

/////////////////////////////////////////////////////////////////
// DK2ERR_ACCESS_DENIED
//
// A DK2 network servers were found but access was denied, either
// due to user restrictions, or invalid login memory.
// See FindDK2Ex

#define DK2ERR_ACCESS_DENIED           0x0002


/////////////////////////////////////////////////////////////////
// DK2ERR_DESKEY_NOTFOUND
//
// A DK2 command failed because a DK2 was not found, either 
// locally or accross the network

#define DK2ERR_DESKEY_NOTFOUND         0x0003

/////////////////////////////////////////////////////////////////
// DK2ERR_NORESPONSE
//
// A DK2 oommand to a server failed becase the server did not 
// respond.

#define DK2ERR_NORESPONSE              0x0004

/////////////////////////////////////////////////////////////////
// DK2ERR_NOSERVERS
//
// The drivers searched for a DK2 a network server, but none were
// found.

#define DK2ERR_NOSERVERS               0x0005

/////////////////////////////////////////////////////////////////
// DK2ERR_DRIVERNOTINSTALLED
//
// The DK2 drivers are not installed

#define DK2ERR_DRIVERNOTINSTALLED      0x0006

/////////////////////////////////////////////////////////////////
// DK2ERR_COMMANDNOTSUPPORTED
//
// The DK2 does not support the requested command   

#define DK2ERR_COMMANDNOTSUPPORTED     0x0007

/////////////////////////////////////////////////////////////////
// DK2ERR_ALREADYNETWORK
//
// A local DK2 command failed because there is a server runnning
// the command must be carried out over the network.

#define DK2ERR_ALREADYNETWORK          0x1001

/////////////////////////////////////////////////////////////////
// DK2ERR_COMMANDNOTNETWORK
//
// A DK2 command failed because the command cannot operate over
// the network

#define DK2ERR_COMMANDNOTNETWORK       0x1002

/////////////////////////////////////////////////////////////////
// DK2ERR_TOOMANYPROGS
//
// The maximum possible programs using the DK2 drivers has been
// reached

#define DK2ERR_TOOMANYPROGS            0x1004

/////////////////////////////////////////////////////////////////
// DK2ERR_BADOS
//
// The DK2 command will not function on the current operating system

#define DK2ERR_BADOS                   0x1005

/////////////////////////////////////////////////////////////////
// DK2ERR_NETWORKONLY
//
// The DK2 command failed because it can only be performed across
// the network and a local connection was specified

#define DK2ERR_NETWORKONLY             0x1006

/////////////////////////////////////////////////////////////////
// DK2ERR_CANCELLED
//
// Returned the GDI/ECP Window is cancelled

#define DK2ERR_CANCELLED               0x1007

/////////////////////////////////////////////////////////////////
// DK2ERR_FAILURE
//
// The command failed due to an error comunicating with the protocol

#define DK2ERR_FAILURE                 0x8000

////////////////////////////////////////////////////////////////
// DK2ERR_PROTOCOLFAILURE
//
// The DK2 command faied due to a problem in the protocol

#define DK2ERR_PROTOCOLFAILURE         0x8001

////////////////////////////////////////////////////////////////
// DK2ERR_BADPARAMETER
//
// The DK2 command failed due to an invalid parameter passed to the 
// function

#define DK2ERR_BADPARAMETER            0x8002

////////////////////////////////////////////////////////////////
// DK2ERR_NOMEMORY
//
// The DK2 command failed because the function could not allocate
// enough memory

#define DK2ERR_NOMEMORY                0x8003

////////////////////////////////////////////////////////////////
// DK2ERR_STARTPROTOCOL
//
// The DK2 command failed because the current protocol did not
// start

#define DK2ERR_STARTPROTOCOL           0x8004

////////////////////////////////////////////////////////////////
// DK2ERR_NOPROTOCOL
//
// The DK2 command failed be cause the current protocol does not
// exist or is not loaded
 
#define DK2ERR_NOPROTOCOL              0x8005

////////////////////////////////////////////////////////////////
// DK2ERR_NOSERVERMEMORY
//
// The DK2 command failed because the server could not allocate
// enough memory

#define DK2ERR_NOSERVERMEMORY          0x8006

////////////////////////////////////////////////////////////////
// DK2ERR_INVALIDCONNECTION
//
// The DK2 command failed because the specified connection is
// invalid

#define DK2ERR_INVALIDCONNECTION       0x8007


////////////////////////////////////////////////////////////////
// Structures
////////////////////////////////////////////////////////////////

#pragma pack( 1 )

#define DK2MEMORYMAP
typedef struct _tDK2Memory
{
    WORD  wAddress;
    WORD  wSeed;
    WORD  wCount;
    LPSTR lpBytes;
    WORD  wModule;
} DK2MEMORY, FAR *LPDK2MEMORY;

typedef struct _tDateTime
{
    WORD wDay;
    WORD wMonth;
    WORD wYear;
    WORD wHour;
    WORD wMinute;
    WORD wSecond;
    WORD wMilliseconds;
} DATETIME, *NPDATETIME, FAR *LPDATETIME;

#pragma pack()


////////////////////////////////////////////////////////////////
// DK2 Functions
////////////////////////////////////////////////////////////////

BOOL APIENTRY DK2DriverInstalled( void );

WORD APIENTRY FindDK2( LPSTR Id, LPSTR PKey );

WORD APIENTRY FindDK2Ex( LPSTR Id, LPSTR PKey, LPDK2MEMORY lpDK2Memory );

WORD APIENTRY FindDK2ExP( LPSTR Id, LPSTR PKey, WORD Address, WORD Seed, WORD Count, LPSTR Bytes, WORD Module );

void APIENTRY DK2LogoutFromServer( WORD DataReg );

WORD APIENTRY DK2FindLPTPort( WORD Port );

WORD APIENTRY DK2GetDelayTime ( void );

void APIENTRY DK2SetDelayTime( WORD Delay );

void APIENTRY DK2ReadRandomNumbers( WORD  DataReg,
                    LPSTR Id,
                    WORD  Seed,
                    LPSTR Buffer,
                    WORD  BytesToRead );

void APIENTRY DK2ThroughEncryption( WORD  DataReg,
                    LPSTR Id,
                    WORD  Seed,
                    LPSTR Buffer,
                    WORD  BytesToEncrypt );


void APIENTRY DK2ReadMemory( WORD  DataReg,
                 LPSTR Id,
                 WORD  Seed,
                 WORD  Address,
                 LPSTR Buffer,
                 WORD  BytesToRead );

void APIENTRY DK2WriteMemory( WORD  DataReg,
                  LPSTR Id,
                  WORD  Seed,
                  WORD  Address,
                  LPSTR Buffer,
                  WORD  BytesToWrite,
                  LPSTR Password );

void APIENTRY DK2ReadDownCounter( WORD  DataReg,
                  LPSTR Id,
                  DWORD *DownCounter );


void APIENTRY DK2DecrementDownCounter( WORD  DataReg,
                       LPSTR Id );

BOOL APIENTRY DK2RegisterModule( WORD  DataReg, WORD wModule );

BOOL APIENTRY DK2UnregisterModule( WORD  DataReg, WORD wModule );

void APIENTRY DK2RestartDownCounter( WORD  DataReg,
                     LPSTR Id,
                     DWORD NewCounter,
                     LPSTR Password );

void APIENTRY DK2ReadDUSN( WORD   DataReg,
                           LPSTR  Id,
                           LPSTR  Password,
                           LPWORD SecCount,
                           LPSTR  DUSN );

void APIENTRY DK2SendAlgorithmString( WORD  DataReg,
                      LPSTR Id,
                      WORD  Iteration1,
                      WORD  Iteration2,
                      LPSTR Buffer1,
                      LPSTR Buffer2 );

void APIENTRY DK2SendAlgorithmBuffer( WORD  DataReg,
                      LPSTR Id,
                      LPWORD Iteration,
                      LPSTR Buffer,
                      WORD  BufferCount );

void APIENTRY DK2SendAndReceive( WORD DataReg, LPSTR Id, LPSTR lpFirst, WORD wFirst, LPSTR lpSend, WORD wSend, LPSTR lpReceive, WORD wReceive, WORD wCount );

BOOL APIENTRY DK2Success( void );

void APIENTRY DK2AllowChangeInterrupts( WORD Change );

WORD APIENTRY DK2DetectSpeed( WORD  DataReg,
                  LPSTR Id );

WORD APIENTRY DK2SubDetectSpeed( WORD  DataReg,
                 LPSTR Id,
                 LPSTR PKey,
                 LPSTR Bytes );

////////////////////////////////////////////////////////////////
// time function
void APIENTRY DK2GetSystemTime( WORD DateReg, LPSTR Id, LPDATETIME lpDateTime );

////////////////////////////////////////////////////////////////
// DK2 Flags 

#define DK2_BITRONICS      0x00000001
#define DK2_HASBITRONICS   0x00000002

DWORD APIENTRY DK2GetFlags ( WORD DataReg,
                 LPSTR Id );

VOID APIENTRY DK2SetFlags ( WORD  DataReg,
                LPSTR Id,
                DWORD Flags );

////////////////////////////////////////////////////////////////

WORD APIENTRY DK2Encode( LPSTR lpszData,
              WORD  cbData,
              LPSTR lpszEncode,
              WORD  cbEncode );

WORD APIENTRY DK2Decode( LPSTR lpszData,
              LPSTR lpszDecode );

////////////////////////////////////////////////////////////////
// DK2 Access Flags - Override Searching Network or Local

#define DNET_NETWORK            0x0001
#define DNET_LOCAL              0x0002

void APIENTRY DK2SetAccessFlags( WORD wFlags );

////////////////////////////////////////////////////////////////

DWORD APIENTRY DK2GetLastError( void );

void APIENTRY DK2FormatError( DWORD Error, LPSTR ErrorString, int MaxLen  );

WORD APIENTRY DK2GetServerName( WORD DataReg, LPSTR lpszServerName, LPSTR lpszComputerName );

#ifdef __cplusplus
 }
#endif