原帖:http://topic.csdn.net/u/20100717/00/451b53d4-04c0-4ec2-8401-0335c1bd29b3.html发现错误是由于使用了 toupper 而引起的;去掉后可正常编译;STDMETHODIMP CvbWB::AddTofcc(short wUID)
{
…… 我想在这里调用 hash 函数 在这里如何调用prepareCryptTable() 和 HashString()这两个函数??
}
unsigned long HashString( char *lpszFileName, unsigned long dwHashType )
{
unsigned char *key = (unsigned char *)lpszFileName;
unsigned long seed1 = 0x7FED7FED;
unsigned long seed2 = 0xEEEEEEEE;
int ch; while( *key != 0 )
{
ch = toupper(*key++);
seed1 = cryptTable[(dwHashType << 8) + ch] ^ (seed1 + seed2);
seed2 = ch + seed1 + seed2 + (seed2 << 5) + 3;
}
return seed1;
}
{
…… 我想在这里调用 hash 函数 在这里如何调用prepareCryptTable() 和 HashString()这两个函数??
}
unsigned long HashString( char *lpszFileName, unsigned long dwHashType )
{
unsigned char *key = (unsigned char *)lpszFileName;
unsigned long seed1 = 0x7FED7FED;
unsigned long seed2 = 0xEEEEEEEE;
int ch; while( *key != 0 )
{
ch = toupper(*key++);
seed1 = cryptTable[(dwHashType << 8) + ch] ^ (seed1 + seed2);
seed2 = ch + seed1 + seed2 + (seed2 << 5) + 3;
}
return seed1;
}
char *lpszFileName换成 BSTR *lpszFileName
char *lpszFileName换成 BSTR *lpszFileName BSTR& bstr = _bstr_t(lpszFileName).GetBSTR();BSTR* pbstr = _bstr_t(lpszFileName).GetAddress();
在类的头文件中声明。
还是将 BSTR 转换成 char 这样函数里不用修改了!在一个,我发现函数HashString返回的seed1不是 数组的下标,如何通过HSAH码得到这个HASH的下标呢??希望能解决了啊