Adjust for Visual Studio 2005:

- use secure CRT functions where available
- use COUNTOF instead of hard coded buffer sizes
- project files in new format for manifest integration

svn path=/trunk/; revision=19750
This commit is contained in:
Martin Fuchs 2005-11-29 13:34:24 +00:00
parent 2b3e3984b1
commit e87cd46903
29 changed files with 4427 additions and 134 deletions

View file

@ -184,7 +184,7 @@ void FindProgramDlg::collect_programs_callback(Entry* entry, void* param)
WIN32_FIND_DATA wfd; WIN32_FIND_DATA wfd;
TCHAR path[MAX_PATH]; TCHAR path[MAX_PATH];
hr = pShellLink->GetPath(path, MAX_PATH-1, &wfd, SLGP_UNCPRIORITY); hr = pShellLink->GetPath(path, COUNTOF(path)-1, &wfd, SLGP_UNCPRIORITY);
if (SUCCEEDED(hr)) { if (SUCCEEDED(hr)) {
TCHAR entry_path[MAX_PATH]; TCHAR entry_path[MAX_PATH];

View file

@ -165,3 +165,4 @@ If you search for more information, look into the Subversion repository.
09.10.2005 m. fuchs Fix for Bugzilla Entry 330: Correctly handle WM_COMMAND messages in web windows without web control 09.10.2005 m. fuchs Fix for Bugzilla Entry 330: Correctly handle WM_COMMAND messages in web windows without web control
m. fuchs replace "search computer" start menu entry by a "not yet implemented" message m. fuchs replace "search computer" start menu entry by a "not yet implemented" message
01.11.2005 m. fuchs String::str(), String::toLower() to allow conventient and WINE compatible string conversions 01.11.2005 m. fuchs String::str(), String::toLower() to allow conventient and WINE compatible string conversions
29.11.2005 m. fuchs Adjustments for Visual Studio 2005: use new secure CT functions, COUNTOF for buffer sizes

View file

@ -1,19 +1,24 @@
//Microsoft Developer Studio generated resource script.
//
#include "resource.h" #include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS #define APSTUDIO_READONLY_SYMBOLS
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include <windows.h> #include <windows.h>
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS #undef APSTUDIO_READONLY_SYMBOLS
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Hungarian (HU.) resources by Robert Horvath - talley at cubeclub.hu // Hungarian (unknown sub-lang: 0x0) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_HUN)
#ifdef _WIN32 #ifdef _WIN32
LANGUAGE LANG_HUNGARIAN, SUBLANG_NEUTRAL LANGUAGE LANG_HUNGARIAN, 0x0
#pragma code_page(1252) #pragma code_page(1250)
#endif //_WIN32 #endif //_WIN32
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@ -54,7 +59,7 @@ BEGIN
BEGIN BEGIN
MENUITEM "&Beállítások", ID_TOOLS_OPTIONS MENUITEM "&Beállítások", ID_TOOLS_OPTIONS
END END
POPUP "&Súgó" POPUP "&Súgóó"
BEGIN BEGIN
MENUITEM "Explorer &GYIK...", ID_EXPLORER_FAQ MENUITEM "Explorer &GYIK...", ID_EXPLORER_FAQ
MENUITEM "Explorer &névjegye...", ID_ABOUT_EXPLORER MENUITEM "Explorer &névjegye...", ID_ABOUT_EXPLORER
@ -117,7 +122,7 @@ BEGIN
BEGIN BEGIN
MENUITEM "&Beállítások", ID_TOOLS_OPTIONS MENUITEM "&Beállítások", ID_TOOLS_OPTIONS
END END
POPUP "&Súgó" POPUP "&Súgóó"
BEGIN BEGIN
MENUITEM "Explorer &GYIK...", ID_EXPLORER_FAQ MENUITEM "Explorer &GYIK...", ID_EXPLORER_FAQ
MENUITEM "&Az Explorer névjegye...", ID_ABOUT_EXPLORER MENUITEM "&Az Explorer névjegye...", ID_ABOUT_EXPLORER
@ -377,12 +382,17 @@ BEGIN
IDS_TASKBAR "Taskbar" IDS_TASKBAR "Taskbar"
END END
#endif // Hungarian (HU.) resources #endif // Hungarian (unknown sub-lang: 0x0) resources
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED #ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED #endif // not APSTUDIO_INVOKED

View file

@ -901,7 +901,7 @@ int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdL
// install ROS Explorer into the registry // install ROS Explorer into the registry
TCHAR path[MAX_PATH]; TCHAR path[MAX_PATH];
int l = GetModuleFileName(0, path, MAX_PATH); int l = GetModuleFileName(0, path, COUNTOF(path));
if (l) { if (l) {
HKEY hkey; HKEY hkey;

View file

@ -22,7 +22,6 @@ CFG=explorer - Win32 WineDll
!MESSAGE "explorer - Win32 Debug Release" (based on "Win32 (x86) Console Application") !MESSAGE "explorer - Win32 Debug Release" (based on "Win32 (x86) Console Application")
!MESSAGE "explorer - Win32 Unicode Release" (based on "Win32 (x86) Console Application") !MESSAGE "explorer - Win32 Unicode Release" (based on "Win32 (x86) Console Application")
!MESSAGE "explorer - Win32 Unicode Debug" (based on "Win32 (x86) Console Application") !MESSAGE "explorer - Win32 Unicode Debug" (based on "Win32 (x86) Console Application")
!MESSAGE "explorer - Win32 _NO_COMUTIL" (based on "Win32 (x86) Console Application")
!MESSAGE "explorer - Win32" (based on "Win32 (x86) Console Application") !MESSAGE "explorer - Win32" (based on "Win32 (x86) Console Application")
!MESSAGE "explorer - Win32 WineRelease" (based on "Win32 (x86) Console Application") !MESSAGE "explorer - Win32 WineRelease" (based on "Win32 (x86) Console Application")
!MESSAGE "explorer - Win32 WineDll" (based on "Win32 (x86) Console Application") !MESSAGE "explorer - Win32 WineDll" (based on "Win32 (x86) Console Application")
@ -128,7 +127,7 @@ LINK32=link.exe
# ADD BASE CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "UNICODE" /D "_ROS_" /YX /FD /c # ADD BASE CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "UNICODE" /D "_ROS_" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GR /GX /O2 /D "NDEBUG" /D "UNICODE" /D "WIN32" /D _WIN32_IE=0x0600 /D _WIN32_WINNT=0x0501 /Yu"precomp.h" /FD /c # ADD CPP /nologo /MD /W3 /GR /GX /O2 /D "NDEBUG" /D "UNICODE" /D "WIN32" /D _WIN32_IE=0x0600 /D _WIN32_WINNT=0x0501 /Yu"precomp.h" /FD /c
# ADD BASE RSC /l 0x407 /d "NDEBUG" # ADD BASE RSC /l 0x407 /d "NDEBUG"
# ADD RSC /l 0x407 /d "NDEBUG" # ADD RSC /l 0x407 /d "NDEBUG" /d "UNICODE"
BSC32=bscmake.exe BSC32=bscmake.exe
# ADD BASE BSC32 /nologo # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo # ADD BSC32 /nologo
@ -154,7 +153,7 @@ LINK32=link.exe
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "UNICODE" /D "_ROS_" /FR /YX /FD /GZ /c # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "UNICODE" /D "_ROS_" /FR /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /D "_DEBUG" /D "UNICODE" /D "WIN32" /D _WIN32_IE=0x0600 /D _WIN32_WINNT=0x0501 /FR /Yu"precomp.h" /FD /GZ /c # ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /D "_DEBUG" /D "UNICODE" /D "WIN32" /D _WIN32_IE=0x0600 /D _WIN32_WINNT=0x0501 /FR /Yu"precomp.h" /FD /GZ /c
# ADD BASE RSC /l 0x407 /d "_DEBUG" # ADD BASE RSC /l 0x407 /d "_DEBUG"
# ADD RSC /l 0x407 /d "_DEBUG" # ADD RSC /l 0x407 /d "_DEBUG" /d "UNICODE"
BSC32=bscmake.exe BSC32=bscmake.exe
# ADD BASE BSC32 /nologo # ADD BASE BSC32 /nologo
# ADD BSC32 /nologo # ADD BSC32 /nologo
@ -163,33 +162,6 @@ LINK32=link.exe
# ADD LINK32 shell32.lib comctl32.lib gdi32.lib user32.lib advapi32.lib ole32.lib delayimp.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"Debug" /delayload:oleaut32.dll /delayload:wsock32.dll # ADD LINK32 shell32.lib comctl32.lib gdi32.lib user32.lib advapi32.lib ole32.lib delayimp.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /libpath:"Debug" /delayload:oleaut32.dll /delayload:wsock32.dll
# SUBTRACT LINK32 /pdb:none # SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "explorer - Win32 _NO_COMUTIL"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "explorer___Win32__NO_COMUTIL"
# PROP BASE Intermediate_Dir "explorer___Win32__NO_COMUTIL"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "_NO_COMUTIL"
# PROP Intermediate_Dir "_NO_COMUTIL"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_ROS_" /D _WIN32_IE=0x0501 /D _WIN32_WINNT=0x0501 /FR /YX /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GR /GX /ZI /Od /D "_DEBUG" /D "_NO_COMUTIL" /D "WIN32" /D _WIN32_IE=0x0600 /D _WIN32_WINNT=0x0501 /FR /Yu"precomp.h" /FD /GZ /c
# ADD BASE RSC /l 0x407 /d "_DEBUG"
# ADD RSC /l 0x407 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 user32.lib gdi32.lib advapi32.lib comctl32.lib shell32.lib ole32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# SUBTRACT BASE LINK32 /pdb:none
# ADD LINK32 shell32.lib comctl32.lib gdi32.lib user32.lib advapi32.lib ole32.lib delayimp.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept /delayload:oleaut32.dll /delayload:wsock32.dll
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "explorer - Win32" !ELSEIF "$(CFG)" == "explorer - Win32"
# PROP BASE Use_MFC 0 # PROP BASE Use_MFC 0
@ -280,7 +252,6 @@ LINK32=link.exe
# Name "explorer - Win32 Debug Release" # Name "explorer - Win32 Debug Release"
# Name "explorer - Win32 Unicode Release" # Name "explorer - Win32 Unicode Release"
# Name "explorer - Win32 Unicode Debug" # Name "explorer - Win32 Unicode Debug"
# Name "explorer - Win32 _NO_COMUTIL"
# Name "explorer - Win32" # Name "explorer - Win32"
# Name "explorer - Win32 WineRelease" # Name "explorer - Win32 WineRelease"
# Name "explorer - Win32 WineDll" # Name "explorer - Win32 WineDll"
@ -426,6 +397,11 @@ SOURCE=".\explorer-fr.rc"
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=".\explorer-hu.rc"
# PROP Exclude_From_Build 1
# End Source File
# Begin Source File
SOURCE=".\explorer-jp.rc" SOURCE=".\explorer-jp.rc"
# PROP Exclude_From_Build 1 # PROP Exclude_From_Build 1
# End Source File # End Source File

View file

@ -6,7 +6,7 @@
name="ReactOS.Explorer" name="ReactOS.Explorer"
type="win32" type="win32"
/> />
<description>ROS Excplorer</description> <description>ROS Explorer</description>
<dependency> <dependency>
<dependentAssembly> <dependentAssembly>
<assemblyIdentity <assemblyIdentity

View file

@ -0,0 +1,79 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual C++ Express 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "explorer", "explorer.vcproj", "{BFBAE588-8C68-4303-9BF6-C830087D8F25}"
ProjectSection(ProjectDependencies) = postProject
{F28B575D-7DBA-44DE-AAEF-FA0D065E5162} = {F28B575D-7DBA-44DE-AAEF-FA0D065E5162}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_explorer", "make_explorer.vcproj", "{E132A04B-8BC6-4D18-81F2-F0156B809871}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "notifyhook", "notifyhook\notifyhook.vcproj", "{F28B575D-7DBA-44DE-AAEF-FA0D065E5162}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
bjam|Win32 = bjam|Win32
Debug Release|Win32 = Debug Release|Win32
Debug|Win32 = Debug|Win32
doxy docu|Win32 = doxy docu|Win32
Release|Win32 = Release|Win32
Unicode Debug|Win32 = Unicode Debug|Win32
Unicode Release|Win32 = Unicode Release|Win32
WineDll|Win32 = WineDll|Win32
WineRelease|Win32 = WineRelease|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BFBAE588-8C68-4303-9BF6-C830087D8F25}.bjam|Win32.ActiveCfg = WineDll|Win32
{BFBAE588-8C68-4303-9BF6-C830087D8F25}.bjam|Win32.Build.0 = WineDll|Win32
{BFBAE588-8C68-4303-9BF6-C830087D8F25}.Debug Release|Win32.ActiveCfg = Debug|Win32
{BFBAE588-8C68-4303-9BF6-C830087D8F25}.Debug Release|Win32.Build.0 = Debug|Win32
{BFBAE588-8C68-4303-9BF6-C830087D8F25}.Debug|Win32.ActiveCfg = Debug|Win32
{BFBAE588-8C68-4303-9BF6-C830087D8F25}.Debug|Win32.Build.0 = Debug|Win32
{BFBAE588-8C68-4303-9BF6-C830087D8F25}.doxy docu|Win32.ActiveCfg = Debug|Win32
{BFBAE588-8C68-4303-9BF6-C830087D8F25}.doxy docu|Win32.Build.0 = Debug|Win32
{BFBAE588-8C68-4303-9BF6-C830087D8F25}.Release|Win32.ActiveCfg = Release|Win32
{BFBAE588-8C68-4303-9BF6-C830087D8F25}.Release|Win32.Build.0 = Release|Win32
{BFBAE588-8C68-4303-9BF6-C830087D8F25}.Unicode Debug|Win32.ActiveCfg = Unicode Debug|Win32
{BFBAE588-8C68-4303-9BF6-C830087D8F25}.Unicode Debug|Win32.Build.0 = Unicode Debug|Win32
{BFBAE588-8C68-4303-9BF6-C830087D8F25}.Unicode Release|Win32.ActiveCfg = Unicode Release|Win32
{BFBAE588-8C68-4303-9BF6-C830087D8F25}.Unicode Release|Win32.Build.0 = Unicode Release|Win32
{BFBAE588-8C68-4303-9BF6-C830087D8F25}.WineDll|Win32.ActiveCfg = WineDll|Win32
{BFBAE588-8C68-4303-9BF6-C830087D8F25}.WineDll|Win32.Build.0 = WineDll|Win32
{BFBAE588-8C68-4303-9BF6-C830087D8F25}.WineRelease|Win32.ActiveCfg = WineRelease|Win32
{BFBAE588-8C68-4303-9BF6-C830087D8F25}.WineRelease|Win32.Build.0 = WineRelease|Win32
{E132A04B-8BC6-4D18-81F2-F0156B809871}.bjam|Win32.ActiveCfg = bjam|Win32
{E132A04B-8BC6-4D18-81F2-F0156B809871}.bjam|Win32.Build.0 = bjam|Win32
{E132A04B-8BC6-4D18-81F2-F0156B809871}.Debug Release|Win32.ActiveCfg = Debug|Win32
{E132A04B-8BC6-4D18-81F2-F0156B809871}.Debug|Win32.ActiveCfg = Debug|Win32
{E132A04B-8BC6-4D18-81F2-F0156B809871}.doxy docu|Win32.ActiveCfg = doxy docu|Win32
{E132A04B-8BC6-4D18-81F2-F0156B809871}.doxy docu|Win32.Build.0 = doxy docu|Win32
{E132A04B-8BC6-4D18-81F2-F0156B809871}.Release|Win32.ActiveCfg = Release|Win32
{E132A04B-8BC6-4D18-81F2-F0156B809871}.Unicode Debug|Win32.ActiveCfg = Unicode Debug|Win32
{E132A04B-8BC6-4D18-81F2-F0156B809871}.Unicode Release|Win32.ActiveCfg = Unicode Release|Win32
{E132A04B-8BC6-4D18-81F2-F0156B809871}.WineDll|Win32.ActiveCfg = Debug|Win32
{E132A04B-8BC6-4D18-81F2-F0156B809871}.WineDll|Win32.Build.0 = Debug|Win32
{E132A04B-8BC6-4D18-81F2-F0156B809871}.WineRelease|Win32.ActiveCfg = Release|Win32
{E132A04B-8BC6-4D18-81F2-F0156B809871}.WineRelease|Win32.Build.0 = Release|Win32
{F28B575D-7DBA-44DE-AAEF-FA0D065E5162}.bjam|Win32.ActiveCfg = Debug|Win32
{F28B575D-7DBA-44DE-AAEF-FA0D065E5162}.bjam|Win32.Build.0 = Debug|Win32
{F28B575D-7DBA-44DE-AAEF-FA0D065E5162}.Debug Release|Win32.ActiveCfg = Debug|Win32
{F28B575D-7DBA-44DE-AAEF-FA0D065E5162}.Debug Release|Win32.Build.0 = Debug|Win32
{F28B575D-7DBA-44DE-AAEF-FA0D065E5162}.Debug|Win32.ActiveCfg = Debug|Win32
{F28B575D-7DBA-44DE-AAEF-FA0D065E5162}.Debug|Win32.Build.0 = Debug|Win32
{F28B575D-7DBA-44DE-AAEF-FA0D065E5162}.doxy docu|Win32.ActiveCfg = Debug|Win32
{F28B575D-7DBA-44DE-AAEF-FA0D065E5162}.doxy docu|Win32.Build.0 = Debug|Win32
{F28B575D-7DBA-44DE-AAEF-FA0D065E5162}.Release|Win32.ActiveCfg = Release|Win32
{F28B575D-7DBA-44DE-AAEF-FA0D065E5162}.Release|Win32.Build.0 = Release|Win32
{F28B575D-7DBA-44DE-AAEF-FA0D065E5162}.Unicode Debug|Win32.ActiveCfg = Debug|Win32
{F28B575D-7DBA-44DE-AAEF-FA0D065E5162}.Unicode Debug|Win32.Build.0 = Debug|Win32
{F28B575D-7DBA-44DE-AAEF-FA0D065E5162}.Unicode Release|Win32.ActiveCfg = Release|Win32
{F28B575D-7DBA-44DE-AAEF-FA0D065E5162}.Unicode Release|Win32.Build.0 = Release|Win32
{F28B575D-7DBA-44DE-AAEF-FA0D065E5162}.WineDll|Win32.ActiveCfg = Debug|Win32
{F28B575D-7DBA-44DE-AAEF-FA0D065E5162}.WineDll|Win32.Build.0 = Debug|Win32
{F28B575D-7DBA-44DE-AAEF-FA0D065E5162}.WineRelease|Win32.ActiveCfg = Release|Win32
{F28B575D-7DBA-44DE-AAEF-FA0D065E5162}.WineRelease|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

File diff suppressed because it is too large Load diff

View file

@ -102,7 +102,9 @@ BEGIN
"#endif\r\n" "#endif\r\n"
"END\r\n" "END\r\n"
"#endif\r\n" "#endif\r\n"
"#ifndef _DEBUG\r\n"
"CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST DISCARDABLE PURE ""explorer.exe.manifest""\r\n" "CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST DISCARDABLE PURE ""explorer.exe.manifest""\r\n"
"#endif\r\n"
"\r\n" "\r\n"
"#include ""explorer-en.rc""\r\n" "#include ""explorer-en.rc""\r\n"
"#include ""explorer-de.rc""\r\n" "#include ""explorer-de.rc""\r\n"
@ -186,7 +188,9 @@ IDS_EXPLORER_VERSION_STR "ROS Explorer Ansi%0s"
#endif #endif
END END
#endif #endif
#ifndef _DEBUG
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST DISCARDABLE PURE "explorer.exe.manifest" CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST DISCARDABLE PURE "explorer.exe.manifest"
#endif
#include "explorer-en.rc" #include "explorer-en.rc"
#include "explorer-de.rc" #include "explorer-de.rc"

View file

@ -92,6 +92,8 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "utility/utility.h" // for strcpy_s()
/************************************************************************ /************************************************************************
* *
* external low-level support routines * external low-level support routines
@ -897,7 +899,7 @@ handle_exception (int exceptionVector)
break; break;
case 'G': /* set the value of the CPU registers - return OK */ case 'G': /* set the value of the CPU registers - return OK */
hex2mem (ptr, (char *) registers, NUMREGBYTES, 0); hex2mem (ptr, (char *) registers, NUMREGBYTES, 0);
strcpy (remcomOutBuffer, "OK"); strcpy_s(remcomOutBuffer, BUFMAX, "OK");
break; break;
case 'P': /* set the value of a single CPU register - return OK */ case 'P': /* set the value of a single CPU register - return OK */
{ {
@ -907,11 +909,11 @@ handle_exception (int exceptionVector)
if (regno >= 0 && regno < NUMREGS) if (regno >= 0 && regno < NUMREGS)
{ {
hex2mem (ptr, (char *) &registers[regno], 4, 0); hex2mem (ptr, (char *) &registers[regno], 4, 0);
strcpy (remcomOutBuffer, "OK"); strcpy_s(remcomOutBuffer, BUFMAX, "OK");
break; break;
} }
strcpy (remcomOutBuffer, "E01"); strcpy_s(remcomOutBuffer, BUFMAX, "E01");
break; break;
} }
@ -927,14 +929,14 @@ handle_exception (int exceptionVector)
mem2hex ((char *) addr, remcomOutBuffer, length, 1); mem2hex ((char *) addr, remcomOutBuffer, length, 1);
if (mem_err) if (mem_err)
{ {
strcpy (remcomOutBuffer, "E03"); strcpy_s(remcomOutBuffer, BUFMAX, "E03");
debug_error ("memory fault"); debug_error ("memory fault");
} }
} }
if (ptr) if (ptr)
{ {
strcpy (remcomOutBuffer, "E01"); strcpy_s(remcomOutBuffer, BUFMAX, "E01");
} }
break; break;
@ -951,19 +953,19 @@ handle_exception (int exceptionVector)
if (mem_err) if (mem_err)
{ {
strcpy (remcomOutBuffer, "E03"); strcpy_s(remcomOutBuffer, BUFMAX, "E03");
debug_error ("memory fault"); debug_error ("memory fault");
} }
else else
{ {
strcpy (remcomOutBuffer, "OK"); strcpy_s(remcomOutBuffer, BUFMAX, "OK");
} }
ptr = 0; ptr = 0;
} }
if (ptr) if (ptr)
{ {
strcpy (remcomOutBuffer, "E02"); strcpy_s(remcomOutBuffer, BUFMAX, "E02");
} }
break; break;

View file

@ -0,0 +1,186 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="make_explorer"
ProjectGUID="{E132A04B-8BC6-4D18-81F2-F0156B809871}"
Keyword="MakeFileProj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Unicode Release|Win32"
OutputDirectory=".\URelease"
IntermediateDirectory=".\URelease"
ConfigurationType="0"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
>
<Tool
Name="VCNMakeTool"
BuildCommandLine="msdevfilt -gcc make -f Makefile.PCH UNICODE=1"
ReBuildCommandLine="msdevfilt -gcc make -f Makefile.PCH UNICODE=1 clean all"
CleanCommandLine=""
Output="explorer.exe"
PreprocessorDefinitions=""
IncludeSearchPath=""
ForcedIncludes=""
AssemblySearchPath=""
ForcedUsingAssemblies=""
CompileAsManaged=""
/>
</Configuration>
<Configuration
Name="bjam|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="0"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
>
<Tool
Name="VCNMakeTool"
BuildCommandLine="msdevfilt -gcc -pipe &quot;perl d:\tools\gSTLFilt.pl&quot; bjam"
ReBuildCommandLine="msdevfilt -gcc -pipe &quot;perl d:\tools\gSTLFilt.pl&quot; bjam clean&amp;bjam release"
CleanCommandLine=""
Output="explorer.exe"
PreprocessorDefinitions=""
IncludeSearchPath=""
ForcedIncludes=""
AssemblySearchPath=""
ForcedUsingAssemblies=""
CompileAsManaged=""
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="0"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
>
<Tool
Name="VCNMakeTool"
BuildCommandLine="msdevfilt -gcc -pipe &quot;perl d:\tools\gSTLFilt.pl&quot; make -f Makefile.PCH UNICODE=0"
ReBuildCommandLine="msdevfilt -gcc -pipe &quot;perl d:\tools\gSTLFilt.pl&quot; make -f Makefile.PCH UNICODE=0 clean all"
CleanCommandLine=""
Output="explorer.exe"
PreprocessorDefinitions=""
IncludeSearchPath=""
ForcedIncludes=""
AssemblySearchPath=""
ForcedUsingAssemblies=""
CompileAsManaged=""
/>
</Configuration>
<Configuration
Name="doxy docu|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="0"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
>
<Tool
Name="VCNMakeTool"
BuildCommandLine="msdevfilt -java make docu"
ReBuildCommandLine="msdevfilt -java make docu full-docu"
CleanCommandLine=""
Output="explorer.exe"
PreprocessorDefinitions=""
IncludeSearchPath=""
ForcedIncludes=""
AssemblySearchPath=""
ForcedUsingAssemblies=""
CompileAsManaged=""
/>
</Configuration>
<Configuration
Name="Unicode Debug|Win32"
OutputDirectory=".\UDebug"
IntermediateDirectory=".\UDebug"
ConfigurationType="0"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
>
<Tool
Name="VCNMakeTool"
BuildCommandLine="msdevfilt -gcc -pipe &quot;perl d:\tools\gSTLFilt.pl&quot; make -f Makefile.MinGW UNICODE=1 DEBUG=1"
ReBuildCommandLine="msdevfilt -gcc -pipe &quot;perl d:\tools\gSTLFilt.pl&quot; make -f Makefile.MinGW UNICODE=1 DEBUG=1 clean all"
CleanCommandLine=""
Output="explorer.exe"
PreprocessorDefinitions=""
IncludeSearchPath=""
ForcedIncludes=""
AssemblySearchPath=""
ForcedUsingAssemblies=""
CompileAsManaged=""
/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="0"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
>
<Tool
Name="VCNMakeTool"
BuildCommandLine="msdevfilt -gcc -pipe &quot;perl d:\tools\gSTLFilt.pl&quot; make -f Makefile.PCH UNICODE=0 DEBUG=1"
ReBuildCommandLine="msdevfilt -gcc -pipe &quot;perl d:\tools\gSTLFilt.pl&quot; make -f Makefile.PCH UNICODE=0 DEBUG=1 clean all"
CleanCommandLine=""
Output="explorer.exe"
PreprocessorDefinitions=""
IncludeSearchPath=""
ForcedIncludes=""
AssemblySearchPath=""
ForcedUsingAssemblies=""
CompileAsManaged=""
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="msdevfilt -gcc -pipe &quot;perl d:\tools\gSTLFilt.pl&quot; make -f Makefile.MinGW UNICODE=0 DEBUG=1"
>
</File>
<File
RelativePath="Jamfile"
>
</File>
<File
RelativePath="Makefile"
>
</File>
<File
RelativePath="Makefile.MinGW"
>
</File>
<File
RelativePath="Makefile.PCH"
>
</File>
<File
RelativePath="Makefile.Wine"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -65,7 +65,7 @@ LRESULT CALLBACK NotifyHookProc(int code, WPARAM wparam, LPARAM lparam)
COPYDATASTRUCT data; COPYDATASTRUCT data;
cds._hwnd = pmsg->hwnd; cds._hwnd = pmsg->hwnd;
cds._len = GetWindowModuleFileNameA(pmsg->hwnd, cds._path, MAX_PATH); cds._len = GetWindowModuleFileNameA(pmsg->hwnd, cds._path, COUNTOF(cds._path));
data.dwData = WM_GETMODULEPATH; data.dwData = WM_GETMODULEPATH;
data.cbData = sizeof(cds); data.cbData = sizeof(cds);

View file

@ -0,0 +1,237 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="notifyhook"
ProjectGUID="{F28B575D-7DBA-44DE-AAEF-FA0D065E5162}"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\..\Release"
IntermediateDirectory=".\Release"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\..\Release/notifyhook.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
PreprocessorDefinitions="NDEBUG;WIN32;_NOTIFYHOOK_IMPL"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
PrecompiledHeaderFile=".\Release/notifyhook.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="true"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1031"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="user32.lib"
OutputFile=".\..\Release/notifyhook.dll"
LinkIncremental="1"
SuppressStartupBanner="true"
ProgramDatabaseFile=".\..\Release/notifyhook.pdb"
SubSystem="2"
ImportLibrary=".\..\Release/notifyhook.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\..\Release/notifyhook.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\..\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="true"
SuppressStartupBanner="true"
TargetEnvironment="1"
TypeLibraryName=".\..\Debug/notifyhook.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="_DEBUG;WIN32;_NOTIFYHOOK_IMPL"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
PrecompiledHeaderFile=".\Debug/notifyhook.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1031"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="user32.lib"
OutputFile=".\..\Debug/notifyhook.dll"
LinkIncremental="2"
SuppressStartupBanner="true"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\..\Debug/notifyhook.pdb"
SubSystem="2"
ImportLibrary=".\..\Debug/notifyhook.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\..\Debug/notifyhook.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<File
RelativePath="notifyhook.c"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="notifyhook.h"
>
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -1,6 +1,6 @@
//{{NO_DEPENDENCIES}} //{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file. // Microsoft Developer Studio generated include file.
// Used by explorer_intres.rc // Used by explorer-hu.rc
// //
#define IDS_TITLE 1 #define IDS_TITLE 1
#define MANIFEST_RESOURCE_ID 1 #define MANIFEST_RESOURCE_ID 1

View file

@ -83,10 +83,12 @@ void FATDirectory::read_directory(int scan_flags)
TCHAR buffer[MAX_PATH]; TCHAR buffer[MAX_PATH];
_tcscpy(buffer, (LPCTSTR)_path); _tcscpy_s(buffer, COUNTOF(buffer), (LPCTSTR)_path);
LPTSTR pname = buffer + _tcslen(buffer); LPTSTR pname = buffer + _tcslen(buffer);
int plen = COUNTOF(buffer) - _tcslen(buffer);
*pname++ = '\\'; *pname++ = '\\';
--plen;
for(Kette*p=_alloc; p; p=p->Vorw) { for(Kette*p=_alloc; p; p=p->Vorw) {
memset(&w32fd, 0, sizeof(WIN32_FIND_DATA)); memset(&w32fd, 0, sizeof(WIN32_FIND_DATA));
@ -167,7 +169,7 @@ void FATDirectory::read_directory(int scan_flags)
Entry* entry; Entry* entry;
if (w32fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { if (w32fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
_tcscpy(pname, w32fd.cFileName); _tcscpy_s(pname, plen, w32fd.cFileName);
entry = new FATDirectory(_drive, this, buffer, e.fclus); entry = new FATDirectory(_drive, this, buffer, e.fclus);
} else } else
entry = new FATEntry(this, e.fclus); entry = new FATEntry(this, e.fclus);

View file

@ -106,7 +106,7 @@ INT_PTR CALLBACK ExecuteDialog::WndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPA
int id = (int)wparam; int id = (int)wparam;
if (id == IDOK) { if (id == IDOK) {
GetWindowText(GetDlgItem(hwnd, 201), dlg->cmd, MAX_PATH); GetWindowText(GetDlgItem(hwnd, 201), dlg->cmd, COUNTOF(dlg->cmd));
dlg->cmdshow = Button_GetState(GetDlgItem(hwnd,214))&BST_CHECKED? dlg->cmdshow = Button_GetState(GetDlgItem(hwnd,214))&BST_CHECKED?
SW_SHOWMINIMIZED: SW_SHOWNORMAL; SW_SHOWMINIMIZED: SW_SHOWNORMAL;
EndDialog(hwnd, id); EndDialog(hwnd, id);
@ -168,7 +168,7 @@ FileChildWindow::FileChildWindow(HWND hwnd, const FileChildWndInfo& info)
_root._drive_type = DRIVE_UNKNOWN; _root._drive_type = DRIVE_UNKNOWN;
_root._sort_order = SORT_NAME; _root._sort_order = SORT_NAME;
_tsplitpath(info._path, drv, NULL, NULL, NULL); _tsplitpath_s(info._path, drv, COUNTOF(drv), NULL, 0, NULL, 0, NULL, 0);
lstrcat(drv, TEXT("\\")); lstrcat(drv, TEXT("\\"));
lstrcpy(_root._volname, TEXT("NT Object Namespace")); lstrcpy(_root._volname, TEXT("NT Object Namespace"));
lstrcpy(_root._fs, TEXT("NTOBJ")); lstrcpy(_root._fs, TEXT("NTOBJ"));
@ -181,7 +181,7 @@ FileChildWindow::FileChildWindow(HWND hwnd, const FileChildWndInfo& info)
_root._drive_type = DRIVE_UNKNOWN; _root._drive_type = DRIVE_UNKNOWN;
_root._sort_order = SORT_NONE; _root._sort_order = SORT_NONE;
_tsplitpath(info._path, drv, NULL, NULL, NULL); _tsplitpath_s(info._path, drv, COUNTOF(drv), NULL, 0, NULL, 0, NULL, 0);
lstrcat(drv, TEXT("\\")); lstrcat(drv, TEXT("\\"));
lstrcpy(_root._volname, TEXT("Registry")); lstrcpy(_root._volname, TEXT("Registry"));
lstrcpy(_root._fs, TEXT("Registry")); lstrcpy(_root._fs, TEXT("Registry"));
@ -194,7 +194,7 @@ FileChildWindow::FileChildWindow(HWND hwnd, const FileChildWndInfo& info)
_root._drive_type = DRIVE_UNKNOWN; _root._drive_type = DRIVE_UNKNOWN;
_root._sort_order = SORT_NONE; _root._sort_order = SORT_NONE;
_tsplitpath(info._path, drv, NULL, NULL, NULL); _tsplitpath_s(info._path, drv, COUNTOF(drv), NULL, 0, NULL, 0, NULL, 0);
lstrcat(drv, TEXT("\\")); lstrcat(drv, TEXT("\\"));
lstrcpy(_root._volname, TEXT("FAT XXX")); //@@ lstrcpy(_root._volname, TEXT("FAT XXX")); //@@
lstrcpy(_root._fs, TEXT("FAT")); lstrcpy(_root._fs, TEXT("FAT"));
@ -211,9 +211,9 @@ FileChildWindow::FileChildWindow(HWND hwnd, const FileChildWndInfo& info)
_root._drive_type = GetDriveType(info._path); _root._drive_type = GetDriveType(info._path);
_root._sort_order = SORT_NAME; _root._sort_order = SORT_NAME;
_tsplitpath(info._path, drv, NULL, NULL, NULL); _tsplitpath_s(info._path, drv, COUNTOF(drv), NULL, 0, NULL, 0, NULL, 0);
lstrcat(drv, TEXT("\\")); lstrcat(drv, TEXT("\\"));
GetVolumeInformation(drv, _root._volname, _MAX_FNAME, 0, 0, &_root._fs_flags, _root._fs, _MAX_DIR); GetVolumeInformation(drv, _root._volname, _MAX_FNAME, 0, 0, &_root._fs_flags, _root._fs, COUNTOF(_root._fs));
lstrcpy(_root._path, drv); lstrcpy(_root._path, drv);
_root._entry = new WinDirectory(_root._path); _root._entry = new WinDirectory(_root._path);
entry = _root.read_tree(info._path+_tcslen(_root._path)); entry = _root.read_tree(info._path+_tcslen(_root._path));

View file

@ -1021,7 +1021,7 @@ int MDIMainFrame::Command(int id, int code)
if (activate_drive_window(root)) if (activate_drive_window(root))
return 0; return 0;
_tsplitpath(root, drv, 0, 0, 0); _tsplitpath_s(root, drv, COUNTOF(drv), 0, 0, 0, 0, 0, 0);
if (!SetCurrentDirectory(drv)) { if (!SetCurrentDirectory(drv)) {
display_error(_hwnd, GetLastError()); display_error(_hwnd, GetLastError());
@ -1073,7 +1073,7 @@ int MDIMainFrame::Command(int id, int code)
TCHAR path[MAX_PATH]; TCHAR path[MAX_PATH];
FileChildWindow* child; FileChildWindow* child;
getcwd(path, MAX_PATH); getcwd(path, COUNTOF(path));
if (activate_child_window(TEXT("unixfs"))) if (activate_child_window(TEXT("unixfs")))
break; break;
@ -1251,14 +1251,14 @@ bool MDIMainFrame::activate_drive_window(LPCTSTR path)
TCHAR drv1[_MAX_DRIVE], drv2[_MAX_DRIVE]; TCHAR drv1[_MAX_DRIVE], drv2[_MAX_DRIVE];
HWND child_wnd; HWND child_wnd;
_tsplitpath(path, drv1, 0, 0, 0); _tsplitpath_s(path, drv1, COUNTOF(drv1), 0, 0, 0, 0, 0, 0);
// search for a already open window for the same drive // search for a already open window for the same drive
for(child_wnd=::GetNextWindow(_hmdiclient,GW_CHILD); child_wnd; child_wnd=::GetNextWindow(child_wnd, GW_HWNDNEXT)) { for(child_wnd=::GetNextWindow(_hmdiclient,GW_CHILD); child_wnd; child_wnd=::GetNextWindow(child_wnd, GW_HWNDNEXT)) {
FileChildWindow* child = (FileChildWindow*) SendMessage(child_wnd, PM_GET_FILEWND_PTR, 0, 0); FileChildWindow* child = (FileChildWindow*) SendMessage(child_wnd, PM_GET_FILEWND_PTR, 0, 0);
if (child) { if (child) {
_tsplitpath(child->get_root()._path, drv2, 0, 0, 0); _tsplitpath_s(child->get_root()._path, drv2, COUNTOF(drv2), 0, 0, 0, 0, 0, 0);
if (!lstrcmpi(drv2, drv1)) { if (!lstrcmpi(drv2, drv1)) {
SendMessage(_hmdiclient, WM_MDIACTIVATE, (WPARAM)child_wnd, 0); SendMessage(_hmdiclient, WM_MDIACTIVATE, (WPARAM)child_wnd, 0);

View file

@ -237,9 +237,9 @@ void NtObjDirectory::read_directory(int scan_flags)
} else { } else {
info->type.string_ptr = TEXT(""); info->type.string_ptr = TEXT("");
} }
lstrcpynW(p, info->name.string_ptr, _MAX_PATH); lstrcpynW(p, info->name.string_ptr, COUNTOF(buffer));
#else #else
WideCharToMultiByte(CP_ACP, 0, info->name.string_ptr, info->name.string_len, p, MAX_PATH, 0, 0); WideCharToMultiByte(CP_ACP, 0, info->name.string_ptr, info->name.string_len, p, COUNTOF(buffer), 0, 0);
#endif #endif
lstrcpyn(w32fd.cFileName, p, sizeof(w32fd.cFileName) / sizeof(0[w32fd.cFileName])); lstrcpyn(w32fd.cFileName, p, sizeof(w32fd.cFileName) / sizeof(0[w32fd.cFileName]));
@ -310,7 +310,7 @@ void NtObjDirectory::read_directory(int scan_flags)
int len = link.string_len/sizeof(WCHAR); int len = link.string_len/sizeof(WCHAR);
entry->_content = (LPTSTR) malloc((len+1)*sizeof(TCHAR)); entry->_content = (LPTSTR) malloc((len+1)*sizeof(TCHAR));
#ifdef UNICODE #ifdef UNICODE
wcsncpy(entry->_content, link, len); wcsncpy_s(entry->_content, len+1, link, len);
#else #else
U2nA(link, entry->_content, len); U2nA(link, entry->_content, len);
#endif #endif

View file

@ -501,7 +501,7 @@ void Pane::draw_item(LPDRAWITEMSTRUCT dis, Entry* entry, int calcWidthCol)
if (visible_cols & COL_SIZE) { if (visible_cols & COL_SIZE) {
ULONGLONG size = ((ULONGLONG)entry->_data.nFileSizeHigh << 32) | entry->_data.nFileSizeLow; ULONGLONG size = ((ULONGLONG)entry->_data.nFileSizeHigh << 32) | entry->_data.nFileSizeLow;
_stprintf(buffer, TEXT("%") LONGLONGARG TEXT("d"), size); _stprintf_s1(buffer, BUFFER_LEN, TEXT("%") LONGLONGARG TEXT("d"), size);
if (calcWidthCol == -1) if (calcWidthCol == -1)
_out_wrkr.output_number(dis, _positions, col, buffer); _out_wrkr.output_number(dis, _positions, col, buffer);
@ -539,7 +539,7 @@ void Pane::draw_item(LPDRAWITEMSTRUCT dis, Entry* entry, int calcWidthCol)
ULONGLONG index = ((ULONGLONG)entry->_bhfi.nFileIndexHigh << 32) | entry->_bhfi.nFileIndexLow; ULONGLONG index = ((ULONGLONG)entry->_bhfi.nFileIndexHigh << 32) | entry->_bhfi.nFileIndexLow;
if (visible_cols & COL_INDEX) { if (visible_cols & COL_INDEX) {
_stprintf(buffer, TEXT("%") LONGLONGARG TEXT("X"), index); _stprintf_s1(buffer, BUFFER_LEN, TEXT("%") LONGLONGARG TEXT("X"), index);
if (calcWidthCol == -1) if (calcWidthCol == -1)
_out_wrkr.output_text(dis, _positions, col, buffer, DT_RIGHT); _out_wrkr.output_text(dis, _positions, col, buffer, DT_RIGHT);

View file

@ -40,14 +40,15 @@ void RegDirectory::read_directory(int scan_flags)
TCHAR buffer[MAX_PATH]; TCHAR buffer[MAX_PATH];
_tcscpy(buffer, (LPCTSTR)_path); _tcscpy_s(buffer, COUNTOF(buffer), (LPCTSTR)_path);
LPTSTR pname = buffer + _tcslen(buffer); LPTSTR pname = buffer + _tcslen(buffer);
int plen = MAX_PATH - _tcslen(buffer);
HKEY hkey; HKEY hkey;
if (!RegOpenKeyEx(_hKeyRoot, *buffer=='\\'?buffer+1:buffer, 0, STANDARD_RIGHTS_READ|KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS, &hkey)) { if (!RegOpenKeyEx(_hKeyRoot, *buffer=='\\'?buffer+1:buffer, 0, STANDARD_RIGHTS_READ|KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS, &hkey)) {
if (pname[-1] != '\\') if (pname[-1] != '\\')
*pname++ = '\\'; *pname++ = '\\', plen--;
TCHAR name[MAX_PATH], class_name[MAX_PATH]; TCHAR name[MAX_PATH], class_name[MAX_PATH];
WIN32_FIND_DATA w32fd; WIN32_FIND_DATA w32fd;
@ -64,9 +65,9 @@ void RegDirectory::read_directory(int scan_flags)
break; break;
w32fd.dwFileAttributes |= FILE_ATTRIBUTE_DIRECTORY; w32fd.dwFileAttributes |= FILE_ATTRIBUTE_DIRECTORY;
_tcsncpy(w32fd.cFileName, name, name_len); _tcsncpy_s(w32fd.cFileName, COUNTOF(w32fd.cFileName), name, name_len);
_tcscpy(pname, name); _tcscpy_s(pname, plen, name);
entry = new RegDirectory(this, buffer, _hKeyRoot); entry = new RegDirectory(this, buffer, _hKeyRoot);
memcpy(&entry->_data, &w32fd, sizeof(WIN32_FIND_DATA)); memcpy(&entry->_data, &w32fd, sizeof(WIN32_FIND_DATA));
@ -152,7 +153,7 @@ void RegDirectory::read_directory(int scan_flags)
entry->_content = _tcsdup(value); entry->_content = _tcsdup(value);
else if (type == REG_DWORD) { else if (type == REG_DWORD) {
TCHAR b[32]; TCHAR b[32];
_stprintf(b, TEXT("%ld"), *(DWORD*)&value); _stprintf_s1(b, COUNTOF(b), TEXT("%ld"), *(DWORD*)&value);
entry->_content = _tcsdup(b); entry->_content = _tcsdup(b);
} }
} }
@ -253,49 +254,49 @@ void RegistryRoot::read_directory(int scan_flags)
_data.dwFileAttributes |= FILE_ATTRIBUTE_DIRECTORY; _data.dwFileAttributes |= FILE_ATTRIBUTE_DIRECTORY;
entry = new RegDirectory(this, TEXT("\\"), HKEY_CURRENT_USER); entry = new RegDirectory(this, TEXT("\\"), HKEY_CURRENT_USER);
_tcscpy(entry->_data.cFileName, TEXT("HKEY_CURRENT_USER")); _tcscpy_s(entry->_data.cFileName, COUNTOF(entry->_data.cFileName), TEXT("HKEY_CURRENT_USER"));
entry->_level = level; entry->_level = level;
first_entry = entry; first_entry = entry;
last = entry; last = entry;
entry = new RegDirectory(this, TEXT("\\"), HKEY_LOCAL_MACHINE); entry = new RegDirectory(this, TEXT("\\"), HKEY_LOCAL_MACHINE);
_tcscpy(entry->_data.cFileName, TEXT("HKEY_LOCAL_MACHINE")); _tcscpy_s(entry->_data.cFileName, COUNTOF(entry->_data.cFileName), TEXT("HKEY_LOCAL_MACHINE"));
entry->_level = level; entry->_level = level;
last->_next = entry; last->_next = entry;
last = entry; last = entry;
entry = new RegDirectory(this, TEXT("\\"), HKEY_CLASSES_ROOT); entry = new RegDirectory(this, TEXT("\\"), HKEY_CLASSES_ROOT);
_tcscpy(entry->_data.cFileName, TEXT("HKEY_CLASSES_ROOT")); _tcscpy_s(entry->_data.cFileName, COUNTOF(entry->_data.cFileName), TEXT("HKEY_CLASSES_ROOT"));
entry->_level = level; entry->_level = level;
last->_next = entry; last->_next = entry;
last = entry; last = entry;
entry = new RegDirectory(this, TEXT("\\"), HKEY_USERS); entry = new RegDirectory(this, TEXT("\\"), HKEY_USERS);
_tcscpy(entry->_data.cFileName, TEXT("HKEY_USERS")); _tcscpy_s(entry->_data.cFileName, COUNTOF(entry->_data.cFileName), TEXT("HKEY_USERS"));
entry->_level = level; entry->_level = level;
last->_next = entry; last->_next = entry;
last = entry; last = entry;
/* /*
entry = new RegDirectory(this, TEXT("\\"), HKEY_PERFORMANCE_DATA); entry = new RegDirectory(this, TEXT("\\"), HKEY_PERFORMANCE_DATA);
_tcscpy(entry->_data.cFileName, TEXT("HKEY_PERFORMANCE_DATA")); _tcscpy_s(entry->_data.cFileName, COUNTOF(entry->_data.cFileName), TEXT("HKEY_PERFORMANCE_DATA"));
entry->_level = level; entry->_level = level;
last->_next = entry; last->_next = entry;
last = entry; last = entry;
*/ */
entry = new RegDirectory(this, TEXT("\\"), HKEY_CURRENT_CONFIG); entry = new RegDirectory(this, TEXT("\\"), HKEY_CURRENT_CONFIG);
_tcscpy(entry->_data.cFileName, TEXT("HKEY_CURRENT_CONFIG")); _tcscpy_s(entry->_data.cFileName, COUNTOF(entry->_data.cFileName), TEXT("HKEY_CURRENT_CONFIG"));
entry->_level = level; entry->_level = level;
last->_next = entry; last->_next = entry;
last = entry; last = entry;
/* /*
entry = new RegDirectory(this, TEXT("\\"), HKEY_DYN_DATA); entry = new RegDirectory(this, TEXT("\\"), HKEY_DYN_DATA);
_tcscpy(entry->_data.cFileName, TEXT("HKEY_DYN_DATA")); _tcscpy_s(entry->_data.cFileName, COUNTOF(entry->_data.cFileName), TEXT("HKEY_DYN_DATA"));
entry->_level = level; entry->_level = level;
last->_next = entry; last->_next = entry;

View file

@ -61,7 +61,7 @@ bool ShellDirectory::fill_w32fdata_shell(LPCITEMIDLIST pidl, SFGAOF attribs, WIN
if (path) { if (path) {
// fill with drive names "C:", ... // fill with drive names "C:", ...
assert(_tcslen(path) < GlobalSize(medium.UNION_MEMBER(hGlobal))); assert(_tcslen(path) < GlobalSize(medium.UNION_MEMBER(hGlobal)));
_tcscpy(pw32fdata->cFileName, path); _tcscpy_s(pw32fdata->cFileName, COUNTOF(pw32fdata->cFileName), path);
UINT sem_org = SetErrorMode(SEM_FAILCRITICALERRORS); UINT sem_org = SetErrorMode(SEM_FAILCRITICALERRORS);
@ -135,7 +135,7 @@ bool ShellEntry::get_path(PTSTR path, size_t path_count) const
/* /*
path[0] = TEXT('\0'); path[0] = TEXT('\0');
if (FAILED(path_from_pidl(get_parent_folder(), &*_pidl, path, MAX_PATH))) if (FAILED(path_from_pidl(get_parent_folder(), &*_pidl, path, path_count)))
return false; return false;
*/ */
FileSysShellPath fs_path(create_absolute_pidl()); FileSysShellPath fs_path(create_absolute_pidl());
@ -410,9 +410,9 @@ void ShellDirectory::read_directory(int scan_flags)
if (bhfi_valid) if (bhfi_valid)
memcpy(&entry->_bhfi, &bhfi, sizeof(BY_HANDLE_FILE_INFORMATION)); memcpy(&entry->_bhfi, &bhfi, sizeof(BY_HANDLE_FILE_INFORMATION));
if (SUCCEEDED(name_from_pidl(_folder, pidls[n], name, MAX_PATH, SHGDN_INFOLDER|0x2000/*0x2000=SHGDN_INCLUDE_NONFILESYS*/))) { if (SUCCEEDED(name_from_pidl(_folder, pidls[n], name, COUNTOF(name), SHGDN_INFOLDER|0x2000/*0x2000=SHGDN_INCLUDE_NONFILESYS*/))) {
if (!entry->_data.cFileName[0]) if (!entry->_data.cFileName[0])
_tcscpy(entry->_data.cFileName, name); _tcscpy_s(entry->_data.cFileName, COUNTOF(entry->_data.cFileName), name);
else if (_tcscmp(entry->_display_name, name)) else if (_tcscmp(entry->_display_name, name))
entry->_display_name = _tcsdup(name); // store display name separate from file name; sort display by file name entry->_display_name = _tcsdup(name); // store display name separate from file name; sort display by file name
} }

View file

@ -407,7 +407,7 @@ void BookmarkList::import_IE_favorites(ShellDirectory& dir, HWND hwnd)
bookmark._name = DecodeXMLString(name); bookmark._name = DecodeXMLString(name);
entry->get_path(path, COUNTOF(path)); entry->get_path(path, COUNTOF(path));
_tsplitpath(path, NULL, NULL, NULL, ext); _tsplitpath_s(path, NULL, 0, NULL, 0, NULL, 0, ext, COUNTOF(ext));
if (!_tcsicmp(ext, TEXT(".url"))) { if (!_tcsicmp(ext, TEXT(".url"))) {
bookmark.read_url(path); bookmark.read_url(path);

View file

@ -100,7 +100,7 @@ void QuickLaunchBar::AddShortcuts()
SpecialFolderFSPath app_data(CSIDL_APPDATA, _hwnd); ///@todo perhaps also look into CSIDL_COMMON_APPDATA ? SpecialFolderFSPath app_data(CSIDL_APPDATA, _hwnd); ///@todo perhaps also look into CSIDL_COMMON_APPDATA ?
_stprintf(path, TEXT("%s\\")QUICKLAUNCH_FOLDER, (LPCTSTR)app_data); _stprintf_s1(path, COUNTOF(path), TEXT("%s\\")QUICKLAUNCH_FOLDER, (LPCTSTR)app_data);
RecursiveCreateDirectory(path); RecursiveCreateDirectory(path);
_dir = new ShellDirectory(GetDesktopFolder(), path, _hwnd); _dir = new ShellDirectory(GetDesktopFolder(), path, _hwnd);

View file

@ -248,10 +248,10 @@ void StartMenu::AddShellEntries(const ShellDirectory& dir, int max, const String
TCHAR dir_path[MAX_PATH]; TCHAR dir_path[MAX_PATH];
if (!ignore.empty()) { if (!ignore.empty()) {
_tsplitpath(ignore, ignore_path, ignore_dir, ignore_name, ignore_ext); _tsplitpath_s(ignore, ignore_path, COUNTOF(ignore_path), ignore_dir, COUNTOF(ignore_dir), ignore_name, COUNTOF(ignore_name), ignore_ext, COUNTOF(ignore_ext));
_tcscat(ignore_path, ignore_dir); _tcscat_s(ignore_path, COUNTOF(ignore_path), ignore_dir);
_tcscat(ignore_name, ignore_ext); _tcscat_s(ignore_name, COUNTOF(ignore_path), ignore_ext);
dir.get_path(dir_path, COUNTOF(dir_path)); dir.get_path(dir_path, COUNTOF(dir_path));

View file

@ -54,7 +54,7 @@ bool NotifyHook::ModulePathCopyData(LPARAM lparam, HWND* phwnd, String& path)
{ {
char buffer[MAX_PATH]; char buffer[MAX_PATH];
int l = GetWindowModulePathCopyData(lparam, phwnd, buffer, MAX_PATH); int l = GetWindowModulePathCopyData(lparam, phwnd, buffer, COUNTOF(buffer));
if (l) { if (l) {
path.assign(buffer, l); path.assign(buffer, l);
@ -190,7 +190,7 @@ bool NotifyInfo::modify(NOTIFYICONDATA* pnid)
// avoid to send WM_GETTEXT messages to the own process // avoid to send WM_GETTEXT messages to the own process
if (pid != GetCurrentProcessId()) if (pid != GetCurrentProcessId())
if (GetWindowText(_hWnd, title, MAX_PATH)) { if (GetWindowText(_hWnd, title, COUNTOF(title))) {
if (_windowTitle != title) { if (_windowTitle != title) {
_windowTitle = title; _windowTitle = title;
changes = true; changes = true;
@ -1282,10 +1282,10 @@ HWND ClockWindow::Create(HWND hwndParent)
FontSelection font(canvas, GetStockFont(DEFAULT_GUI_FONT)); FontSelection font(canvas, GetStockFont(DEFAULT_GUI_FONT));
RECT rect = {0, 0, 0, 0}; RECT rect = {0, 0, 0, 0};
TCHAR buffer[16]; TCHAR buffer[8];
if (!GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, NULL, NULL, buffer, sizeof(buffer)/sizeof(TCHAR))) if (!GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, NULL, NULL, buffer, sizeof(buffer)/sizeof(TCHAR)))
_tcscpy(buffer, TEXT("00:00")); _tcscpy_s(buffer, COUNTOF(buffer), TEXT("00:00"));
DrawText(canvas, buffer, -1, &rect, DT_SINGLELINE|DT_NOPREFIX|DT_CALCRECT); DrawText(canvas, buffer, -1, &rect, DT_SINGLELINE|DT_NOPREFIX|DT_CALCRECT);
int clockwindowWidth = rect.right-rect.left + 4; int clockwindowWidth = rect.right-rect.left + 4;
@ -1324,7 +1324,7 @@ int ClockWindow::Notify(int id, NMHDR* pnmh)
GetLocalTime(&systime); GetLocalTime(&systime);
if (GetDateFormat(LOCALE_USER_DEFAULT, DATE_LONGDATE, &systime, NULL, buffer, 64)) if (GetDateFormat(LOCALE_USER_DEFAULT, DATE_LONGDATE, &systime, NULL, buffer, 64))
_tcscpy(pdi->szText, buffer); _tcscpy_s(pdi->szText, COUNTOF(pdi->szText), buffer);
else else
pdi->szText[0] = '\0'; pdi->szText[0] = '\0';
} }
@ -1344,7 +1344,7 @@ bool ClockWindow::FormatTime()
if (GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, NULL, NULL, buffer, sizeof(buffer)/sizeof(TCHAR))) if (GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, NULL, NULL, buffer, sizeof(buffer)/sizeof(TCHAR)))
if (_tcscmp(buffer, _time)) { if (_tcscmp(buffer, _time)) {
_tcscpy(_time, buffer); _tcscpy_s(_time, COUNTOF(_time), buffer);
return true; // The text to display has changed. return true; // The text to display has changed.
} }

View file

@ -70,12 +70,15 @@ LPWSTR wcscpyn(LPWSTR dest, LPCWSTR source, size_t count)
String COMException::toString() const String COMException::toString() const
{ {
TCHAR msg[4*BUFFER_LEN]; TCHAR msg[4*BUFFER_LEN];
int l = 4*BUFFER_LEN;
LPTSTR p = msg; LPTSTR p = msg;
p += _stprintf(p, TEXT("%s\nContext: %s"), super::ErrorMessage(), (LPCTSTR)_context.toString()); int n = _stprintf_s2(p, l, TEXT("%s\nContext: %s"), super::ErrorMessage(), (LPCTSTR)_context.toString());
p += n;
l -= n;
if (_file) if (_file)
p += _stprintf(p, TEXT("\nLocation: %hs:%d"), _file, _line); p += _stprintf_s2(p, l, TEXT("\nLocation: %hs:%d"), _file, _line);
return msg; return msg;
} }
@ -320,7 +323,7 @@ String ShellFolder::get_name(LPCITEMIDLIST pidl, SHGDNF flags) const
HRESULT hr = ((IShellFolder*)*const_cast<ShellFolder*>(this))->GetDisplayNameOf(pidl, flags, &strret); HRESULT hr = ((IShellFolder*)*const_cast<ShellFolder*>(this))->GetDisplayNameOf(pidl, flags, &strret);
if (hr == S_OK) if (hr == S_OK)
strret.GetString(pidl->mkid, buffer, MAX_PATH); strret.GetString(pidl->mkid, buffer, COUNTOF(buffer));
else { else {
CHECKERROR(hr); CHECKERROR(hr);
*buffer = TEXT('\0'); *buffer = TEXT('\0');

View file

@ -683,7 +683,7 @@ struct ShellPath : public SShellPtr<ITEMIDLIST>
WCHAR b[MAX_PATH]; WCHAR b[MAX_PATH];
if (path) { if (path) {
MultiByteToWideChar(CP_ACP, 0, path, -1, b, MAX_PATH); MultiByteToWideChar(CP_ACP, 0, path, -1, b, COUNTOF(b));
CHECKERROR(folder->ParseDisplayName(0, NULL, b, NULL, &_p, NULL)); CHECKERROR(folder->ParseDisplayName(0, NULL, b, NULL, &_p, NULL));
} else } else
_p = NULL; _p = NULL;
@ -696,7 +696,7 @@ struct ShellPath : public SShellPtr<ITEMIDLIST>
WCHAR b[MAX_PATH]; WCHAR b[MAX_PATH];
if (path) { if (path) {
MultiByteToWideChar(CP_ACP, 0, path, -1, b, MAX_PATH); MultiByteToWideChar(CP_ACP, 0, path, -1, b, COUNTOF(b));
CHECKERROR(GetDesktopFolder()->ParseDisplayName(0, NULL, b, NULL, &_p, NULL)); CHECKERROR(GetDesktopFolder()->ParseDisplayName(0, NULL, b, NULL, &_p, NULL));
} else } else
_p = NULL; _p = NULL;

View file

@ -158,11 +158,20 @@ String Context::getStackTrace() const
BOOL time_to_filetime(const time_t* t, FILETIME* ftime) BOOL time_to_filetime(const time_t* t, FILETIME* ftime)
{ {
#ifdef __STDC_WANT_SECURE_LIB__
SYSTEMTIME stime;
struct tm tm_;
struct tm* tm = &tm_;
if (gmtime_s(tm, t) != 0)
return FALSE;
#else
struct tm* tm = gmtime(t); struct tm* tm = gmtime(t);
SYSTEMTIME stime; SYSTEMTIME stime;
if (!tm) if (!tm)
return FALSE; return FALSE;
#endif
stime.wYear = tm->tm_year+1900; stime.wYear = tm->tm_year+1900;
stime.wMonth = tm->tm_mon+1; stime.wMonth = tm->tm_mon+1;
@ -384,7 +393,7 @@ BOOL RecursiveCreateDirectory(LPCTSTR path_in)
{ {
TCHAR path[MAX_PATH], hole_path[MAX_PATH]; TCHAR path[MAX_PATH], hole_path[MAX_PATH];
_tcscpy(hole_path, path_in); _tcscpy_s(hole_path, COUNTOF(hole_path), path_in);
int drv_len = 0; int drv_len = 0;
LPCTSTR d; LPCTSTR d;
@ -409,7 +418,7 @@ BOOL RecursiveCreateDirectory(LPCTSTR path_in)
HANDLE hFind = FindFirstFile(hole_path, &w32fd); HANDLE hFind = FindFirstFile(hole_path, &w32fd);
if (hFind == INVALID_HANDLE_VALUE) { if (hFind == INVALID_HANDLE_VALUE) {
_tcsncpy(path, hole_path, drv_len); _tcsncpy_s(path, COUNTOF(path), hole_path, drv_len);
int i = drv_len; int i = drv_len;
for(p=dir; *p=='/'||*p=='\\'; p++) for(p=dir; *p=='/'||*p=='\\'; p++)
@ -504,15 +513,15 @@ bool SplitFileSysURL(LPCTSTR url, String& dir_out, String& fname_out)
TCHAR path[_MAX_PATH]; TCHAR path[_MAX_PATH];
// convert slashes to back slashes // convert slashes to back slashes
GetFullPathName(url, _MAX_PATH, path, NULL); GetFullPathName(url, COUNTOF(path), path, NULL);
if (GetFileAttributes(path) & FILE_ATTRIBUTE_DIRECTORY) if (GetFileAttributes(path) & FILE_ATTRIBUTE_DIRECTORY)
fname_out.erase(); fname_out.erase();
else { else {
TCHAR drv[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT]; TCHAR drv[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT];
_tsplitpath(path, drv, dir, fname, ext); _tsplitpath_s(path, drv, COUNTOF(drv), dir, COUNTOF(dir), fname, COUNTOF(fname), ext, COUNTOF(ext));
_stprintf(path, TEXT("%s%s"), drv, dir); _stprintf_s2(path, COUNTOF(path), TEXT("%s%s"), drv, dir);
fname_out.printf(TEXT("%s%s"), fname, ext); fname_out.printf(TEXT("%s%s"), fname, ext);
} }

View file

@ -166,6 +166,31 @@ BOOL exists_path(LPCTSTR path);
#endif #endif
#ifdef __STDC_WANT_SECURE_LIB__ // for VS 2005: _MSC_VER>=1400
#undef _vsntprintf
#define _vsntprintf(b, s, f, l) _vsntprintf_s(b, s, s, f, l)
#undef _sntprintf
#define _sntprintf(b, s, f, l) _sntprintf_s(b, s, s, f, l)
#define _stprintf_s1 _stprintf_s
#define _stprintf_s2 _stprintf_s
#else // __STDC_WANT_SECURE_LIB__
#define strcpy_s(d, l, s) strcpy(d, s)
#define _tcscpy_s(d, l, s) _tcscpy(d, s)
#define _tcscat_s(d, l, s) _tcscat(d, s)
#define wcsncpy_s(d, l, s, n) wcsncpy(d, s, n)
#define _tcsncpy_s(d, l, s, n) _tcsncpy(d, s, n)
#define _stprintf_s1(b, l, f, p1) _stprintf(b, f, p1)
#define _stprintf_s2(b, l, f, p1,p2) _stprintf(b, f, p1,p2)
#define _tsplitpath_s(f, d,dl, p,pl, n,nl, e,el) _tsplitpath(f, d, p, n, e)
#endif // __STDC_WANT_SECURE_LIB__
#ifdef __cplusplus #ifdef __cplusplus
#ifdef _MSC_VER #ifdef _MSC_VER
@ -185,9 +210,11 @@ using namespace std;
#include <vector> #include <vector>
/* not necessary with correct include file order for comdef.h (path "...\Program Files\Microsoft SDK\include" first)
#if _MSC_VER>=1300 // VS.Net #if _MSC_VER>=1300 // VS.Net
#define _NO_COMUTIL //@@ #define _NO_COMUTIL
#endif #endif
*/
#if defined(_MSC_VER) && !defined(_NO_COMUTIL) #if defined(_MSC_VER) && !defined(_NO_COMUTIL)