Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[driver] Do not attempt to display boot-screen text when /NOGUIBOOT i…
…s used

Modified-by: Michael Brown <mbrown@fensystems.co.uk>
Signed-off-by: Michael Brown <mbrown@fensystems.co.uk>
  • Loading branch information
TalAloni authored and mcb30 committed Oct 9, 2011
1 parent 3f33a9e commit 99490e2
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/driver/boottext.c
Expand Up @@ -62,6 +62,9 @@ VOID NTAPI InbvSolidColorFill ( IN ULONG Left, IN ULONG Top, IN ULONG Width,
IN ULONG Height, IN ULONG Color );
VOID NTAPI InbvSetProgressBarSubset ( IN ULONG Floor, IN ULONG Ceiling );

/** Graphical boot is enabled (i.e. /NOGUIBOOT switch is not present) */
BOOLEAN guiboot_enabled = TRUE;

/** Boot text is enabled */
BOOLEAN boottext_enabled = TRUE;

Expand All @@ -84,6 +87,10 @@ VOID BootPrint ( const char *fmt, ... ) {
/* Log to debugger, if attached */
DbgPrint ( "%s", buf );

/* Do nothing more unless graphical boot is enabled */
if ( ! guiboot_enabled )
return;

/* Do nothing more unless boot text is enabled */
if ( ! boottext_enabled )
return;
Expand Down
1 change: 1 addition & 0 deletions src/driver/boottext.h
Expand Up @@ -19,6 +19,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

extern BOOLEAN guiboot_enabled;
extern BOOLEAN boottext_enabled;

extern VOID BootPrint ( const char *fmt, ... );
Expand Down
53 changes: 53 additions & 0 deletions src/driver/sanbootconf.c
Expand Up @@ -69,6 +69,50 @@ static const PWCHAR sanbootconf_device_symlink[] = {
L"\\DosDevices\\iSCSIBoot",
};

/**
* Load system start options
*
* @ret ntstatus NT status
*/
static NTSTATUS load_start_options ( VOID ) {
LPCWSTR key_name = ( L"\\Registry\\Machine\\SYSTEM\\"
L"CurrentControlSet\\Control" );
LPWSTR options;
PWCHAR optchar;
HANDLE reg_key;
NTSTATUS status;

/* Open Control key */
status = reg_open ( &reg_key, key_name, NULL );
if ( ! NT_SUCCESS ( status ) ) {
DbgPrint ( "Could not open Control key: %x\n", status );
goto err_reg_open;
}

/* Retrieve SystemStartOptions parameter */
status = reg_fetch_sz ( reg_key, L"SystemStartOptions", &options );
if ( ! NT_SUCCESS ( status ) ) {
DbgPrint ( "Could not read SystemStartOptions parameter: %x\n",
status );
goto err_reg_fetch_sz;
}
DbgPrint ( "SystemStartOptions are %S\n", options );

/* Check for /NOGUIBOOT option */
for ( optchar = options ; *optchar ; optchar++ )
*optchar = towupper ( *optchar );
if ( wcsstr ( options, L"/NOGUIBOOT" ) != NULL )
guiboot_enabled = FALSE;
DbgPrint ( "Graphical boot is %s\n",
( guiboot_enabled ? "enabled" : "disabled" ) );

ExFreePool ( options );
err_reg_fetch_sz:
reg_close ( reg_key );
err_reg_open:
return status;
}

/**
* Load driver parameters
*
Expand Down Expand Up @@ -536,6 +580,15 @@ NTSTATUS DriverEntry ( IN PDRIVER_OBJECT DriverObject,

DbgPrint ( "SAN Boot Configuration Driver initialising\n" );

/* Load start options */
status = load_start_options();
if ( ! NT_SUCCESS ( status ) ) {
/* Treat as non-fatal error */
DbgPrint ( "Could not load system start options: %x\n",
status );
status = STATUS_SUCCESS;
}

/* Load driver parameters */
status = load_parameters ( RegistryPath->Buffer );
if ( ! NT_SUCCESS ( status ) ) {
Expand Down

0 comments on commit 99490e2

Please sign in to comment.