Hallo,

I’m facing a winlogon/Notify problem.

I’m creating to Winlogon Notification Package. I have therefore written an ATL DLL with a winlogonevent handler function. I exported the winlogon event handler function with the “MyProjectName.def” file as follows

Code:
LIBRARY "MyProjectNamaePS"

EXPORTS
DllGetClassObject PRIVATE
DllCanUnloadNow PRIVATE
GetProxyDllInfo PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE
fLogonEventHandler PRIVATE
fLogoutEventHandler PRIVATE
From the fLogonEventHandler function I’m doing the following things

Code:
 
void fLogonEventHandler (PWLX_NOTIFICATION_INFO pInfo)
{
LPCTSTR lpTestValue;
HKEY hk;
DWORD dwData, dwDisp;
TCHAR BufSubkey[MAX_PATH];
LPTSTR MyTestValue;
long HRESULT;

BOOL BRESULT = 0;
LPCTSTR lpCaption;
TCHAR msg[128];

lpCaption = TEXT("OK");
wsprintf(msg, "It's OK!");
MessageBox(NULL, msg, lpCaption, MB_OK);

dwData = 1;
MyTestValue = TEXT("Test Value\n");
wsprintf(BufSubkey,"MyTESTCONTROL"\\TEST");

HRESULT = -1;

HRESULT = RegCreateKeyEx(HKEY_CURRENT_USER, 
BufSubkey, 
0, 
NULL, 
REG_OPTION_NON_VOLATILE, 
KEY_WRITE, 
NULL, 
&hk, 
&dwDisp); 

if (HRESULT == ERROR_SUCCESS)
{
HRESULT = RegSetValueEx(hk,
MTestValue,
0,
REG_DWORD,
(LPBYTE)&dwData,
sizeof(DWORD));
}
}
I registered the dynamic library on a terminal server and used Regmon.exe and filemon.exe to monitor the logon event on the server, and I created the registry entries inside the "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Notify\MyProjectname" subkey to register my dll.

Asynchronous = REG_DWORD 1
DllName = REG_SZ MyProjectname.dll
Impersonate = REG_DWORD 0
Logon = REG_SZ fLogonEventHandler

It appeared that the library was called at logon. But I did not seen the massage box and the user did not had in his registry the entry as it has to be.

Can anyone point me please to what I’m doing wrong?

Thanks a lot for your help.