⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xgina.cpp.svn-base

📁 windows 重写gina编程经典基本实现方法.
💻 SVN-BASE
📖 第 1 页 / 共 3 页
字号:
//		rect.top = rect.bottom - 60;
//		rect.left = rect.right - 214;
//		DrawLogo(hwndDlg,IMAGE_FILE,rect.left , rect.top);
	}

   return bResult;
}


//
// Redirected ChangePasswordDlgProc().
//

BOOL 
CALLBACK 
MyChangePasswordDlgProc (HWND   hwndDlg,  // handle to dialog box
                         UINT   uMsg,     // message  
                         WPARAM wParam,   // first message parameter
                         LPARAM lParam)   // second message parameter
{
   BOOL bResult;
   
   //
   // Sanity check.
   //
   assert(pfChangePasswordDlgProc != NULL);

   //
   // Pass on to MSGINA first.
   //
   bResult = pfChangePasswordDlgProc(hwndDlg, uMsg, wParam, lParam);

   //
   // We are only interested in WM_INITDIALOG message.
   //
#ifdef _DEBUG
   DEBUG_MSG("Change pwd dlg msg id : %ld" , uMsg);
#endif

   if (uMsg == WM_INITDIALOG)
   {
#ifdef _DEBUG
	   DEBUG_MSG("Change pwd dlg init");
#endif
      //
      // Manipulate the dialog box to match your needs here. For example,
      // you can add a static control to the dialog box or display another
      // message to clearly explain the rules for composing a valid password.
      //
	}
	else if ( uMsg == WM_PAINT)
	{	RECT rect;
		GetClientRect( hwndDlg , &rect);
		rect.top = rect.bottom - 33;
		 rect.left = rect.left + 10;
		DrawLogo(hwndDlg,IMAGE_FILE,rect.left , rect.top);
	}

   return bResult;
}


BOOL 
CALLBACK 
MyWlxDisplaySASDlgProc (HWND   hwndDlg,  
                         UINT   uMsg,     
                         WPARAM wParam, 
                         LPARAM lParam)  
{	
	BOOL bResult;
   
   //
   // Sanity check.
   //
	assert(pfWlxDisplaySASDlgProc != NULL);

   //
   // Pass on to MSGINA first.
   //
   bResult = pfWlxDisplaySASDlgProc(hwndDlg, uMsg, wParam, lParam);

   //
   // We are only interested in WM_INITDIALOG message.
   //
#ifdef _DEBUG
   DEBUG_MSG("display SAS dlg msg id : %ld" , uMsg);
#endif

   if (uMsg == WM_INITDIALOG)
   {
#ifdef _DEBUG
	   DEBUG_MSG("display SAS dlg init");
#endif
      //
      // Manipulate the dialog box to match your needs here. For example,
      // you can add a static control to the dialog box or display another
      // message to clearly explain the rules for composing a valid password.
      //
	}
	else if ( uMsg == WM_PAINT)
	{	RECT rect;
		GetClientRect( hwndDlg , &rect);
		rect.top = rect.bottom - 33;
		DrawLogo(hwndDlg,IMAGE_FILE,rect.left , rect.top);
	}

   return bResult;
}

BOOL 
CALLBACK 
MyWlxLoggedOnSASDlgProc (HWND   hwndDlg,  
                         UINT   uMsg,     
                         WPARAM wParam, 
                         LPARAM lParam)  
{	
	BOOL bResult;
   
   //
   // Sanity check.
   //
	assert(pfWlxLoggedOnSASDlgProc != NULL);

   //
   // Pass on to MSGINA first.
   //
   bResult = pfWlxLoggedOnSASDlgProc(hwndDlg, uMsg, wParam, lParam);

   //
   // We are only interested in WM_INITDIALOG message.
   //
#ifdef _DEBUG
   DEBUG_MSG("Log on SAS dlg msg id : %ld" , uMsg);
#endif
   if (uMsg == WM_INITDIALOG)
   {
#ifdef _DEBUG
	   DEBUG_MSG("Log on SAS dlg init");
#endif
      //
      // Manipulate the dialog box to match your needs here. For example,
      // you can add a static control to the dialog box or display another
      // message to clearly explain the rules for composing a valid password.
      //
	}
	else if ( uMsg == WM_PAINT)
	{	RECT rect;
		GetClientRect( hwndDlg , &rect);
		rect.top = rect.bottom - 33;
		DrawLogo(hwndDlg,IMAGE_FILE,rect.left , rect.top);
	}

   return bResult;
}

//
// Redirected WlxDialogBoxParam() function.
//

int 
WINAPI 
MyWlxDialogBoxParam (HANDLE  hWlx,
                     HANDLE  hInst,
                     LPWSTR  lpszTemplate,
                     HWND    hwndOwner,
                     DLGPROC dlgprc,
                     LPARAM  dwInitParam)
{
   //
   // Sanity check.
   //
   assert(pfWlxDialogBoxParam != NULL);

   //
   // We only know MSGINA dialogs by identifiers.
   //
   
   if (!HIWORD(lpszTemplate))
   {
      //
      // Hook appropriate dialog boxes as necessary.
      //
#ifdef _DEBUG
	   DEBUG_MSG("WlxDialogBoxParam :%ld",(DWORD) lpszTemplate);
#endif
      switch ((DWORD) lpszTemplate)
      {
		case IDD_WLXDIAPLAYSASNOTICE_DIALOG:
		{
#ifdef _DEBUG
			DEBUG_MSG("WlxDialogBoxParam : WLXDIAPLAYSASNOTICE_DIALOG");	
#endif
			pfWlxDisplaySASDlgProc = dlgprc;
			return pfWlxDialogBoxParam(hWlx, hInst, lpszTemplate, hwndOwner, 
                                       MyWlxDisplaySASDlgProc, dwInitParam);
		}

		case 1500:
	     case IDD_WLXLOGGEDOUTSAS_DIALOG:
         {
#ifdef _DEBUG
			DEBUG_MSG("WlxDialogBoxParam : WLXLOGGEDOUTSAS_DIALOG");
#endif
            pfWlxLoggedOutSASDlgProc = dlgprc;
            return pfWlxDialogBoxParam(hWlx, hInst, lpszTemplate, hwndOwner, 
                                       MyWlxLoggedOutSASDlgProc, dwInitParam);
         }
	    case 1900:
         case IDD_WLXWKSTALOCKEDSAS_DIALOG:
         {
#ifdef _DEBUG		    
		    DEBUG_MSG("WlxDialogBoxParam : WLXWKSTALOCKEDSAS_DIALOG");
#endif
            pfWlxWkstaLockedSASDlgProc = dlgprc;
            return pfWlxDialogBoxParam(hWlx, hInst, lpszTemplate, hwndOwner, 
                                       MyWlxWkstaLockedSASDlgProc, dwInitParam);
         }
	    case 1950:
	    case IDD_WLXLOGGEDONSAS_DIALOG:
		{	
#ifdef _DEBUG			
			DEBUG_MSG("WlxDialogBoxParam : WLXLOGGEDONSAS_DIALOG");
#endif
			pfWlxLoggedOnSASDlgProc = dlgprc;
			return pfWlxDialogBoxParam(hWlx, hInst, lpszTemplate, hwndOwner, 
                                       MyWlxLoggedOnSASDlgProc, dwInitParam);
		}
	    case 1700:
         case IDD_CHANGE_PASSWORD_DIALOG:
         {	
#ifdef _DEBUG		    
		    DEBUG_MSG("WlxDialogBoxParam : CHANGE_PASSWORD_DIALOG");
#endif
            pfChangePasswordDlgProc = dlgprc;
            return pfWlxDialogBoxParam(hWlx, hInst, lpszTemplate, hwndOwner, 
                                       MyChangePasswordDlgProc, dwInitParam);
         }
      }
   }

   //
   // The rest will not be redirected.
   //
   return pfWlxDialogBoxParam(hWlx, hInst, lpszTemplate, 
                              hwndOwner, dlgprc, dwInitParam);
}




//
// Hook into the real MSGINA.
//

BOOL MyInitialize (HINSTANCE hDll, DWORD dwWlxVersion)
{
   //
   // Get pointers to all of the WLX functions in the real MSGINA.
   //
   pfWlxInitialize = 
      (PFWLXINITIALIZE) GetProcAddress(hDll, "WlxInitialize");
   if (!pfWlxInitialize) 
   {
      return FALSE;
   }

   pfWlxDisplaySASNotice =
      (PFWLXDISPLAYSASNOTICE) GetProcAddress(hDll, "WlxDisplaySASNotice");
   if (!pfWlxDisplaySASNotice) 
   {
      return FALSE;
   }

   pfWlxLoggedOutSAS = 
      (PFWLXLOGGEDOUTSAS) GetProcAddress(hDll, "WlxLoggedOutSAS");
   if (!pfWlxLoggedOutSAS) 
   {
      return FALSE;
   }

   pfWlxActivateUserShell =
      (PFWLXACTIVATEUSERSHELL) GetProcAddress(hDll, "WlxActivateUserShell");
   if (!pfWlxActivateUserShell) 
   {
      return FALSE;
   }

   pfWlxLoggedOnSAS =
      (PFWLXLOGGEDONSAS) GetProcAddress(hDll, "WlxLoggedOnSAS");
   if (!pfWlxLoggedOnSAS) 
   {
      return FALSE;
   }

   pfWlxDisplayLockedNotice =
      (PFWLXDISPLAYLOCKEDNOTICE) GetProcAddress(hDll, "WlxDisplayLockedNotice");
   if (!pfWlxDisplayLockedNotice) 
   {
      return FALSE;
   }

   pfWlxIsLockOk = 
      (PFWLXISLOCKOK) GetProcAddress(hDll, "WlxIsLockOk");
   if (!pfWlxIsLockOk) 
   {
      return FALSE;
   }

   pfWlxWkstaLockedSAS =
       (PFWLXWKSTALOCKEDSAS) GetProcAddress(hDll, "WlxWkstaLockedSAS");
   if (!pfWlxWkstaLockedSAS) 
   {
      return FALSE;
   }

   pfWlxIsLogoffOk = 
      (PFWLXISLOGOFFOK) GetProcAddress(hDll, "WlxIsLogoffOk");
   if (!pfWlxIsLogoffOk) 
   {
      return FALSE;
   }

   pfWlxLogoff = 
      (PFWLXLOGOFF) GetProcAddress(hDll, "WlxLogoff");
   if (!pfWlxLogoff) 
   {
      return FALSE;
   }

   pfWlxShutdown = 
      (PFWLXSHUTDOWN) GetProcAddress(hDll, "WlxShutdown");
   if (!pfWlxShutdown) 
   {
      return FALSE;
   }

   //
   // Load functions for version 1.1 as necessary.
   //
   if (dwWlxVersion > WLX_VERSION_1_0)
   {
      pfWlxStartApplication = 
         (PFWLXSTARTAPPLICATION) GetProcAddress(hDll, "WlxStartApplication");
      if (!pfWlxStartApplication)
      {
         return FALSE;
      }

      pfWlxScreenSaverNotify = 
         (PFWLXSCREENSAVERNOTIFY) GetProcAddress(hDll, "WlxScreenSaverNotify");
      if (!pfWlxScreenSaverNotify)
      {
         return FALSE;
      }
   }

   //
   // Load functions for version 1.3 as necessary.
   //
   if (dwWlxVersion > WLX_VERSION_1_2)
   {
      pfWlxNetworkProviderLoad = 
         (PFWLXNETWORKPROVIDERLOAD) 
            GetProcAddress(hDll, "WlxNetworkProviderLoad");
      if (!pfWlxNetworkProviderLoad)
      {
         return FALSE;
      }

      pfWlxDisplayStatusMessage =
         (PFWLXDISPLAYSTATUSMESSAGE) 
            GetProcAddress(hDll, "WlxDisplayStatusMessage");
      if (!pfWlxDisplayStatusMessage)
      {
         return FALSE;
      }

      pfWlxGetStatusMessage =
         (PFWLXGETSTATUSMESSAGE)
            GetProcAddress(hDll, "WlxGetStatusMessage");
      if (!pfWlxGetStatusMessage)
      {
         return FALSE;
      }

      pfWlxRemoveStatusMessage =
         (PFWLXREMOVESTATUSMESSAGE)
            GetProcAddress(hDll, "WlxRemoveStatusMessage");
      if (!pfWlxRemoveStatusMessage)
      {
         return FALSE;
      }
   }

   //
   // Load functions for newer version here...
   //

   //
   // Everything loaded OK.
   //
   return TRUE;
}


BOOL 
WINAPI 
WlxNegotiate (DWORD   dwWinlogonVersion,
              DWORD * pdwDllVersion)
{
   HINSTANCE hDll;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -