diff --git a/Source/Common/Common.vcproj b/Source/Common/Common.vcproj
index dbd15e433..4924c1903 100644
--- a/Source/Common/Common.vcproj
+++ b/Source/Common/Common.vcproj
@@ -145,10 +145,6 @@
RelativePath="MemTest.cpp"
>
-
-
@@ -218,10 +214,6 @@
RelativePath="MemTest.h"
>
-
-
diff --git a/Source/Common/Common.vcxproj b/Source/Common/Common.vcxproj
index a34df03a5..6bd4dfb6c 100644
--- a/Source/Common/Common.vcxproj
+++ b/Source/Common/Common.vcxproj
@@ -42,7 +42,6 @@
-
@@ -59,7 +58,6 @@
-
diff --git a/Source/Common/Common.vcxproj.filters b/Source/Common/Common.vcxproj.filters
index f77f45322..41fa887fa 100644
--- a/Source/Common/Common.vcxproj.filters
+++ b/Source/Common/Common.vcxproj.filters
@@ -26,9 +26,6 @@
Source Files
-
- Source Files
-
Source Files
@@ -67,9 +64,6 @@
Header Files
-
- Header Files
-
Header Files
diff --git a/Source/Common/File Class.cpp b/Source/Common/File Class.cpp
index 0c3134eb1..ec01bb536 100644
--- a/Source/Common/File Class.cpp
+++ b/Source/Common/File Class.cpp
@@ -62,11 +62,6 @@ bool CFile::Open(LPCTSTR lpszFileName, ULONG nOpenFlags)
_ASSERTE(false);
}
- COSVersion osver;
- WORD ostype = osver.GetOSType();
- BOOL is_NT =((ostype & OS_WINNT) != 0);
-
-
// map share mode
ULONG dwShareMode = 0;
@@ -94,7 +89,7 @@ bool CFile::Open(LPCTSTR lpszFileName, ULONG nOpenFlags)
dwCreateFlag = OPEN_EXISTING;
// attempt file creation
- HANDLE hFile = ::CreateFile(lpszFileName, dwAccess, dwShareMode, is_NT ? &sa : NULL,
+ HANDLE hFile = ::CreateFile(lpszFileName, dwAccess, dwShareMode, &sa,
dwCreateFlag, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE)
{ //#define ERROR_PATH_NOT_FOUND 3L
diff --git a/Source/Common/osversion.cpp b/Source/Common/osversion.cpp
deleted file mode 100644
index ac50ff4c2..000000000
--- a/Source/Common/osversion.cpp
+++ /dev/null
@@ -1,306 +0,0 @@
-//---------------------------------------------------------------------------
-// Copyright (C) 1998, Interscope Ltd. All rights reserved.
-// Reproduction or distribution of this program, or any portion of it,
-// is permitted only if this header is kept as it is.
-// For more information, contact:
-//
-// Interscope Ltd., 5 Culturii St., 5th Floor, 4800 Baia Mare, RO
-// Phone/Fax: +40-62-215023
-// E-mail: office@interscope.ro
-//
-// $Author: Levente Farkas $
-// $Date: 5/12/98 11:50p $
-// $Modtime: 4/30/98 8:22a $
-// $Revision: 23 $
-// $Archive: /Interscope/Thebe/InstallMaster/OSVersion.cpp $
-// $Workfile: OSVersion.cpp $
-//---------------------------------------------------------------
-
-// 4 more details about API calls in this module, see
-// Knowledge Base Atricle Q113998 and
-// Knowledge Base Atricle Q114470 on
-// Microsoft Development Library (October 1995)
-
-//Ads - This is very out of date!
-// Rewrote the O/S detection in the constructor 15/3/2002
-
-#include "stdafx.h"
-
-#pragma comment(lib, "version.lib")
-
-
-//--- Some types and consts -----------------------------------
-
-#define WNNC_NET_MULTINET 0x8000
-#define WNNC_SUBNET_WINWORKGROUP 0x0004
-#define WNNC_NET_TYPE 0x0002
-
-typedef WORD (WINAPI *NETCAPFUNC)(int);
-
-//-------------------------------------------------------------
-// Task : Constructs and OS version class and extracts all the
-// version information necessary
-//-------------------------------------------------------------
-COSVersion::COSVersion():
- m_nOSType(OS_UNKNOWN),
- m_nWinType(WIN_UNKNOWN),
- m_dwVersion(GetVersion())
-{
-#if defined(__WIN32__) || defined(_WIN32) // 32-bit platform
-
- osvi.dwOSVersionInfoSize = sizeof(osvi);
- GetVersionEx(&osvi);
-
- //Determine which versions of the O/S we are running
- if (osvi.dwPlatformId == VER_PLATFORM_WIN32s) //Win32s on windows 3.1
- {
- m_nWinType = WIN_32S;
-
- // Determine if Win 3.X or WFW
- if(IsWindows4Workgroups(METHOD_FILEVERSION))
- m_nOSType = OS_WFW;
- else if(IsWindows4Workgroups(METHOD_MULTINET))
- m_nOSType = OS_WFW;
- else
- m_nOSType = OS_WIN3X;
- }
- else if (osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) //Win 95, 98 or ME
- {
- m_nWinType = WIN_32C;
-
- // Determine if Win95 or Win98 or WinMe
- if(osvi.dwMinorVersion == 0)
- m_nOSType = OS_WIN95;
- else if (osvi.dwMinorVersion == 10)
- m_nOSType = OS_WIN98;
- else if (osvi.dwMinorVersion == 90)
- m_nOSType = OS_WINME;
- else
- m_nOSType = OS_UNKNOWN;
- }
- else if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) //Win NT 3.51, 4.0, 2000, XP or .Net Server
- {
- m_nWinType = WIN_32;
-
- //Determine which version
- if (osvi.dwMajorVersion == 3)
- {
- m_nOSType = OS_WINNT351;
- }
- else if (osvi.dwMajorVersion == 4)
- {
- m_nOSType = OS_WINNT40;
- }
- if (osvi.dwMajorVersion == 5)
- {
- if (osvi.dwMinorVersion == 0)
- {
- m_nOSType = OS_WIN2000;
- }
- else
- {
- m_nOSType = OS_WINXP | OS_WINNET;
- }
- }
- else
- {
- m_nOSType = OS_WINNT; //Future proof
- }
- }
- /*
- else if (osvi.dwPlatformId == VER_PLATFORM_WIN32_CE) //Windows CE
- {
- m_nOSType = OS_WINCE;
- }
- */
-
- /* Original code
- // Test 4 NT/NTS/NTAS by the highest bit of the version
- if(m_dwVersion & 0x80000000)
- {
- // This is not NT
- // Check major version number 2 distinguish between
- // WIN32s (Win 3.X) and WIN32c (Win 95)
- if(LOBYTE(LOWORD(m_dwVersion)) <= 3)
- {
- m_nWinType =WIN_32S;
-
- // Determine if Win 3.X or WFW
- if(IsWindows4Workgroups(METHOD_FILEVERSION))
- m_nOSType =OS_WFW;
- else if(IsWindows4Workgroups(METHOD_MULTINET))
- m_nOSType =OS_WFW;
- else
- m_nOSType =OS_WIN3X;
- }
- else
- {
- m_nWinType =WIN_32C;
-
- // Determine if Win95 or Win98 or WinMe
- // Note: We consider Win98 from beta 2 up (4.10.1650)
- ASSERT(osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS);
- if(osvi.dwMinorVersion == 0)
- m_nOSType =OS_WIN95;
- else if (osvi.dwMinorVersion == 10)
- m_nOSType =OS_WIN98;
- else if (osvi.dwMinorVersion == 90)
- m_nOSType =OS_WINME;
-
- }
- }
- else
- {
- // Must be NTWS, NTS or NTAS
- // Check the registry 2 distinguish between them
- HKEY hKey;
- BYTE szValue[128];
- DWORD dwSize =sizeof(szValue);
- RegOpenKeyEx(HKEY_LOCAL_MACHINE,_T("SYSTEM\\CurrentControlSet\\Control\\ProductOptions"),
- 0,KEY_READ,&hKey);
- RegQueryValueEx(hKey,_T("ProductType"),0,NULL,szValue,&dwSize);
- RegCloseKey(hKey);
- if(!STRICMP((TCHAR *)&szValue[0],_T("WinNT")))
- // WinNT (Windows NT Workstation)
- m_nOSType =OS_WINNTWS;
- else if(!STRICMP((TCHAR *)&szValue[0],_T("ServerNT")))
- // ServerNT (Windows NT Server)
- m_nOSType =OS_WINNTS;
- else
- // LanmanNT (Windows NT Advanced Server)
- m_nOSType =OS_WINNTAS;
-
- m_nWinType =WIN_32;
- }
- */
-
-#else // 16-bit platform
-
- // For 16-bit code, use GetWinFlags 2 find out if running on the
- // Windows on Windows layer of NT/NTAS
- if(GetWinFlags() & 0x4000)
- m_nOSType =OS_WINNTWS;
- else
- {
- // Check version number 2 distinguish between Win 3.X and Win 95
- if((LOBYTE(LOWORD(dwVersion)) > 3) ||
- (HIBYTE(LOWORD(dwVersion)) > 50))
- // Windows 95
- m_nOSType =OS_WIN95;
- else
- {
- // Determine if Win 3.X or WFW
- if(IsWindows4Workgroups(MEHOD_FILEVERSION))
- m_nOSType =OS_WFW;
- else if(IsWindows4Workgroups(METHOD_MULTINET))
- m_nOSType =OS_WFW;
- else
- m_nOSType =OS_WIN3X;
- }
- }
- m_nWinType =WIN_16;
-
-#endif
-}
-
-//-------------------------------------------------------------
-// Pre : Check method
-// Task : Checks if running on Windows 4 Workgroups
-//-------------------------------------------------------------
-BOOL COSVersion::IsWindows4Workgroups(unsigned short usMethod) {
- WORD wNetType;
- DWORD dwVerSize, dwVerHandle;
- HANDLE hMem;
- VS_VERSION FAR *lpVerInfo;
- BOOL bWfW =FALSE;
-
- if(usMethod == METHOD_MULTINET)
- {
- // Use the method that checks 4 multinet driver
- HINSTANCE hLib =LoadLibrary((LPTSTR)"USER.EXE");
- if((WORD)hLib >= (WORD)HINSTANCE_ERROR)
- {
- // Check if library loaded OK
- //NETCAPFUNC lpWNetGetCaps =(NETCAPFUNC)GetProcAddress(hLib,_T("WNetGetCaps"));
- NETCAPFUNC lpWNetGetCaps =(NETCAPFUNC)GetProcAddress(hLib,"WNetGetCaps");
- if(lpWNetGetCaps != NULL)
- {
- wNetType =(*lpWNetGetCaps)(WNNC_NET_TYPE);
- if((wNetType & WNNC_NET_MULTINET) &&
- (LOBYTE(wNetType) & WNNC_SUBNET_WINWORKGROUP))
- // Yes, it is Windows 4 Workgroups
- bWfW =TRUE;
- }
-
- if(hLib)
- FreeLibrary(hLib);
- }
- }
- else
- {
- // Use the method that checks the fileversion of USER.EXE
- // Allocate memory 4 the file info struct
- dwVerSize =GetFileVersionInfoSize(_T("USER.EXE"),&dwVerHandle);
- hMem =GlobalAlloc(GMEM_MOVEABLE,dwVerSize);
- if(hMem != NULL)
- {
- lpVerInfo =(VS_VERSION FAR *)GlobalLock(hMem);
- // Get the file version
- // in Win32, the dwVerHandle is zero, ignored
- if(GetFileVersionInfo(_T("USER.EXE"),dwVerHandle,dwVerSize,lpVerInfo))
- if((HIWORD(lpVerInfo->vffInfo.dwProductVersionMS) == 3) &&
- (LOWORD(lpVerInfo->vffInfo.dwProductVersionMS) == 11))
- // Yes, it is Windows 4 Workgroups
- bWfW =TRUE;
- GlobalUnlock(hMem);
- GlobalFree(hMem);
- }
- }
-
- return bWfW;
-}
-
-//-------------------------------------------------------------
-// Task : Get OS major version number
-//-------------------------------------------------------------
-DWORD COSVersion::GetMajorVersion() const
-{
-#if defined(__WIN32__) || defined(_WIN32)
- return osvi.dwMajorVersion;
-#else
- return (DWORD)(LOBYTE(LOWORD(dwVersion)));
-#endif
-}
-
-//-------------------------------------------------------------
-// Task : Get OS minor version number
-//-------------------------------------------------------------
-DWORD COSVersion::GetMinorVersion() const
-{
-#if defined(__WIN32__) || defined(_WIN32)
- return osvi.dwMinorVersion;
-#else
- return (DWORD)(HIBYTE(LOWORD(dwVersion)));
-#endif
-}
-
-#if defined(__WIN32__) || defined(_WIN32)
-//-------------------------------------------------------------
-// Task : Get the build number of the OS
-//-------------------------------------------------------------
-DWORD COSVersion::GetBuildNumber() const
-{
- return (m_nOSType & OS_WINNT) ? osvi.dwBuildNumber : LOWORD(osvi.dwBuildNumber);
-}
-#endif
-
-#if defined(__WIN32__) || defined(_WIN32)
-//-------------------------------------------------------------
-// Task : Get the special version data (string got from GetVersionEX)
-//-------------------------------------------------------------
-LPCTSTR COSVersion::GetSpecialVersion() const
-{
- return osvi.szCSDVersion;
-}
-#endif
-
diff --git a/Source/Common/osversion.h b/Source/Common/osversion.h
deleted file mode 100644
index 8026dd175..000000000
--- a/Source/Common/osversion.h
+++ /dev/null
@@ -1,120 +0,0 @@
-//---------------------------------------------------------------------------
-// Copyright (C) 1998, Interscope Ltd. All rights reserved.
-// Reproduction or distribution of this program, or any portion of it,
-// is permitted only if this header is kept as it is.
-// For more information, contact:
-//
-// Interscope Ltd., 5 Culturii St., 5th Floor, 4800 Baia Mare, RO
-// Phone/Fax: +40-62-215023
-// E-mail: office@interscope.ro
-//
-// $Author: Levente Farkas $
-// $Date: 5/13/98 12:03a $
-// $Modtime: 4/27/98 6:50a $
-// $Revision: 17 $
-// $Archive: /Interscope/Thebe/InstallMaster/OSVersion.Hpp $
-// $Workfile: OSVersion.Hpp $
-//-----------------------------------------------------------------------------
-
-#ifndef __OperatingSystemVersion_Hpp__
-#define __OperatingSystemVersion_Hpp__
-
-// Define the following symbol if compiling using precompiled headers through
-// header file StdAfx.H
-// #define __STDAFX__
-//
-// Define the following symbol if used in a MFC project
-
-#if !defined(__WIN32__) && !defined(_WIN32)
-#ifndef STRICT
-#define STRICT
-#endif
-#endif // __WIN32__
-
-#if defined(__WIN32__) || defined(_WIN32)
-#include
-#else
-#include
-#endif
-
-
-//--- Extended OS and Win32 (tm) version types --------------------------------
-
-#define OS_UNKNOWN 0x0000
-#define OS_WIN3X 0x0001
-#define OS_WFW 0x0002
-#define OS_WIN95 0x0004
-#define OS_WIN98 0x0008
-#define OS_WINME 0x0010
-#define OS_WINNT351 0x0020
-#define OS_WINNT40 0x0040
-#define OS_WINNTWS 0x0080 // Workstation
-#define OS_WINNTS 0x0100 // Server
-#define OS_WINNTAS 0x0200 // Advanced server (only if older than 4.0)
-#define OS_WIN2000 0x0400
-#define OS_WINXP 0x0800
-#define OS_WINNET 0x1000
-#define OS_WINNT (OS_WINNT351 | OS_WINNTWS | OS_WINNTS | OS_WINNTAS | OS_WIN2000 | OS_WINXP | OS_WINNET)
-#define OS_WINCE 0x2000
-
-#define WIN_UNKNOWN 0x0000
-#define WIN_16 0x0100
-#define WIN_32 0x0200
-#define WIN_32S 0x0400
-#define WIN_32C 0x0800
-
-
-//--- Windows 4 Workgroups detection methods --------------------------------
-
-#define METHOD_MULTINET 1
-#define METHOD_FILEVERSION 2
-
-
-//--- OS version checker class ----------------------------------------------
-
-class COSVersion
-{
-// Type(s)
-protected:
- struct VS_VERSION
- {
- WORD wTotLen;
- WORD wValLen;
- char szSig[16];
- VS_FIXEDFILEINFO vffInfo;
- };
-
-// Data members
-private:
- WORD m_nOSType;
- WORD m_nWinType;
- DWORD m_dwVersion;
-
- #if defined(__WIN32__) || defined(_WIN32)
- OSVERSIONINFO osvi;
- #endif
-
-// Construction
-public:
- COSVersion();
-
-// Implementation
-public:
- WORD GetOSType() const { return m_nOSType; } // Returns one of the OS_ constants
- WORD GetWindowsType() const { return m_nWinType; } // Returns one of the WIN_ constants
- DWORD GetMajorVersion() const;
- DWORD GetMinorVersion() const;
-
- #if defined(__WIN32__) || defined(_WIN32)
- DWORD GetBuildNumber() const;
- LPCTSTR GetSpecialVersion() const;
- #endif
-
-// Helper(s)
-private:
- BOOL IsWindows4Workgroups(unsigned short usMethod);
-};
-
-
-#endif
-
diff --git a/Source/Common/path.cpp b/Source/Common/path.cpp
index 998dedeee..02b21610a 100644
--- a/Source/Common/path.cpp
+++ b/Source/Common/path.cpp
@@ -36,39 +36,6 @@ HINSTANCE CPath::GethInst()
return m_hInst;
}
-//-------------------------------------------------------------
-// Task : Create a string of length nDigits containing random digits
-//-------------------------------------------------------------
-static stdstr RandomDigits(int nDigits)
-{
- // Keep the number of digits in a rational limit
- //ASSERT(nDigits > 0);
- //ASSERT(nDigits < 20);
-
- int nDigits2 = nDigits;
- stdstr Digits;
- TCHAR next_8_digits[9];
- while(nDigits2 > 0)
- {
- _stprintf(next_8_digits,_T("%08lx"),GetTickCount());
-
- for(int i=0; i<8; i++)
- {
- Digits += next_8_digits[i];
- if(--nDigits2 == 0)
- break;
- }
- }
-
- int last_digit =rand();
- if(last_digit < 0)
- last_digit =(-last_digit);
- last_digit %= 10;
- Digits[nDigits - 1] = (char)('0' + last_digit);
-
- return Digits;
-}
-
//////////////////////////////////////////////////////////////////////
// Initialisation
//////////////////////////////////////////////////////////////////////
@@ -166,29 +133,6 @@ CPath::CPath(const stdstr& strPath, const stdstr& NameExten )
SetNameExtension(NameExten.c_str());
}
-//-------------------------------------------------------------
-// Task : Constructs a path and points it 2 specified
-// special directory
-//-------------------------------------------------------------
-CPath::CPath(SpecialDirectoryType eInitialDir)
-{
- Init();
- SpecialDirectory(eInitialDir);
-}
-
-CPath::CPath(SpecialDirectoryType eInitialDir, const stdstr & NameExten )
-{
- Init();
- SpecialDirectory(eInitialDir);
- SetNameExtension(NameExten.c_str());
-}
-
-CPath::CPath(SpecialDirectoryType eInitialDir, LPCTSTR NameExten )
-{
- Init();
- SpecialDirectory(eInitialDir);
- SetNameExtension(NameExten);
-}
//-------------------------------------------------------------
// Task : Cleanup and destruct a path object
//-------------------------------------------------------------
@@ -275,45 +219,6 @@ CPath::CPath(DIR_CURRENT_DIRECTORY /*sdt*/, LPCTSTR NameExten)
if (NameExten) { SetNameExtension(NameExten); }
}
-CPath::CPath(DIR_WINDOWS_DIRECTORY /*sdt*/, LPCTSTR NameExten)
-{
- // Windows directory
- Init();
- WindowsDirectory();
- if (NameExten) { SetNameExtension(NameExten); }
-}
-
-CPath::CPath(DIR_SYSTEM_DIRECTORY /*sdt*/, LPCTSTR NameExten)
-{
- // Windows' system directory
- Init();
- SystemDirectory();
- if (NameExten) { SetNameExtension(NameExten); }
-}
-
-CPath::CPath(DIR_SYSTEM32_DIRECTORY /*sdt*/, LPCTSTR NameExten)
-{
- Init();
- SystemDirectory();
- if (NameExten) { SetNameExtension(NameExten); }
-}
-
-CPath::CPath(DIR_SYSTEM_DRIVER_DIRECTORY /*sdt*/, LPCTSTR NameExten)
-{
- Init();
- SystemDirectory();
- AppendDirectory(_T("drivers"));
- if (NameExten) { SetNameExtension(NameExten); }
-}
-
-CPath::CPath(DIR_SYSTEM_DRIVE_ROOT_DIRECTORY /*sdt*/, LPCTSTR NameExten)
-{
- // The root directory of system drive
- Init();
- SystemDriveRootDirectory();
- if (NameExten) { SetNameExtension(NameExten); }
-}
-
CPath::CPath(DIR_MODULE_DIRECTORY /*sdt*/, LPCTSTR NameExten)
{
// The directory where the executable of this app is
@@ -329,96 +234,6 @@ CPath::CPath(DIR_MODULE_FILE /*sdt*/)
Module();
}
-void CPath::SpecialDirectory(SpecialDirectoryType eInitialDir)
-{
- switch(eInitialDir)
- {
- // Windows temp directory
- case TEMP_DIRECTORY:
- TempDirectory();
- break;
- // Program files directory
- case PROGRAM_FILES_DIRECTORY:
- ProgramFilesDirectory();
- break;
- // Common files directory
- case COMMON_FILES_DIRECTORY:
- CommonFilesDirectory();
- break;
- // Accessories directory
- case ACCESSORIES_DIRECTORY:
- AccessoriesDirectory();
- break;
- // Media directory
- case MEDIA_DIRECTORY:
- MediaDirectory();
- break;
- // INF directory
- case DEVICE_DIRECTORY:
- DeviceDirectory();
- break;
- // User specific directories
- case USER_DESKTOP_DIRECTORY:
- UserDesktopDirectory();
- break;
- case USER_FAVORITES_DIRECTORY:
- UserFavoritesDirectory();
- break;
- case USER_FONTS_DIRECTORY:
- UserFontsDirectory();
- break;
- case USER_NETHOOD_DIRECTORY:
- UserNetworkNeighbourhoodDirectory();
- break;
- case USER_DOCUMENTS_DIRECTORY:
- UserDocumentsDirectory();
- break;
- case USER_RECENT_DIRECTORY:
- UserRecentDirectory();
- break;
- case USER_SENDTO_DIRECTORY:
- UserSendToDirectory();
- break;
- case USER_RECYCLE_DIRECTORY:
- UserRecycleBinDirectory();
- break;
- case USER_APPLICATION_DATA_DIRECTORY:
- UserApplicationDataDirectory();
- break;
- case USER_TEMPLATES_DIRECTORY:
- UserTemplatesDirectory();
- break;
- case USER_STARTMENU_DIRECTORY:
- UserStartMenuDirectory();
- break;
- case USER_STARTMENU_STARTUP_DIRECTORY:
- UserStartMenuStartupDirectory();
- break;
- case USER_STARTMENU_PROGRAMS_DIRECTORY:
- UserStartMenuProgramsDirectory();
- break;
- // Directories common 2 all users
- case COMMON_DESKTOP_DIRECTORY:
- CommonDesktopDirectory();
- break;
- case COMMON_STARTMENU_DIRECTORY:
- CommonStartMenuDirectory();
- break;
- case COMMON_STARTMENU_STARTUP_DIRECTORY:
- CommonStartMenuStartupDirectory();
- break;
- case COMMON_STARTMENU_PROGRAMS_DIRECTORY:
- CommonStartMenuProgramsDirectory();
- break;
- // Unknown special directory constant
- default:
- // Accept only constants we know about
- //Bugger
- _ASSERTE(false);
- break;
- }
-}
-
//-------------------------------------------------------------
// Post : Returns the drive component without a colon, e.g. "c"
// Returns the directory component with a leading backslash,
@@ -474,21 +289,6 @@ void CPath::GetComponents(stdstr* pDrive,
StripLeadingChar(*pExtension,EXTENSION_DELIMITER);
}
-//-------------------------------------------------------------
-// Task : Get drive from path
-//-------------------------------------------------------------
-void CPath::GetDrive(stdstr& rDrive) const
-{
- GetComponents(&rDrive);
-}
-
-stdstr CPath::GetDrive(void) const
-{
- stdstr rDrive;
- GetComponents(&rDrive);
- return rDrive;
-}
-
//-------------------------------------------------------------
// Task : Get drive and directory from path
//-------------------------------------------------------------
@@ -621,23 +421,6 @@ void CPath::GetFullyQualified(stdstr& rFullyQualified) const
rFullyQualified =buff_fullname;
}
-//-------------------------------------------------------------
-// Task : Get fully qualified path in short (8.3 style) form
-//-------------------------------------------------------------
-void CPath::GetFullyQualifiedShort(stdstr& rFullyQualifiedShort) const
-{
- GetFullyQualified(rFullyQualifiedShort);
-
- //#pragma message(Reminder(_T("Also implement a GetFullyQualifiedLong")))
-
- TCHAR buff_fullname[MAX_PATH];
-
- memset(buff_fullname, 0, sizeof(buff_fullname));
-
- GetShortPathName(rFullyQualifiedShort.c_str(),buff_fullname,sizeof(buff_fullname)/sizeof(TCHAR));
- rFullyQualifiedShort =buff_fullname;
-}
-
//-------------------------------------------------------------
// Post : Return TRUE if path does not start from filesystem root
// Task : Check if path is a relative one (e.g. doesn't start with C:\...)
@@ -655,52 +438,6 @@ BOOL CPath::IsRelative() const
return true;
}
-//-------------------------------------------------------------
-// Post : Return TRUE if there are wildcards in the path
-// Task : Check if path contains wildcards
-//-------------------------------------------------------------
-BOOL CPath::IsWild() const
-{
- return (m_strPath.find_first_of(WILD_SET) != stdstr::npos);
-}
-
-//-------------------------------------------------------------
-// Post : Return TRUE if path is lexically correct
-// Task : Determine whether lpszFileName is valid. A filename
-// is valid if it contains only legal characters, doesn't
-// have repeated contiguous subdirectory delimiters, has at
-// most one drive delimiter, and all components fit within
-// maximum sizes
-// This routine does NOT determine if a file exists, or
-// even if it could exist relative to the user's directory
-// hierarchy. Its tests are for lexical correctness only
-// See also: CPath::Exists
-//-------------------------------------------------------------
-BOOL CPath::IsValid () const
-{
- // Check 4 illegal characters (no wildcards allowed)
- // We accept either \ or / as folder delimiter
- if(IsWild() ||
- (m_strPath.find_first_of(_T("|\"<>")) != stdstr::npos) ||
- (m_strPath.find(_T("//")) != stdstr::npos))
- return FALSE;
-
- int index = (int)m_strPath.find(_T("\\\\"));
- if((index != stdstr::npos) && (index > 0))
- return FALSE;
-
- // Make sure : can appear only in the 2nd position as a drive delimiter
- if(((index = (int)m_strPath.find(':')) != stdstr::npos) && (index != 1))
- return FALSE;
-
- // Make sure it fits in the maximum path size
- if(m_strPath.length() > MAX_PATH)
- return FALSE;
-
- // Path is valid
- return TRUE;
-}
-
//-------------------------------------------------------------
// Task : Set path components
//-------------------------------------------------------------
@@ -910,45 +647,6 @@ void CPath::CurrentDirectory()
SetDriveDirectory(buff_path);
}
-//-------------------------------------------------------------
-// Task : Set path 2 Windows directory
-//-------------------------------------------------------------
-void CPath::WindowsDirectory()
-{
- TCHAR buff_path[MAX_PATH];
-
- memset(buff_path, 0, sizeof(buff_path));
-
- GetWindowsDirectory(buff_path,MAX_PATH);
-
- Empty();
- SetDriveDirectory(buff_path);
-}
-
-//-------------------------------------------------------------
-// Task : Set path 2 Windows system directory
-//-------------------------------------------------------------
-void CPath::SystemDirectory()
-{
- TCHAR buff_path[MAX_PATH];
-
- memset(buff_path, 0, sizeof(buff_path));
-
- GetSystemDirectory(buff_path,MAX_PATH);
-
- Empty();
- SetDriveDirectory(buff_path);
-}
-
-//-------------------------------------------------------------
-// Task : Set path 2 root of system drive (usually C:\)
-//-------------------------------------------------------------
-void CPath::SystemDriveRootDirectory()
-{
- SystemDirectory();
- SetDirectory(_T(""));
-}
-
//-------------------------------------------------------------
// Task : Set path 2 the name of specified module
//-------------------------------------------------------------
@@ -992,897 +690,6 @@ void CPath::ModuleDirectory()
SetNameExtension(_T(""));
}
-//-------------------------------------------------------------
-// Task : Currently, if the current environment has an
-// entry for the TEMP environment variable, the directory will
-// be set to that. If not, the directory will be the Windows
-// System directory. The caller of this method, however, should
-// not rely on this convention
-//-------------------------------------------------------------
-void CPath::TempDirectory()
-{
- TCHAR buff_path[MAX_PATH];
-
- memset(buff_path, 0, sizeof(buff_path));
-
- GetTempPath(MAX_PATH,buff_path);
-
- m_strPath =buff_path;
- SetNameExtension(_T(""));
-}
-
-//-------------------------------------------------------------
-// Task : Set path 2 program files folder
-// Usually C:\Program Files
-//-------------------------------------------------------------
-void CPath::ProgramFilesDirectory()
-{
- stdstr strPath;
- if(GetRegistryPath(HKEY_LOCAL_MACHINE,_T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion"),_T("ProgramFilesDir"),strPath))
- {
- // Got a path, use it
- Empty();
- SetDriveDirectory(strPath.c_str());
- }
- else
- {
- // This is some old or unknown system
- Empty();
- SetDriveDirectory(_T("C:\\Programs"));
- }
-}
-
-//-------------------------------------------------------------
-// Task : Set path 2 common files folder
-// Usually C:\Program Files\Common Files
-//-------------------------------------------------------------
-void CPath::CommonFilesDirectory()
-{
- stdstr strPath;
- if(GetRegistryPath(HKEY_LOCAL_MACHINE,_T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion"),_T("CommonFilesDir"),strPath))
- {
- // Got a path, use it
- Empty();
- SetDriveDirectory(strPath.c_str());
- }
- else
- {
- // This is some old or unknown system
- Empty();
-
- TCHAR Drive[3];
- memset(Drive, 0, sizeof(Drive));
- ExpandEnvironmentStrings (_T("%SystemDrive%"), Drive, sizeof(Drive)/sizeof(TCHAR) );
-
- stdstr strDir = stdstr(Drive) + stdstr(_T("\\Program Files\\Common Files"));
-
- SetDriveDirectory(strDir.c_str());
- }
-}
-
-//-------------------------------------------------------------
-// Task : Set path 2 common files folder
-// On Win95 is C:\Program Files\Accessories
-// On WinNT is C:\Program Files\Windows NT\Accessories
-//-------------------------------------------------------------
-void CPath::AccessoriesDirectory()
-{
- // Accessories folder is in Program Files folder
- ProgramFilesDirectory();
-
- COSVersion osver;
- WORD ostype =osver.GetOSType();
- WORD wintype =osver.GetWindowsType();
- BOOL is_Win95 =(ostype==OS_WIN95) || (ostype==OS_WIN98);
- BOOL is_NT =((ostype & OS_WINNT) != 0);
-
- if((wintype != WIN_32S) && is_Win95)
- {
- // Windows 95
- AppendDirectory(_T("Accessories"));
- return;
- }
-
- if((wintype != WIN_32S) && is_NT && (((osver.GetMajorVersion()==3) && (osver.GetMinorVersion()>=51)) || (osver.GetMajorVersion()>3)))
- {
- // Windows NT with the new Chichago shell
- AppendDirectory(_T("Windows NT\\Accessories"));
- return;
- }
-
- // This is some old or unknown system
- AppendDirectory(_T("Accessry"));
-}
-
-//-------------------------------------------------------------
-// Task : Set path 2 media folder
-// Usually C:\Windows\Media
-//-------------------------------------------------------------
-void CPath::MediaDirectory()
-{
- stdstr strPath;
- if(GetRegistryPath(HKEY_LOCAL_MACHINE,_T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion"),_T("MediaPath"),strPath))
- {
- // Got a path, use it
- Empty();
- SetDriveDirectory(strPath.c_str());
- }
- else
- {
- // This is some old or unknown system
- WindowsDirectory();
- AppendDirectory(_T("Media"));
- }
-}
-
-//-------------------------------------------------------------
-// Task : Set path 2 device definition folder
-// Usually C:\Windows\Inf
-//-------------------------------------------------------------
-void CPath::DeviceDirectory()
-{
- stdstr strPath;
- if(GetRegistryPath(HKEY_LOCAL_MACHINE,_T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion"),_T("DevicePath"),strPath))
- {
- // Got a path, use it
- Empty();
- SetDriveDirectory(strPath.c_str());
- }
- else
- {
- // This is some old or unknown system
- WindowsDirectory();
- AppendDirectory(_T("Inf"));
- }
-}
-
-//-------------------------------------------------------------
-// Post : If this function is called on a system which does not
-// support the new Chichago shell, it will return FALSE
-// Task : Set path 2 one of the special folders in Chichago
-//-------------------------------------------------------------
-BOOL CPath::ShellDirectory(int nShellFolderID)
-{
- COSVersion osver;
- WORD ostype =osver.GetOSType();
- WORD wintype =osver.GetWindowsType();
- BOOL is_Win95 =(ostype==OS_WIN95) || (ostype==OS_WIN98);
- BOOL is_NT =((ostype & OS_WINNT) != 0);
-
- if((wintype != WIN_32S) &&
- (is_Win95 || (is_NT && (((osver.GetMajorVersion()==3) && (osver.GetMinorVersion()>=51)) || (osver.GetMajorVersion()>3)))))
- {
- // These systems support the new Chichago shell, get location from registry
- BOOL result =FALSE;
- LPITEMIDLIST pidl =NULL;
- TCHAR special_path[MAX_PATH];
-
- memset(special_path, 0, sizeof(special_path));
-
- // Get a PIDL 2 the special shell folder
- HRESULT hr =SHGetSpecialFolderLocation(NULL,nShellFolderID,&pidl);
- if(SUCCEEDED(hr))
- {
- // Convert the PIDL in2 a path
- result =SHGetPathFromIDList(pidl,special_path);
-
- // Free the PIDL
- // Get the address of our task allocator's IMalloc interface
- LPMALLOC pMalloc = NULL;
- hr =SHGetMalloc(&pMalloc);
-
- if(SUCCEEDED(hr))
- {
- // Free the PIDL
- pMalloc->Free(pidl);
-
- // Free our task allocator
- pMalloc->Release();
- }
- }
-
- if(result)
- {
- // We've got the special path, now set ourselves 2 point 2 this
- Empty();
- SetDriveDirectory(special_path);
- }
-
- return result;
- }
-
- // This is some old or unknown system, shell folders not supported
- return FALSE;
-}
-
-//---------------------------------------------------------------------------
-// Post : Return TRUE on success
-// Task : Set path 2 one of the special folders in Chichago
-// This function manually digs in the registry instead of using
-// SHGetSpecialFolderLocation, since it seems that this does not work 4
-// special location constants beginning with
-//---------------------------------------------------------------------------
-BOOL CPath::ShellDirectory2(int nShellFolderID)
-{
- COSVersion osver;
- WORD ostype =osver.GetOSType();
- WORD wintype =osver.GetWindowsType();
- BOOL is_Win95 =(ostype==OS_WIN95) || (ostype==OS_WIN98);
- BOOL is_NT =((ostype & OS_WINNT) != 0);
-
- if((wintype != WIN_32S) &&
- (is_Win95 || (is_NT && (((osver.GetMajorVersion()==3) && (osver.GetMinorVersion()>=51)) || (osver.GetMajorVersion()>3)))))
- {
- // These systems support the new Chichago shell, get location from registry
- HKEY root = NULL;
- stdstr key;
- stdstr value;
-
- switch(nShellFolderID)
- {
- case CSIDL_DESKTOPDIRECTORY:
- root =HKEY_CURRENT_USER;
- key =_T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders");
- value =_T("Desktop");
- break;
-
- case CSIDL_FAVORITES:
- root =HKEY_CURRENT_USER;
- key =_T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders");
- value =_T("Favorites");
- break;
-
- case CSIDL_FONTS:
- root =HKEY_CURRENT_USER;
- key =_T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders");
- value =_T("Fonts");
- break;
-
- case CSIDL_NETHOOD:
- root =HKEY_CURRENT_USER;
- key =_T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders");
- value =_T("NetHood");
- break;
-
- case CSIDL_PERSONAL:
- root =HKEY_CURRENT_USER;
- key =_T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders");
- value =_T("Personal");
- break;
-
- case CSIDL_RECENT:
- root =HKEY_CURRENT_USER;
- key =_T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders");
- value =_T("Recent");
- break;
-
- case CSIDL_SENDTO:
- root =HKEY_CURRENT_USER;
- key =_T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders");
- value =_T("SendTo");
- break;
-
- case CSIDL_TEMPLATES:
- root =HKEY_CURRENT_USER;
- key =_T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders");
- value =_T("Templates");
- break;
-
- case CSIDL_APPDATA:
- root =HKEY_CURRENT_USER;
- key =_T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders");
- value =_T("AppData");
- break;
-
- case CSIDL_STARTMENU:
- root =HKEY_CURRENT_USER;
- key =_T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders");
- value =_T("Start Menu");
- break;
-
- case CSIDL_STARTUP:
- root =HKEY_CURRENT_USER;
- key =_T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders");
- value =_T("Startup");
- break;
-
- case CSIDL_PROGRAMS:
- root =HKEY_CURRENT_USER;
- key =_T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders");
- value =_T("Programs");
- break;
-
- case CSIDL_COMMON_DESKTOPDIRECTORY:
- root =HKEY_LOCAL_MACHINE;
- key =_T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders");
- value =_T("Common Desktop");
- break;
-
- case CSIDL_COMMON_STARTMENU:
- root =HKEY_LOCAL_MACHINE;
- key =_T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders");
- value =_T("Common Start Menu");
- break;
-
- case CSIDL_COMMON_STARTUP:
- root =HKEY_LOCAL_MACHINE;
- key =_T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders");
- value =_T("Common Startup");
- break;
-
- case CSIDL_COMMON_PROGRAMS:
- root =HKEY_LOCAL_MACHINE;
- key =_T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders");
- value =_T("Common Programs");
- break;
- }
-
- stdstr strPath;
- if(GetRegistryPath(root,key.c_str(),value.c_str(),strPath))
- {
- // Got a path, use it
- Empty();
- SetDriveDirectory(strPath.c_str());
-
- return TRUE;
- }
- }
-
- // This is some old or unknown system
- return FALSE;
-}
-
-//---------------------------------------------------------------------------
-// Post : Return FALSE if specified value does not exist or some error
-// Task : Dig in the registry 2 the specified location, and extract a path
-// Make sure the path is a valid
-//---------------------------------------------------------------------------
-BOOL CPath::GetRegistryPath(HKEY hRootKey, LPCTSTR lpcszKeyName, LPCTSTR lpcszValueName, stdstr &strPath)
-{
- TCHAR path_buffer [MAX_PATH];
- TCHAR expanded_buffer[MAX_PATH];
- ULONG path_buffer_size =sizeof(path_buffer);
- CRegistry reg(hRootKey,lpcszKeyName,KEY_READ);
- memset(path_buffer, 0, sizeof(path_buffer));
- memset(expanded_buffer, 0, sizeof(expanded_buffer));
-
- if(reg.GetValue(lpcszValueName,(BYTE *)&path_buffer,path_buffer_size))
- {
- COSVersion osver;
-#ifndef _UNICODE
- WORD ostype =osver.GetOSType();
- BOOL is_NT =((ostype & OS_WINNT) != 0);
- if(is_NT)
- {
- // Running on NT and the ExpandEnvironmentStrings API requires
- // Unicode strings
- WCHAR path_buffer_unicode [MAX_PATH];
- WCHAR expanded_buffer_unicode[MAX_PATH];
-
- memset(path_buffer_unicode, 0, sizeof(path_buffer_unicode));
- memset(expanded_buffer_unicode, 0, sizeof(expanded_buffer_unicode));
-
- MultiByteToWideChar(CP_ACP,0,path_buffer,-1,path_buffer_unicode,sizeof(path_buffer_unicode)/sizeof(WCHAR));
- ExpandEnvironmentStringsW(path_buffer_unicode,expanded_buffer_unicode,sizeof(expanded_buffer_unicode)/sizeof(WCHAR));
- WideCharToMultiByte(CP_ACP,0,expanded_buffer_unicode,-1,expanded_buffer,sizeof(path_buffer)/sizeof(TCHAR),NULL,NULL);
- }
- else
-#endif
- ExpandEnvironmentStrings(path_buffer,expanded_buffer,path_buffer_size);
-
- strPath.erase();
- strPath =expanded_buffer;
-
- return TRUE;
- }
-
- // No such key and/or value
- return FALSE;
-}
-
-//-------------------------------------------------------------
-// Post : If this function is called on a system which does not
-// support the new Chichago shell, it will clear the path
-// Task : Set path 2 desktop folder of currently logged-in user
-//-------------------------------------------------------------
-void CPath::UserDesktopDirectory()
-{
- if(!ShellDirectory(CSIDL_DESKTOPDIRECTORY))
- Empty();
-}
-
-//-------------------------------------------------------------
-// Post : If this function is called on a system which does not
-// support the new Chichago shell, it will clear the path
-// Task : Set path 2 favorites folder of currently logged-in user
-//-------------------------------------------------------------
-void CPath::UserFavoritesDirectory()
-{
- if(!ShellDirectory(CSIDL_FAVORITES))
- Empty();
-}
-
-//-------------------------------------------------------------
-// Post : If this function is called on a system which does not
-// support the new Chichago shell, it will clear the path
-// Task : Set path 2 fonts folder of currently logged-in user
-//-------------------------------------------------------------
-void CPath::UserFontsDirectory()
-{
- if(!ShellDirectory(CSIDL_FONTS))
- Empty();
-}
-
-//-------------------------------------------------------------
-// Post : If this function is called on a system which does not
-// support the new Chichago shell, it will clear the path
-// Task : Set path 2 network hood folder of currently logged-in user
-//-------------------------------------------------------------
-void CPath::UserNetworkNeighbourhoodDirectory()
-{
- if(!ShellDirectory(CSIDL_NETHOOD))
- Empty();
-}
-
-//-------------------------------------------------------------
-// Post : If this function is called on a system which does not
-// support the new Chichago shell, it will clear the path
-// Task : Set path 2 personal folder of currently logged-in user
-// Usually C:\My Documents
-//-------------------------------------------------------------
-void CPath::UserDocumentsDirectory()
-{
- if(!ShellDirectory(CSIDL_PERSONAL))
- Empty();
-}
-
-//-------------------------------------------------------------
-// Post : If this function is called on a system which does not
-// support the new Chichago shell, it will clear the path
-// Task : Set path 2 recent folder of currently logged-in user
-//-------------------------------------------------------------
-void CPath::UserRecentDirectory()
-{
- if(!ShellDirectory(CSIDL_RECENT))
- Empty();
-}
-
-//-------------------------------------------------------------
-// Post : If this function is called on a system which does not
-// support the new Chichago shell, it will clear the path
-// Task : Set path 2 SendTo folder of currently logged-in user
-//-------------------------------------------------------------
-void CPath::UserSendToDirectory()
-{
- if(!ShellDirectory(CSIDL_SENDTO))
- Empty();
-}
-
-//-------------------------------------------------------------
-// Post : If this function is called on a system which does not
-// support the new Chichago shell, it will clear the path
-// Task : Set path 2 templates folder of currently logged-in user
-// Usually C:\Windows\ShellNew
-//-------------------------------------------------------------
-void CPath::UserTemplatesDirectory()
-{
- if(!ShellDirectory(CSIDL_TEMPLATES))
- Empty();
-}
-
-//-------------------------------------------------------------
-// Post : If this function is called on a system which does not
-// support the new Chichago shell, it will clear the path
-// Task : Set path 2 the recycle bin directory
-// Usually C:\Recycled
-//-------------------------------------------------------------
-void CPath::UserRecycleBinDirectory()
-{
- if(!ShellDirectory(CSIDL_BITBUCKET))
- Empty();
-}
-
-//-------------------------------------------------------------
-// Post : If this function is called on a system which does not
-// support the new Chichago shell, it will clear the path
-// Task : Set path 2 the folder where application data is stored
-// specific 2 currently logged-in user
-//-------------------------------------------------------------
-void CPath::UserApplicationDataDirectory()
-{
- if(!ShellDirectory(CSIDL_APPDATA))
- Empty();
-}
-
-//-------------------------------------------------------------
-// Post : If this function is called on a system which does not
-// support the new Chichago shell, it will clear the path
-// Task : Set path 2 start menu folder of currently logged-in user
-//-------------------------------------------------------------
-void CPath::UserStartMenuDirectory()
-{
- if(!ShellDirectory(CSIDL_STARTMENU))
- Empty();
-}
-
-//-------------------------------------------------------------
-// Post : If this function is called on a system which does not
-// support the new Chichago shell, it will clear the path
-// Task : Set path 2 startup folder of currently logged-in user
-//-------------------------------------------------------------
-void CPath::UserStartMenuStartupDirectory()
-{
- if(!ShellDirectory(CSIDL_STARTUP))
- Empty();
-}
-
-//-------------------------------------------------------------
-// Post : If this function is called on a system which does not
-// support the new Chichago shell, it will clear the path
-// Task : Set path 2 programs menu folder of currently logged-in user
-//-------------------------------------------------------------
-void CPath::UserStartMenuProgramsDirectory()
-{
- if(!ShellDirectory(CSIDL_PROGRAMS))
- Empty();
-}
-
-//-------------------------------------------------------------
-// Post : If this function is called on a system which does not
-// support the new Chichago shell, it will clear the path
-// Task : Set path 2 desktop folder common 2 all users
-//-------------------------------------------------------------
-void CPath::CommonDesktopDirectory()
-{
- if(!ShellDirectory2(CSIDL_COMMON_DESKTOPDIRECTORY))
- {
- // Check if running on Windows 95, and workaround this if so
- COSVersion osver;
- WORD ostype =osver.GetOSType();
- if((ostype == OS_WIN95) || (ostype == OS_WIN98))
- {
- // Manual workaround
- WindowsDirectory();
- AppendDirectory(_T("Desktop"));
- }
- else
- // Failure, clear path
- Empty();
- }
-}
-
-//-------------------------------------------------------------
-// Post : If this function is called on a system which does not
-// support the new Chichago shell, it will clear the path
-// Task : Set path 2 start menu folder common 2 all users
-//-------------------------------------------------------------
-void CPath::CommonStartMenuDirectory()
-{
- if(!ShellDirectory2(CSIDL_COMMON_STARTMENU))
- {
- // Check if running on Windows 95, and workaround this if so
- COSVersion osver;
- WORD ostype =osver.GetOSType();
- if((ostype == OS_WIN95) || (ostype == OS_WIN98))
- {
- // Manual workaround
- WindowsDirectory();
- AppendDirectory(_T("Start Menu"));
- }
- else
- // Failure, clear path
- Empty();
- }
-}
-
-//-------------------------------------------------------------
-// Post : If this function is called on a system which does not
-// support the new Chichago shell, it will clear the path
-// Task : Set path 2 startup folder common 2 all users
-//-------------------------------------------------------------
-void CPath::CommonStartMenuStartupDirectory()
-{
- if(!ShellDirectory2(CSIDL_COMMON_STARTUP))
- {
- // Check if running on Windows 95, and workaround this if so
- COSVersion osver;
- WORD ostype =osver.GetOSType();
- if((ostype == OS_WIN95) || (ostype == OS_WIN98))
- {
- // Manual workaround
- WindowsDirectory();
- AppendDirectory(_T("Start Menu\\Programs\\StartUp"));
- }
- else
- // Failure, clear path
- Empty();
- }
-}
-
-//-------------------------------------------------------------
-// Post : If this function is called on a system which does not
-// support the new Chichago shell, it will clear the path
-// Task : Set path 2 programs menu folder common 2 all users
-//-------------------------------------------------------------
-void CPath::CommonStartMenuProgramsDirectory()
-{
- if(!ShellDirectory2(CSIDL_COMMON_PROGRAMS))
- {
- // Check if running on Windows 95, and workaround this if so
- COSVersion osver;
- WORD ostype =osver.GetOSType();
- if((ostype == OS_WIN95) || (ostype == OS_WIN98))
- {
- // Manual workaround
- WindowsDirectory();
- AppendDirectory(_T("Start Menu\\Programs"));
- }
- else
- // Failure, clear path
- Empty();
- }
-}
-
-
-//-------------------------------------------------------------
-// Task : Set path 2 file WIN.INI in the Windows directory
-//-------------------------------------------------------------
-void CPath::WindowsProfile()
-{
- WindowsDirectory();
- SetNameExtension(_T("Win.INI"));
-}
-
-//-------------------------------------------------------------
-// Task : Set path 2 file WIN.INI in the Windows directory
-//-------------------------------------------------------------
-void CPath::SystemProfile()
-{
- WindowsDirectory();
- SetNameExtension(_T("System.INI"));
-}
-
-//-------------------------------------------------------------
-// Task : Turn this path from "x:\directory\subdirectory\name.ext"
-// to just "x:\"
-//-------------------------------------------------------------
-void CPath::MakeRoot()
-{
- SetDirectory(_T(""));
- SetNameExtension(_T(""));
-}
-
-//-------------------------------------------------------------
-// Pre : Only the first 3 character from lpcszPrefix will be used
-// Post : Returns TRUE on success
-// Task : Creates a temporary name
-//-------------------------------------------------------------
-BOOL CPath::CreateTempName(LPCTSTR lpcszPrefix)
-{
- // Check that we've got a prefix
- if(!lpcszPrefix)
- return FALSE;
-
- stdstr Dir;
- TCHAR temp_file[MAX_PATH];
-
- memset(temp_file, 0, sizeof(temp_file));
-
- GetDriveDirectory(Dir);
-
- if(::GetTempFileName(Dir.c_str(),lpcszPrefix,0,temp_file) != 0)
- {
- // Got a temp file name
- *this =temp_file;
- SetExtension(_T("tmp"));
-
- // GetTempFileName actually created the file, remove it now,
- // we only needed a name
- Delete(TRUE);
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-//---------------------------------------------------------------------------
-// Pre : Only the first 3 character from lpcszPrefix will be used
-// Post : Returns TRUE on success
-// Task : Creates a temporary folder name
-//---------------------------------------------------------------------------
-BOOL CPath::CreateTempDir(LPCTSTR lpcszPrefix, UINT nRetries)
-{
- // Check that we've got a prefix
- if(!lpcszPrefix)
- return FALSE;
-
- UINT retries =0;
- BOOL bSuccess =FALSE;
- TCHAR temp_prefix[ 5];
- TCHAR temp_name [15];
-
- ZeroMemory(temp_prefix, sizeof(temp_prefix));
- ZeroMemory(temp_name , sizeof(temp_name ));
- _tcsncpy(temp_prefix,lpcszPrefix,4);
- temp_prefix[3] =_T('\0');
-
- while(!bSuccess && (retries < nRetries))
- {
- _tcscpy(temp_name, temp_prefix);
- stdstr temp =RandomDigits(5);
- _tcscat(temp_name,temp.c_str());
- _tcscat(temp_name,_T(".tmp"));
-
- CPath test(*this);
-
- test.AppendDirectory(temp_name);
- if(!test.DirectoryExists() && test.CreateDirectory())
- {
- // CreateTempDir actually created the folder, remove it now,
- // we only needed a name
- test.RemoveDirectory();
- bSuccess =TRUE;
- }
-
- retries++;
- }
-
- if(bSuccess)
- AppendDirectory(temp_name);
-
- return bSuccess;
-}
-
-//-------------------------------------------------------------
-// Post : Returns TRUE on success
-// Task : Sets path 2 a random name, and optionally ensures
-// uniqueness of that path
-//-------------------------------------------------------------
-BOOL CPath::CreateRandomName(BOOL bMustNotExist /*= TRUE*/, UINT nRetries /*= 1000*/)
-{
- stdstr Name;
-
- for(UINT nRetry=0; nRetry < nRetries; nRetry++)
- {
- Name =RandomDigits(8);
- SetName(Name.c_str());
- if(!bMustNotExist)
- return TRUE;
- if(!Exists())
- return TRUE;
- }
-
- return FALSE;
-}
-
-//-------------------------------------------------------------
-// Post : Returns TRUE on success
-// Task : Create a new name, based on the existing name, for the same
-// drive and directory. If bMustNotExist, test the path up to
-// nRetries till we get an unused path
-// See also: CreateRandomName
-//-------------------------------------------------------------
-BOOL CPath::CreateSimilarName(BOOL bMustNotExist /*= TRUE*/, UINT nRetries /*= 1000*/)
-{
- stdstr NewName;
- stdstr OriginalName;
-
- GetName(OriginalName);
-
- for(UINT nRetry=0; nRetry < nRetries; nRetry++)
- {
- NewName =OriginalName + RandomDigits(_MAX_FNAME - (int)OriginalName.length());
- SetName(NewName.c_str());
- if(!Exists() || !bMustNotExist)
- return TRUE;
- }
-
- return FALSE;
-}
-
-//-------------------------------------------------------------
-// Post : Returns one of the EX_DRIVE_ constants
-// Task : Return the type of the drive this path points to
-// See DrvType.H for more details
-//-------------------------------------------------------------
-UINT CPath::GetDriveType() const
-{
- CPath RootPath = *this;
- stdstr Root;
-
- RootPath.MakeRoot();
- Root =(LPCTSTR)RootPath;
-
- return ::GetDriveType(Root.c_str());
-}
-
-//-------------------------------------------------------------
-// Post : Return -1 on error
-// Task : Find out the amount of free space on drive (in bytes)
-//-------------------------------------------------------------
-ULONG CPath::DriveFreeSpaceBytes() const
-{
- CPath RootPath = *this;
- stdstr Root;
-
- RootPath.MakeRoot();
-
- ULONG nSectorsPerCluster = 0;
- ULONG nBytesPerSector = 0;
- ULONG nFreeClusters = 0;
- ULONG nClusters = 0;
-
- if(!GetDiskFreeSpace((LPCTSTR)RootPath,&nSectorsPerCluster,&nBytesPerSector,&nFreeClusters,&nClusters))
- return 0;
- else
- return nFreeClusters * nSectorsPerCluster * nBytesPerSector;
-}
-
-//-------------------------------------------------------------
-// Post : Return -1 on error
-// Task : Find out the size of the drive (in bytes)
-//-------------------------------------------------------------
-ULONG CPath::DriveTotalSpaceBytes() const
-{
- CPath RootPath = *this;
- stdstr Root;
-
- RootPath.MakeRoot();
-
- ULONG nSectorsPerCluster = 0;
- ULONG nBytesPerSector = 0;
- ULONG nFreeClusters = 0;
- ULONG nClusters = 0;
-
- if(!GetDiskFreeSpace((LPCTSTR)RootPath,&nSectorsPerCluster,&nBytesPerSector,&nFreeClusters,&nClusters))
- return 0;
- else
- return nClusters * nSectorsPerCluster * nBytesPerSector;
-}
-
-//-------------------------------------------------------------
-// Post : Return -1 on error
-// Task : Find out the cluster size on this drive (in bytes)
-//-------------------------------------------------------------
-ULONG CPath::GetDriveClusterSize() const
-{
- CPath RootPath = *this;
- stdstr Root;
-
- RootPath.MakeRoot();
-
- ULONG nSectorsPerCluster = 0;
- ULONG nBytesPerSector = 0;
- ULONG nFreeClusters = 0;
- ULONG nClusters = 0;
-
- if(!GetDiskFreeSpace((LPCTSTR)RootPath,&nSectorsPerCluster,&nBytesPerSector,&nFreeClusters,&nClusters))
- return 0;
- else
- return nSectorsPerCluster * nBytesPerSector;
-}
-
-//-------------------------------------------------------------
-// Post : Return TRUE on success
-// Task : Find out info about drive
-//-------------------------------------------------------------
-BOOL CPath::GetDiskInfo(LPDWORD lpSectorsPerCluster,
- LPDWORD lpBytesPerSector,
- LPDWORD lpFreeClusters,
- LPDWORD lpClusters) const
-{
- // Create root path
- CPath RootPath = *this;
- RootPath.MakeRoot();
-
- return GetDiskFreeSpace((LPCTSTR)RootPath,
- lpSectorsPerCluster,
- lpBytesPerSector,
- lpFreeClusters,
- lpClusters);
-}
-
//---------------------------------------------------------------------------
// Post : Return TRUE if a directory
// Task : Check if this path represents a directory
@@ -1923,21 +730,6 @@ BOOL CPath::DirectoryExists() const
return bGotFile;
}
-//-------------------------------------------------------------
-// Post : Return TRUE if there are no files(s)/folder(s) in
-// directory. All objects (with hidden, system, etc. attributes)
-// are looked up
-// Task : Check if directory contains any file(s)
-//-------------------------------------------------------------
-BOOL CPath::IsDirectoryEmpty() const
-{
- CPath FileSpec = *this;
-
- FileSpec.SetNameExtension(WILD_NAME_EXTENSION);
- return !FileSpec.FindFirst(_A_NORMAL | _A_ARCH | _A_HIDDEN | _A_SYSTEM | _A_RDONLY) &&
- !FileSpec.FindFirst(_A_HIDDEN | _A_SUBDIR);
-}
-
//-------------------------------------------------------------
// Post : Return TRUE if these is such a file
// Task : Check if file exists
@@ -1954,200 +746,6 @@ BOOL CPath::Exists() const
return bSuccess;
}
-//-------------------------------------------------------------
-// Post : Return file size, -1 on error
-// Task : Get file size (in bytes)
-//-------------------------------------------------------------
-ULONG CPath::GetSize() const
-{
- WIN32_FIND_DATA FindData;
-
- memset(&FindData, 0, sizeof(FindData));
-
- HANDLE hFindFile =FindFirstFile(m_strPath.c_str(),&FindData);
- BOOL bSuccess =(hFindFile != INVALID_HANDLE_VALUE);
-
- if(hFindFile != NULL) // Make sure we close the search
- FindClose(hFindFile);
-
- return bSuccess ? FindData.nFileSizeLow : (ULONG)-1;
-}
-
-//-------------------------------------------------------------
-// Post : Return file attributes
-// Task : Get attributes of the file
-//-------------------------------------------------------------
-ULONG CPath::GetAttributes() const
-{
- return GetFileAttributes(m_strPath.c_str());
-}
-
-//---------------------------------------------------------------------------
-// Post : Return TRUE on success
-// Task : Set the attributes of the file
-//---------------------------------------------------------------------------
-BOOL CPath::SetAttributes(ULONG dwAttributes)
-{
- return SetFileAttributes(m_strPath.c_str(),dwAttributes);
-}
-
-//-------------------------------------------------------------
-// Post : Return TRUE on success
-// Task : Get file creation, last acces and/or last modification
-// time as local time
-//-------------------------------------------------------------
-BOOL CPath::GetTime(FILETIME *lpCreated, FILETIME *lpAccessed, FILETIME *lpModified) const
-{
- WIN32_FIND_DATA findFileData;
- HANDLE hFind =FindFirstFile(m_strPath.c_str(),&findFileData);
- if(hFind == INVALID_HANDLE_VALUE)
- // Oops, no such file system object
- return FALSE;
- FindClose(hFind);
-
- FILETIME ftLastWriteTimeLocal;
- FileTimeToLocalFileTime(&findFileData.ftLastWriteTime,&ftLastWriteTimeLocal);
-
- if(lpCreated)
- {
- FILETIME ftCreationTimeLocal;
- FileTimeToLocalFileTime(&findFileData.ftCreationTime,&ftCreationTimeLocal);
-
- *lpCreated =ftCreationTimeLocal;
- if(!ftCreationTimeLocal.dwLowDateTime &&
- !ftCreationTimeLocal.dwHighDateTime)
- // Adjust time
- *lpCreated =ftLastWriteTimeLocal;
- }
-
- if(lpAccessed)
- {
- FILETIME ftLastAccessTimeLocal;
- FileTimeToLocalFileTime(&findFileData.ftLastAccessTime,&ftLastAccessTimeLocal);
-
- *lpAccessed =ftLastAccessTimeLocal;
- if(!ftLastAccessTimeLocal.dwLowDateTime &&
- !ftLastAccessTimeLocal.dwHighDateTime)
- // Adjust time
- *lpAccessed =ftLastWriteTimeLocal;
- }
-
- if(lpModified)
- *lpModified =ftLastWriteTimeLocal;
-
- return TRUE;
-}
-
-//---------------------------------------------------------------------------
-// Post : Return creation time
-// Task : Get the time this file/folder was created
-//---------------------------------------------------------------------------
-FILETIME CPath::GetTimeCreated() const
-{
- FILETIME file_time;
- ZeroMemory(&file_time,sizeof(file_time));
-
- GetTime(&file_time,NULL,NULL);
-
- return file_time;
-}
-
-//---------------------------------------------------------------------------
-// Post : Return last access time
-// Task : Get the time this file/folder was last accessed
-//---------------------------------------------------------------------------
-FILETIME CPath::GetTimeLastAccessed() const
-{
- FILETIME file_time;
- ZeroMemory(&file_time,sizeof(file_time));
-
- GetTime(NULL,&file_time,NULL);
-
- return file_time;
-}
-
-//---------------------------------------------------------------------------
-// Post : Return last modification time
-// Task : Get the time this file/folder was last changed
-//---------------------------------------------------------------------------
-FILETIME CPath::GetTimeLastModified() const
-{
- FILETIME file_time;
- ZeroMemory(&file_time,sizeof(file_time));
-
- GetTime(NULL,NULL,&file_time);
-
- return file_time;
-}
-
-//---------------------------------------------------------------------------
-// Pre : All time parameters are supposed 2 be local times
-// Post : Return TRUE on success
-// Task : Set the creation, last acces and/or last modification time
-//---------------------------------------------------------------------------
-BOOL CPath::SetTime(const FILETIME *lpCreated, const FILETIME *lpAccessed, const FILETIME *lpModified)
-{
- if(!lpCreated && !lpAccessed && !lpModified)
- // No time params specified
- return FALSE;
-
- WIN32_FIND_DATA findFileData;
- HANDLE hFind =FindFirstFile(m_strPath.c_str(),&findFileData);
- if(hFind == INVALID_HANDLE_VALUE)
- // Oops, no such file system object
- return FALSE;
- FindClose(hFind);
-
- if(lpCreated)
- LocalFileTimeToFileTime(lpCreated,&findFileData.ftCreationTime);
- if(lpAccessed)
- LocalFileTimeToFileTime(lpAccessed,&findFileData.ftLastAccessTime);
- if(lpModified)
- LocalFileTimeToFileTime(lpModified,&findFileData.ftLastWriteTime);
-
- HANDLE hFile =CreateFile(m_strPath.c_str(),GENERIC_WRITE,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
- if(hFile != INVALID_HANDLE_VALUE)
- {
- SetFileTime(hFile,lpCreated ? &findFileData.ftCreationTime : NULL,
- lpAccessed ? &findFileData.ftLastAccessTime : NULL,
- lpModified ? &findFileData.ftLastWriteTime : NULL);
- CloseHandle(hFile);
- return TRUE;
- }
-
- return FALSE;
-}
-
-//---------------------------------------------------------------------------
-// Pre : lpCreated is supposed 2 be local time
-// Post : Return TRUE on success
-// Task : Set the file's creation time
-//---------------------------------------------------------------------------
-BOOL CPath::SetTimeCreated(const FILETIME *lpCreated)
-{
- return SetTime(lpCreated,NULL,NULL);
-}
-
-//---------------------------------------------------------------------------
-// Pre : lpModified is supposed 2 be local time
-// Post : Return TRUE on success
-// Task : Set the file's creation time
-//---------------------------------------------------------------------------
-BOOL CPath::SetTimeLastModified(const FILETIME *lpModified)
-{
- return SetTime(NULL,NULL,lpModified);
-}
-
-//---------------------------------------------------------------------------
-// Pre : lpAccessed is supposed 2 be local time
-// Post : Return TRUE on success
-// Task : Set the file's creation time
-//---------------------------------------------------------------------------
-BOOL CPath::SetTimeLastAccessed(const FILETIME *lpAccessed)
-{
- return SetTime(NULL,lpAccessed,NULL);
-}
-
//-------------------------------------------------------------
// Post : Return TRUE on success
// Task : Delete file
@@ -2167,15 +765,6 @@ BOOL CPath::Delete(BOOL bEvenIfReadOnly) const
return DeleteFile(m_strPath.c_str());
}
-//-------------------------------------------------------------
-// Post : Return TRUE on success
-// Task : Rename file
-//-------------------------------------------------------------
-BOOL CPath::Rename(LPCTSTR lpszNewPath)
-{
- return MoveTo(lpszNewPath,FALSE);
-}
-
//-------------------------------------------------------------
// Post : Return TRUE on success, FALSE if there is such a target file
// and we weren't granted permission 2 overwrite file or some error
@@ -2369,80 +958,6 @@ BOOL CPath::ChangeDirectory()
return SetCurrentDirectory(DriveDirectory.c_str());
}
-//-------------------------------------------------------------
-// Post : Return TRUE if deleted OK
-// Task : Delete everything in the directory
-//-------------------------------------------------------------
-BOOL CPath::RemoveDirectoryContent()
-{
- // Deleting the directory's content
- // Iterate the content of the directory and delete it
- stdstr filename;
- CPath iterator(*this);
- BOOL deleted_OK =TRUE;
-
- // Deleting all contained files
- iterator.SetNameExtension(WILD_NAME_EXTENSION);
- BOOL iterating =iterator.FindFirst(_A_NORMAL | _A_ARCH | _A_HIDDEN | _A_SYSTEM | _A_RDONLY);
- while(iterating)
- {
- // Found something
- deleted_OK =iterator.Delete(TRUE);
-
- if(!deleted_OK)
- break;
-
- iterator.SetNameExtension(WILD_NAME_EXTENSION);
- iterating =iterator.FindFirst(_A_NORMAL | _A_ARCH | _A_HIDDEN | _A_SYSTEM | _A_RDONLY);
- }
-
- if(!deleted_OK)
- return FALSE;
-
- // Deleting all contained directories
- iterator.SetNameExtension(WILD_NAME_EXTENSION);
- iterating =iterator.FindFirst(_A_HIDDEN | _A_SUBDIR);
- while(iterating)
- {
- // Found something
- deleted_OK =iterator.RemoveDirectory(TRUE);
-
- if(!deleted_OK)
- break;
-
- iterator.SetNameExtension(WILD_NAME_EXTENSION);
- iterator.UpDirectory();
- iterating =iterator.FindFirst(_A_HIDDEN | _A_SUBDIR);
- }
-
- return deleted_OK;
-}
-
-//-------------------------------------------------------------
-// Post : Return TRUE if deleted OK
-// Task : Remove the directory
-//-------------------------------------------------------------
-BOOL CPath::RemoveDirectory(BOOL bEvenIfNotEmpty)
-{
- if(bEvenIfNotEmpty)
- {
- // Delete the directory's content
- if(!RemoveDirectoryContent())
- return FALSE;
- }
-
- // Make sure there is no enumeration in progress,
- // otherwise we we'll get an error (sharing violation) because
- // that search keeps an open handle for this directory
- Exit();
-
- // Deleting this directory (and only if it's empty)
- stdstr DriveDirectory;
- GetDriveDirectory(DriveDirectory);
-
- return ::RemoveDirectory(DriveDirectory.c_str());
-}
-
//-------------------------------------------------------------
// Pre : If bCreateIntermediates is TRUE, create all eventually
// missing parent directories too
@@ -2595,24 +1110,4 @@ void CPath::EnsureLeadingBackslash(stdstr& Directory) const
stdstr temp =Directory;
Directory.Format(_T("%c%s"),DIRECTORY_DELIMITER,temp.c_str());
}
-}
-
-//------------------------------------------------------------------------
-// Task : Return path with swapped polarity on all backslashes
-//------------------------------------------------------------------------
-void CPath::GetAsInternetPath(stdstr& Directory) const
-{
- Directory = m_strPath;
- if(!Directory.empty())
- {
- stdstr temp = Directory;
- for (int idx = 0; idx < (int)temp.size(); idx++)
- {
- if (temp[idx]==_T('\\'))
- temp[idx] = _T('/');
- }
- Directory = temp;
- }
- else
- Directory = _T("/");
-}
+}
\ No newline at end of file
diff --git a/Source/Common/path.h b/Source/Common/path.h
index f3193d72d..de1f8919c 100644
--- a/Source/Common/path.h
+++ b/Source/Common/path.h
@@ -35,41 +35,8 @@ class CPath
public:
enum DIR_CURRENT_DIRECTORY { CURRENT_DIRECTORY = 1 };
- enum DIR_WINDOWS_DIRECTORY { WINDOWS_DIRECTORY = 2 };
- enum DIR_SYSTEM_DIRECTORY { SYSTEM_DIRECTORY = 3 };
- enum DIR_SYSTEM32_DIRECTORY { SYSTEM32_DIRECTORY = 4 };
- enum DIR_SYSTEM_DRIVER_DIRECTORY { SYSTEM_DRIVER_DIRECTORY = 5 };
- enum DIR_SYSTEM_DRIVE_ROOT_DIRECTORY { SYSTEM_DRIVE_ROOT_DIRECTORY = 6 };
- enum DIR_MODULE_DIRECTORY { MODULE_DIRECTORY = 7 };
- enum DIR_MODULE_FILE { MODULE_FILE = 8 };
-
- enum SpecialDirectoryType
- {
- TEMP_DIRECTORY,
- PROGRAM_FILES_DIRECTORY,
- COMMON_FILES_DIRECTORY,
- ACCESSORIES_DIRECTORY,
- MEDIA_DIRECTORY,
- DEVICE_DIRECTORY,
- USER_DESKTOP_DIRECTORY,
- USER_FAVORITES_DIRECTORY,
- USER_FONTS_DIRECTORY,
- USER_NETHOOD_DIRECTORY,
- USER_DOCUMENTS_DIRECTORY,
- USER_RECENT_DIRECTORY,
- USER_SENDTO_DIRECTORY,
- USER_TEMPLATES_DIRECTORY,
- USER_RECYCLE_DIRECTORY,
- USER_APPLICATION_DATA_DIRECTORY,
- USER_STARTMENU_DIRECTORY,
- USER_STARTMENU_STARTUP_DIRECTORY,
- USER_STARTMENU_PROGRAMS_DIRECTORY,
- COMMON_DESKTOP_DIRECTORY,
- COMMON_STARTMENU_DIRECTORY,
- COMMON_STARTMENU_STARTUP_DIRECTORY,
- COMMON_STARTMENU_PROGRAMS_DIRECTORY,
- LAST_SPECIAL
- };
+ enum DIR_MODULE_DIRECTORY { MODULE_DIRECTORY = 2 };
+ enum DIR_MODULE_FILE { MODULE_FILE = 3 };
enum { _A_ALLFILES = 0xFFFF }; /* Search Include all files */
@@ -93,16 +60,8 @@ public:
CPath(const stdstr& strPath);
CPath(const stdstr& strPath, LPCTSTR NameExten);
CPath(const stdstr& strPath, const stdstr& NameExten);
- CPath(SpecialDirectoryType sdt);
- CPath(SpecialDirectoryType sdt, LPCTSTR NameExten );
- CPath(SpecialDirectoryType sdt, const stdstr& NameExten );
-
+
CPath(DIR_CURRENT_DIRECTORY sdt, LPCTSTR NameExten = NULL);
- CPath(DIR_WINDOWS_DIRECTORY sdt, LPCTSTR NameExten = NULL);
- CPath(DIR_SYSTEM_DIRECTORY sdt, LPCTSTR NameExten = NULL );
- CPath(DIR_SYSTEM32_DIRECTORY sdt, LPCTSTR NameExten = NULL);
- CPath(DIR_SYSTEM_DRIVER_DIRECTORY sdt, LPCTSTR NameExten = NULL);
- CPath(DIR_SYSTEM_DRIVE_ROOT_DIRECTORY sdt, LPCTSTR NameExten = NULL);
CPath(DIR_MODULE_DIRECTORY sdt, LPCTSTR NameExten = NULL);
CPath(DIR_MODULE_FILE sdt);
@@ -122,8 +81,6 @@ public:
operator stdstr&() { return m_strPath; }
//Get path components
- void GetDrive(stdstr& rDrive) const;
- stdstr GetDrive(void) const;
void GetDriveDirectory(stdstr& rDriveDirectory) const;
stdstr GetDriveDirectory(void) const;
void GetDirectory(stdstr& rDirectory) const;
@@ -137,18 +94,14 @@ public:
void GetCurrentDirectory(stdstr& rDrive) const;
stdstr GetCurrentDirectory(void) const;
void GetFullyQualified(stdstr& rFullyQualified) const;
- void GetFullyQualifiedShort(stdstr& rFullyQualifiedShort) const;
void GetComponents(stdstr* pDrive =NULL,
stdstr* pDirectory =NULL,
stdstr* pName =NULL,
stdstr* pExtension =NULL) const;
- void GetAsInternetPath(stdstr& Directory) const;
//Get other state
BOOL IsEmpty() const { return m_strPath.empty(); }
BOOL IsRelative() const;
- BOOL IsWild() const;
- BOOL IsValid() const; // Checks lexical correctness only
//Set path components
void SetDrive(TCHAR chDrive);
@@ -168,94 +121,28 @@ public:
//Set whole path
void Empty() { m_strPath.erase(); }
- void SpecialDirectory(SpecialDirectoryType sdt);
- void MakeRoot();
void CurrentDirectory();
- void WindowsDirectory();
- void SystemDirectory();
- void SystemDriveRootDirectory();
- void TempDirectory();
void Module();
void Module(HINSTANCE hInstance);
void ModuleDirectory();
void ModuleDirectory(HINSTANCE hInstance);
- void ProgramFilesDirectory(); // C:\Program Files
- void CommonFilesDirectory(); // C:\Program Files\Common Files
- void AccessoriesDirectory(); // C:\Program Files\Accessories
- void MediaDirectory(); // C:\Windows\Media
- void DeviceDirectory(); // C:\Windows\Inf
- void UserDesktopDirectory();
- void UserFavoritesDirectory();
- void UserFontsDirectory();
- void UserNetworkNeighbourhoodDirectory();
- void UserDocumentsDirectory();
- void UserRecentDirectory();
- void UserSendToDirectory();
- void UserTemplatesDirectory();
- void UserRecycleBinDirectory();
- void UserApplicationDataDirectory();
- void UserStartMenuDirectory();
- void UserStartMenuStartupDirectory();
- void UserStartMenuProgramsDirectory();
- void CommonDesktopDirectory();
- void CommonStartMenuDirectory();
- void CommonStartMenuStartupDirectory();
- void CommonStartMenuProgramsDirectory();
- void WindowsProfile(); // Win.INI
- void SystemProfile(); // System.INI
-
- BOOL CreateTempName(LPCTSTR lpcszPrefix);
- BOOL CreateTempDir(LPCTSTR lpcszPrefix, UINT nRetries =100);
- BOOL CreateRandomName(BOOL bMustNotExist =TRUE, UINT nRetries =1000);
- BOOL CreateSimilarName(BOOL bMustNotExist =TRUE, UINT nRetries =1000);
-
- //Drive Information
- UINT GetDriveType() const;
- BOOL IsRemovableDrive() const { return GetDriveType()==DRIVE_REMOVABLE; }
- BOOL IsCDRomDrive() const { return GetDriveType()==DRIVE_CDROM; }
- BOOL IsNetworkDrive() const { return GetDriveType()==DRIVE_REMOTE; }
- BOOL IsRAMDrive() const { return GetDriveType()==DRIVE_RAMDISK; }
- BOOL IsFixedDrive() const { return GetDriveType()==DRIVE_FIXED; }
-
- ULONG DriveTotalSpaceBytes() const;
- ULONG DriveFreeSpaceBytes() const;
- ULONG GetDriveClusterSize() const;
- BOOL GetDiskInfo(LPDWORD lpSectorsPerCluster,
- LPDWORD lpBytesPerSector,
- LPDWORD lpFreeClusters,
- LPDWORD lpClusters) const;
//Directory information
BOOL IsDirectory() const;
BOOL DirectoryExists() const;
- BOOL IsDirectoryEmpty() const;
//File Information
BOOL IsFile() const { return !IsDirectory(); }
BOOL Exists() const;
- ULONG GetSize() const;
- ULONG GetAttributes() const;
- BOOL GetTime(FILETIME *lpCreated, FILETIME *lpAccessed, FILETIME *lpModified) const;
- FILETIME GetTimeCreated() const;
- FILETIME GetTimeLastModified() const;
- FILETIME GetTimeLastAccessed() const;
//Directory operations
BOOL CreateDirectory(BOOL bCreateIntermediates =TRUE);
- BOOL RemoveDirectory(BOOL bEvenIfNotEmpty =FALSE);
- BOOL RemoveDirectoryContent();
BOOL ChangeDirectory();
//File operations
BOOL Delete(BOOL bEvenIfReadOnly =TRUE) const;
- BOOL Rename(LPCTSTR lpszNewPath);
BOOL CopyTo(LPCTSTR lpcszTargetFile, BOOL bOverwrite =TRUE);
BOOL MoveTo(LPCTSTR lpcszTargetFile, BOOL bOverwrite =TRUE);
- BOOL SetAttributes(ULONG dwAttributes);
- BOOL SetTime(const FILETIME *lpCreated, const FILETIME *lpAccessed, const FILETIME *lpModified);
- BOOL SetTimeCreated(const FILETIME *lpCreated);
- BOOL SetTimeLastModified(const FILETIME *lpModified);
- BOOL SetTimeLastAccessed(const FILETIME *lpAccessed);
//Finders
BOOL FindFirst(ULONG dwAttributes =_A_NORMAL);
@@ -267,10 +154,6 @@ public:
private:
BOOL AttributesMatch(ULONG dwTargetAttributes, ULONG dwFileAttributes);
- BOOL ShellDirectory(int nShellFolderID);
- BOOL ShellDirectory2(int nShellFolderID);
- BOOL GetRegistryPath(HKEY hRootKey, LPCTSTR lpcszKeyName, LPCTSTR lpcszValueName, stdstr &strPath);
-
void cleanPathString(stdstr& rDirectory) const;
void StripLeadingChar(stdstr& rText, TCHAR chLeading) const;
diff --git a/Source/Common/stdafx.h b/Source/Common/stdafx.h
index 716ca12ba..c23edb6dc 100644
--- a/Source/Common/stdafx.h
+++ b/Source/Common/stdafx.h
@@ -10,7 +10,6 @@
#include "CriticalSection.h"
#include "File Class.h"
#include "Ini File Class.h"
-#include "osversion.h"
#include "registry.h"
#include "path.h"
#include "Log Class.h"