[driver] Allow boot text to be disabled via "BootText" registry parameter

Suggested-by: Tal Aloni <tal.aloni.il@gmail.com>
Signed-off-by: Michael Brown <mbrown@fensystems.co.uk>
This commit is contained in:
Michael Brown 2011-08-15 18:37:05 +01:00
parent 8b48fa5f8e
commit 3285a5aa91

View File

@ -25,6 +25,7 @@
#include "ibft.h"
#include "sbft.h"
#include "abft.h"
#include "registry.h"
#include "boottext.h"
/** Maximum time to wait for system disk, in seconds */
@ -68,6 +69,41 @@ static const PWCHAR sanbootconf_device_symlink[] = {
L"\\DosDevices\\iSCSIBoot",
};
/**
* Load driver parameters
*
* @v key_name Driver key name
* @ret ntstatus NT status
*/
static NTSTATUS load_parameters ( LPCWSTR key_name ) {
HANDLE reg_key;
ULONG boottext;
NTSTATUS status;
/* Open Parameters key */
status = reg_open ( &reg_key, key_name, L"Parameters", NULL );
if ( ! NT_SUCCESS ( status ) ) {
DbgPrint ( "Could not open Parameters key: %x\n", status );
goto err_reg_open;
}
/* Retrieve BootText parameter */
status = reg_fetch_dword ( reg_key, L"BootText", &boottext );
if ( NT_SUCCESS ( status ) ) {
boottext_enabled = ( ( boottext != 0 ) ? TRUE : FALSE );
DbgPrint ( "Boot screen text is %s\n",
( boottext_enabled ? "enabled" : "disabled" ) );
} else {
DbgPrint ( "Could not read BootText parameter: %x\n", status );
/* Treat as non-fatal error */
status = STATUS_SUCCESS;
}
reg_close ( reg_key );
err_reg_open:
return status;
}
/**
* Dummy IRP handler
*
@ -493,6 +529,14 @@ NTSTATUS DriverEntry ( IN PDRIVER_OBJECT DriverObject,
DbgPrint ( "SAN Boot Configuration Driver initialising\n" );
/* Load driver parameters */
status = load_parameters ( RegistryPath->Buffer );
if ( ! NT_SUCCESS ( status ) ) {
/* Treat as non-fatal error */
DbgPrint ( "Could not load parameters: %x\n", status );
status = STATUS_SUCCESS;
}
/* Hook in driver methods */
DriverObject->MajorFunction[IRP_MJ_CREATE] = sanbootconf_dummy_irp;
DriverObject->MajorFunction[IRP_MJ_CLOSE] = sanbootconf_dummy_irp;