oleview: Avoid variable-length arrays.

This commit is contained in:
Thomas Faber 2014-03-25 11:27:12 +01:00 committed by Alexandre Julliard
parent 626040b1ac
commit 644bda381e
2 changed files with 7 additions and 7 deletions

View File

@ -158,7 +158,7 @@ static void CreateRegRec(HKEY hKey, HTREEITEM parent, WCHAR *wszKeyName, BOOL ad
RegCloseKey(hCurKey);
memmove(&wszData[6], wszData, sizeof(WCHAR[lenData]));
memmove(&wszData[6], wszData, lenData * sizeof(WCHAR));
memcpy(wszData, wszCLSID, sizeof(WCHAR[6]));
wszData[5] = '\\';
@ -187,7 +187,7 @@ static void CreateRegRec(HKEY hKey, HTREEITEM parent, WCHAR *wszKeyName, BOOL ad
RegCloseKey(hCurKey);
memmove(&wszData[8], wszData, sizeof(WCHAR[lenData]));
memmove(&wszData[8], wszData, lenData * sizeof(WCHAR));
memcpy(wszData, wszTypeLib, sizeof(WCHAR[8]));
wszData[7] = '\\';
RegOpenKeyW(HKEY_CLASSES_ROOT, wszData, &hCurKey);
@ -238,9 +238,9 @@ static void CreateReg(WCHAR *buffer)
if(RegQueryValueW(hKey, NULL, wszTree, (LONG *)&lenTree) == ERROR_SUCCESS)
{
memmove(&wszTree[lenBuffer-lastLenBuffer+3], wszTree,
sizeof(WCHAR[lenTree]));
lenTree * sizeof(WCHAR));
memcpy(wszTree, &buffer[lastLenBuffer],
sizeof(WCHAR[lenBuffer-lastLenBuffer]));
(lenBuffer - lastLenBuffer) * sizeof(WCHAR));
if(lenTree == 1) wszTree[lenBuffer-lastLenBuffer] = '\0';
else

View File

@ -225,7 +225,7 @@ BOOL CreateRegPath(HTREEITEM item, WCHAR *buffer, int bufSize)
int bufLen;
BOOL ret;
memset(buffer, 0, sizeof(WCHAR[bufSize]));
memset(buffer, 0, bufSize * sizeof(WCHAR));
memset(&tvi, 0, sizeof(TVITEMW));
tvi.hItem = item;
@ -239,8 +239,8 @@ BOOL CreateRegPath(HTREEITEM item, WCHAR *buffer, int bufSize)
if(tvi.lParam && (((ITEM_INFO *)tvi.lParam)->cFlag & (REGPATH|REGTOP)))
{
bufLen = lstrlenW(((ITEM_INFO *)tvi.lParam)->info);
memmove(&buffer[bufLen], buffer, sizeof(WCHAR[bufSize-bufLen]));
memcpy(buffer, ((ITEM_INFO *)tvi.lParam)->info, sizeof(WCHAR[bufLen]));
memmove(&buffer[bufLen], buffer, (bufSize - bufLen) * sizeof(WCHAR));
memcpy(buffer, ((ITEM_INFO *)tvi.lParam)->info, bufLen * sizeof(WCHAR));
}
if(tvi.lParam && ((ITEM_INFO *)tvi.lParam)->cFlag & REGTOP) break;