48 ANSI_STRING ArcSystemString, ArcString, LanmanRedirector, LoaderPathNameA;
55 sprintf(
Buffer,
"\\ArcName\\%s", LoaderBlock->ArcHalDeviceName);
62 sprintf(
Buffer,
"\\ArcName\\%s", LoaderBlock->ArcBootDeviceName);
77 LoaderBlock->ArcBootDeviceName,
82 if ((SingleDisk) &&
strstr(LoaderBlock->ArcBootDeviceName,
"cdrom"))
106 sprintf(
Buffer,
"\\ArcName\\%s", LoaderBlock->ArcBootDeviceName);
172 ULONG DiskNumber, CdRomCount, CheckSum,
i, EnabledDisks = 0;
190 GUID_DEVINTERFACE_CDROM,
195 NotEnabledPresent =
TRUE;
205 NextEntry = NextEntry->
Flink)
211 if (
strcmp(LoaderBlock->ArcBootDeviceName, ArcDiskSignature->
ArcName) == 0)
216 ArcDiskSignature =
NULL;
220 if (!ArcDiskSignature)
222 DPRINT(
"Failed finding a cd that could match current boot device\n");
230 DPRINT(
"Failed allocating resources!\n");
236 if (EnabledDisks > CdRomCount)
238 CdRomCount = EnabledDisks;
242 if (NotEnabledPresent && !EnabledDisks)
254 for (DiskNumber = 0, EnabledDisks = 0; DiskNumber < CdRomCount; DiskNumber++)
257 if (lSymbolicLinkList && *lSymbolicLinkList !=
UNICODE_NULL)
365 for (
i = 0;
i < 2048 /
sizeof(
ULONG);
i++)
376 if (CheckSum + ArcDiskSignature->
CheckSum == 0)
379 sprintf(ArcBuffer,
"\\ArcName\\%s", LoaderBlock->ArcBootDeviceName);
387 DPRINT(
"Boot device found\n");
436 PDRIVE_LAYOUT_INFORMATION_EX DriveLayout =
NULL;
440 ANSI_STRING ArcBootString, ArcSystemString, DeviceStringA, ArcNameStringA, HalPathStringA;
449 GUID_DEVINTERFACE_DISK,
454 NotEnabledPresent =
TRUE;
465 if (EnabledDisks > DiskCount)
467 DiskCount = EnabledDisks;
471 if (NotEnabledPresent && !EnabledDisks)
483 for (DiskNumber = 0; DiskNumber < DiskCount; DiskNumber++)
488 if (lSymbolicLinkList && *lSymbolicLinkList !=
UNICODE_NULL)
538 if (NotEnabledPresent && *lSymbolicLinkList ==
UNICODE_NULL)
553 DiskCount = DiskNumber + 20;
559 sprintf(
Buffer,
"\\Device\\Harddisk%lu\\Partition0", DiskNumber);
590 sizeof(DiskGeometry),
679 for (
i = 0, CheckSum = 0;
i < 512 /
sizeof(
ULONG);
i++)
700 NextEntry = NextEntry->
Flink)
712 if ((SingleDisk && (DiskCount == 1) &&
715 (ArcDiskSignature->
CheckSum + CheckSum == 0)))
745 for (
i = 1;
i <= DriveLayout->PartitionCount;
i++)
764 DPRINT(
"Found boot device\n");
786 sprintf(ArcBuffer,
"\\ArcName\\%spartition(%lu)", ArcDiskSignature->
ArcName,
i);
811 (ArcDiskSignature->
CheckSum + CheckSum != 0))
813 DPRINT(
"Be careful, you have a duplicate disk signature, or a virus altered your MBR!\n");
848 WCHAR ArcNameBuffer[64];
854 sprintf(
Buffer,
"\\ArcName\\%s", LoaderBlock->ArcBootDeviceName);
876 ArcName.
Buffer = ArcNameBuffer;
950 _In_ PDRIVE_LAYOUT_INFORMATION_EX DriveLayout,
955 if (!ArcDiskSignature->ValidPartitionTable)
962 if (DriveLayout->Mbr.Signature == ArcDiskSignature->Signature)
974 if (ArcDiskSignature->IsGpt &&
975 IsEqualGUID((
PGUID)&ArcDiskSignature->GptSignature, &DriveLayout->Gpt.DiskId))
int strcmp(const char *String1, const char *String2)
char * strstr(char *String1, char *String2)
ACPI_SIZE strlen(const char *String)
_In_ PFCB _In_ LONGLONG StartingOffset
_In_z_ PCHAR TargetString
#define IOCTL_DISK_GET_DRIVE_GEOMETRY
_In_ PCHAR _In_ ULONG DeviceNumber
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
#define NT_SUCCESS(StatCode)
static const WCHAR Signature[]
static const WCHAR Cleanup[]
#define ExAllocatePoolWithTag(hernya, size, tag)
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
#define KeInitializeEvent(pEvt, foo, foo2)
#define NonPagedPoolCacheAligned
NTSTATUS NTAPI IoReadPartitionTableEx(IN PDEVICE_OBJECT DeviceObject, IN PDRIVE_LAYOUT_INFORMATION_EX *DriveLayout)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define OBJ_CASE_INSENSITIVE
PCONFIGURATION_INFORMATION NTAPI IoGetConfigurationInformation(VOID)
Returns a pointer to the I/O manager's global configuration information structure.
#define ExFreePoolWithTag(_P, _T)
#define sprintf(buf, format,...)
static OUT PIO_STATUS_BLOCK IoStatusBlock
#define InitializeObjectAttributes(p, n, a, r, s)
#define SYMBOLIC_LINK_ALL_ACCESS
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToAnsiString(PANSI_STRING DestinationString, PUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
NTSYSAPI VOID NTAPI RtlCopyString(PSTRING DestinationString, PSTRING SourceString)
#define FILE_READ_ATTRIBUTES
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
NTSYSAPI BOOLEAN NTAPI RtlEqualString(PSTRING String1, PSTRING String2, BOOLEAN CaseInSensitive)
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
_In_ ULONG _In_ ULONG _In_ ULONG Length
#define IOCTL_STORAGE_GET_DEVICE_NUMBER
BOOLEAN IoRemoteBootClient
NTSTATUS IopFetchConfigurationInformation(_Out_ PWSTR *SymbolicLinkList, _In_ GUID Guid, _In_ ULONG ExpectedInterfaces, _Out_ PULONG Interfaces)
VOID IopStoreSystemPartitionInformation(_In_ PUNICODE_STRING NtSystemPartitionDeviceName, _In_ PUNICODE_STRING OsLoaderPathName)
NTSTATUS NTAPI IopCreateArcNamesDisk(IN PLOADER_PARAMETER_BLOCK LoaderBlock, IN BOOLEAN SingleDisk, OUT PBOOLEAN FoundBoot)
NTSTATUS NTAPI IopCreateArcNamesCd(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
UNICODE_STRING IoArcHalDeviceName
UNICODE_STRING IoArcBootDeviceName
NTSTATUS NTAPI IopReassignSystemRoot(IN PLOADER_PARAMETER_BLOCK LoaderBlock, OUT PANSI_STRING NtBootPath)
BOOLEAN IopVerifyDiskSignature(_In_ PDRIVE_LAYOUT_INFORMATION_EX DriveLayout, _In_ PARC_DISK_SIGNATURE ArcDiskSignature, _Out_ PULONG Signature)
PCHAR IoLoaderArcBootDeviceName
NTSTATUS NTAPI IopCreateArcNames(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
NTSTATUS NTAPI IoGetDeviceObjectPointer(IN PUNICODE_STRING ObjectName, IN ACCESS_MASK DesiredAccess, OUT PFILE_OBJECT *FileObject, OUT PDEVICE_OBJECT *DeviceObject)
PIRP NTAPI IoBuildSynchronousFsdRequest(IN ULONG MajorFunction, IN PDEVICE_OBJECT DeviceObject, IN PVOID Buffer, IN ULONG Length, IN PLARGE_INTEGER StartingOffset, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
PIRP NTAPI IoBuildDeviceIoControlRequest(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, IN PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN InternalDeviceIoControl, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
NTSTATUS NTAPI ObCloseHandle(IN HANDLE Handle, IN KPROCESSOR_MODE AccessMode)
NTSTATUS NTAPI NtMakeTemporaryObject(IN HANDLE ObjectHandle)
NTSTATUS NTAPI NtQuerySymbolicLinkObject(IN HANDLE LinkHandle, OUT PUNICODE_STRING LinkTarget, OUT PULONG ResultLength OPTIONAL)
NTSTATUS NTAPI NtCreateSymbolicLinkObject(OUT PHANDLE LinkHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN PUNICODE_STRING LinkTarget)
NTSTATUS NTAPI NtOpenSymbolicLinkObject(OUT PHANDLE LinkHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes)
#define IsEqualGUID(rguid1, rguid2)
BOOLEAN ValidPartitionTable
struct _LIST_ENTRY * Flink
#define RtlCopyMemory(Destination, Source, Length)
#define CONTAINING_RECORD(address, type, field)
#define STATUS_INSUFFICIENT_RESOURCES
_In_ PDEVICE_OBJECT DeviceObject
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
_In_opt_ PDEVICE_OBJECT _In_ ULONG _Outptr_result_nullonfailure_ _At_ * SymbolicLinkList(return==0, __drv_allocatesMem(Mem))) PZZWSTR *SymbolicLinkList
#define IoAssignArcName(_ArcName, _DeviceName)
_In_ ULONG _In_ BOOLEAN _Out_ struct _DRIVE_LAYOUT_INFORMATION ** PartitionBuffer
#define ObDereferenceObject