我尝试实现密码过滤,所以我写了一个简单的密码过滤器.我按照MSDN中的文档进行操作,并确保正确声明了这些函数.我在VS 2010中编译.
LIBRARY myFilt
EXPORTS
InitializeChangeNotify
PasswordFilter
PasswordChangeNotify
Run Code Online (Sandbox Code Playgroud)
#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, "%s\r\n", 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;
} …Run Code Online (Sandbox Code Playgroud) 我有一个导出3功能的DLL:
extern "C"
{
__declspec(dllexport) BOOLEAN __stdcall InitializeChangeNotify(void);
__declspec(dllexport) BOOLEAN __stdcall PasswordFilter(LPCWSTR AccountName,LPCWSTR FullName,LPCWSTR Password,BOOLEAN SetOperation);
__declspec(dllexport) NTSTATUS __stdcall PasswordChangeNotify(LPCWSTR UserName,ULONG RelativeId,LPCWSTR NewPassword);
}
Run Code Online (Sandbox Code Playgroud)
extern "C"
{
__declspec(dllexport) BOOLEAN __stdcall InitializeChangeNotify(void)
{
writeToLog("InitializeChangeNotify()");
return TRUE;
}
__declspec(dllexport) BOOLEAN __stdcall PasswordFilter(LPCWSTR AccountName,LPCWSTR FullName,LPCWSTR Password,BOOLEAN SetOperation)
{
writeToLog("PasswordFilter()");
return TRUE;
}
__declspec(dllexport) NTSTATUS __stdcall PasswordChangeNotify(LPCWSTR UserName,ULONG RelativeId,LPCWSTR NewPassword)
{
writeToLog("PasswordChangeNotify()");
return 0;
}
}
Run Code Online (Sandbox Code Playgroud)
我在VS 2010中编译.
我看到函数名称取决于:_InitializeChangeNotify@0, _PasswordChangeNotify@12.如何取消功能?