diff options
author | George Hazan <george.hazan@gmail.com> | 2015-06-19 19:35:42 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-06-19 19:35:42 +0000 |
commit | 4c814798c7bc7f6a0f92c21b027b26290622aa2f (patch) | |
tree | 9bbfb38bd639f352300aa16ff7c45f5a9b2dba6d /plugins/ShellExt/src | |
parent | f0f0cd088f1ec3a85abee825ddbc214f3f6b92c3 (diff) |
SIZEOF replaced with more secure analog - _countof
git-svn-id: http://svn.miranda-ng.org/main/trunk@14270 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/ShellExt/src')
-rw-r--r-- | plugins/ShellExt/src/main.cpp | 6 | ||||
-rw-r--r-- | plugins/ShellExt/src/options.cpp | 4 | ||||
-rw-r--r-- | plugins/ShellExt/src/shlcom.cpp | 10 |
3 files changed, 10 insertions, 10 deletions
diff --git a/plugins/ShellExt/src/main.cpp b/plugins/ShellExt/src/main.cpp index 12a09506a4..10e018ae3e 100644 --- a/plugins/ShellExt/src/main.cpp +++ b/plugins/ShellExt/src/main.cpp @@ -26,8 +26,8 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) if (fdwReason == DLL_PROCESS_ATTACH) {
bIsVistaPlus = GetProcAddress( GetModuleHandleA("kernel32.dll"), "GetProductInfo") != NULL;
- GetTempPath(SIZEOF(tszLogPath), tszLogPath);
- _tcscat_s(tszLogPath, SIZEOF(tszLogPath), _T("shlext.log"));
+ GetTempPath(_countof(tszLogPath), tszLogPath);
+ _tcscat_s(tszLogPath, _countof(tszLogPath), _T("shlext.log"));
hInst = hinstDLL;
DisableThreadLibraryCalls(hinstDLL);
@@ -127,7 +127,7 @@ STDAPI DllRegisterServer() return E_FAIL;
TCHAR tszFileName[MAX_PATH];
- GetModuleFileName(hInst, tszFileName, SIZEOF(tszFileName));
+ GetModuleFileName(hInst, tszFileName, _countof(tszFileName));
if ( RegSetValueEx(kInprocServer, NULL, 0, REG_SZ, (LPBYTE)tszFileName, sizeof(TCHAR)*(lstrlen(tszFileName)+1)))
return E_FAIL;
if ( RegSetValueExA(kInprocServer, "ThreadingModel", 0, REG_SZ, (PBYTE)str4, sizeof(str4)))
diff --git a/plugins/ShellExt/src/options.cpp b/plugins/ShellExt/src/options.cpp index b3402a65f1..3e4ddc83f8 100644 --- a/plugins/ShellExt/src/options.cpp +++ b/plugins/ShellExt/src/options.cpp @@ -8,7 +8,7 @@ static void AutoSize(HWND hwnd) HFONT hOldFont = (HFONT)SelectObject(hDC, hFont);
TCHAR szBuf[MAX_PATH];
- int i = GetWindowText(hwnd, szBuf, SIZEOF(szBuf));
+ int i = GetWindowText(hwnd, szBuf, _countof(szBuf));
SIZE tS;
GetTextExtentPoint32(hDC, szBuf, i, &tS);
@@ -34,7 +34,7 @@ static INT_PTR CALLBACK OptDialogProc(HWND hwndDlg, UINT wMsg, WPARAM wParam, LP case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
comReg = IsCOMRegistered();
- mir_sntprintf(szBuf, SIZEOF(szBuf), _T("%s (%s)"),
+ mir_sntprintf(szBuf, _countof(szBuf), _T("%s (%s)"),
TranslateTS(COM_OKSTR[ (comReg & COMREG_OK) != 0 ]),
TranslateTS(COM_APPROVEDSTR[ (comReg & COMREG_APPROVED) != 0 ]));
SetDlgItemText(hwndDlg, IDC_STATUS, szBuf);
diff --git a/plugins/ShellExt/src/shlcom.cpp b/plugins/ShellExt/src/shlcom.cpp index c77d6f3d86..fe15398aee 100644 --- a/plugins/ShellExt/src/shlcom.cpp +++ b/plugins/ShellExt/src/shlcom.cpp @@ -90,7 +90,7 @@ BOOL AddToList(TAddArgList& args) HANDLE hFind = FindFirstFileA(szBuf, &fd);
while (true) {
if (fd.cFileName[0] != '.') {
- mir_snprintf(szBuf, SIZEOF(szBuf),"%s\\%s", args.szFile, fd.cFileName);
+ mir_snprintf(szBuf, _countof(szBuf),"%s\\%s", args.szFile, fd.cFileName);
// keep a copy of the current thing being processed
szThis = args.szFile;
args.szFile = szBuf;
@@ -559,8 +559,8 @@ void CheckUnregisterServer() if (bIsVistaPlus) {
// launches regsvr to remove the dll under admin.
TCHAR szFileName[MAX_PATH], szBuf[MAX_PATH * 2];
- GetModuleFileName(hInst, szFileName, SIZEOF(szFileName));
- mir_sntprintf(szBuf, SIZEOF(szBuf), _T("/s /u \"%s\""), szFileName);
+ GetModuleFileName(hInst, szFileName, _countof(szFileName));
+ mir_sntprintf(szBuf, _countof(szBuf), _T("/s /u \"%s\""), szFileName);
SHELLEXECUTEINFO sei = { sizeof(sei) };
sei.lpVerb = _T("runas");
@@ -588,8 +588,8 @@ void CheckRegisterServer() TranslateT("Shell context menus requires your permission to register with Windows Explorer (one time only)."),
TranslateT("Miranda NG - Shell context menus (shellext.dll)"), MB_OK | MB_ICONINFORMATION);
// /s = silent
- GetModuleFileName(hInst, szFileName, SIZEOF(szFileName));
- mir_sntprintf(szBuf, SIZEOF(szBuf), _T("/s \"%s\""), szFileName);
+ GetModuleFileName(hInst, szFileName, _countof(szFileName));
+ mir_sntprintf(szBuf, _countof(szBuf), _T("/s \"%s\""), szFileName);
SHELLEXECUTEINFO sei = { sizeof(sei) };
sei.lpVerb = _T("runas");
|