我有一个程式是关于当插入移动硬盘时,输入密码把移动硬盘锁住
我先调出.dll (FARPROC&)SecuritySetPassword = ::GetProcAddress(m_hDLL,"SecuritySetPassword");在header file 加入要用的函数跟着调入函数,具体代码如下void CLoginDlg::OnOK()
{
// TODO: Add extra validation here
size_t passwdcnt;
char buffer1[64];
char buffer2[64];
memset(buffer1,0,64);
memset(buffer2,0,64);CEdit*pass1=(CEdit*)this->GetDlgItem(IDC_EDIT_SET_PASS1);
pass1->GetLine(0,buffer1,64);CEdit*pass2=(CEdit*)this->GetDlgItem(IDC_EDIT_SET_PASS2);
pass2->GetLine(0,buffer2,64);
passwdcnt=strlen(buffer1);
if (passwdcnt>20)
{
::MessageBox(NULL,"Password cannot be longer than 20 characters","Warning",MB_OK|MB_ICONINFORMATION);
pass1->SetWindowText("");
pass1->SetFocus();
}else if (passwdcnt==0)
{
::MessageBox(NULL,"Password Enter Password!","Warning",MB_OK|MB_ICONINFORMATION);
pass2->SetWindowText("");
pass1->SetFocus();
}
else if (strcmp(buffer1,buffer2)!=0)
{
::MessageBox(NULL,"Password MisMatch","Set Password Error",MB_OK|MB_ICONERROR);
pass1->SetWindowText("");
pass2->SetWindowText("");
pass1->SetFocus();
}else
if(SecuritySetPassword((unsign char *)buffer1) == FALSE )
{
::MessageBox(NULL,"Set User Password Error","Error",MB_OK|MB_ICONERROR);
OnOK();
return ; }
}
但当我输入密码时会出现一个error box说 Login MFC Application has encountered a problem and needs to close. We are sorry for the inconvenience.到底是那里有问题啊,经过测试,好像是if(SecuritySetPassword((unsign char *)buffer1) == FALSE )这句导致出现错误,,有谁可以帮帮我???
我先调出.dll (FARPROC&)SecuritySetPassword = ::GetProcAddress(m_hDLL,"SecuritySetPassword");在header file 加入要用的函数跟着调入函数,具体代码如下void CLoginDlg::OnOK()
{
// TODO: Add extra validation here
size_t passwdcnt;
char buffer1[64];
char buffer2[64];
memset(buffer1,0,64);
memset(buffer2,0,64);CEdit*pass1=(CEdit*)this->GetDlgItem(IDC_EDIT_SET_PASS1);
pass1->GetLine(0,buffer1,64);CEdit*pass2=(CEdit*)this->GetDlgItem(IDC_EDIT_SET_PASS2);
pass2->GetLine(0,buffer2,64);
passwdcnt=strlen(buffer1);
if (passwdcnt>20)
{
::MessageBox(NULL,"Password cannot be longer than 20 characters","Warning",MB_OK|MB_ICONINFORMATION);
pass1->SetWindowText("");
pass1->SetFocus();
}else if (passwdcnt==0)
{
::MessageBox(NULL,"Password Enter Password!","Warning",MB_OK|MB_ICONINFORMATION);
pass2->SetWindowText("");
pass1->SetFocus();
}
else if (strcmp(buffer1,buffer2)!=0)
{
::MessageBox(NULL,"Password MisMatch","Set Password Error",MB_OK|MB_ICONERROR);
pass1->SetWindowText("");
pass2->SetWindowText("");
pass1->SetFocus();
}else
if(SecuritySetPassword((unsign char *)buffer1) == FALSE )
{
::MessageBox(NULL,"Set User Password Error","Error",MB_OK|MB_ICONERROR);
OnOK();
return ; }
}
但当我输入密码时会出现一个error box说 Login MFC Application has encountered a problem and needs to close. We are sorry for the inconvenience.到底是那里有问题啊,经过测试,好像是if(SecuritySetPassword((unsign char *)buffer1) == FALSE )这句导致出现错误,,有谁可以帮帮我???
你再贴一些详细一点的信息,比如函数的具体的定义,SecuritySetPassword是在哪里定义的,怎么定义的等等。
或者在这里加个断点,调出汇编来,看看调用函数的过程。
BOOL (*SecuritySetPassword)(unsigned char *writebuf);
除了这个就没别的了