mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 07:13:23 +00:00
[SETUPLIB][USETUP] Diverse additions.
- Use NT string safe functions. - Add support for other bootloaders; - Update a couple of comments; - Remove deprecated __REACTOS__ #ifdefs. svn path=/branches/setup_improvements/; revision=74713
This commit is contained in:
parent
563d9f26c4
commit
cacae6d9a0
5 changed files with 166 additions and 92 deletions
|
@ -127,11 +127,11 @@ _MyGetFileSystem(
|
|||
FileFsAttribute = (PFILE_FS_ATTRIBUTE_INFORMATION)Buffer;
|
||||
|
||||
/* Set PartitionRootPath */
|
||||
swprintf(PathBuffer,
|
||||
// L"\\Device\\Harddisk%lu\\Partition%lu", // Should work! But because ReactOS sucks atm. it actually doesn't work!!
|
||||
L"\\Device\\Harddisk%lu\\Partition%lu\\", // HACK: Use this as a temporary hack!
|
||||
PartEntry->DiskEntry->DiskNumber,
|
||||
PartEntry->PartitionNumber);
|
||||
RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
|
||||
// L"\\Device\\Harddisk%lu\\Partition%lu", // Should work! But because ReactOS sucks atm. it actually doesn't work!!
|
||||
L"\\Device\\Harddisk%lu\\Partition%lu\\", // HACK: Use this as a temporary hack!
|
||||
PartEntry->DiskEntry->DiskNumber,
|
||||
PartEntry->PartitionNumber);
|
||||
RtlInitUnicodeString(&PartitionRootPath, PathBuffer);
|
||||
DPRINT("PartitionRootPath: %wZ\n", &PartitionRootPath);
|
||||
|
||||
|
|
|
@ -110,9 +110,9 @@ GetDriverName(
|
|||
RtlInitUnicodeString(&DiskEntry->DriverName,
|
||||
NULL);
|
||||
|
||||
swprintf(KeyName,
|
||||
L"\\Scsi\\Scsi Port %hu",
|
||||
DiskEntry->Port);
|
||||
RtlStringCchPrintfW(KeyName, ARRAYSIZE(KeyName),
|
||||
L"\\Scsi\\Scsi Port %hu",
|
||||
DiskEntry->Port);
|
||||
|
||||
RtlZeroMemory(&QueryTable,
|
||||
sizeof(QueryTable));
|
||||
|
@ -366,7 +366,9 @@ EnumerateBiosDiskEntries(
|
|||
AdapterCount = 0;
|
||||
while (1)
|
||||
{
|
||||
swprintf(Name, L"%s\\%lu", ROOT_NAME, AdapterCount);
|
||||
RtlStringCchPrintfW(Name, ARRAYSIZE(Name),
|
||||
L"%s\\%lu",
|
||||
ROOT_NAME, AdapterCount);
|
||||
Status = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE,
|
||||
Name,
|
||||
&QueryTable[2],
|
||||
|
@ -377,7 +379,9 @@ EnumerateBiosDiskEntries(
|
|||
break;
|
||||
}
|
||||
|
||||
swprintf(Name, L"%s\\%lu\\DiskController", ROOT_NAME, AdapterCount);
|
||||
RtlStringCchPrintfW(Name, ARRAYSIZE(Name),
|
||||
L"%s\\%lu\\DiskController",
|
||||
ROOT_NAME, AdapterCount);
|
||||
Status = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE,
|
||||
Name,
|
||||
&QueryTable[2],
|
||||
|
@ -387,7 +391,9 @@ EnumerateBiosDiskEntries(
|
|||
{
|
||||
while (1)
|
||||
{
|
||||
swprintf(Name, L"%s\\%lu\\DiskController\\0", ROOT_NAME, AdapterCount);
|
||||
RtlStringCchPrintfW(Name, ARRAYSIZE(Name),
|
||||
L"%s\\%lu\\DiskController\\0",
|
||||
ROOT_NAME, AdapterCount);
|
||||
Status = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE,
|
||||
Name,
|
||||
&QueryTable[2],
|
||||
|
@ -399,7 +405,9 @@ EnumerateBiosDiskEntries(
|
|||
return;
|
||||
}
|
||||
|
||||
swprintf(Name, L"%s\\%lu\\DiskController\\0\\DiskPeripheral", ROOT_NAME, AdapterCount);
|
||||
RtlStringCchPrintfW(Name, ARRAYSIZE(Name),
|
||||
L"%s\\%lu\\DiskController\\0\\DiskPeripheral",
|
||||
ROOT_NAME, AdapterCount);
|
||||
Status = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE,
|
||||
Name,
|
||||
&QueryTable[2],
|
||||
|
@ -421,7 +429,9 @@ EnumerateBiosDiskEntries(
|
|||
break;
|
||||
}
|
||||
|
||||
swprintf(Name, L"%s\\%lu\\DiskController\\0\\DiskPeripheral\\%lu", ROOT_NAME, AdapterCount, DiskCount);
|
||||
RtlStringCchPrintfW(Name, ARRAYSIZE(Name),
|
||||
L"%s\\%lu\\DiskController\\0\\DiskPeripheral\\%lu",
|
||||
ROOT_NAME, AdapterCount, DiskCount);
|
||||
Status = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE,
|
||||
Name,
|
||||
QueryTable,
|
||||
|
@ -974,7 +984,8 @@ AddDiskToList(
|
|||
}
|
||||
Checksum = ~Checksum + 1;
|
||||
|
||||
swprintf(Identifier, L"%08x-%08x-A", Checksum, Signature);
|
||||
RtlStringCchPrintfW(Identifier, ARRAYSIZE(Identifier),
|
||||
L"%08x-%08x-A", Checksum, Signature);
|
||||
DPRINT("Identifier: %S\n", Identifier);
|
||||
|
||||
DiskEntry = RtlAllocateHeap(ProcessHeap,
|
||||
|
@ -1205,7 +1216,7 @@ CreatePartitionList(VOID)
|
|||
|
||||
List = (PPARTLIST)RtlAllocateHeap(ProcessHeap,
|
||||
0,
|
||||
sizeof (PARTLIST));
|
||||
sizeof(PARTLIST));
|
||||
if (List == NULL)
|
||||
return NULL;
|
||||
|
||||
|
@ -1233,11 +1244,10 @@ CreatePartitionList(VOID)
|
|||
|
||||
for (DiskNumber = 0; DiskNumber < Sdi.NumberOfDisks; DiskNumber++)
|
||||
{
|
||||
swprintf(Buffer,
|
||||
L"\\Device\\Harddisk%d\\Partition0",
|
||||
DiskNumber);
|
||||
RtlInitUnicodeString(&Name,
|
||||
Buffer);
|
||||
RtlStringCchPrintfW(Buffer, ARRAYSIZE(Buffer),
|
||||
L"\\Device\\Harddisk%lu\\Partition0",
|
||||
DiskNumber);
|
||||
RtlInitUnicodeString(&Name, Buffer);
|
||||
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&Name,
|
||||
|
@ -2460,7 +2470,7 @@ DeleteCurrentPartition(
|
|||
RtlFreeHeap(ProcessHeap, 0, PartEntry);
|
||||
|
||||
/* Remove the next entry */
|
||||
RemoveEntryList (&NextPartEntry->ListEntry);
|
||||
RemoveEntryList(&NextPartEntry->ListEntry);
|
||||
RtlFreeHeap(ProcessHeap, 0, NextPartEntry);
|
||||
|
||||
/* Update current partition */
|
||||
|
@ -2764,11 +2774,10 @@ WritePartitions(
|
|||
|
||||
DPRINT("WritePartitions() Disk: %lu\n", DiskEntry->DiskNumber);
|
||||
|
||||
swprintf(DstPath,
|
||||
L"\\Device\\Harddisk%d\\Partition0",
|
||||
DiskEntry->DiskNumber);
|
||||
RtlInitUnicodeString(&Name,
|
||||
DstPath);
|
||||
RtlStringCchPrintfW(DstPath, ARRAYSIZE(DstPath),
|
||||
L"\\Device\\Harddisk%lu\\Partition0",
|
||||
DiskEntry->DiskNumber);
|
||||
RtlInitUnicodeString(&Name, DstPath);
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
&Name,
|
||||
0,
|
||||
|
@ -2865,7 +2874,8 @@ SetMountedDeviceValue(
|
|||
NTSTATUS Status;
|
||||
HANDLE KeyHandle;
|
||||
|
||||
swprintf(ValueNameBuffer, L"\\DosDevices\\%C:", Letter);
|
||||
RtlStringCchPrintfW(ValueNameBuffer, ARRAYSIZE(ValueNameBuffer),
|
||||
L"\\DosDevices\\%C:", Letter);
|
||||
RtlInitUnicodeString(&ValueName, ValueNameBuffer);
|
||||
|
||||
InitializeObjectAttributes(&ObjectAttributes,
|
||||
|
|
|
@ -14,10 +14,7 @@
|
|||
#define _INC_WINDOWS
|
||||
#define COM_NO_WINDOWS_H
|
||||
|
||||
#include <wingdi.h> // For LF_FACESIZE and TranslateCharsetInfo()
|
||||
#include <wincon.h>
|
||||
#include <winnls.h> // For code page support
|
||||
#include <winreg.h>
|
||||
#include <winxxx.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -29,6 +26,7 @@ extern HANDLE ProcessHeap;
|
|||
#include "linklist.h"
|
||||
#include "ntverrsrc.h"
|
||||
// #include "arcname.h"
|
||||
#include "bldrsup.h"
|
||||
#include "filesup.h"
|
||||
#include "fsutil.h"
|
||||
#include "genlist.h"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue