*/
VOID
FASTCALL
-INIT_FUNCTION
IopDisplayLoadingMessage(PUNICODE_STRING ServiceName)
{
CHAR TextBuffer[256];
_In_ PUNICODE_STRING ServiceName)
{
UNICODE_STRING SystemRootString = RTL_CONSTANT_STRING(L"\\SystemRoot\\");
- UNICODE_STRING DriversPathString = RTL_CONSTANT_STRING(L"\\SystemRoot\\system32\\drivers\\");
+ UNICODE_STRING DriversPathString = RTL_CONSTANT_STRING(L"\\SystemRoot\\System32\\drivers\\");
UNICODE_STRING DotSysString = RTL_CONSTANT_STRING(L".sys");
UNICODE_STRING InputImagePath;
PLDR_DATA_TABLE_ENTRY LdrEntry;
PLIST_ENTRY NextEntry;
UNICODE_STRING ServiceName;
+ BOOLEAN Success;
/*
* Display 'Loading XXX...' message
/*
* Strip the file extension from ServiceName
*/
- RtlCreateUnicodeString(&ServiceName, FileNameWithoutPath);
+ Success = RtlCreateUnicodeString(&ServiceName, FileNameWithoutPath);
+ if (!Success)
+ {
+ return STATUS_INSUFFICIENT_RESOURCES;
+ }
+
FileExtension = wcsrchr(ServiceName.Buffer, '.');
if (FileExtension != NULL)
{
NextEntry = NextEntry->Flink;
}
- NT_ASSERT(NextEntry != &PsLoadedModuleList);
+ ASSERT(NextEntry != &PsLoadedModuleList);
/*
* Initialize the driver
/* Set the unload invoked flag and call the unload routine */
DriverObject->Flags |= DRVO_UNLOAD_INVOKED;
Status = IopLoadUnloadDriver(NULL, &DriverObject);
- NT_ASSERT(Status == STATUS_SUCCESS);
+ ASSERT(Status == STATUS_SUCCESS);
/* Mark the driver object temporary, so it could be deleted later */
ObMakeTemporaryObject(DriverObject);
/* Create a random name and set up the string*/
NameLength = (USHORT)swprintf(NameBuffer,
DRIVER_ROOT_NAME L"%08u",
- KeTickCount);
+ KeTickCount.LowPart);
LocalDriverName.Length = NameLength * sizeof(WCHAR);
LocalDriverName.MaximumLength = LocalDriverName.Length + sizeof(UNICODE_NULL);
LocalDriverName.Buffer = NameBuffer;
ObjectSize = sizeof(DRIVER_OBJECT) + sizeof(EXTENDED_DRIVER_EXTENSION);
InitializeObjectAttributes(&ObjectAttributes,
&LocalDriverName,
- OBJ_PERMANENT | OBJ_CASE_INSENSITIVE,
+ OBJ_PERMANENT | OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
NULL,
NULL);
{
PLOAD_UNLOAD_PARAMS LoadParams = Parameter;
- NT_ASSERT(PsGetCurrentProcess() == PsInitialSystemProcess);
+ ASSERT(PsGetCurrentProcess() == PsInitialSystemProcess);
LoadParams->Status = IopLoadUnloadDriver(LoadParams->RegistryPath,
&LoadParams->DriverObject);
KeSetEvent(&LoadParams->Event, 0, FALSE);
*/
Status = IopGetDriverObject(DriverObject,
&ServiceName,
- (Type == 2 /* SERVICE_FILE_SYSTEM_DRIVER */ ||
- Type == 8 /* SERVICE_RECOGNIZER_DRIVER */));
+ (Type == SERVICE_FILE_SYSTEM_DRIVER ||
+ Type == SERVICE_RECOGNIZER_DRIVER));
if (!NT_SUCCESS(Status))
{
Status = IopInitializeDriverModule(DeviceNode,
ModuleObject,
&DeviceNode->ServiceName,
- (Type == 2 /* SERVICE_FILE_SYSTEM_DRIVER */ ||
- Type == 8 /* SERVICE_RECOGNIZER_DRIVER */),
+ (Type == SERVICE_FILE_SYSTEM_DRIVER ||
+ Type == SERVICE_RECOGNIZER_DRIVER),
DriverObject);
if (!NT_SUCCESS(Status))
{