Commit e7f5dc19 authored by André Hentschel's avatar André Hentschel Committed by Alexandre Julliard

advpack: Use ARRAY_SIZE() macro.

parent fc8d9692
......@@ -530,18 +530,12 @@ HRESULT WINAPI SetPerUserSecValuesA(PERUSERSECTIONA* pPerUser)
if (!pPerUser)
return E_INVALIDARG;
MultiByteToWideChar(CP_ACP, 0, pPerUser->szGUID, -1, perUserW.szGUID,
sizeof(perUserW.szGUID) / sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, pPerUser->szDispName, -1, perUserW.szDispName,
sizeof(perUserW.szDispName) / sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, pPerUser->szLocale, -1, perUserW.szLocale,
sizeof(perUserW.szLocale) / sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, pPerUser->szStub, -1, perUserW.szStub,
sizeof(perUserW.szStub) / sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, pPerUser->szVersion, -1, perUserW.szVersion,
sizeof(perUserW.szVersion) / sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, pPerUser->szCompID, -1, perUserW.szCompID,
sizeof(perUserW.szCompID) / sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, pPerUser->szGUID, -1, perUserW.szGUID, ARRAY_SIZE(perUserW.szGUID));
MultiByteToWideChar(CP_ACP, 0, pPerUser->szDispName, -1, perUserW.szDispName, ARRAY_SIZE(perUserW.szDispName));
MultiByteToWideChar(CP_ACP, 0, pPerUser->szLocale, -1, perUserW.szLocale, ARRAY_SIZE(perUserW.szLocale));
MultiByteToWideChar(CP_ACP, 0, pPerUser->szStub, -1, perUserW.szStub, ARRAY_SIZE(perUserW.szStub));
MultiByteToWideChar(CP_ACP, 0, pPerUser->szVersion, -1, perUserW.szVersion, ARRAY_SIZE(perUserW.szVersion));
MultiByteToWideChar(CP_ACP, 0, pPerUser->szCompID, -1, perUserW.szCompID, ARRAY_SIZE(perUserW.szCompID));
perUserW.dwIsInstalled = pPerUser->dwIsInstalled;
perUserW.bRollback = pPerUser->bRollback;
......
......@@ -115,28 +115,22 @@ static HRESULT per_user_install_callback(HINF hinf, PCWSTR field, const void *ar
per_user.bRollback = FALSE;
per_user.dwIsInstalled = 0;
SetupGetLineTextW(NULL, hinf, field, disp_name, per_user.szDispName,
sizeof(per_user.szDispName) / sizeof(WCHAR), &size);
SetupGetLineTextW(NULL, hinf, field, disp_name, per_user.szDispName, ARRAY_SIZE(per_user.szDispName), &size);
SetupGetLineTextW(NULL, hinf, field, version, per_user.szVersion,
sizeof(per_user.szVersion) / sizeof(WCHAR), &size);
SetupGetLineTextW(NULL, hinf, field, version, per_user.szVersion, ARRAY_SIZE(per_user.szVersion), &size);
if (SetupFindFirstLineW(hinf, field, is_installed, &context))
{
SetupGetIntField(&context, 1, (PINT)&per_user.dwIsInstalled);
}
SetupGetLineTextW(NULL, hinf, field, comp_id, per_user.szCompID,
sizeof(per_user.szCompID) / sizeof(WCHAR), &size);
SetupGetLineTextW(NULL, hinf, field, comp_id, per_user.szCompID, ARRAY_SIZE(per_user.szCompID), &size);
SetupGetLineTextW(NULL, hinf, field, guid, per_user.szGUID,
sizeof(per_user.szGUID) / sizeof(WCHAR), &size);
SetupGetLineTextW(NULL, hinf, field, guid, per_user.szGUID, ARRAY_SIZE(per_user.szGUID), &size);
SetupGetLineTextW(NULL, hinf, field, locale, per_user.szLocale,
sizeof(per_user.szLocale) / sizeof(WCHAR), &size);
SetupGetLineTextW(NULL, hinf, field, locale, per_user.szLocale, ARRAY_SIZE(per_user.szLocale), &size);
SetupGetLineTextW(NULL, hinf, field, stub_path, per_user.szStub,
sizeof(per_user.szStub) / sizeof(WCHAR), &size);
SetupGetLineTextW(NULL, hinf, field, stub_path, per_user.szStub, ARRAY_SIZE(per_user.szStub), &size);
return SetPerUserSecValuesW(&per_user);
}
......@@ -154,8 +148,7 @@ static HRESULT register_ocxs_callback(HINF hinf, PCWSTR field, const void *arg)
WCHAR buffer[MAX_INF_STRING_LENGTH];
/* get OCX filename */
if (!SetupGetStringFieldW(&context, 1, buffer,
sizeof(buffer) / sizeof(WCHAR), NULL))
if (!SetupGetStringFieldW(&context, 1, buffer, ARRAY_SIZE(buffer), NULL))
continue;
hm = LoadLibraryExW(buffer, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
......@@ -273,7 +266,7 @@ static HRESULT iterate_section_fields(HINF hinf, PCWSTR section, PCWSTR key,
{
WCHAR static_buffer[200];
WCHAR *buffer = static_buffer;
DWORD size = sizeof(static_buffer) / sizeof(WCHAR);
DWORD size = ARRAY_SIZE(static_buffer);
INFCONTEXT context;
HRESULT hr = E_FAIL;
......@@ -645,8 +638,7 @@ HRESULT WINAPI ExecuteCabA(HWND hwnd, CABINFOA* pCab, LPVOID pReserved)
RtlCreateUnicodeStringFromAsciiz(&inf, pCab->pszInf);
RtlCreateUnicodeStringFromAsciiz(&section, pCab->pszSection);
MultiByteToWideChar(CP_ACP, 0, pCab->szSrcPath, -1, cabinfo.szSrcPath,
sizeof(cabinfo.szSrcPath) / sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, pCab->szSrcPath, -1, cabinfo.szSrcPath, ARRAY_SIZE(cabinfo.szSrcPath));
cabinfo.pszInf = inf.Buffer;
cabinfo.pszSection = section.Buffer;
......
......@@ -44,7 +44,7 @@ static BOOL get_temp_ini_path(LPWSTR name)
WCHAR tmp_dir[MAX_PATH];
WCHAR prefix[] = {'a','v','p',0};
if(!GetTempPathW(sizeof(tmp_dir)/sizeof(WCHAR), tmp_dir))
if(!GetTempPathW(ARRAY_SIZE(tmp_dir), tmp_dir))
return FALSE;
if(!GetTempFileNameW(tmp_dir, prefix, 0, name))
......@@ -177,14 +177,14 @@ static HRESULT write_predefined_strings(HMODULE hm, LPCWSTR ini_path)
WCHAR sys_root[MAX_PATH];
*mod_path = '\"';
if (!GetModuleFileNameW(hm, mod_path + 1, sizeof(mod_path) / sizeof(WCHAR) - 2))
if (!GetModuleFileNameW(hm, mod_path + 1, ARRAY_SIZE(mod_path) - 2))
return E_FAIL;
lstrcatW(mod_path, quote);
WritePrivateProfileStringW(Strings, MOD_PATH, mod_path, ini_path);
*sys_root = '\0';
GetEnvironmentVariableW(SystemRoot, sys_root, sizeof(sys_root) / sizeof(WCHAR));
GetEnvironmentVariableW(SystemRoot, sys_root, ARRAY_SIZE(sys_root));
if(!strncmpiW(sys_root, mod_path + 1, strlenW(sys_root)))
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment