加密狗文件读取连接时出错!!![Linker Error],好困惑!!!

daily_flashing 2005-01-14 10:21:38
在C++Builder中提供了SchipApi.h, ssKeyApi.h, schiplibb.lib,sChip.PAS这四个文件,还提供了一个对加密狗关闭读写等操作的例子,但我的程序模仿例子中的头文件和参数,但是例子能运行成功,而我的程序没能运行成功!出现了:[Linker Error ]Unresolved external 'ClosesChip' referenced from E:\TEST\UNIT1.OBJ 之类的错误,

变量定义为:
private: // User declarations
HANDLE hKey;
WORD UID;
char szReadPswd[4];
char szWritePswd[4];
char szKeyPath[MAX_PATH*2];
bool __fastcall TryOpen();
public: // User declarations
__fastcall TMainForm(TComponent* Owner);
void __fastcall DisplayMessage(AnsiString info);

程序:

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"

#include "schipapi.h" //外部文件

//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TMainForm *MainForm;
//---------------------------------------------------------------------------
__fastcall TMainForm::TMainForm(TComponent* Owner)
: TForm(Owner)
{
hKey = INVALID_HANDLE_VALUE;
UID = 0xffff;
*(int *)szReadPswd = -1;
*(int *)szWritePswd = -1;
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
void __fastcall TMainForm::DisplayMessage(AnsiString info)
{
static int LineCount = 0;
AnsiString x;

LineCount++;
x.printf("%d: %s", LineCount, info);
Memo1->Lines->Add(x);
}
//-----------------------------------------------------------------------
//---------------------------------------------------------------------------
void __fastcall TMainForm::CloseChip1Click(TObject *Sender)
{
AnsiString info;
info.printf("Handle 0x%x is to be closed.", hKey);
DisplayMessage(info);
ClosesChip(hKey); //这里调用关闭或打开加密狗句柄时出现[Linker Error] 好困惑
hKey = INVALID_HANDLE_VALUE;
}
...全文
262 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
daily_flashing 2005-01-14
  • 打赏
  • 举报
回复
只要调用到它的提供的接口函数如OpensChip(UID, szKeyPath),GetsChipSerial(hKey, HardSerial, 16)都出现类似的错误!
Linker Error ]Unresolved external 'ClosesChip' referenced from E:\TEST\UNIT1.OBJ

sChipApi.h文件我是从例子中复制过去的,应该没什么问题,代码是:



#ifndef _SCHIP_API_H
#define _SCHIP_API_H

#define SCHIP_API_VER "2.2"

#include <dbt.h> //need in Pnp Message functions

//下面的宏方便选择不同的发布文件
//#define STATIC_SCHIP_LIB //define this if using STATIC LIB
//#pragma comment(lib, "schplibb.lib") //link with 静态DEBUG库

/*
#ifdef STATIC_SCHIP_LIB //obj static linked
#ifdef _DEBUG
#pragma comment(lib, "schpobjd.lib") //link with 静态DEBUG库
#pragma message( "链接使用schpobjd.lib,DEBUG版的静态库" )
#else
#pragma comment(lib, "schpobjr.lib") //link with 静态RELEASE库
#pragma message( "链接使用schpobjr.lib,RELEASE版的静态库" )
#endif
#else //run with schiprtl.dll
#ifdef _DEBUG
#pragma comment(lib, "schpdlld.lib") //link with 动态DEBUG库
#pragma message( "链接使用 schpdlld.lib,DEBUG版的动态库,要将SCHIPRTLD.DLL重命名为SCHIPRTL.DLL" )
#else
#pragma comment(lib, "schpdllr.lib") //link with 动态RELEASE库
#pragma message( "链接使用 schpdllr.lib,RELEASE版的动态库" )
#endif
#endif
*/

//don't directly include ssKeyapi.h, using sChipApi.h
#include "ssKeyApi.h"

#endif
3996906 2005-01-14
  • 打赏
  • 举报
回复
ClosesChip函数有问题??

之类的错误有几个?你是怎么用的?dll的静态调用吗?

你在用之前有没有要求把用到的函数先声明引出来?
whitelion 2005-01-14
  • 打赏
  • 举报
回复
这个东西用的人很少的,你最好跟你的软件锁供应商联系一下
daily_flashing 2005-01-14
  • 打赏
  • 举报
回复
schiplibb.lib已经添加进去了还是不行!
samchoy 2005-01-14
  • 打赏
  • 举报
回复
把schiplibb.lib添加到你的工程里试试
gzlcd 2005-01-14
  • 打赏
  • 举报
回复
要看看加密库中的相关函数是怎么声明的,VC和BC的库函数不一样,其实无非是一些__stdacll,__fastcall,cdecl等修饰符,楼主试一试就知道了。有个工具impdef可以帮你看看动态库中的函数声明格式。

13,825

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧