This is still wrong. Tcscat is completely unsafe and can result in you
overwriting the path as soon as the user has a windows path longer
than MAX_PATH - sizeof("regedit.exe").
Please use the PathAppend API for this.
On Sat, May 17, 2008 at 5:39 PM, <cfinck(a)svn.reactos.org> wrote:
Author: cfinck
Date: Sat May 17 04:39:36 2008
New Revision: 33547
URL:
http://svn.reactos.org/svn/reactos?rev=33547&view=rev
Log:
Make 100% sure that the correct "regedit.exe" is launched by using
GetWindowsDirectory and appending "\regedit.exe" as suggested by Alex on
ros-dev.
Modified:
trunk/reactos/base/applications/regedt32/regedt32.c
Modified: trunk/reactos/base/applications/regedt32/regedt32.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedt32…
==============================================================================
--- trunk/reactos/base/applications/regedt32/regedt32.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/regedt32/regedt32.c [iso-8859-1] Sat May 17 04:39:36
2008
@@ -5,7 +5,12 @@
int WINAPI _tWinMain(HINSTANCE hCurInst, HINSTANCE hPrevInst,
LPTSTR lpsCmdLine, int nCmdShow)
{
- ShellExecute(NULL, NULL, _T("regedit.exe"), lpsCmdLine, NULL, nCmdShow);
+ TCHAR szPath[MAX_PATH];
+
+ GetWindowsDirectory(szPath, MAX_PATH);
+ _tcscat(szPath, _T("\\regedit.exe"));
+
+ ShellExecute(NULL, NULL, szPath, lpsCmdLine, NULL, nCmdShow);
return 0;
}