nustzhua
驱动中牛
驱动中牛
  • 注册日期2002-06-19
  • 最后登录2015-09-27
  • 粉丝0
  • 关注0
  • 积分18分
  • 威望2点
  • 贡献值0点
  • 好评度1点
  • 原创分0分
  • 专家分0分
阅读:2869回复:12

如何在用户登陆前用服务启动程序操作

楼主#
更多 发布于:2003-07-01 17:48
我想在用户登陆前弹出一个对话框或者一个做一些操作请问我该如何去做呢,有没有什么例子
不限容量的免费邮箱 www.k65.net
vcmfc
驱动中牛
驱动中牛
  • 注册日期2001-03-23
  • 最后登录2008-01-28
  • 粉丝0
  • 关注0
  • 积分528分
  • 威望53点
  • 贡献值0点
  • 好评度52点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2003-07-02 19:36
用gina.
nustzhua
驱动中牛
驱动中牛
  • 注册日期2002-06-19
  • 最后登录2015-09-27
  • 粉丝0
  • 关注0
  • 积分18分
  • 威望2点
  • 贡献值0点
  • 好评度1点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2003-07-04 09:37
用gina好像太麻烦,我看了一下,不是那么容易实现的。还有没有其他的好方法呢?
不限容量的免费邮箱 www.k65.net
rayyang2000
管理员
管理员
  • 注册日期2001-03-23
  • 最后登录2012-09-13
  • 粉丝3
  • 关注0
  • 积分1036分
  • 威望925点
  • 贡献值3点
  • 好评度823点
  • 原创分0分
  • 专家分0分
地板#
发布于:2003-07-16 11:57
platform sdk里面有gina的2个例子,稍微修改一下就可以用了,很简单。
天天coding-debugging中----超稀饭memory dump file ======================================================== [b]Windows Device Driver Development and Consulting Service[/b] [color=blue][url]http://www.ybwork.com[/url][/color] ========================================================
jfx_lion
驱动牛犊
驱动牛犊
  • 注册日期2003-02-12
  • 最后登录2006-05-25
  • 粉丝0
  • 关注0
  • 积分10分
  • 威望1点
  • 贡献值0点
  • 好评度1点
  • 原创分0分
  • 专家分0分
地下室#
发布于:2003-07-17 13:23
那么在win98下呢,win98没有msgina
rayyang2000
管理员
管理员
  • 注册日期2001-03-23
  • 最后登录2012-09-13
  • 粉丝3
  • 关注0
  • 积分1036分
  • 威望925点
  • 贡献值3点
  • 好评度823点
  • 原创分0分
  • 专家分0分
5楼#
发布于:2003-07-20 09:36
np
天天coding-debugging中----超稀饭memory dump file ======================================================== [b]Windows Device Driver Development and Consulting Service[/b] [color=blue][url]http://www.ybwork.com[/url][/color] ========================================================
nustzhua
驱动中牛
驱动中牛
  • 注册日期2002-06-19
  • 最后登录2015-09-27
  • 粉丝0
  • 关注0
  • 积分18分
  • 威望2点
  • 贡献值0点
  • 好评度1点
  • 原创分0分
  • 专家分0分
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 );
}
请问我错在那里
不限容量的免费邮箱 www.k65.net
lifeship
驱动小牛
驱动小牛
  • 注册日期2002-10-18
  • 最后登录2005-07-19
  • 粉丝0
  • 关注0
  • 积分6分
  • 威望2点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
7楼#
发布于:2003-07-20 23:27
通过服务调用你要创建对话框的程序。
杯汝前来,  老子今朝,  放荡形骸!  甚长年抱渴,  咽如焦釜,  于今喜醉,  气似奔雷!  慢说刘伶,  古今达者,  醉后何妨死便埋! 
SupermiLG
驱动牛犊
驱动牛犊
  • 注册日期2003-01-28
  • 最后登录2006-02-03
  • 粉丝0
  • 关注0
  • 积分10分
  • 威望1点
  • 贡献值0点
  • 好评度1点
  • 原创分0分
  • 专家分0分
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最好是用微软的例子中的编译文件。
SupermiLG
驱动牛犊
驱动牛犊
  • 注册日期2003-01-28
  • 最后登录2006-02-03
  • 粉丝0
  • 关注0
  • 积分10分
  • 威望1点
  • 贡献值0点
  • 好评度1点
  • 原创分0分
  • 专家分0分
9楼#
发布于:2003-07-21 15:20
对了,上文中的
 Warn_Time_Out(); // 时间限制警告
不要学哟,是我吓人玩的。
nustzhua
驱动中牛
驱动中牛
  • 注册日期2002-06-19
  • 最后登录2015-09-27
  • 粉丝0
  • 关注0
  • 积分18分
  • 威望2点
  • 贡献值0点
  • 好评度1点
  • 原创分0分
  • 专家分0分
10楼#
发布于:2003-07-22 19:56
代码和我写的差不错,可是好像总是没有预想的那样,我把GWlxDisplaySASNotice给注释掉也没有什么错误,可能是编译的问题,能解释一下如何编译么?
不限容量的免费邮箱 www.k65.net
liming
驱动牛犊
驱动牛犊
  • 注册日期2001-06-12
  • 最后登录2010-02-21
  • 粉丝0
  • 关注0
  • 积分116分
  • 威望12点
  • 贡献值0点
  • 好评度11点
  • 原创分0分
  • 专家分0分
11楼#
发布于:2003-07-23 12:46
我以前做过一个gina
结论是
如果你的dialog里面有任何ActiveX
则你需要在该线程里面调用CoInitializeEx(...)
Yss
Yss
驱动牛犊
驱动牛犊
  • 注册日期2002-01-29
  • 最后登录2005-06-28
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
12楼#
发布于:2003-07-24 18:41
9x:可以VXD调用EXE.用APPTIME方式.
游客

返回顶部