From 93b5f39fd876688c60e3e968b4d328a5986fefb0 Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Sun, 19 Jan 2014 19:49:12 +0000 Subject: [PATCH] [explorer_new] use strsafe functions svn path=/trunk/; revision=61712 --- reactos/base/shell/explorer-new/explorer.c | 12 +++++++----- reactos/base/shell/explorer-new/precomp.h | 1 + reactos/base/shell/explorer-new/traywnd.c | 9 +++++++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/reactos/base/shell/explorer-new/explorer.c b/reactos/base/shell/explorer-new/explorer.c index 395165aef79..a574a5b93e6 100644 --- a/reactos/base/shell/explorer-new/explorer.c +++ b/reactos/base/shell/explorer-new/explorer.c @@ -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, diff --git a/reactos/base/shell/explorer-new/precomp.h b/reactos/base/shell/explorer-new/precomp.h index c7e263dc57d..ad2bfc9944a 100644 --- a/reactos/base/shell/explorer-new/precomp.h +++ b/reactos/base/shell/explorer-new/precomp.h @@ -22,6 +22,7 @@ #include #include #include +#include #include "tmschema.h" #include "resource.h" diff --git a/reactos/base/shell/explorer-new/traywnd.c b/reactos/base/shell/explorer-new/traywnd.c index 0cfdb21b8d1..a887319b4f8 100644 --- a/reactos/base/shell/explorer-new/traywnd.c +++ b/reactos/base/shell/explorer-new/traywnd.c @@ -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); } -- 2.17.1