mirror of
https://github.com/reactos/reactos.git
synced 2025-04-20 04:20:46 +00:00
[CMLIB]
Use a #define instead of the magic 31. svn path=/trunk/; revision=61923
This commit is contained in:
parent
048856c9cc
commit
8dddaf53b2
2 changed files with 8 additions and 5 deletions
|
@ -107,6 +107,8 @@ typedef enum
|
||||||
* On-disk header for registry hive file.
|
* On-disk header for registry hive file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define HIVE_FILENAME_MAXLEN 31
|
||||||
|
|
||||||
typedef struct _HBASE_BLOCK
|
typedef struct _HBASE_BLOCK
|
||||||
{
|
{
|
||||||
/* Hive identifier "regf" (0x66676572) */
|
/* Hive identifier "regf" (0x66676572) */
|
||||||
|
@ -146,7 +148,7 @@ typedef struct _HBASE_BLOCK
|
||||||
|
|
||||||
/* Last 31 UNICODE characters, plus terminating NULL character,
|
/* Last 31 UNICODE characters, plus terminating NULL character,
|
||||||
of the full name of the hive file */
|
of the full name of the hive file */
|
||||||
WCHAR FileName[32];
|
WCHAR FileName[HIVE_FILENAME_MAXLEN + 1];
|
||||||
|
|
||||||
ULONG Reserved1[99];
|
ULONG Reserved1[99];
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ HvpCreateHive(
|
||||||
/* Copy the 31 last characters of the hive file name if any */
|
/* Copy the 31 last characters of the hive file name if any */
|
||||||
if (FileName)
|
if (FileName)
|
||||||
{
|
{
|
||||||
if (FileName->Length / sizeof(WCHAR) <= 31)
|
if (FileName->Length / sizeof(WCHAR) <= HIVE_FILENAME_MAXLEN)
|
||||||
{
|
{
|
||||||
RtlCopyMemory(BaseBlock->FileName,
|
RtlCopyMemory(BaseBlock->FileName,
|
||||||
FileName->Buffer,
|
FileName->Buffer,
|
||||||
|
@ -127,12 +127,13 @@ HvpCreateHive(
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RtlCopyMemory(BaseBlock->FileName,
|
RtlCopyMemory(BaseBlock->FileName,
|
||||||
FileName->Buffer + FileName->Length / sizeof(WCHAR) - 31,
|
FileName->Buffer +
|
||||||
31 * sizeof(WCHAR));
|
FileName->Length / sizeof(WCHAR) - HIVE_FILENAME_MAXLEN,
|
||||||
|
HIVE_FILENAME_MAXLEN * sizeof(WCHAR));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* NULL-terminate */
|
/* NULL-terminate */
|
||||||
BaseBlock->FileName[31] = L'\0';
|
BaseBlock->FileName[HIVE_FILENAME_MAXLEN] = L'\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseBlock->CheckSum = HvpHiveHeaderChecksum(BaseBlock);
|
BaseBlock->CheckSum = HvpHiveHeaderChecksum(BaseBlock);
|
||||||
|
|
Loading…
Reference in a new issue