?? schip.pas
字號:
unit sChip;
interface
uses Windows, SysUtils;
type
QueryData = record
cbSize : DWORD;
Challenge : array [0..7] of Byte;
Response : array [0..7] of Byte;
end;
PQueryData = ^QueryData;
PWord = ^Word;
const
ERROR_CODE_BASE = $A000;
ERROR_UNKNOWN = ERROR_CODE_BASE;
ERROR_NO_MEMORY = ERROR_CODE_BASE + 1;
ERROR_CREATE_THREAD_FAIL = ERROR_CODE_BASE + 2;
ERROR_STACK_NULL = ERROR_CODE_BASE + 3;
ERROR_NO_DEVICE = ERROR_CODE_BASE + 4;
ERROR_OUT_SPACE = ERROR_CODE_BASE + 5;
ERROR_NO_NT4DRIVER = ERROR_CODE_BASE + 6;
ERROR_NT4DRIVER_VERLOW = ERROR_CODE_BASE + 7;
EW_USE_HARDSERIAL = $80000000;
EW_ALGO_16 = $1;
EW_ALGO_32 = $2;
EW_ALGO_64 = $4;
INVALID_HANDLE_VALUE = $ffffffff;
{open schip(key) functions}
function OpensChip(UserID: WORD; DevicePath: PChar): THandle; stdcall;
function OpensChipByPath(Path: PChar): THandle; stdcall;
{enumerate schip(key) functions}
function CreateEnumsChipContext(pContext: PHandle; UserID: WORD): DWORD; stdcall;
function OpenNextsChip(Context: THandle; DevicePath: PChar): THandle; stdcall;
procedure CloseEnumsChipContext(Context: THandle); stdcall;
procedure EnumsChipPaths(Context: THandle; Paths: PChar); stdcall;
procedure ClosesChip(hKey: THandle); stdcall;
{test or check schip(key) functions}
function QuerysChip(hKey: THandle; pQuery: PQueryData): BOOL; stdcall;
function GetsChipSerial(hKey: THandle; pSerial: PChar; BufferSize: DWORD): BOOL; stdcall;
{read/write/set schip(key) functions}
function WritesChipMem(hKey: THandle; pWritePassword: PChar; Index: WORD; Value: WORD): BOOL; stdcall;
function ReadsChipMem(hKey: THandle; pReadPassword: PChar; Index: WORD; pValue: PWORD): BOOL; stdcall;
function SetsChipPassword(hKey: THandle; pWritePassword: PChar; pNewPassword: PChar): BOOL; stdcall;
function SetsChipID(hKey: THandle; pWritePassword: PChar; NewUserID: WORD): BOOL; stdcall;
function SetsChipAlgoFactors(hKey: THandle; pWritePassword: PChar; NewAlgoFactor: DWORD): BOOL; stdcall;
function WriteDWORD(hKey: THandle; pWritePassword: PChar; Index: WORD; Value: DWORD): BOOL; stdcall;
function ReadDWORD(hKey: THandle; pReadPassword: PChar; Index: WORD; pValue: PDWORD): BOOL; stdcall;
function WriteBuffer(hKey: THandle; pWritePassword: PChar; Index: WORD; Buffer: PChar; Size: DWORD): BOOL; stdcall;
function ReadBuffer(hKey: THandle; pReadPassword: PChar; Index: WORD; Buffer: PChar; Size: DWORD): BOOL; stdcall;
function EncryptWriteBuffer(hKey: THandle; pWritePassword: PChar; Index: WORD; Buffer: PChar; Size: DWORD; pKeyString: PChar; Flag: DWORD): BOOL; stdcall;
function DecryptReadBuffer(hKey: THandle; pReadPassword: PChar; Index: WORD; Buffer: PChar; Size: DWORD; pKeyString: PChar; Flag: DWORD): BOOL; stdcall;
{Pnp related functions}
function RegistersChipPnPNotification(hRecipient: THandle; UserID: WORD; IsService: BOOL): THandle; stdcall;
function UnregistersChipPnPNotification(hNotify: THandle): BOOL; stdcall;
{algorithm related functions}
function InitCryptContext(Algo: DWORD; Context: Pointer; Key: PChar; KeyLen: DWORD): BOOL; stdcall;
function EncrypDecryp(Algo: DWORD; pContext: Pointer; pInput: Pointer; InputLen: DWORD; pOutput: Pointer; OutputLen: DWORD; Mode:DWORD): BOOL; stdcall;
function CheckSum(CRC_Algo: DWORD; pInput: Pointer; InputLen: DWORD; pOutput: Pointer; OutputLen: DWORD): BOOL; stdcall;
implementation
{$TYPEDADDRESS OFF}
function OpensChip; external 'schiprtl.dll';
function OpensChipByPath; external 'schiprtl.dll';
{enumerate schip(key) functions}
function CreateEnumsChipContext; external 'schiprtl.dll';
function OpenNextsChip; external 'schiprtl.dll';
procedure CloseEnumsChipContext; external 'schiprtl.dll';
procedure EnumsChipPaths; external 'schiprtl.dll';
procedure ClosesChip; external 'schiprtl.dll';
{test or check schip(key) functions}
function QuerysChip; external 'schiprtl.dll';
function GetsChipSerial; external 'schiprtl.dll';
{read/write/set schip(key) functions}
function WritesChipMem; external 'schiprtl.dll';
function ReadsChipMem; external 'schiprtl.dll';
function SetsChipPassword; external 'schiprtl.dll';
function SetsChipID; external 'schiprtl.dll';
function SetsChipAlgoFactors; external 'schiprtl.dll';
function WriteDWORD; external 'schiprtl.dll';
function ReadDWORD; external 'schiprtl.dll';
function WriteBuffer; external 'schiprtl.dll';
function ReadBuffer; external 'schiprtl.dll';
function EncryptWriteBuffer; external 'schiprtl.dll';
function DecryptReadBuffer; external 'schiprtl.dll';
{Pnp related functions}
function RegistersChipPnPNotification; external 'schiprtl.dll';
function UnregistersChipPnPNotification; external 'schiprtl.dll';
{algorithm related functions}
function InitCryptContext; external 'schiprtl.dll';
function EncrypDecryp; external 'schiprtl.dll';
function CheckSum; external 'schiprtl.dll';
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -