Maybe _tcscat_s should be used instead ?
Kind regards,
Sylvain Petreolle (aka Usurp)
Support artists, not multinationals -
De : Alex Ionescu <ionucu(a)videotron.ca>
À : ros-dev(a)reactos.org
Envoyé le : Samedi, 17 Mai 2008, 16h00mn 00s
Objet : Re: [ros-dev] [ros-diffs] [cfinck] 33547: Make 100% sure that the correct
"regedit.exe" is launched by using GetWindowsDirectory and appending
"\regedit.exe" as suggested by Alex on ros-dev.
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, 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;
}
--
Best regards,
Alex Ionescu
_______________________________________________
Ros-dev mailing list
Ros-dev(a)reactos.org
http://www.reactos.org/mailman/listinfo/ros-dev