[explorer_new]
authorChristoph von Wittich <christoph_vw@reactos.org>
Sun, 19 Jan 2014 19:49:12 +0000 (19:49 +0000)
committerChristoph von Wittich <christoph_vw@reactos.org>
Sun, 19 Jan 2014 19:49:12 +0000 (19:49 +0000)
use strsafe functions

svn path=/trunk/; revision=61712

reactos/base/shell/explorer-new/explorer.c
reactos/base/shell/explorer-new/precomp.h
reactos/base/shell/explorer-new/traywnd.c

index 395165a..a574a5b 100644 (file)
@@ -220,12 +220,14 @@ GetExplorerRegValueSet(IN HKEY hKey,
     DWORD dwType, dwSize;
     BOOL Ret = FALSE;
 
-    _tcscpy(szBuffer,
+    StringCbCopy(szBuffer, sizeof(szBuffer),
             TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer"));
-    _tcscat(szBuffer,
-            _T("\\"));
-    _tcscat(szBuffer,
-            lpSubKey);
+    if (FAILED(StringCbCat(szBuffer, sizeof(szBuffer),
+            _T("\\"))))
+        return FALSE;
+    if (FAILED(StringCbCat(szBuffer, sizeof(szBuffer),
+            lpSubKey)))
+    return FALSE;
 
     dwSize = sizeof(szBuffer);
     if (RegOpenKeyEx(hKey,
index c7e263d..ad2bfc9 100644 (file)
@@ -22,6 +22,7 @@
 #include <shlwapi.h>
 #include <shlguid_undoc.h>
 #include <uxtheme.h>
+#include <strsafe.h>
 
 #include "tmschema.h"
 #include "resource.h"
index 0cfdb21..a887319 100644 (file)
@@ -99,8 +99,13 @@ typedef struct
 BOOL LaunchCPanel(HWND hwnd, LPCTSTR applet)
 {
     TCHAR szParams[MAX_PATH];
-    _tcscpy(szParams, TEXT("shell32.dll,Control_RunDLL "));
-    _tcscat(szParams, applet);
+
+    StringCbCopy(szParams, sizeof(szParams),
+        TEXT("shell32.dll,Control_RunDLL "));
+    if (FAILED(StringCbCat(szParams, sizeof(szParams),
+            applet)))
+        return FALSE;
+
     return (ShellExecute(hwnd, TEXT("open"), TEXT("rundll32.exe"), szParams, NULL, SW_SHOWDEFAULT) > (HINSTANCE)32);
 }