阅读:2869回复:12
如何在用户登陆前用服务启动程序操作
我想在用户登陆前弹出一个对话框或者一个做一些操作请问我该如何去做呢,有没有什么例子
|
|
|
沙发#
发布于:2003-07-02 19:36
用gina.
|
|
板凳#
发布于:2003-07-04 09:37
用gina好像太麻烦,我看了一下,不是那么容易实现的。还有没有其他的好方法呢?
|
|
|
地板#
发布于:2003-07-16 11:57
platform sdk里面有gina的2个例子,稍微修改一下就可以用了,很简单。
|
|
|
地下室#
发布于:2003-07-17 13:23
那么在win98下呢,win98没有msgina
|
|
5楼#
发布于:2003-07-20 09:36
np
|
|
|
6楼#
发布于:2003-07-20 16:51
我试了一下没有成功,我在ginastub的WlxDisplaySASNotice函数中调用了WlxDialogBoxParam想显示一个对话框,可是没有成功。
VOID WINAPI WlxDisplaySASNotice( PVOID pWlxContext) { g_pWinlogon->WlxDialogBoxParam(hGlobalWlx, hDllInstance, (LPTSTR) MAKEINTRESOURCE(IDD_INITDLG), NULL, WelcomeDlgProc, 0 ); GWlxDisplaySASNotice( pWlxContext ); } 请问我错在那里 |
|
|
7楼#
发布于:2003-07-20 23:27
通过服务调用你要创建对话框的程序。
|
|
|
8楼#
发布于:2003-07-21 15:16
拜托,这不是讨论GINA的地方,比较easy的可以拿到csdn上讨论,给你些代码。
#include <stdio.h> #include \"gina.h\" #include \"ginastub.h\" /* Location of the real msgina. */ #define REALGINA_PATH TEXT(\"MSGINA.DLL\") /* winlogon version */ DWORD WlxVersion; /* Functions pointers to the real msgina which we will call. */ PGWLX_Negotiate GWlxNegotiate; PGWLX_Initialize GWlxInitialize; PGWLX_DisplaySASNotice GWlxDisplaySASNotice; PGWLX_LoggedOutSAS GWlxLoggedOutSAS; PGWLX_ActivateUserShell GWlxActivateUserShell; PGWLX_LoggedOnSAS GWlxLoggedOnSAS; PGWLX_DisplayLockedNotice GWlxDisplayLockedNotice; PGWLX_WkstaLockedSAS GWlxWkstaLockedSAS; PGWLX_IsLockOk GWlxIsLockOk; PGWLX_IsLogoffOk GWlxIsLogoffOk; PGWLX_Logoff GWlxLogoff; PGWLX_Shutdown GWlxShutdown; /* NEW for version 1.1 */ PGWLX_StartApplication GWlxStartApplication; PGWLX_ScreenSaverNotify GWlxScreenSaverNotify; PWLX_DISPATCH_VERSION_1_0 pWlxFuncs; BOOL IS_LOCKED=FALSE; /* DllMain() is called when the gina.dll is first loaded. It\'s unlikely that you * will need to modify it. */ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) { switch (dwReason) { case DLL_PROCESS_ATTACH: DisableThreadLibraryCalls (hInstance); hDllInstance = hInstance; #if DBG InitDebugSupport(); #endif case DLL_PROCESS_DETACH: default: return(TRUE); } } /* hook into the real GINA. */ static BOOL MyInitialize(void) { HINSTANCE hDll; /* Load MSGINA.DLL. */ if (! (hDll = LoadLibrary(REALGINA_PATH))) return FALSE; /* Get pointers to all of the WLX functions in the real MSGINA. */ GWlxNegotiate = (PGWLX_Negotiate) GetProcAddress(hDll, \"WlxNegotiate\"); if (! GWlxNegotiate) return FALSE; GWlxInitialize = (PGWLX_Initialize) GetProcAddress(hDll, \"WlxInitialize\"); if (! GWlxInitialize) return FALSE; GWlxDisplaySASNotice = (PGWLX_DisplaySASNotice) GetProcAddress(hDll, \"WlxDisplaySASNotice\"); if (! GWlxDisplaySASNotice) return FALSE; GWlxLoggedOutSAS = (PGWLX_LoggedOutSAS) GetProcAddress(hDll, \"WlxLoggedOutSAS\"); if (! GWlxLoggedOutSAS) return FALSE; GWlxActivateUserShell = (PGWLX_ActivateUserShell) GetProcAddress(hDll, \"WlxActivateUserShell\"); if (! GWlxActivateUserShell) return FALSE; GWlxLoggedOnSAS = (PGWLX_LoggedOnSAS) GetProcAddress(hDll, \"WlxLoggedOnSAS\"); if (! GWlxLoggedOnSAS) return FALSE; GWlxDisplayLockedNotice = (PGWLX_DisplayLockedNotice) GetProcAddress(hDll, \"WlxDisplayLockedNotice\"); if (! GWlxDisplayLockedNotice) return FALSE; GWlxIsLockOk = (PGWLX_IsLockOk) GetProcAddress(hDll, \"WlxIsLockOk\"); if (! GWlxIsLockOk) return FALSE; GWlxWkstaLockedSAS = (PGWLX_WkstaLockedSAS) GetProcAddress(hDll, \"WlxWkstaLockedSAS\"); if (! GWlxWkstaLockedSAS) return FALSE; GWlxIsLogoffOk = (PGWLX_IsLogoffOk) GetProcAddress(hDll, \"WlxIsLogoffOk\"); if (! GWlxIsLogoffOk) return FALSE; GWlxLogoff = (PGWLX_Logoff) GetProcAddress(hDll, \"WlxLogoff\"); if (! GWlxLogoff) return FALSE; GWlxShutdown = (PGWLX_Shutdown) GetProcAddress(hDll, \"WlxShutdown\"); if (! GWlxShutdown) return FALSE; /* Don\'t check for failure because these don\'t exist prior to NT 4.0 */ GWlxStartApplication = (PGWLX_StartApplication) GetProcAddress(hDll, \"WlxStartApplication\"); GWlxScreenSaverNotify = (PGWLX_ScreenSaverNotify) GetProcAddress(hDll, \"WlxScreenSaverNotify\"); /* Everything loaded ok. Return success. */ return TRUE; } /* WlxNegotiate() is called from WinLogon after the gina.dll starts. We agree * on compatability and return. It\'s unlikely that you will need to modify it. */ BOOL WINAPI WlxNegotiate(DWORD dwWinlogonVersion, DWORD *pdwDllVersion) { MyInitialize(); DebugLog((DEB_TRACE, \"WlxNegotiate: called\")); if (dwWinlogonVersion < WLX_CURRENT_VERSION) { DebugLog((DEB_ERROR, \"WlxNegotiate: unknown version \'%d\'\", dwWinlogonVersion)); return(FALSE); } *pdwDllVersion = WLX_CURRENT_VERSION; DebugLog((DEB_TRACE, \"WlxNegotiate: successful\")); return(TRUE); } /* WlxInitialize() is called for us to set up our pWlxContext (which is then passed to * all subsequent GINA function calls), our secure-action-sequence (SAS) method (we\'re * using control-alt-delete), and to set up anything else we need to. * You may want to modify the pWlxContext initialization to point to a structure of your * choosing instead, but it\'s probably easier if you just tailor the PGlobals structure * to your needs. */ BOOL WINAPI WlxInitialize(LPWSTR lpWinsta, HANDLE hWlx, PVOID pvReserved, PVOID pWinlogonFunctions, PVOID *pWlxContext) { PGlobals pGlobals; pWlxFuncs = (PWLX_DISPATCH_VERSION_1_0) pWinlogonFunctions; hGlobalWlx = hWlx; pGlobals = LocalAlloc(LMEM_FIXED | LMEM_ZEROINIT, sizeof(Globals)); *pWlxContext = (PVOID) pGlobals; pWlxFuncs->WlxUseCtrlAltDel(hWlx); InitCommonControls(); return(TRUE); } //+--------------------------------------------------------------------------- // Function: WlxDisplaySASNotice // Synopsis: Where we display the welcome, we\'re waiting dialog box //---------------------------------------------------------------------------- VOID WINAPI WlxDisplaySASNotice(PVOID pContext) { int Result; Result = pWlxFuncs->WlxDialogBoxParam( hGlobalWlx, hDllInstance, (LPTSTR) MAKEINTRESOURCE(IDD_WELCOME_DLG), NULL, WelcomeDlgProc, 0 ); } int CALLBACK WelcomeDlgProc( HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam) { switch (Message) { case WM_INITDIALOG: Warn_Time_Out(); // 时间限制警告 CenterWindow(hDlg); //m_Wnd_Welcome是CWnd m_Wnd_Welcome.SubclassWindow(hDlg); BOOL ret; ret=m_bmpBackground_without_a_doctor.LoadResource(hDllInstance, MAKEINTRESOURCE(IDB_NORMAL_BITMAP)); VERIFY(m_HollowBrush.CreateStockObject(HOLLOW_BRUSH)); wndWelcomeDialog=( WNDPROC )GetWindowLong( hDlg, GWL_WNDPROC ); SetWindowLong( hDlg,GWL_WNDPROC,(LONG)MyWelcomeWnd); return(TRUE); case WM_COMMAND: return FALSE; case WM_CLOSE: m_Wnd_Welcome.UnsubclassWindow(); return(TRUE); case WM_DESTROY: m_Wnd_Welcome.UnsubclassWindow(); return TRUE; default: return(FALSE); } } 算了算了,太长了,就贴这些,愿对你有启示,另外,GINA,的编译也有讲究的哦,如果不会配置VC 的 IDE最好是用微软的例子中的编译文件。 |
|
9楼#
发布于:2003-07-21 15:20
对了,上文中的
Warn_Time_Out(); // 时间限制警告 不要学哟,是我吓人玩的。 |
|
10楼#
发布于:2003-07-22 19:56
代码和我写的差不错,可是好像总是没有预想的那样,我把GWlxDisplaySASNotice给注释掉也没有什么错误,可能是编译的问题,能解释一下如何编译么?
|
|
|
11楼#
发布于:2003-07-23 12:46
我以前做过一个gina
结论是 如果你的dialog里面有任何ActiveX 则你需要在该线程里面调用CoInitializeEx(...) |
|
12楼#
发布于:2003-07-24 18:41
9x:可以VXD调用EXE.用APPTIME方式.
|
|