/* Build profile name postfix */
if (!ExpandEnvironmentStringsW(L"%SystemRoot%",
szSystemRoot,
- MAX_PATH))
+ ARRAYSIZE(szSystemRoot)))
{
DPRINT1("Error: %lu\n", GetLastError());
return FALSE;
}
/* Get profiles path */
- dwLength = MAX_PATH * sizeof(WCHAR);
+ dwLength = sizeof(szRawProfilesPath);
Error = RegQueryValueExW(hKey,
L"ProfilesDirectory",
NULL,
/* Expand it */
if (!ExpandEnvironmentStringsW(szRawProfilesPath,
szProfilesPath,
- MAX_PATH))
+ ARRAYSIZE(szProfilesPath)))
{
DPRINT1("Error: %lu\n", GetLastError());
RegCloseKey(hKey);
}
/* Get default user path */
- dwLength = MAX_PATH * sizeof(WCHAR);
+ dwLength = sizeof(szBuffer);
Error = RegQueryValueExW(hKey,
L"DefaultUserProfile",
NULL,
0,
REG_EXPAND_SZ,
(LPBYTE)szBuffer,
- (wcslen (szBuffer) + 1) * sizeof(WCHAR));
+ (wcslen(szBuffer) + 1) * sizeof(WCHAR));
if (Error != ERROR_SUCCESS)
{
DPRINT1("Error: %lu\n", Error);
/* Expand it */
if (!ExpandEnvironmentStringsW(szBuffer,
szProfilesPath,
- MAX_PATH))
+ ARRAYSIZE(szProfilesPath)))
{
DPRINT1("Error: %lu\n", GetLastError());
return FALSE;
}
- dwLength = wcslen (szProfilesPath) + 1;
+ dwLength = wcslen(szProfilesPath) + 1;
if (lpProfilesDir != NULL)
{
if (*lpcchSize < dwLength)
/* Expand it */
if (!ExpandEnvironmentStringsW(szRawImagePath,
szImagePath,
- MAX_PATH))
+ ARRAYSIZE(szImagePath)))
{
DPRINT1 ("Error: %lu\n", GetLastError());
return FALSE;
}
/* Convert the structure to UNICODE... */
- ProfileInfoW.dwSize = sizeof(PROFILEINFOW);
+ ProfileInfoW.dwSize = sizeof(ProfileInfoW);
ProfileInfoW.dwFlags = lpProfileInfo->dwFlags;
if (lpProfileInfo->lpUserName)
if (!LoadStringW(hInstance,
IDS_PROFILEPATH,
szBuffer,
- MAX_PATH))
+ ARRAYSIZE(szBuffer)))
{
DPRINT1("Error: %lu\n", GetLastError());
return FALSE;
/* Expand it */
if (!ExpandEnvironmentStringsW(szBuffer,
szProfilesPath,
- MAX_PATH))
+ ARRAYSIZE(szProfilesPath)))
{
DPRINT1("Error: %lu\n", GetLastError());
RegCloseKey(hKey);
}
/* Store the profiles directory path in the registry */
- dwLength = (wcslen (szBuffer) + 1) * sizeof(WCHAR);
+ dwLength = (wcslen(szBuffer) + 1) * sizeof(WCHAR);
Error = RegSetValueExW(hKey,
L"ProfilesDirectory",
0,
wcscat(szProfilePath, szBuffer);
/* Attempt default user directory creation */
- if (!CreateDirectoryW (szProfilePath, NULL))
+ if (!CreateDirectoryW(szProfilePath, NULL))
{
if (GetLastError() != ERROR_ALREADY_EXISTS)
{
}
/* Directory existed, let's try to append the postfix */
- if (!AppendSystemPostfix(szBuffer, MAX_PATH))
+ if (!AppendSystemPostfix(szBuffer, ARRAYSIZE(szBuffer)))
{
DPRINT1("AppendSystemPostfix() failed\n", GetLastError());
RegCloseKey(hKey);
}
/* Store the default user profile path in the registry */
- dwLength = (wcslen (szBuffer) + 1) * sizeof(WCHAR);
+ dwLength = (wcslen(szBuffer) + 1) * sizeof(WCHAR);
Error = RegSetValueExW(hKey,
L"DefaultUserProfile",
0,
if (!LoadStringW(hInstance,
lpFolderData->uId,
&szBuffer[dwLength],
- MAX_PATH - dwLength))
+ ARRAYSIZE(szBuffer) - dwLength))
{
/* Use the default name instead */
wcscat(szBuffer, lpFolderData->lpPath);
if (!LoadStringW(hInstance,
lpFolderData->uId,
&szBuffer[dwLength],
- MAX_PATH - dwLength))
+ ARRAYSIZE(szBuffer) - dwLength))
{
/* Use the default name instead */
wcscat(szBuffer, lpFolderData->lpPath);
}
/* Set 'Fonts' folder path */
- GetWindowsDirectoryW(szBuffer, MAX_PATH);
+ GetWindowsDirectoryW(szBuffer, ARRAYSIZE(szBuffer));
wcscat(szBuffer, L"\\Fonts");
dwLength = (wcslen(szBuffer) + 1) * sizeof(WCHAR);
if (!LoadStringW(hInstance,
lpFolderData->uId,
&szBuffer[dwLength],
- MAX_PATH - dwLength))
+ ARRAYSIZE(szBuffer) - dwLength))
{
/* Use the default name instead */
wcscat(szBuffer, lpFolderData->lpPath);
wcscat(szProfilePath, szBuffer);
/* Attempt 'All Users' directory creation */
- if (!CreateDirectoryW (szProfilePath, NULL))
+ if (!CreateDirectoryW(szProfilePath, NULL))
{
if (GetLastError() != ERROR_ALREADY_EXISTS)
{
}
/* Directory existed, let's try to append the postfix */
- if (!AppendSystemPostfix(szBuffer, MAX_PATH))
+ if (!AppendSystemPostfix(szBuffer, ARRAYSIZE(szBuffer)))
{
DPRINT1("AppendSystemPostfix() failed\n", GetLastError());
return FALSE;
if (!LoadStringW(hInstance,
lpFolderData->uId,
&szBuffer[dwLength],
- MAX_PATH - dwLength))
+ ARRAYSIZE(szBuffer) - dwLength))
{
/* Use the default name instead */
wcscat(szBuffer, lpFolderData->lpPath);
if (!LoadStringW(hInstance,
lpFolderData->uId,
&szBuffer[dwLength],
- MAX_PATH - dwLength))
+ ARRAYSIZE(szBuffer) - dwLength))
{
/* Use the default name instead */
wcscat(szBuffer, lpFolderData->lpPath);
if (!LoadStringW(hInstance,
lpFolderData->uId,
&szBuffer[dwLength],
- MAX_PATH - dwLength))
+ ARRAYSIZE(szBuffer) - dwLength))
{
/* Use the default name instead */
wcscat(szBuffer, lpFolderData->lpPath);
if (!LoadStringW(hInstance,
IDS_PROGRAMFILES,
szBuffer,
- MAX_PATH))
+ ARRAYSIZE(szBuffer)))
{
DPRINT1("Error: %lu\n", GetLastError());
return FALSE;
if (!LoadStringW(hInstance,
IDS_COMMONFILES,
szCommonFilesDirPath,
- MAX_PATH))
+ ARRAYSIZE(szCommonFilesDirPath)))
{
DPRINT1("Warning: %lu\n", GetLastError());
}
/* Expand it */
if (!ExpandEnvironmentStringsW(szBuffer,
szProfilesPath,
- MAX_PATH))
+ ARRAYSIZE(szProfilesPath)))
{
DPRINT1("Error: %lu\n", GetLastError());
return FALSE;
wcscat(szBuffer, szCommonFilesDirPath);
if (!ExpandEnvironmentStringsW(szBuffer,
- szCommonFilesDirPath,
- MAX_PATH))
+ szCommonFilesDirPath,
+ ARRAYSIZE(szCommonFilesDirPath)))
{
DPRINT1("Warning: %lu\n", GetLastError());
}
return FALSE;
}
- dwLength = (wcslen (szProfilesPath) + 1) * sizeof(WCHAR);
+ dwLength = (wcslen(szProfilesPath) + 1) * sizeof(WCHAR);
Error = RegSetValueExW(hKey,
L"ProgramFilesDir",
0,
DPRINT1("Warning: %lu\n", Error);
}
- RegCloseKey (hKey);
+ RegCloseKey(hKey);
/* Create directory */
if (!CreateDirectoryW(szProfilesPath, NULL))
{
- if (GetLastError () != ERROR_ALREADY_EXISTS)
+ if (GetLastError() != ERROR_ALREADY_EXISTS)
{
DPRINT1("Error: %lu\n", GetLastError());
return FALSE;
/* Create directory */
if (!CreateDirectoryW(szCommonFilesDirPath, NULL))
{
- if (GetLastError () != ERROR_ALREADY_EXISTS)
+ if (GetLastError() != ERROR_ALREADY_EXISTS)
{
DPRINT1("Warning: %lu\n", GetLastError());
}
if (!LoadStringW(hInstance,
lpFolderData->uId,
&szBuffer[dwLength],
- MAX_PATH - dwLength))
+ ARRAYSIZE(szBuffer) - dwLength))
{
/* Use the default name instead */
wcscat(szBuffer, lpFolderData->lpPath);