[NTOBJSHEX]

* Fix gcc build.
* Remove magic.
* Address nitpicks.

svn path=/trunk/; revision=75167
This commit is contained in:
David Quintana 2017-06-22 18:00:57 +00:00
parent cdb3d06d8d
commit 3dae17b0e7
2 changed files with 11 additions and 10 deletions

View file

@ -227,7 +227,7 @@ public:
DWORD entryBufferLength = FIELD_OFFSET(RegPidlEntry, entryName) + sizeof(WCHAR) + cchName * sizeof(WCHAR);
// allocate space for the terminator
entryBufferLength += 2;
entryBufferLength += FIELD_OFFSET(SHITEMID, abID);
RegPidlEntry* entry = (RegPidlEntry*) CoTaskMemAlloc(entryBufferLength);
if (!entry)
@ -377,7 +377,7 @@ public:
}
// allocate space for the terminator
entryBufferLength += 2;
entryBufferLength += FIELD_OFFSET(SHITEMID, abID);
RegPidlEntry* entry = (RegPidlEntry*) CoTaskMemAlloc(entryBufferLength);
if (!entry)
@ -432,7 +432,8 @@ public:
DWORD entryBufferLength = FIELD_OFFSET(RegPidlEntry, entryName) + sizeof(WCHAR) + cchName * sizeof(WCHAR);
BOOL copyData = dataSize <= 32;
#define MAX_EMBEDDED_DATA 32
BOOL copyData = dataSize <= MAX_EMBEDDED_DATA;
if (copyData)
{
entryBufferLength += dataSize + sizeof(WCHAR);
@ -441,7 +442,7 @@ public:
}
// allocate space for the terminator
entryBufferLength += 2;
entryBufferLength += FIELD_OFFSET(SHITEMID, abID);
RegPidlEntry* entry = (RegPidlEntry*) CoTaskMemAlloc(entryBufferLength);
if (!entry)
@ -636,7 +637,7 @@ public:
}
// allocate space for the terminator
entryBufferLength += 2;
entryBufferLength += FIELD_OFFSET(SHITEMID, abID);
NtPidlEntry* entry = (NtPidlEntry*) CoTaskMemAlloc(entryBufferLength);
if (!entry)

View file

@ -308,16 +308,16 @@ public:
case REG_MULTI_SZ:
{
PCWSTR separator = L" "; // To match regedit
int sepChars = wcslen(separator);
size_t sepChars = wcslen(separator);
int strings = 0;
int stringChars = 0;
PCWSTR strData = (PCWSTR)td;
while (*strData)
{
int l = wcslen(strData);
stringChars += l;
strData += l + 1; // Skips null-terminator
size_t len = wcslen(strData);
stringChars += len;
strData += len + 1; // Skips null-terminator
strings++;
}
@ -363,7 +363,7 @@ public:
PWSTR strValue = (PWSTR)CoTaskMemAlloc(bufferLength);
PWSTR strTemp = strValue;
PBYTE data = (PBYTE)td;
for (int i = 0; i < contentsLength; i++)
for (DWORD i = 0; i < contentsLength; i++)
{
StringCbPrintfW(strTemp, bufferLength, L"%02x ", data[i]);
strTemp += 3;