[RAPPS][RAPPS_NEW]: Try to not hardcode types of variables in sizeofs, and use _countof where possible.

svn path=/trunk/; revision=72918
This commit is contained in:
Hermès Bélusca-Maïto 2016-10-06 12:22:32 +00:00
parent 894fa45ad2
commit 5f68ab2401
18 changed files with 73 additions and 73 deletions

View file

@ -104,10 +104,10 @@ UninstallApplication(INT Index, BOOL bModify)
ItemIndex = Index;
}
ListView_GetItemText(hListView, ItemIndex, 0, szAppName, sizeof(szAppName) / sizeof(WCHAR));
ListView_GetItemText(hListView, ItemIndex, 0, szAppName, _countof(szAppName));
WriteLogMessage(EVENTLOG_SUCCESS, MSG_SUCCESS_REMOVE, szAppName);
ZeroMemory(&Item, sizeof(LVITEM));
ZeroMemory(&Item, sizeof(Item));
Item.mask = LVIF_PARAM;
Item.iItem = ItemIndex;
@ -149,7 +149,7 @@ ShowInstalledAppInfo(INT Index)
#define GET_INFO(a, b, c, d) \
if (GetApplicationString(Info->hSubKey, a, szInfo)) \
{ \
LoadStringW(hInst, b, szText, sizeof(szText) / sizeof(WCHAR)); \
LoadStringW(hInst, b, szText, _countof(szText)); \
InsertRichEditText(szText, c); \
InsertRichEditText(szInfo, d); \
} \
@ -190,8 +190,8 @@ RemoveAppFromRegistry(INT Index)
Info = ListViewGetlParam(Index);
if (!Info || !Info->hSubKey || (ItemIndex == -1)) return;
if (!LoadStringW(hInst, IDS_APP_REG_REMOVE, szMsgText, sizeof(szMsgText) / sizeof(WCHAR)) ||
!LoadStringW(hInst, IDS_INFORMATION, szMsgTitle, sizeof(szMsgTitle) / sizeof(WCHAR)))
if (!LoadStringW(hInst, IDS_APP_REG_REMOVE, szMsgText, _countof(szMsgText)) ||
!LoadStringW(hInst, IDS_INFORMATION, szMsgTitle, _countof(szMsgTitle)))
return;
if (MessageBoxW(hMainWnd, szMsgText, szMsgTitle, MB_YESNO | MB_ICONQUESTION) == IDYES)
@ -204,7 +204,7 @@ RemoveAppFromRegistry(INT Index)
return;
}
if (!LoadStringW(hInst, IDS_UNABLE_TO_REMOVE, szMsgText, sizeof(szMsgText) / sizeof(WCHAR)))
if (!LoadStringW(hInst, IDS_UNABLE_TO_REMOVE, szMsgText, _countof(szMsgText)))
return;
MessageBoxW(hMainWnd, szMsgText, NULL, MB_OK | MB_ICONERROR);

View file

@ -28,7 +28,7 @@ ListViewGetlParam(INT Index)
ItemIndex = Index;
}
ZeroMemory(&Item, sizeof(LVITEM));
ZeroMemory(&Item, sizeof(Item));
Item.mask = LVIF_PARAM;
Item.iItem = ItemIndex;
@ -43,7 +43,7 @@ ListViewAddColumn(INT Index, LPWSTR lpText, INT Width, INT Format)
{
LV_COLUMN Column;
ZeroMemory(&Column, sizeof(LV_COLUMN));
ZeroMemory(&Column, sizeof(Column));
Column.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
Column.iSubItem = Index;
@ -59,7 +59,7 @@ ListViewAddItem(INT ItemIndex, INT IconIndex, LPWSTR lpText, LPARAM lParam)
{
LV_ITEMW Item;
ZeroMemory(&Item, sizeof(LV_ITEM));
ZeroMemory(&Item, sizeof(Item));
Item.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE | LVIF_IMAGE;
Item.pszText = lpText;
@ -82,11 +82,11 @@ ListViewCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
IndexInfo.lParam = lParam1;
Index = ListView_FindItem(hListView, -1, &IndexInfo);
ListView_GetItemText(hListView, Index, (INT)lParamSort, Item1, sizeof(Item1) / sizeof(WCHAR));
ListView_GetItemText(hListView, Index, (INT)lParamSort, Item1, _countof(Item1));
IndexInfo.lParam = lParam2;
Index = ListView_FindItem(hListView, -1, &IndexInfo);
ListView_GetItemText(hListView, Index, (INT)lParamSort, Item2, sizeof(Item2) / sizeof(WCHAR));
ListView_GetItemText(hListView, Index, (INT)lParamSort, Item2, _countof(Item2));
if (bAscending)
return wcscmp(Item2, Item1);

View file

@ -257,7 +257,7 @@ static BOOL CertIsValid(HINTERNET hInternet, LPWSTR lpszHostName)
Ret = HttpSendRequestW(hRequest, L"", 0, NULL, 0);
if (Ret)
{
certInfoLength = sizeof(INTERNET_CERTIFICATE_INFOW);
certInfoLength = sizeof(certInfo);
Ret = InternetQueryOptionW(hRequest,
INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT,
&certInfo,
@ -402,7 +402,7 @@ ThreadFunc(LPVOID Context)
{
WCHAR szMsgText[MAX_STR_LEN];
if (!LoadStringW(hInst, IDS_UNABLE_TO_DOWNLOAD, szMsgText, sizeof(szMsgText) / sizeof(WCHAR)))
if (!LoadStringW(hInst, IDS_UNABLE_TO_DOWNLOAD, szMsgText, _countof(szMsgText)))
goto end;
MessageBoxW(hMainWnd, szMsgText, NULL, MB_OK | MB_ICONERROR);
@ -440,7 +440,7 @@ ThreadFunc(LPVOID Context)
{
WCHAR szMsgText[MAX_STR_LEN];
if (!LoadStringW(hInst, IDS_CERT_DOES_NOT_MATCH, szMsgText, sizeof(szMsgText) / sizeof(WCHAR)))
if (!LoadStringW(hInst, IDS_CERT_DOES_NOT_MATCH, szMsgText, _countof(szMsgText)))
goto end;
MessageBoxW(Dlg, szMsgText, NULL, MB_OK | MB_ICONERROR);
@ -705,7 +705,7 @@ DownloadApplicationsDB(LPWSTR lpUrl)
{
APPLICATION_INFO IntInfo;
ZeroMemory(&IntInfo, sizeof(APPLICATION_INFO));
ZeroMemory(&IntInfo, sizeof(IntInfo));
if (FAILED(StringCbCopyW(IntInfo.szUrlDownload,
sizeof(IntInfo.szUrlDownload),
lpUrl)))

View file

@ -55,7 +55,7 @@ GetSystemColorDepth(VOID)
DEVMODE pDevMode;
INT ColorDepth;
pDevMode.dmSize = sizeof(DEVMODE);
pDevMode.dmSize = sizeof(pDevMode);
pDevMode.dmDriverExtra = 0;
if (!EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &pDevMode))
@ -143,13 +143,13 @@ SetWelcomeText(VOID)
{
WCHAR szText[MAX_STR_LEN*3];
LoadStringW(hInst, IDS_WELCOME_TITLE, szText, sizeof(szText) / sizeof(WCHAR));
LoadStringW(hInst, IDS_WELCOME_TITLE, szText, _countof(szText));
NewRichEditText(szText, CFE_BOLD);
LoadStringW(hInst, IDS_WELCOME_TEXT, szText, sizeof(szText) / sizeof(WCHAR));
LoadStringW(hInst, IDS_WELCOME_TEXT, szText, _countof(szText));
InsertRichEditText(szText, 0);
LoadStringW(hInst, IDS_WELCOME_URL, szText, sizeof(szText) / sizeof(WCHAR));
LoadStringW(hInst, IDS_WELCOME_URL, szText, _countof(szText));
InsertRichEditText(szText, CFM_LINK);
}
@ -272,7 +272,7 @@ ExtractFilesFromCab(LPWSTR lpCabName, LPWSTR lpOutputPath)
pfnExtract = (void *) GetProcAddress(hCabinetDll, "Extract");
if (pfnExtract)
{
ZeroMemory(&Dest, sizeof(SESSION));
ZeroMemory(&Dest, sizeof(Dest));
WideCharToMultiByte(CP_ACP, 0, lpOutputPath, -1, Dest.Destination, MAX_PATH, NULL, NULL);
WideCharToMultiByte(CP_ACP, 0, lpCabName, -1, szCabName, MAX_PATH, NULL, NULL);
@ -315,7 +315,7 @@ InitLogs(VOID)
return;
}
if (!GetModuleFileName(NULL, szPath, sizeof(szPath) / sizeof(szPath[0])))
if (!GetModuleFileNameW(NULL, szPath, _countof(szPath)))
return;
if (RegSetValueExW(hKey,

View file

@ -49,9 +49,9 @@ SetRangeFormatting(LONG Start, LONG End, DWORD dwEffects)
SendMessageW(hRichEdit, EM_SETSEL, Start, End);
ZeroMemory(&CharFormat, sizeof(CHARFORMAT2));
ZeroMemory(&CharFormat, sizeof(CharFormat));
CharFormat.cbSize = sizeof(CHARFORMAT2);
CharFormat.cbSize = sizeof(CharFormat);
CharFormat.dwMask = dwEffects;
CharFormat.dwEffects = dwEffects;

View file

@ -20,7 +20,7 @@ ChooseFolder(HWND hwnd)
BROWSEINFO bi;
WCHAR szPath[MAX_PATH], szBuf[MAX_STR_LEN];
LoadStringW(hInst, IDS_CHOOSE_FOLDER_TEXT, szBuf, sizeof(szBuf) / sizeof(TCHAR));
LoadStringW(hInst, IDS_CHOOSE_FOLDER_TEXT, szBuf, _countof(szBuf));
ZeroMemory(&bi, sizeof(bi));
bi.hwndOwner = hwnd;
@ -162,7 +162,7 @@ SettingsDlgProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
LoadStringW(hInst,
IDS_CHOOSE_FOLDER_ERROR,
szMsgText, sizeof(szMsgText) / sizeof(WCHAR));
szMsgText, _countof(szMsgText));
if (MessageBoxW(hDlg, szMsgText, NULL, MB_YESNO) == IDYES)
{

View file

@ -123,7 +123,7 @@ CreateHSplitBar(HWND hwnd)
WCHAR szWindowClass[] = L"HSplitterWindowClass";
WNDCLASSEXW WndClass = {0};
WndClass.cbSize = sizeof(WNDCLASSEXW);
WndClass.cbSize = sizeof(WndClass);
WndClass.lpszClassName = szWindowClass;
WndClass.lpfnWndProc = HSplitterWindowProc;
WndClass.hInstance = hInst;
@ -264,7 +264,7 @@ CreateVSplitBar(HWND hwnd)
WCHAR szWindowClass[] = L"VSplitterWindowClass";
WNDCLASSEXW WndClass = {0};
WndClass.cbSize = sizeof(WNDCLASSEXW);
WndClass.cbSize = sizeof(WndClass);
WndClass.lpszClassName = szWindowClass;
WndClass.lpfnWndProc = VSplitterWindowProc;
WndClass.hInstance = hInst;

View file

@ -137,7 +137,7 @@ CreateSearchBar(VOID)
SendMessageW(hSearchBar, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), 0);
LoadStringW(hInst, IDS_SEARCH_TEXT, szBuf, sizeof(szBuf) / sizeof(WCHAR));
LoadStringW(hInst, IDS_SEARCH_TEXT, szBuf, _countof(szBuf));
SetWindowTextW(hSearchBar, szBuf);
SetParent(hSearchBar, hToolBar);
@ -148,12 +148,12 @@ CreateSearchBar(VOID)
BOOL
CreateToolBar(HWND hwnd)
{
INT NumButtons = sizeof(Buttons) / sizeof(Buttons[0]);
INT NumButtons = _countof(Buttons);
HIMAGELIST hImageList;
LoadStringW(hInst, IDS_INSTALL, szInstallBtn, sizeof(szInstallBtn) / sizeof(WCHAR));
LoadStringW(hInst, IDS_UNINSTALL, szUninstallBtn, sizeof(szUninstallBtn) / sizeof(WCHAR));
LoadStringW(hInst, IDS_MODIFY, szModifyBtn, sizeof(szModifyBtn) / sizeof(WCHAR));
LoadStringW(hInst, IDS_INSTALL, szInstallBtn, _countof(szInstallBtn));
LoadStringW(hInst, IDS_UNINSTALL, szUninstallBtn, _countof(szUninstallBtn));
LoadStringW(hInst, IDS_MODIFY, szModifyBtn, _countof(szModifyBtn));
hToolBar = CreateWindowExW(0,
TOOLBARCLASSNAMEW,

View file

@ -15,7 +15,7 @@ TreeViewAddItem(HTREEITEM hParent, LPWSTR lpText, INT Image, INT SelectedImage,
{
TV_INSERTSTRUCTW Insert;
ZeroMemory(&Insert, sizeof(TV_INSERTSTRUCT));
ZeroMemory(&Insert, sizeof(Insert));
Insert.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
Insert.hInsertAfter = TVI_LAST;

View file

@ -61,7 +61,7 @@ LoadSettings(VOID)
if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\ReactOS\\rapps", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
{
dwSize = sizeof(SETTINGS_INFO);
dwSize = sizeof(SettingsInfo);
if (RegQueryValueExW(hKey, L"Settings", NULL, NULL, (LPBYTE)&SettingsInfo, &dwSize) == ERROR_SUCCESS)
{
RegCloseKey(hKey);
@ -82,7 +82,7 @@ SaveSettings(HWND hwnd)
if (SettingsInfo.bSaveWndPos)
{
wp.length = sizeof(WINDOWPLACEMENT);
wp.length = sizeof(wp);
GetWindowPlacement(hwnd, &wp);
SettingsInfo.Left = wp.rcNormalPosition.left;
@ -95,7 +95,7 @@ SaveSettings(HWND hwnd)
if (RegCreateKeyExW(HKEY_CURRENT_USER, L"Software\\ReactOS\\rapps", 0, NULL,
REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS)
{
RegSetValueExW(hKey, L"Settings", 0, REG_BINARY, (LPBYTE)&SettingsInfo, sizeof(SETTINGS_INFO));
RegSetValueExW(hKey, L"Settings", 0, REG_BINARY, (LPBYTE)&SettingsInfo, sizeof(SettingsInfo));
RegCloseKey(hKey);
}
}
@ -943,7 +943,7 @@ wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nSh
InitCommonControls();
/* Create the window */
WndClass.cbSize = sizeof(WNDCLASSEXW);
WndClass.cbSize = sizeof(WndClass);
WndClass.lpszClassName = szWindowClass;
WndClass.lpfnWndProc = MainWindowProc;
WndClass.hInstance = hInstance;

View file

@ -10,9 +10,9 @@ public:
SendMessageW(EM_SETSEL, Start, End);
ZeroMemory(&CharFormat, sizeof(CHARFORMAT2));
ZeroMemory(&CharFormat, sizeof(CharFormat));
CharFormat.cbSize = sizeof(CHARFORMAT2);
CharFormat.cbSize = sizeof(CharFormat);
CharFormat.dwMask = dwEffects;
CharFormat.dwEffects = dwEffects;

View file

@ -129,12 +129,12 @@ public:
{ 6, ID_EXIT, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, { 0 }, 0, 0 }
};
INT NumButtons = sizeof(Buttons) / sizeof(Buttons[0]);
INT NumButtons = _countof(Buttons);
HIMAGELIST hImageList;
LoadStringW(hInst, IDS_INSTALL, szInstallBtn, sizeof(szInstallBtn) / sizeof(WCHAR));
LoadStringW(hInst, IDS_UNINSTALL, szUninstallBtn, sizeof(szUninstallBtn) / sizeof(WCHAR));
LoadStringW(hInst, IDS_MODIFY, szModifyBtn, sizeof(szModifyBtn) / sizeof(WCHAR));
LoadStringW(hInst, IDS_INSTALL, szInstallBtn, _countof(szInstallBtn));
LoadStringW(hInst, IDS_UNINSTALL, szUninstallBtn, _countof(szUninstallBtn));
LoadStringW(hInst, IDS_MODIFY, szModifyBtn, _countof(szModifyBtn));
m_hWnd = CreateWindowExW(0,
TOOLBARCLASSNAMEW,
@ -213,7 +213,7 @@ public:
ItemIndex = Index;
}
ZeroMemory(&Item, sizeof(LVITEM));
ZeroMemory(&Item, sizeof(Item));
Item.mask = LVIF_PARAM;
Item.iItem = ItemIndex;
@ -227,7 +227,7 @@ public:
{
LV_COLUMN Column;
ZeroMemory(&Column, sizeof(LV_COLUMN));
ZeroMemory(&Column, sizeof(Column));
Column.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
Column.iSubItem = Index;
@ -242,7 +242,7 @@ public:
{
LV_ITEMW Item;
ZeroMemory(&Item, sizeof(LV_ITEM));
ZeroMemory(&Item, sizeof(Item));
Item.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE | LVIF_IMAGE;
Item.pszText = lpText;
@ -269,11 +269,11 @@ public:
IndexInfo.lParam = lParam1;
Index = FindItem(-1, &IndexInfo);
GetItemText(Index, iSubItem, Item1, sizeof(Item1) / sizeof(WCHAR));
GetItemText(Index, iSubItem, Item1, _countof(Item1));
IndexInfo.lParam = lParam2;
Index = FindItem(-1, &IndexInfo);
GetItemText(Index, iSubItem, Item2, sizeof(Item2) / sizeof(WCHAR));
GetItemText(Index, iSubItem, Item2, _countof(Item2));
if (bAscending)
return wcscmp(Item2, Item1);
@ -510,7 +510,7 @@ private:
m_SearchBar->SendMessageW(WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
LoadStringW(hInst, IDS_SEARCH_TEXT, szBuf, sizeof(szBuf) / sizeof(WCHAR));
LoadStringW(hInst, IDS_SEARCH_TEXT, szBuf, _countof(szBuf));
m_SearchBar->SetWindowTextW(szBuf);
return hwnd != NULL;

View file

@ -104,10 +104,10 @@ UninstallApplication(INT Index, BOOL bModify)
ItemIndex = Index;
}
ListView_GetItemText(hListView, ItemIndex, 0, szAppName, sizeof(szAppName) / sizeof(WCHAR));
ListView_GetItemText(hListView, ItemIndex, 0, szAppName, _countof(szAppName));
WriteLogMessage(EVENTLOG_SUCCESS, MSG_SUCCESS_REMOVE, szAppName);
ZeroMemory(&Item, sizeof(LVITEM));
ZeroMemory(&Item, sizeof(Item));
Item.mask = LVIF_PARAM;
Item.iItem = ItemIndex;
@ -149,7 +149,7 @@ ShowInstalledAppInfo(INT Index)
#define GET_INFO(a, b, c, d) \
if (GetApplicationString(Info->hSubKey, a, szInfo)) \
{ \
LoadStringW(hInst, b, szText, sizeof(szText) / sizeof(WCHAR)); \
LoadStringW(hInst, b, szText, _countof(szText)); \
InsertRichEditText(szText, c); \
InsertRichEditText(szInfo, d); \
} \
@ -190,8 +190,8 @@ RemoveAppFromRegistry(INT Index)
Info = (PINSTALLED_INFO) ListViewGetlParam(Index);
if (!Info || !Info->hSubKey || (ItemIndex == -1)) return;
if (!LoadStringW(hInst, IDS_APP_REG_REMOVE, szMsgText, sizeof(szMsgText) / sizeof(WCHAR)) ||
!LoadStringW(hInst, IDS_INFORMATION, szMsgTitle, sizeof(szMsgTitle) / sizeof(WCHAR)))
if (!LoadStringW(hInst, IDS_APP_REG_REMOVE, szMsgText, _countof(szMsgText)) ||
!LoadStringW(hInst, IDS_INFORMATION, szMsgTitle, _countof(szMsgTitle)))
return;
if (MessageBoxW(hMainWnd, szMsgText, szMsgTitle, MB_YESNO | MB_ICONQUESTION) == IDYES)
@ -204,7 +204,7 @@ RemoveAppFromRegistry(INT Index)
return;
}
if (!LoadStringW(hInst, IDS_UNABLE_TO_REMOVE, szMsgText, sizeof(szMsgText) / sizeof(WCHAR)))
if (!LoadStringW(hInst, IDS_UNABLE_TO_REMOVE, szMsgText, _countof(szMsgText)))
return;
MessageBoxW(hMainWnd, szMsgText, NULL, MB_OK | MB_ICONERROR);

View file

@ -212,7 +212,7 @@ static BOOL CertIsValid(HINTERNET hInternet, LPWSTR lpszHostName)
Ret = HttpSendRequestW(hRequest, L"", 0, NULL, 0);
if (Ret)
{
certInfoLength = sizeof(INTERNET_CERTIFICATE_INFOW);
certInfoLength = sizeof(certInfo);
Ret = InternetQueryOptionW(hRequest,
INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT,
&certInfo,
@ -351,7 +351,7 @@ ThreadFunc(LPVOID Context)
{
WCHAR szMsgText[MAX_STR_LEN];
if (!LoadStringW(hInst, IDS_UNABLE_TO_DOWNLOAD2, szMsgText, sizeof(szMsgText) / sizeof(WCHAR)))
if (!LoadStringW(hInst, IDS_UNABLE_TO_DOWNLOAD2, szMsgText, _countof(szMsgText)))
goto end;
MessageBoxW(hMainWnd, szMsgText, NULL, MB_OK | MB_ICONERROR);
@ -365,7 +365,7 @@ ThreadFunc(LPVOID Context)
{
WCHAR szMsgText[MAX_STR_LEN];
if (!LoadStringW(hInst, IDS_UNABLE_TO_DOWNLOAD, szMsgText, sizeof(szMsgText) / sizeof(WCHAR)))
if (!LoadStringW(hInst, IDS_UNABLE_TO_DOWNLOAD, szMsgText, _countof(szMsgText)))
goto end;
MessageBoxW(hMainWnd, szMsgText, NULL, MB_OK | MB_ICONERROR);
@ -403,7 +403,7 @@ ThreadFunc(LPVOID Context)
{
WCHAR szMsgText[MAX_STR_LEN];
if (!LoadStringW(hInst, IDS_CERT_DOES_NOT_MATCH, szMsgText, sizeof(szMsgText) / sizeof(WCHAR)))
if (!LoadStringW(hInst, IDS_CERT_DOES_NOT_MATCH, szMsgText, _countof(szMsgText)))
goto end;
MessageBoxW(Dlg, szMsgText, NULL, MB_OK | MB_ICONERROR);
@ -664,7 +664,7 @@ DownloadApplicationsDB(LPCWSTR lpUrl)
{
APPLICATION_INFO IntInfo;
ZeroMemory(&IntInfo, sizeof(APPLICATION_INFO));
ZeroMemory(&IntInfo, sizeof(IntInfo));
if (FAILED(StringCbCopyW(IntInfo.szUrlDownload,
sizeof(IntInfo.szUrlDownload),
lpUrl)))

View file

@ -55,7 +55,7 @@ GetSystemColorDepth(VOID)
DEVMODE pDevMode;
INT ColorDepth;
pDevMode.dmSize = sizeof(DEVMODE);
pDevMode.dmSize = sizeof(pDevMode);
pDevMode.dmDriverExtra = 0;
if (!EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &pDevMode))
@ -143,13 +143,13 @@ SetWelcomeText(VOID)
{
WCHAR szText[MAX_STR_LEN*3];
LoadStringW(hInst, IDS_WELCOME_TITLE, szText, sizeof(szText) / sizeof(WCHAR));
LoadStringW(hInst, IDS_WELCOME_TITLE, szText, _countof(szText));
NewRichEditText(szText, CFE_BOLD);
LoadStringW(hInst, IDS_WELCOME_TEXT, szText, sizeof(szText) / sizeof(WCHAR));
LoadStringW(hInst, IDS_WELCOME_TEXT, szText, _countof(szText));
InsertRichEditText(szText, 0);
LoadStringW(hInst, IDS_WELCOME_URL, szText, sizeof(szText) / sizeof(WCHAR));
LoadStringW(hInst, IDS_WELCOME_URL, szText, _countof(szText));
InsertRichEditText(szText, CFM_LINK);
}
@ -272,7 +272,7 @@ ExtractFilesFromCab(LPWSTR lpCabName, LPWSTR lpOutputPath)
pfnExtract = (fnExtract) GetProcAddress(hCabinetDll, "Extract");
if (pfnExtract)
{
ZeroMemory(&Dest, sizeof(SESSION));
ZeroMemory(&Dest, sizeof(Dest));
WideCharToMultiByte(CP_ACP, 0, lpOutputPath, -1, Dest.Destination, MAX_PATH, NULL, NULL);
WideCharToMultiByte(CP_ACP, 0, lpCabName, -1, szCabName, MAX_PATH, NULL, NULL);
@ -315,7 +315,7 @@ InitLogs(VOID)
return;
}
if (!GetModuleFileName(NULL, szPath, sizeof(szPath) / sizeof(szPath[0])))
if (!GetModuleFileNameW(NULL, szPath, _countof(szPath)))
return;
if (RegSetValueExW(hKey,

View file

@ -20,7 +20,7 @@ ChooseFolder(HWND hwnd)
BROWSEINFO bi;
WCHAR szPath[MAX_PATH], szBuf[MAX_STR_LEN];
LoadStringW(hInst, IDS_CHOOSE_FOLDER_TEXT, szBuf, sizeof(szBuf) / sizeof(TCHAR));
LoadStringW(hInst, IDS_CHOOSE_FOLDER_TEXT, szBuf, _countof(szBuf));
ZeroMemory(&bi, sizeof(bi));
bi.hwndOwner = hwnd;
@ -162,7 +162,7 @@ SettingsDlgProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam)
LoadStringW(hInst,
IDS_CHOOSE_FOLDER_ERROR,
szMsgText, sizeof(szMsgText) / sizeof(WCHAR));
szMsgText, _countof(szMsgText));
if (MessageBoxW(hDlg, szMsgText, NULL, MB_YESNO) == IDYES)
{

View file

@ -123,7 +123,7 @@ CreateHSplitBar(HWND hwnd)
WCHAR szWindowClass[] = L"HSplitterWindowClass";
WNDCLASSEXW WndClass = {0};
WndClass.cbSize = sizeof(WNDCLASSEXW);
WndClass.cbSize = sizeof(WndClass);
WndClass.lpszClassName = szWindowClass;
WndClass.lpfnWndProc = HSplitterWindowProc;
WndClass.hInstance = hInst;
@ -264,7 +264,7 @@ CreateVSplitBar(HWND hwnd)
WCHAR szWindowClass[] = L"VSplitterWindowClass";
WNDCLASSEXW WndClass = {0};
WndClass.cbSize = sizeof(WNDCLASSEXW);
WndClass.cbSize = sizeof(WndClass);
WndClass.lpszClassName = szWindowClass;
WndClass.lpfnWndProc = VSplitterWindowProc;
WndClass.hInstance = hInst;

View file

@ -78,7 +78,7 @@ LoadSettings(VOID)
if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\ReactOS\\rapps", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
{
dwSize = sizeof(SETTINGS_INFO);
dwSize = sizeof(SettingsInfo);
if (RegQueryValueExW(hKey, L"Settings", NULL, NULL, (LPBYTE)&SettingsInfo, &dwSize) == ERROR_SUCCESS)
{
RegCloseKey(hKey);
@ -99,7 +99,7 @@ SaveSettings(HWND hwnd)
if (SettingsInfo.bSaveWndPos)
{
wp.length = sizeof(WINDOWPLACEMENT);
wp.length = sizeof(wp);
GetWindowPlacement(hwnd, &wp);
SettingsInfo.Left = wp.rcNormalPosition.left;
@ -112,7 +112,7 @@ SaveSettings(HWND hwnd)
if (RegCreateKeyExW(HKEY_CURRENT_USER, L"Software\\ReactOS\\rapps", 0, NULL,
REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS)
{
RegSetValueExW(hKey, L"Settings", 0, REG_BINARY, (LPBYTE)&SettingsInfo, sizeof(SETTINGS_INFO));
RegSetValueExW(hKey, L"Settings", 0, REG_BINARY, (LPBYTE)&SettingsInfo, sizeof(SettingsInfo));
RegCloseKey(hKey);
}
}