hash算法出现的异常!100分等达人

hash算法出现的错误!100分等达人!
hash算法引用:http://www.yuanma.org/data/2006/1104/article_1774.htm

我写的是一个com;

我想把这个hash算法加入到我的代码中可是出现的错误不明希望大侠指正!多谢

首先在我的代码段中加入了代码:
C/C++ code

unsigned long cryptTable[0x500];
/***********************************************************
  *以下的函数生成一个长度为0x500(合10进制数:1280)的cryptTable[0x500]
  *
  *
  ***********************************************************/
void prepareCryptTable()
{ 
    unsigned long seed = 0x00100001, index1 = 0, index2 = 0, i;

    for( index1 = 0; index1 < 0x100; index1++ )
    { 
        for( index2 = index1, i = 0; i < 5; i++, index2 += 0x100 )
        { 
            unsigned long temp1, temp2;

            seed = (seed * 125 + 3) % 0x2AAAAB;
            temp1 = (seed & 0xFFFF) << 0x10;

            seed = (seed * 125 + 3) % 0x2AAAAB;
            temp2 = (seed & 0xFFFF);

            cryptTable[index2] = ( temp1 | temp2 ); 
       } 
   } 
}






当我加入下一个函数后:错误出现了[错误信息在代码下边]
C/C++ code

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; 
}


Linking...
Creating library ReleaseUMinDependency/cvb.lib and object ReleaseUMinDependency/cvb.exp
LIBCMT.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
ReleaseUMinDependency/cbvb.dll : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

------解决方案--------------------
error LNK2001: unresolved external symbol _main
---------------------------------------------------
工程建错了吧,你新建工程的时候选择的是Win32 console application, 但是的程序中的入口函数不是main/wmain,而是WinMain/wWinMain

修改工程设置 /subsystem:console ->/subsystem:windows(或者整个去掉)
------解决方案--------------------
....你多删了代码....
------解决方案--------------------
恩,工程建错的问题
------解决方案--------------------
你可以进一步缩小范围,把toupper注释掉,是不是这个函数的问题?
------解决方案--------------------
来关注下。
------解决方案--------------------
toupper 函数 要 #include <locale>

如何将
char *lpszFileName换成 BSTR *lpszFileName 

C/C++ code

BSTR& bstr = _bstr_t(lpszFileName).GetBSTR(); 
BSTR* pbstr = _bstr_t(lpszFileName).GetAddress();