Пример #1
0
EFI_STATUS
MainMenuF9Func(
  IN EFI_MENU_PAGE                *Page
  )
/*++

Routine Description:

  Handle F9 key in case menu

Arguments:

  Page          - A pointer to the menu

Returns:

  EFI_SUCCESS   - Handle Space key successfully
  Other Value   - Something failed

--*/
{
  EFI_STATUS                Status;
  EFI_INPUT_KEY             Key;
  EFI_DIALOG_CONTEXT        MsgDialogContext;
  CHAR16                   *MsgDialogTitle;

  //
  //check parameter.
  //
  if (Page == NULL) {
    return EFI_INVALID_PARAMETER;
  }

  MsgDialogTitle = StrDuplicate (L"Prepare running...");
  MsgDialogContext.Type = EFI_DIALOG_TYPE_REMINDER;
  DoDialog (MsgDialogTitle, &MsgDialogContext);

  ST->ConOut->SetAttribute (
                ST->ConOut,
                EFI_LIGHTGRAY | EFI_BACKGROUND_BLACK
                );
  ST->ConOut->ClearScreen (ST->ConOut);

  Status = SctExecute ();
  if (Status != EFI_SUCCESS) {
    EFI_SCT_DEBUG ((EFI_SCT_D_ERROR, L"Execute - %r", Status));
  }

  //
  //Clear surplus key stroke.
  //
  Status = EFI_SUCCESS;
  while(!EFI_ERROR(Status)) {
    Status = ST->ConIn->ReadKeyStroke (ST->ConIn, &Key);
  }

  MenuPageRefresh (Page);
  return Status;
}
/* void showPageSetup (in nsIDOMWindow parent, in nsIPrintSettings printSettings); */
NS_IMETHODIMP 
nsPrintingPromptService::ShowPageSetup(nsIDOMWindow *parent, nsIPrintSettings *printSettings, nsIObserver *aObs)
{
    NS_ENSURE_ARG(printSettings);

    ParamBlock block;
    nsresult rv = block.Init();
    if (NS_FAILED(rv))
      return rv;

    block->SetInt(0, 0);
    return DoDialog(parent, block, nsnull, printSettings, kPageSetupDialogURL);
}
/* void showPrintDialog (in nsIDOMWindow parent, in nsIWebBrowserPrint webBrowserPrint, in nsIPrintSettings printSettings); */
NS_IMETHODIMP 
nsPrintingPromptService::ShowPrintDialog(nsIDOMWindow *parent, nsIWebBrowserPrint *webBrowserPrint, nsIPrintSettings *printSettings)
{
    NS_ENSURE_ARG(webBrowserPrint);
    NS_ENSURE_ARG(printSettings);

    ParamBlock block;
    nsresult rv = block.Init();
    if (NS_FAILED(rv))
      return rv;

    block->SetInt(0, 0);
    return DoDialog(parent, block, webBrowserPrint, printSettings, kPrintDialogURL);
}
Пример #4
0
NS_IMETHODIMP 
GtkNSSSecurityWarningDialogs::ConfirmPostToInsecure (nsIInterfaceRequestor *aContext,
						     PRBool* _retval)
{
	DoDialog (aContext,
		  INSECURE_SUBMIT_PREF,
		  GTK_MESSAGE_WARNING,
		  GTK_BUTTONS_CANCEL,
		  GTK_RESPONSE_ACCEPT,
		  _("Send information over an insecure connection?"),
		  _("The information you have entered will be sent over an "
		    "insecure connection, and could be intercepted "
		    "by a third party."),
		  _("_Send"),
		  _retval);

	return NS_OK;
}
Пример #5
0
NS_IMETHODIMP 
GtkNSSSecurityWarningDialogs::ConfirmMixedMode (nsIInterfaceRequestor *aContext,
						PRBool *_retval)
{
	DoDialog (aContext,
		  MIXEDCONTENT_PREF,
		  GTK_MESSAGE_INFO,
		  GTK_BUTTONS_OK,
		  GTK_RESPONSE_OK,
		  _("Parts of this page are loaded over an insecure connection"),
		  _("Some information you see or enter will be sent over an insecure "
		    "connection, and could be intercepted by a third party."),
		  nsnull, nsnull);

	/* The return value is ignored anyway:
	 * https://bugzilla.mozilla.org/show_bug.cgi?id=277806 */
	*_retval = PR_TRUE;
	return NS_OK;
}
Пример #6
0
NS_IMETHODIMP 
GtkNSSSecurityWarningDialogs::ConfirmEnteringSecure (nsIInterfaceRequestor *aContext,
						     PRBool *_retval)
{
	DoDialog (aContext,
		  ENTER_SITE_PREF,
		  GTK_MESSAGE_INFO,
		  GTK_BUTTONS_OK,
		  GTK_RESPONSE_OK,
		  _("This page is loaded over a secure connection"),
		  _("You can always see the security status of a page from "
		    "the padlock icon in the statusbar."),
		  nsnull, nsnull);

	/* The return value is ignored anyway:
	 * https://bugzilla.mozilla.org/show_bug.cgi?id=277806 */
	*_retval = PR_TRUE;
	return NS_OK;
}
Пример #7
0
NS_IMETHODIMP 
GtkNSSSecurityWarningDialogs::ConfirmPostToInsecureFromSecure (nsIInterfaceRequestor *aContext,
							       PRBool* _retval)
{
	DoDialog (aContext,
		  nsnull, /* No preference for this one - it's too important */
		  GTK_MESSAGE_WARNING,
		  GTK_BUTTONS_CANCEL,
		  GTK_RESPONSE_CANCEL,
		  _("Send information over an insecure connection?"),
		  _("Although this page was loaded over a secure connection, "
		    "the information you have entered will be sent over an "
		    "insecure connection, and could be intercepted by "
		    "a third party."),
		  _("_Send"),
		  _retval);

	return NS_OK;
}
/* void showPageSetup (in nsIDOMWindow parent, in nsIPrintSettings printSettings); */
NS_IMETHODIMP 
nsPrintingPromptService::ShowPageSetup(nsIDOMWindow *parent, nsIPrintSettings *printSettings, nsIObserver *aObs)
{
    NS_ENSURE_ARG(printSettings);

    // Try to access a component dialog
    nsCOMPtr<nsIPrintDialogService> dlgPrint(do_GetService(
                                             NS_PRINTDIALOGSERVICE_CONTRACTID));
    if (dlgPrint)
      return dlgPrint->ShowPageSetup(parent, printSettings);

    ParamBlock block;
    nsresult rv = block.Init();
    if (NS_FAILED(rv))
      return rv;

    block->SetInt(0, 0);
    return DoDialog(parent, block, nullptr, printSettings, kPageSetupDialogURL);
}
Пример #9
0
NS_IMETHODIMP 
GtkNSSSecurityWarningDialogs::ConfirmEnteringWeak (nsIInterfaceRequestor *aContext,
						   PRBool *_retval)
{
	DoDialog (aContext,
		  WEAK_SITE_PREF,
		  GTK_MESSAGE_INFO,
		  GTK_BUTTONS_OK,
		  GTK_RESPONSE_OK,
		  _("This page is loaded over a low security connection"),
		  _("Information you see or enter on this page could "
		    "be intercepted by some third parties."),
		  nsnull, nsnull);

	/* The return value is ignored anyway:
	 * https://bugzilla.mozilla.org/show_bug.cgi?id=277806 */
        *_retval = PR_TRUE;
	return NS_OK;
}
Пример #10
0
PF_Err
HandleEvent ( 
	PF_InData		*in_data,
	PF_OutData		*out_data,
	PF_ParamDef		*params[],
	PF_LayerDef		*output,
	PF_EventExtra	*extra )
{
	PF_Err		err		= PF_Err_NONE;
	
	if (!err) 
	{
		switch (extra->e_type) 
		{
			case PF_Event_DRAW:
				err =	DrawEvent(in_data, out_data, params, output, extra);
				break;
			
			case PF_Event_DO_CLICK:
				err = DoDialog(in_data, out_data, params, output);
				extra->evt_out_flags = PF_EO_HANDLED_EVENT;
				break;
				
			case PF_Event_ADJUST_CURSOR:
			#if defined(MAC_ENV)
				#if PF_AE_PLUG_IN_VERSION >= PF_AE100_PLUG_IN_VERSION
				SetMickeyCursor(); // the cute mickey mouse hand
				#else
				SetThemeCursor(kThemePointingHandCursor);
				#endif
				extra->u.adjust_cursor.set_cursor = PF_Cursor_CUSTOM;
			#else
				extra->u.adjust_cursor.set_cursor = PF_Cursor_FINGER_POINTER;
			#endif
				extra->evt_out_flags = PF_EO_HANDLED_EVENT;
				break;
		}
	}
	
	return err;
}
/* void showPrintDialog (in nsIDOMWindow parent, in nsIWebBrowserPrint webBrowserPrint, in nsIPrintSettings printSettings); */
NS_IMETHODIMP 
nsPrintingPromptService::ShowPrintDialog(nsIDOMWindow *parent, nsIWebBrowserPrint *webBrowserPrint, nsIPrintSettings *printSettings)
{
    NS_ENSURE_ARG(webBrowserPrint);
    NS_ENSURE_ARG(printSettings);

    // Try to access a component dialog
    nsCOMPtr<nsIPrintDialogService> dlgPrint(do_GetService(
                                             NS_PRINTDIALOGSERVICE_CONTRACTID));
    if (dlgPrint)
      return dlgPrint->Show(parent, printSettings, webBrowserPrint);

    // Show the built-in dialog instead
    ParamBlock block;
    nsresult rv = block.Init();
    if (NS_FAILED(rv))
      return rv;

    block->SetInt(0, 0);
    return DoDialog(parent, block, webBrowserPrint, printSettings, kPrintDialogURL);
}
Пример #12
0
static long	_DoubleCheckAndSetPassword( ChoosePasswordGlobals* choose )
{
PasswordString	secondPW;
Boolean			match;

	//	0.	Check for empty password. If so, just accept it.
	
	if ( choose->newPW[0] == 0 )
	{
		match = true;
	}
	else
	{
		//	1.  Ask user to re-enter the same password
		
		DoDialogParam( kReenterNewPassword, &secondPW );
		
		//	2.  Find out if 1st matched second
		
		match = ComparePW( &secondPW, &choose->newPW);
		
	}
	
	//	3.  Accept if it's a match, reject if not
	if (match)
	{
		ChangeUserPersonificationPart( GetCurrentLocalUser()->userID,
										kPersonificationPassword, &choose->newPW, false );
	}
	else
	{
		DoDialog( kNewPasswordNoMatch );
		RestoreTextState( choose->textState);	// since dialogs messed us up
		ResetEnteredPassword( choose );
	}
	
	//	4.  Return true/false result	- true means we're done with this screen

	return match;
}
/* void showPrinterProperties (in nsIDOMWindow parent, in wstring printerName, in nsIPrintSettings printSettings); */
NS_IMETHODIMP 
nsPrintingPromptService::ShowPrinterProperties(nsIDOMWindow *parent, const PRUnichar *printerName, nsIPrintSettings *printSettings)
{
    /* fixme: We simply ignore the |aPrinter| argument here
     * We should get the supported printer attributes from the printer and 
     * populate the print job options dialog with these data instead of using 
     * the "default set" here.
     * However, this requires changes on all platforms and is another big chunk
     * of patches ... ;-(
     */
    NS_ENSURE_ARG(printerName);
    NS_ENSURE_ARG(printSettings);

    ParamBlock block;
    nsresult rv = block.Init();
    if (NS_FAILED(rv))
      return rv;

    block->SetInt(0, 0);
    return DoDialog(parent, block, nullptr, printSettings, kPrinterPropertiesURL);
   
}
Пример #14
0
//
// Set the plugin params (Key or password )
// If several params are needed, they can be transmitted separated with ',' (comma)
// then translated if necessary. They also can be taken from the internal Plugin config
// 
// WARNING: The plugin is responsible for implementing necessary GUI or File/Registry reading
// to acquire additionnal parameters and to ensure their persistence if necessary.
// Same thing for events/errors logging.
// 
// This function can be called 2 times, both from vncviewer and WinVNC:
// 
// 1.If the user clicks on the Plugin's "config" button in vncviewer and WinVNC dialog boxes
//   In this case this function is called with hVNC != 0 (CASE 1)
//
//   -> szParams is a string formatted as follow: "Part1,Part2"
//   Part1 = "NoPassword"
//   Part2 = type of application that has loaded the plugin
//     "viewer"     : for vncviewer
//     "server-svc" : for WinVNC run as a service
//     "server-app" : for WINVNC run as an application
//
//   -> The Plugin Config dialog box is displayed if any.
// 
// 2.When then plugin is Inited from VNC viewer or Server, right after Startup() call (CASE 2);
//   In this case, this function is called with hVNC = 0 and
//   szParams is a string formatted as follows: "part1,Part2"
//   Part1 = The VNC password, if required by the GetParams() function return value
//   Part2 = type of application that has loaded the plugin
//      "viewer"     : for vncviewer
//      "server-svc" : for WinVNC run as a service
//      "server-app" : for WINVNC run as an application
//   (this info can be used for application/environnement dependent
//    operations (config saving...))
//   
TESTPLUGIN_API int SetParams(HWND hVNC, char* szParams)
{
	// CASE 1
	// Get the environnement (szLoaderType) value that is always sent from 
	// VNC viewer or server
	MyStrToken(szLoaderType, szParams, 2, ',');

	// If hVNC != 0, display for instance the Plugin Config Dialog box 
	if (hVNC)
	{
		// Display the Plugin Config dialog box
		DoDialog();
	}

	// CASE 2: 
	// Use szParams to setup the Plugin.
	// In this example Plugin, the externalkey is not used but we store it anyway.for demo.
	// (it corresponds to the VNC password as we require it in the GetParams() function below)
	MyStrToken(szExternalKey, szParams, 1, ',');

	return 1;
}
/* void showPageSetup (in nsIDOMWindow parent, in nsIPrintSettings printSettings); */
NS_IMETHODIMP 
nsPrintingPromptService::ShowPageSetup(nsIDOMWindow *parent, nsIPrintSettings *printSettings, nsIObserver *aObs)
{
    NS_ENSURE_ARG(printSettings);

    ParamBlock block;
    nsresult rv = block.Init();
    if (NS_FAILED(rv))
      return rv;

    block->SetInt(0, 0);
    rv = DoDialog(parent, block, printSettings, kPageSetupDialogURL);

    // if aWebBrowserPrint is not null then we are printing
    // so we want to pass back NS_ERROR_ABORT on cancel
    if (NS_SUCCEEDED(rv)) 
    {
      int32_t status;
      block->GetInt(0, &status);
      return status == 0?NS_ERROR_ABORT:NS_OK;
    }

    return rv;
}
Пример #16
0
EFI_STATUS
MainMenuClearFunc (
  IN EFI_MENU_PAGE                *Page
  )
{
  EFI_STATUS               Status;
  EFI_DIALOG_CONTEXT       MsgDialogContext;
  CHAR16                  *MsgDialogTitle;

  MsgDialogTitle = StrDuplicate (L"Deleting files ...");
  MsgDialogContext.Type = EFI_DIALOG_TYPE_REMINDER;

  DoDialog (MsgDialogTitle, &MsgDialogContext);

  Status = ResetAllTestResults ();
  MenuPageRefresh (Page);
  if (EFI_ERROR(Status)) {
    EFI_SCT_DEBUG ((EFI_SCT_D_ERROR, L"Reset test results - %r", Status));
    return Status;
  }

  gContinueExec = FALSE;
  return EFI_SUCCESS;
}
Пример #17
0
extern bool DoMainLoop( dlg_state * state )
/*****************************************/
{
    const char          *diag_list[MAX_DIAGS + 1];
    const char          *diags;
    const char          *dstdir;
    int                 dstlen;
    bool                got_disk_sizes = FALSE;
    int                 i;
    char                newdst[_MAX_PATH];
    char                *next;
    bool                ret = FALSE;

    SetupTitle();

    // display initial dialog
    diags = GetVariableStrVal( "DialogOrder" );
    if( stricmp( diags, "" ) == 0 ) {
        diags = "Welcome";
    }
    i = 0;
    for( ;; ) {
        diag_list[i] = diags;
        next = strchr( diags, ',' );
        if( next == NULL ) break;
        *next = '\0';
        diags = next + 1;
        ++i;
    }
    diag_list[i + 1] = NULL;
    /* process installation dialogs */

    i = 0;
    for( ;; ) {
        if( i < 0 ) break;
        if( diag_list[i] == NULL ) {
            if( GetVariableIntVal( "DoCopyFiles" ) == 1 ) {
                if( !CheckDrive( TRUE ) ) {
                    i = 0;
                }
            }
            if( GetVariableByName( "SetupPath" ) != NO_VAR ) {
                ret = TRUE;
                break;
            }
            if( diag_list[i] == NULL ) {
                    StatusShow( TRUE );
                    ret = SetupOperations();
                    StatusShow( FALSE );
                    if( ret ) DoDialog( "Finished" );
                    break;
            }
        }
        if( stricmp( diag_list[i], "GetDiskSizesHere" ) == 0 ) {
            if( *state == DLG_NEXT ) {

                dstdir = GetVariableStrVal( "DstDir" );
                dstlen = strlen( dstdir );
                if( dstlen != 0 &&
                    (dstdir[dstlen - 1] == '\\' || dstdir[dstlen - 1] == '/') ) {
                    strcpy( newdst, dstdir );
                    if( dstlen == 3 && dstdir[1] == ':' ) {
                        newdst[dstlen] = '.';
                        newdst[dstlen + 1] = '\0';
                    } else {
                        newdst[dstlen - 1] = '\0';
                    }
                    SetVariableByName( "DstDir", newdst );
                }
                SimSetNeedGetDiskSizes();
                ResetDiskInfo();
                got_disk_sizes = TRUE;

            }
        } else {
            *state = DoDialog( diag_list[i] );
            GUIWndDirty( NULL );
            StatusCancelled();
        }
        if( *state == DLG_CAN ) {
            if( MsgBox( NULL, "IDS_QUERYABORT", GUI_YES_NO ) == GUI_RET_YES ) {
                CancelSetup = TRUE;
                break;
            }
        } else if( *state == DLG_DONE ) {
            CancelSetup = TRUE;
            break;
        }
        if( got_disk_sizes ) {
            if( !CheckDrive( FALSE ) ) {
                break;
            }
        }
        if( *state == DLG_SAME ) {
            /* nothing */
        } else if( *state == DLG_NEXT || *state == DLG_SKIP ) {
            if( SkipDialogs ) {
                ++i;
            } else {
                for( ;; ) {
                    ++i;
                    if( diag_list[i] == NULL ) break;
                    if( CheckDialog( diag_list[i] ) ) break;
                }
            }
        } else if( *state == DLG_PREV ) {
            for( ;; ) {
                --i;
                if( i < 0 ) break;
                if( CheckDialog( diag_list[i] ) ) break;
            }
        } else if( *state == DLG_START ) {
            i = 0;
        }
    } /* for */

    return( ret );
}
Пример #18
0
EFI_STATUS
DisplayMainMenu (
  VOID
  )
/*++

Routine Description:

  Display the main menu

Returns:

  EFI_SUCCESS   - Display the menu successfully
  Other Value   - Something failed

--*/
{
  EFI_STATUS            Status;
  EFI_MENU_PAGE         *Page;
  EFI_DIALOG_CONTEXT    DialogContext;
  CHAR16                *DialogTitle;

  //
  // Create a standard menu
  //
  Status = CreateStandardMenuPage (
             L"Main Menu",
             &Page
             );
  if (EFI_ERROR(Status)) {
    return Status;
  }

  //
  // Main Menu Items
  //  - Test Case Management
  //  - Test Environment Configuration
  //  - Test Report Generator ...
  //  - Help
  //
  Status = AddSimpleMenuItem (
             EFI_ITEM_HAVE_SUBITEMS,
             L"Test Case Management",
             L"Select and execute test cases",
             (VOID *)(UINTN)EFI_MENU_ITEM_CASE_MANAGEMENT,
             Page
             );
  if (EFI_ERROR(Status)) {
    DestroyMenuPage (Page);
    return Status;
  }

  Status = AddSimpleMenuItem (
             EFI_ITEM_HAVE_SUBITEMS,
             L"Test Environment Configuration",
             L"Set configuration data for testing",
             (VOID *)(UINTN)EFI_MENU_ITEM_CONFIG,
             Page
             );
  if (EFI_ERROR(Status)) {
    DestroyMenuPage (Page);
    return Status;
  }

  Status = AddSimpleMenuItem (
             EFI_ITEM_HAVE_SUBITEMS,
             L"Test Device Configuration",
             L"Set device configuration data for IHV's add-in card testing",
             (VOID *)(UINTN)EFI_MENU_ITEM_DEVICE_CONFIG,
             Page
             );
  if (EFI_ERROR(Status)) {
    DestroyMenuPage (Page);
    return Status;
  }

  Status = AddSimpleMenuItem (
             EFI_ITEM_HAVE_SUBITEMS,
             L"View Test Log ...",
             L"View test log",
             (VOID *)(UINTN)EFI_MENU_ITEM_VIEW_LOG,
             Page
             );
  if (EFI_ERROR(Status)) {
    DestroyMenuPage (Page);
    return Status;
  }

  Status = AddSimpleMenuItem (
             EFI_ITEM_HAVE_SUBITEMS,
             L"Test Report Generator ...",
             L"Generate test report",
             (VOID *)(UINTN)EFI_MENU_ITEM_REPORT_GENERATOR,
             Page
             );
  if (EFI_ERROR(Status)) {
    DestroyMenuPage (Page);
    return Status;
  }

#if (EFI_SPECIFICATION_VERSION == 0x0001000A)
  Status = AddSimpleMenuItem (
             EFI_ITEM_HAVE_SUBITEMS,
             L"Help",
             L"EFI1.1 Self Certification Test is a toolkit to check an EFI1.1 "
             L"implementation is EFI1.1 Specification compliant or not.",
             (VOID *)(UINTN)EFI_MENU_ITEM_UTILITY,
             Page
             );
#elif (EFI_SPECIFICATION_VERSION == 0x00020000)
  Status = AddSimpleMenuItem (
             EFI_ITEM_HAVE_SUBITEMS,
             L"Help",
             L"UEFI2.0 Self Certification Test is a toolkit to check an UEFI2.0 "
             L"implementation is UEFI2.0 Specification compliant or not.",
             (VOID *)(UINTN)EFI_MENU_ITEM_UTILITY,
             Page
             );
#elif (EFI_SPECIFICATION_VERSION == 0x0002000A)
  Status = AddSimpleMenuItem (
             EFI_ITEM_HAVE_SUBITEMS,
             L"Help",
             L"UEFI2.1 Self Certification Test is a toolkit to check an UEFI2.1 "
             L"implementation is UEFI2.1 Specification compliant or not.",
             (VOID *)(UINTN)EFI_MENU_ITEM_UTILITY,
             Page
             );
#elif (EFI_SPECIFICATION_VERSION == 0x0002001E)
  Status = AddSimpleMenuItem (
             EFI_ITEM_HAVE_SUBITEMS,
             L"Help",
             L"UEFI2.3 Self Certification Test is a toolkit to check an UEFI2.3 "
             L"implementation is UEFI2.3 Specification compliant or not.",
             (VOID *)(UINTN)EFI_MENU_ITEM_UTILITY,
             Page
             );
#elif (EFI_SPECIFICATION_VERSION == 0x0002001F)
  Status = AddSimpleMenuItem (
             EFI_ITEM_HAVE_SUBITEMS,
             L"Help",
             L"UEFI2.3.1C Self Certification Test is a toolkit to check an UEFI2.3.1C "
             L"implementation is UEFI2.3.1C Specification compliant or not.",
             (VOID *)(UINTN)EFI_MENU_ITEM_UTILITY,
             Page
             );
#endif  
  if (EFI_ERROR(Status)) {
    DestroyMenuPage (Page);
    return Status;
  }

  //
  // Main Menu Hot Keys
  //  - Up, Down, Enter, Esc, F5, F6
  //
  Status = AddHotKey (
             L"Up/Dn",
             L"Select Item",
             SCAN_UP,
             CHAR_NULL,
             UpFunc,
             TRUE,
             Page
             );
  if (EFI_ERROR(Status)) {
    DestroyMenuPage (Page);
    return Status;
  }

  Status = AddHotKey (
             L"Down",
             L"Select Item",
             SCAN_DOWN,
             CHAR_NULL,
             DownFunc,
             FALSE,
             Page
             );
  if (EFI_ERROR(Status)) {
    DestroyMenuPage (Page);
    return Status;
  }

  Status = AddHotKey (
             L"F4",
             L"Reset results",
             SCAN_F4,
             CHAR_NULL,
             MainMenuClearFunc,
             TRUE,
             Page
             );
  if (EFI_ERROR(Status)) {
    DestroyMenuPage (Page);
    return Status;
  }

  Status = AddHotKey (
             L"F5",
             L"Load Sequence",
             SCAN_F5,
             CHAR_NULL,
             MainMenuLoadSeqFunc,
             TRUE,
             Page
             );
  if (EFI_ERROR (Status)) {
    DestroyMenuPage (Page);
    return Status;
  }

  Status = AddHotKey (
             L"F6",
             L"Save Sequence",
             SCAN_F6,
             CHAR_NULL,
             MainMenuSaveSeqFunc,
             TRUE,
             Page
             );
  if (EFI_ERROR (Status)) {
    DestroyMenuPage (Page);
    return Status;
  }

  Status = AddHotKey (
             L"Enter",
             L"Select SubMenu",
             SCAN_NULL,
             CHAR_CARRIAGE_RETURN,
             MainMenuEnterFunc,
             TRUE,
             Page
             );
  if (EFI_ERROR(Status)) {
    DestroyMenuPage (Page);
    return Status;
  }

  Status = AddHotKey (
             L"ESC",
             L"Exit",
             SCAN_ESC,
             CHAR_NULL,
             MainMenuEscFunc,
             TRUE,
             Page
             );
  if (EFI_ERROR(Status)) {
    DestroyMenuPage (Page);
    return Status;
  }

  Status = AddHotKey (
             L"F9",
             L"Run",
             SCAN_F9,
             CHAR_NULL,
             MainMenuF9Func,
             FALSE,
             Page
             );
  if (EFI_ERROR (Status)) {
    DestroyMenuPage (Page);
    return Status;
  }
  //
  // Display the main menu
  //
  MenuPageRefresh (Page);

  //
  //If start from recovery, remind user to continue running
  //
  if (!IsTestFinished () && !gForceExecution) {
    //
    //Execution was not finished in last time. Display yes or no dialog
    //
    DialogContext.Type = EFI_DIALOG_TYPE_YES_OR_NO;

    //
    //Set Yes as default choise
    //
    DialogContext.ChooseNumber = EFI_DIALOG_SELECT_YES;
    DialogTitle = StrDuplicate (L"Continue Run?");

    //
    //Display ask dialog
    //
    DoDialog (DialogTitle, &DialogContext);

    if (DialogContext.ChooseNumber == EFI_DIALOG_SELECT_YES) {

      //
      //Change to running background
      //
      ST->ConOut->SetAttribute (
                    ST->ConOut,
                    EFI_LIGHTGRAY | EFI_BACKGROUND_BLACK
                    );
      ST->ConOut->ClearScreen (ST->ConOut);
      Status = SctContinueExecute ();
      gContinueExec = FALSE;
      if (EFI_ERROR (Status)) {
        EFI_SCT_DEBUG ((EFI_SCT_D_ERROR, L"Continue execute - %r", Status));
      }
    } else {

      //
      //user choose not to continue run immediatly, set global flag, let user to
      //continue run later
      //
      gContinueExec = TRUE;
    }
    MenuPageRefresh (Page);
  } else {

    //
    //not start from recovery mode
    //
    gContinueExec = FALSE;
  }

  //
  // Start to handle input keys
  //
  MenuPageKeyInput ();

  return EFI_SUCCESS;
}
Пример #19
0
int FAR PASCAL EditServerObject(OBJECTID theObject)
  {
	return DoDialog(MAKEINTRESOURCE(DLGSIGNALS), (FARPROC)SignalsDlgProc, (OBJECTID)theObject);
  }
Пример #20
0
VOID
DisplayReportGenerator(
  IN EFI_MENU_PAGE                *Page
  )
{

  EFI_STATUS               Status;
  EFI_FILE_DIALOG_CONTEXT *DialogContext;
  CHAR16                  *FileName;
  EFI_DIALOG_CONTEXT       MsgDialogContext;
  CHAR16                  *MsgDialogTitle;
  CHAR16                  *LogFilePath;

  DialogContext = NULL;
  //
  //allocate a new efi file dialog context.
  //
  Status = BS->AllocatePool (
                 EfiBootServicesData,
                 sizeof(EFI_FILE_DIALOG_CONTEXT),
                 (VOID **)&DialogContext
                 );
  if (EFI_ERROR (Status)) {
    return;
  }

  BS->SetMem (DialogContext, sizeof(EFI_FILE_DIALOG_CONTEXT), 0);
  DialogContext->DialogType = EFI_FILE_DIALOG_TYPE_SAVE_FILE;
  DialogContext->FileType = EFI_FILTER_FILE_TYPE_CSV;

  //
  //get filename through FileDialog
  //
  Status = DoFileDialog (DialogContext);

  if (EFI_ERROR (Status)) {
    MsgDialogTitle = StrDuplicate (L"Generate Report Error!");
    MsgDialogContext.Type = EFI_DIALOG_TYPE_MESSAGE;
    MenuPageRefresh (Page);
    DoDialog (MsgDialogTitle, &MsgDialogContext);
  } else if (DialogContext->DevicePath != NULL && DialogContext->FileName != NULL
      && DialogContext->FileName[0] != L'\0') {
    //
    //make up file name
    //
    if (StrLen (DialogContext->FileName) > 4 &&
      StriCmp (DialogContext->FileName + StrLen (DialogContext->FileName) - 4, L".csv") == 0) {
      FileName = StrDuplicate (DialogContext->FileName);
    } else if ( StrLen (DialogContext->FileName) > 1 &&
      StriCmp (DialogContext->FileName + StrLen (DialogContext->FileName) - 1, L".") == 0) {
      FileName = PoolPrint (L"%scsv", DialogContext->FileName);
    } else {
      FileName = PoolPrint (L"%s.csv", DialogContext->FileName);
    }
    if (FileName == NULL) {
      BS->FreePool (DialogContext->DevicePath);
      BS->FreePool (DialogContext->FileName);
      BS->FreePool (DialogContext);
      return;
    }

    MsgDialogTitle = StrDuplicate (L"Wait a few minutes...");
    MsgDialogContext.Type = EFI_DIALOG_TYPE_REMINDER;
    MenuPageRefresh (Page);
    DoDialog (MsgDialogTitle, &MsgDialogContext);

    LogFilePath = PoolPrint (
                    L"%s\\%s",
                    gFT->FilePath,
                    EFI_SCT_PATH_LOG
                    );
    if (LogFilePath == NULL) {
      return;
    }

    //
    // Generate the report file
    //
    Status = GenerateReport (
               gFT->DevicePath,
               LogFilePath,
               DialogContext->DevicePath,
               FileName
               );

    if (EFI_ERROR (Status)) {
      MsgDialogTitle = StrDuplicate (L"Generate Report Error!");
    } else {
      MsgDialogTitle = StrDuplicate (L"Generate Report Succeed!");
    }

    MsgDialogContext.Type = EFI_DIALOG_TYPE_MESSAGE;

    DoDialog (MsgDialogTitle, &MsgDialogContext);

    BS->FreePool (FileName);
    BS->FreePool (DialogContext->DevicePath);
    BS->FreePool (DialogContext->FileName);
  } else {
    if (DialogContext->FileName != NULL) {
      BS->FreePool (DialogContext->FileName);
    }
    if (DialogContext->DevicePath != NULL) {
      BS->FreePool (DialogContext->DevicePath);
    }
  }

  BS->FreePool (DialogContext);
  MenuPageRefresh (Page);
  return;
}
Пример #21
0
int
OpenTelnetConnection(void)
{
  int nReturn, ret;
  struct sockaddr_in sockaddr;
  char *p;
  static struct kstream_crypt_ctl_block ctl;
  char buf[128];

  tmpConfig = calloc(sizeof(CONFIG), 1);
	
  if (bAutoConnection) {
    tmpConfig->title = calloc(lstrlen(szHostName), 1);
    lstrcpy(tmpConfig->title, (char *) szHostName);
  } else {
    nReturn = DoDialog("OPENTELNETDLG", OpenTelnetDlg);
    if (nReturn == FALSE)
      return(FALSE);
  }
					 	
  con = (CONNECTION *) GetNewConnection();
  if (con == NULL)
    return(0);

  tmpConfig->width =
    GetPrivateProfileInt(INI_TELNET, INI_WIDTH, DEF_WIDTH, TELNET_INI);

  tmpConfig->height =
    GetPrivateProfileInt(INI_TELNET, INI_HEIGHT, DEF_HEIGHT, TELNET_INI);
  con->width = tmpConfig->width;
  con->height = tmpConfig->height;

  con->backspace = SaveHostName(tmpConfig->title, port_no);

  if (con->backspace == VK_BACK) {
    tmpConfig->backspace = TRUE;
    con->ctrl_backspace = 0x7f;
  } else {
    tmpConfig->backspace = FALSE;
    con->ctrl_backspace = 0x08;
  }

  tmpConfig->hwndTel = hWnd;
  con->pScreen = InitNewScreen(tmpConfig);
  if (!con->pScreen) {
    assert(FALSE);
    free(con->pScreen);
    free(con);
    free(tmpConfig);
    return(-1);
  }

  ret = (SOCKET) socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
	
  if (ret == SOCKET_ERROR) {
    wsprintf(buf, "Socket error on socket = %d!", WSAGetLastError());
    MessageBox(NULL, buf, NULL, MB_OK | MB_ICONEXCLAMATION);
    if (con->pScreen != NULL)
      DestroyWindow(con->pScreen->hWnd);
    free(con);
    free(tmpConfig);
    return(-1);
  } 
	
  con->socket = ret;
	
  sockaddr.sin_family = AF_INET;  
  sockaddr.sin_addr.s_addr = htonl(INADDR_ANY);
  sockaddr.sin_port = htons(0);
	
  ret = bind(con->socket, (struct sockaddr *) &sockaddr, 
	     (int) sizeof(struct sockaddr_in));
	
  if (ret == SOCKET_ERROR) {
    wsprintf(buf, "Socket error on bind!");
    MessageBox(NULL, buf, NULL, MB_OK | MB_ICONEXCLAMATION);
    if (con->pScreen != NULL)
      DestroyWindow(con->pScreen->hWnd);
    free(con);
    free(tmpConfig);
    return(-1);
  }

  WSAAsyncSelect(con->socket, hWnd, WM_NETWORKEVENT,
		 FD_READ | FD_CLOSE | FD_CONNECT);

  lstrcpy(szHostName, tmpConfig->title);
  p = strchr(szHostName, '@');
  if (p != NULL) {
    *p = 0;
    strcpy (szUserName, szHostName);
    strcpy(szHostName, ++p);
  }

  WSAAsyncGetHostByName(hWnd, WM_HOSTNAMEFOUND, szHostName, hostdata, 
			MAXGETHOSTSTRUCT);

  ctl.encrypt = auth_encrypt;
  ctl.decrypt = auth_decrypt;
  ctl.init = auth_init;
  ctl.destroy = auth_destroy;

  con->ks = kstream_create_from_fd(con->socket, &ctl, NULL);

  if (con->ks == NULL)
    return(-1);

  kstream_set_buffer_mode(con->ks, 0);

  return(1);
}
Пример #22
0
EFI_STATUS
MainMenuSaveSeqFunc (
  IN EFI_MENU_PAGE                *Page
  )
{
  EFI_STATUS              Status;
  EFI_FILE_DIALOG_CONTEXT *DialogContext;
  CHAR16                  *FileName;
  EFI_DIALOG_CONTEXT       MsgDialogContext;
  CHAR16                  *MsgDialogTitle;

  DialogContext = NULL;
  //
  //allocate a new efi file dialog context.
  //
  Status = BS->AllocatePool (
                 EfiBootServicesData,
                 sizeof(EFI_FILE_DIALOG_CONTEXT),
                 (VOID **)&DialogContext
                 );
  if (EFI_ERROR (Status)) {
    return EFI_DEVICE_ERROR;
  }

  BS->SetMem (DialogContext, sizeof(EFI_FILE_DIALOG_CONTEXT), 0);
  DialogContext->DialogType = EFI_FILE_DIALOG_TYPE_SAVE_FILE;
  DialogContext->FileType = EFI_FILTER_FILE_TYPE_SEQ;

  //
  //get devicepath and filename through FileDialog
  //
  Status = DoFileDialog (DialogContext);

  if (EFI_ERROR (Status)) {
    MsgDialogTitle = StrDuplicate (L"Save Sequence Error!");
    MsgDialogContext.Type = EFI_DIALOG_TYPE_MESSAGE;
    MenuPageRefresh (Page);
    DoDialog (MsgDialogTitle, &MsgDialogContext);
  } else if (DialogContext->DevicePath != NULL && DialogContext->FileName != NULL
    && DialogContext->FileName[0] != L'\0') {
    //
    //make up file name
    //
    if (StrLen (DialogContext->FileName) > 4 &&
      StriCmp (DialogContext->FileName + StrLen (DialogContext->FileName) - 4, L".seq") == 0) {
      FileName = StrDuplicate (DialogContext->FileName);
    }else if ( StrLen (DialogContext->FileName) > 1 &&
       StriCmp (DialogContext->FileName + StrLen (DialogContext->FileName) - 1, L".") == 0) {
       FileName = PoolPrint (L"%sseq", DialogContext->FileName);
    }else {
      FileName = PoolPrint (L"%s.seq", DialogContext->FileName);
    }
    if (FileName == NULL) {
      BS->FreePool (DialogContext->DevicePath);
      BS->FreePool (DialogContext->FileName);
      BS->FreePool (DialogContext);
      return EFI_DEVICE_ERROR;
    }

    Status = SaveTestSequence (
               gFT->DevicePath,
               FileName,
               &gFT->TestCaseList
               );
    if (EFI_ERROR (Status)) {
      MsgDialogTitle = StrDuplicate (L"Save sequence Error!");
    } else {
      MsgDialogTitle = StrDuplicate (L"Save sequence Succeed!");
    }

    MsgDialogContext.Type = EFI_DIALOG_TYPE_MESSAGE;
    MenuPageRefresh (Page);
    DoDialog (MsgDialogTitle, &MsgDialogContext);

    BS->FreePool (FileName);
    BS->FreePool (DialogContext->DevicePath);
    BS->FreePool (DialogContext->FileName);
  } else {
    if (DialogContext->FileName != NULL) {
      BS->FreePool (DialogContext->FileName);
    }
    if (DialogContext->DevicePath != NULL) {
      BS->FreePool (DialogContext->DevicePath);
    }
  }

  BS->FreePool (DialogContext);
  MenuPageRefresh (Page);
  return EFI_SUCCESS;
}
Пример #23
0
EFI_STATUS
MainMenuLoadSeqFunc (
  IN EFI_MENU_PAGE                *Page
  )
{
  EFI_STATUS              Status;
  EFI_FILE_DIALOG_CONTEXT *DialogContext;
  CHAR16                  *FileName;
  EFI_DIALOG_CONTEXT       MsgDialogContext;
  CHAR16                  *MsgDialogTitle;

  DialogContext = NULL;
  //
  //allocate a new efi file dialog context.
  //
  Status = BS->AllocatePool (
                 EfiBootServicesData,
                 sizeof(EFI_FILE_DIALOG_CONTEXT),
                 (VOID **)&DialogContext
                 );
  if (EFI_ERROR (Status)) {
    return EFI_DEVICE_ERROR;
  }

  BS->SetMem (DialogContext, sizeof(EFI_FILE_DIALOG_CONTEXT), 0);
  DialogContext->DialogType = EFI_FILE_DIALOG_TYPE_OPEN_FILE;
  DialogContext->FileType = EFI_FILTER_FILE_TYPE_SEQ;

  //
  //get filename through FileDialog
  //
  Status = DoFileDialog (DialogContext);

  if (EFI_ERROR (Status)) {
    MsgDialogTitle = StrDuplicate (L"Load Sequence Error!");
    MsgDialogContext.Type = EFI_DIALOG_TYPE_MESSAGE;
    MenuPageRefresh (Page);
    DoDialog (MsgDialogTitle, &MsgDialogContext);
  } else if (DialogContext->DevicePath != NULL && DialogContext->FileName != NULL
    && DialogContext->FileName[0] != L'\0') {
    //
    //make up file name
    //
    FileName = StrDuplicate (DialogContext->FileName);
    if (FileName == NULL) {
      BS->FreePool (DialogContext->DevicePath);
      BS->FreePool (DialogContext->FileName);
      BS->FreePool (DialogContext);
      return EFI_DEVICE_ERROR;
    }

    Status = ResetTestCaseOrder ();

    Status = LoadTestSequence (
               gFT->DevicePath,
               FileName,
               &gFT->TestCaseList
               );
    if (EFI_ERROR (Status)) {
      MsgDialogTitle = StrDuplicate (L"Load Sequence Error!");
    } else {
      MsgDialogTitle = StrDuplicate (L"Load Sequence Succeed!");
    }

    MsgDialogContext.Type = EFI_DIALOG_TYPE_MESSAGE;
    MenuPageRefresh (Page);
    DoDialog (MsgDialogTitle, &MsgDialogContext);

    BS->FreePool (FileName);
    BS->FreePool (DialogContext->DevicePath);
    BS->FreePool (DialogContext->FileName);
  } else {
    if (DialogContext->FileName != NULL) {
      BS->FreePool (DialogContext->FileName);
    }
    if (DialogContext->DevicePath != NULL) {
      BS->FreePool (DialogContext->DevicePath);
    }
  }

  BS->FreePool (DialogContext);
  MenuPageRefresh (Page);
  return EFI_SUCCESS;
}
Пример #24
0
VOID
DisplayLog (
  IN EFI_MENU_PAGE                *Page
  )
{

  EFI_STATUS               Status;
  EFI_FILE_DIALOG_CONTEXT *DialogContext;
  CHAR16                  *FileName;
  EFI_DIALOG_CONTEXT       MsgDialogContext;
  CHAR16                  *MsgDialogTitle;
  CHAR16                  *CmdLine;

  DialogContext = NULL;
  //
  //allocate a new efi file dialog context.
  //
  Status = BS->AllocatePool (
                 EfiBootServicesData,
                 sizeof(EFI_FILE_DIALOG_CONTEXT),
                 (VOID **)&DialogContext
                 );
  if (EFI_ERROR (Status)) {
    return;
  }

  BS->SetMem (DialogContext, sizeof(EFI_FILE_DIALOG_CONTEXT), 0);
  DialogContext->DialogType = EFI_FILE_DIALOG_TYPE_OPEN_FILE;
  DialogContext->FileType = EFI_FILTER_FILE_TYPE_LOG;

  //
  //get filename through FileDialog
  //
  Status = DoLogFileDialog (DialogContext);

  if (EFI_ERROR (Status)) {
    MsgDialogTitle = StrDuplicate (L"Display Log Error!");
    MsgDialogContext.Type = EFI_DIALOG_TYPE_MESSAGE;
    MenuPageRefresh (Page);
    DoDialog (MsgDialogTitle, &MsgDialogContext);
  } else if (DialogContext->DevicePath != NULL && DialogContext->FileName != NULL
      && DialogContext->FileName[0] != L'\0') {
    //
    //make up file name
    //
    if (StrLen (DialogContext->FileName) > 4 &&
      StriCmp (DialogContext->FileName + StrLen (DialogContext->FileName) - 4, L".log") == 0) {
      FileName = StrDuplicate (DialogContext->FileName);
    }else if ( StrLen (DialogContext->FileName) > 1 &&
       StriCmp (DialogContext->FileName + StrLen (DialogContext->FileName) - 1, L".") == 0) {
       FileName = PoolPrint (L"%slog", DialogContext->FileName);
    }else {
      FileName = PoolPrint (L"%s.log", DialogContext->FileName);
    }
    if (FileName == NULL) {
      BS->FreePool (DialogContext->DevicePath);
      BS->FreePool (DialogContext->FileName);
      BS->FreePool (DialogContext);
      return;
    }

    MsgDialogTitle = StrDuplicate (L"Wait a few minutes...");
    MsgDialogContext.Type = EFI_DIALOG_TYPE_REMINDER;

    //
    //set default Console Attribute and clear the screen
    //
    ST->ConOut->SetAttribute (ST->ConOut, EFI_BACKGROUND_BLACK | EFI_WHITE);
    ST->ConOut->ClearScreen (ST->ConOut);

    CmdLine = PoolPrint (L"%s \"%s\"", gFT->ConfigData->EditCommandString, FileName);
    if (CmdLine != NULL) {
      Status = ShellExecute (
                 gFT->ImageHandle,
                 CmdLine,
                 FALSE
                 );
      if (EFI_ERROR (Status)) {
        MsgDialogTitle = StrDuplicate (L"Cannot open the log file! Please check the edit command in the configuration page.");
        MsgDialogContext.Type = EFI_DIALOG_TYPE_MESSAGE;

        DoDialog (MsgDialogTitle, &MsgDialogContext);
      }

      BS->FreePool (CmdLine);
    }

    BS->FreePool (FileName);
    BS->FreePool (DialogContext->DevicePath);
    BS->FreePool (DialogContext->FileName);
  } else {
    if (DialogContext->FileName != NULL) {
      BS->FreePool (DialogContext->FileName);
    }
    if (DialogContext->DevicePath != NULL) {
      BS->FreePool (DialogContext->DevicePath);
    }
  }

  BS->FreePool (DialogContext);
  MenuPageRefresh (Page);
  return;
}