home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / winfe / cxinit.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.7 KB  |  77 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18. #include "stdafx.h"
  19.  
  20. #include "dialog.h"
  21.  
  22. /*----------------------------------------------------------------------**
  23. ** Hack alert.                                                          **
  24. ** The following code is needed so that backend libraries can perform   **
  25. ** a small set of operations before we are initialized.                 **
  26. ** In specific, the fortezza security lib may call FE_PromptPassword    **
  27. ** via the context function table before we ever have finished creating **
  28. ** a window.                                                            **
  29. **----------------------------------------------------------------------*/
  30.  
  31. char *sux_PromptPassword(MWContext *pContext, const char *pMessage)    {
  32.     char *pRetval = NULL;
  33.     
  34.     char *pWinMessage = FE_Windowsify(pMessage);
  35.     if(pWinMessage)  {
  36.         CWnd desktop;
  37.         desktop.Attach(::GetDesktopWindow());
  38.         CDialogPASS dlgPass(&desktop);
  39.         theApp.m_splash.SafeHide();
  40.         
  41.         pRetval = dlgPass.DoModal(pWinMessage);
  42.         
  43.         XP_FREE(pWinMessage);
  44.         pWinMessage = NULL;
  45.         desktop.Detach();
  46.     }
  47.     
  48.     return(pRetval);
  49. }
  50.  
  51. MWContext *FE_GetInitContext(void)  {
  52.     static MWContext *pCX = NULL;
  53.     static _ContextFuncs sFux;
  54.     static MWContext sCX;
  55.     
  56.     //  First time through, init context.
  57.     //  Note, it should only set up the information
  58.     //      needed to get the back end libraries by.
  59.     //  It should not be added to the global context
  60.     //      list or be routed through any of the CAbstractCX
  61.     //      derived classes.  ETC.
  62.     if(pCX == NULL) {
  63.         memset(&sCX, 0, sizeof(sCX));
  64.         memset(&sFux, 0, sizeof(sFux));
  65.  
  66.         //  Set up required functions.
  67.         sFux.PromptPassword = sux_PromptPassword;
  68.         
  69.         //  Fill in the context.
  70.         sCX.funcs = &sFux;
  71.         pCX = &sCX;
  72.     }
  73.     
  74.     return(pCX);
  75. }
  76.  
  77.