[ros-dev] [ros-diffs] [hbelusca] 74619: [USETUP]: filesup module: - Add a NtPathToDiskPartComponents helper, that takes in input a fully qualified NT path to a file on hard disk, e.g.: \Device\Harddisk1\Partition2\foo\b...
Hermès BÉLUSCA-MAÏTO
hermes.belusca at sfr.fr
Mon May 22 12:11:48 UTC 2017
Hi,
>> + if (_wcsnicmp(Path, L"\\Device\\Harddisk", 16) != 0)
>> + {
>> + /* The NT path doesn't start with the prefix string, thus it cannot be a hard disk device path */
>> + DPRINT1("'%S' : Not a possible hard disk device.\n", NtPath);
>> + return FALSE;
>> + }
>> +
>> + Path += 16;
> Avoiding these magic numbers would be nice.
> Options include:
> * static string à la
> static const WCHAR DeviceHarddiskPath[] = L"\\Device\\Harddisk";
> _wcsnicmp(Path, DeviceHarddiskPath, ARRAYSIZE(DeviceHarddiskPath) - 1)
> * simply using wcslen(L"\\Device\\Harddisk") (which should get optimized)
> * making a "starts with" function
> * using RtlPrefixUnicodeString
Yes, I may choose the RtlPrefix one but these options are better.
>> +
>> + if (FileInfo.EndOfFile.HighPart != 0)
>> + DPRINT1("WARNING!! The file %wZ is too large!\n", Name);
>Did you mean &Name?
Correct
More information about the Ros-dev
mailing list