⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 schip.pas

📁 安全芯加密狗 安全芯加密狗
💻 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;

type PassArray = array[0..3] of Byte;

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}

{Specify the name of the OBJ containing the function.}
{$L main.obj}

function OpensChip; StdCall; far; external;

function OpensChipByPath; StdCall; far; external;

{enumerate schip(key) functions}
function CreateEnumsChipContext; StdCall; far; external;
function OpenNextsChip; StdCall; far; external;
procedure CloseEnumsChipContext; StdCall; far; external;
procedure EnumsChipPaths; StdCall; far; external;

procedure ClosesChip; StdCall; far; external;

{test or check schip(key) functions}
function QuerysChip; StdCall; far; external;
function GetsChipSerial; StdCall; far; external;

{read/write/set schip(key) functions}
function WritesChipMem; StdCall; far; external;
function ReadsChipMem; StdCall; far; external;
function SetsChipPassword; StdCall; far; external;

function SetsChipID; StdCall; far; external;
function SetsChipAlgoFactors; StdCall; far; external;

function WriteDWORD; StdCall; far; external;
function ReadDWORD; StdCall; far; external;

function WriteBuffer; StdCall; far; external;
function ReadBuffer; StdCall; far; external;

function EncryptWriteBuffer; StdCall; far; external;
function DecryptReadBuffer; StdCall; far; external;

{Pnp related functions}
function RegistersChipPnPNotification; StdCall; far; external;
function UnregistersChipPnPNotification; StdCall; far; external;

{algorithm related functions}
function InitCryptContext; StdCall; far; external;
function EncrypDecryp; StdCall; far; external;
function CheckSum; StdCall; far; external;

end.
 






















⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -