Author: dquintana
Date: Thu Jun 22 18:00:57 2017
New Revision: 75167
URL:
http://svn.reactos.org/svn/reactos?rev=75167&view=rev
Log:
[NTOBJSHEX]
* Fix gcc build.
* Remove magic.
* Address nitpicks.
Modified:
trunk/reactos/dll/shellext/ntobjshex/ntobjenum.cpp
trunk/reactos/dll/shellext/ntobjshex/regfolder.cpp
Modified: trunk/reactos/dll/shellext/ntobjshex/ntobjenum.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/shellext/ntobjshex/nto…
==============================================================================
--- trunk/reactos/dll/shellext/ntobjshex/ntobjenum.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/shellext/ntobjshex/ntobjenum.cpp [iso-8859-1] Thu Jun 22 18:00:57
2017
@@ -227,7 +227,7 @@
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 @@
}
// allocate space for the terminator
- entryBufferLength += 2;
+ entryBufferLength += FIELD_OFFSET(SHITEMID, abID);
RegPidlEntry* entry = (RegPidlEntry*) CoTaskMemAlloc(entryBufferLength);
if (!entry)
@@ -432,7 +432,8 @@
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 @@
}
// allocate space for the terminator
- entryBufferLength += 2;
+ entryBufferLength += FIELD_OFFSET(SHITEMID, abID);
RegPidlEntry* entry = (RegPidlEntry*) CoTaskMemAlloc(entryBufferLength);
if (!entry)
@@ -636,7 +637,7 @@
}
// allocate space for the terminator
- entryBufferLength += 2;
+ entryBufferLength += FIELD_OFFSET(SHITEMID, abID);
NtPidlEntry* entry = (NtPidlEntry*) CoTaskMemAlloc(entryBufferLength);
if (!entry)
Modified: trunk/reactos/dll/shellext/ntobjshex/regfolder.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/shellext/ntobjshex/reg…
==============================================================================
--- trunk/reactos/dll/shellext/ntobjshex/regfolder.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/shellext/ntobjshex/regfolder.cpp [iso-8859-1] Thu Jun 22 18:00:57
2017
@@ -308,16 +308,16 @@
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 @@
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;