谁能帮我详细解释下以下代码!在线等,谢谢
来源:百度知道 编辑:UC知道 时间:2024/05/08 00:43:17
// Just ignore empty key requests.
if (pCmdParam->szParam1 == NULL) {
return 0;
}
//
// Filter the key using the same criteria as the the Password entry
// dialog. Remember about Unicode and Ansi...
//
const char *pNxtInChar = axpl::t2s((TCHAR *)(pCmdParam->szParam1)).c_str();
// Ensure that szFilterKey is deallocated on exit of this function.
CPtrTo<char> szFilterKey;
szFilterKey = new char[strlen(pNxtInChar) + 1];
ASSPTR(szFilterKey);
char *pNxtOutChar = szFilterKey;
while (*pNxtInChar) {
if (strchr((const char *)szPassphraseChars, *pNxtInChar) != NULL) {
*pNxtOutChar++ = *pNxtInChar;
}
pNxtInChar++;
}
*pNxtOutChar = '\0';
// We are responsible for ensuring the deletion
DWORD CmdAddKey(CCmdParam *pCmdParam) {
// Just ignore empty key requests.
//忽略空的键值请求 (键值为空,返回))
if (pCmdParam->szParam1 == NULL) {
return 0;
}
//
// Filter the key using the same criteria as the the Password entry
// dialog. Remember about Unicode and Ansi...
//
//和密码输入对话框使用相同的原理来适配键值,要注意(Unicode与Ansi编码)
//这句话的目的是为了让程序可以同时处理Unicode 与Ansi(先转成TCHAR *,再到char *)
const char *pNxtInChar = axpl::t2s((TCHAR *)(pCmdParam->szParam1)).c_str();
// Ensure that szFilterKey is deallocated on exit of this function.
//在函数结束确定szFilterKey的空间被分配
//分配空间没的说,然后把在传进来的参数中出现的字符放到szFilterKey中
CPtrTo<char> szFilterKey;
szFilterKey = new char[strlen(pNxtInChar) + 1];
ASSPTR(szFilterKey);
char *pNxtOutChar = szFilterKey;
while (*pNxtInChar) {
if (strchr((const char *)szPassphraseChars, *pNxtInChar) != NULL) {
*pNxtOutChar++ = *pNxtInCh