无法实现密码过滤器
Cannot implement password filter
我尝试实现密码过滤器,所以我写了一个简单的密码过滤器。我遵循了 MSDN 中的文档,并确保正确声明了函数。我在VS 2010中编译。
.def 文件:
LIBRARY myFilt
EXPORTS
InitializeChangeNotify
PasswordFilter
PasswordChangeNotify
.cpp文件:
#include <windows.h>
#include <stdio.h>
#include <ntsecapi.h>
void writeToLog(const char* szString)
{
FILE* pFile = fopen("c:\work\logFile.txt", "a+");
if (NULL == pFile)
{
return;
}
fprintf(pFile, "%srn", szString);
fclose(pFile);
return;
}
// Default DllMain implementation
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
OutputDebugString(L"DllMain");
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
BOOLEAN __stdcall InitializeChangeNotify(void)
{
OutputDebugString(L"InitializeChangeNotify");
writeToLog("InitializeChangeNotify()");
return TRUE;
}
BOOLEAN __stdcall PasswordFilter(
PUNICODE_STRING AccountName,
PUNICODE_STRING FullName,
PUNICODE_STRING Password,
BOOLEAN SetOperation
)
{
OutputDebugString(L"PasswordFilter");
return TRUE;
}
NTSTATUS __stdcall PasswordChangeNotify(
PUNICODE_STRING UserName,
ULONG RelativeId,
PUNICODE_STRING NewPassword
)
{
OutputDebugString(L"PasswordChangeNotify");
writeToLog("PasswordChangeNotify()");
return 0;
}
我把myFilt.dll放在%windir%system32
,将"myFilt"添加到注册表中的"通知包"中,重新启动计算机,更改密码,什么也没发生。
我打开了依赖项.exe并看到功能正确:
InitializeChangeNotify
PasswordChangeNotify
PasswordFilter
错误在哪里??
谢谢。
我发现了问题!我将运行时库从多线程调试 DLL (/MDd) 更改为多线程调试 (/MTd),它非常完美!:)
– user1375970 五月 5 在 10:38
通知包指定在设置或更改密码时加载或调用的动态链接库 (DLL)。要指定多个文件,请在每个文件名之间按 Enter 键,将文件名一一列出。
在另一个之上!
相关文章:
- 带过滤器的现代迭代c++集合
- c++中的oop(密码生成)
- 密码登录程序将永远循环并显示不正确的结果
- 如何将字符串添加到布谷鸟过滤器?
- OpenSSL没有共享密码
- Cryptopp:获取密码输入的填充字符串
- 密码长度验证 (c++)
- C++ win32 如何使密码字段可选并启用复制和粘贴?
- 仿射密码解密,输出大小写不同
- 替换密码:哪一个?
- 在事件过滤器之前发出对象的事件
- C++对开销较少的容器使用多个过滤器
- 无法使用 openssl 服务器,因为密码已过时...什么的...ERR_SSL_VERSION_OR_CIPHER_MISMATCH
- 如何使用 c++ 在 sqlite3 中打开受密码保护的数据库?
- 根据用户名和密码 Qt C++重新访问数据库值
- C++密码问题
- CBasePin 递增对拥有过滤器的引用.循环引用?
- 无法在 Cocos2dx 中使用受密码保护的 zip 文件
- 我们无法在 Windows 10 中设置自定义密码过滤器
- 无法实现密码过滤器