2024-12-21 10:04:04 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////
|
|
|
|
|
|
// INCLUDE
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
#include "STDAFX.H"
|
|
|
|
|
|
#include "FILESET.H"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////
|
|
|
|
|
|
// IMPLEMENTATION
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
#pragma warning (disable:4238)
|
|
|
|
|
|
CFileSet::FILEBOMTYPEDAT CFileSet::m_stBomTypeDat[EV_BT_NONE] = {
|
|
|
|
|
|
CFileSet::FILEBOMTYPEDAT(EV_BT_UTF8, &CVarArgA<UCHAR_MAX>("%c%c%c", 0xEF,0xBB,0xBF), 3),
|
|
|
|
|
|
CFileSet::FILEBOMTYPEDAT(EV_BT_UTF16_LE, &CVarArgA<UCHAR_MAX>("%c%c", 0xFF,0xFE), 2),
|
|
|
|
|
|
CFileSet::FILEBOMTYPEDAT(EV_BT_UTF16_BE, &CVarArgA<UCHAR_MAX>("%c%c", 0xFE,0xFF), 2),
|
|
|
|
|
|
// CFileSet::FILEBOMTYPEDAT(EV_BT_UTF32_LE, &CVarArgA<UCHAR_MAX>("%c%c%c%c", 0xFF,0xFE,0x00,0x00), 4),
|
|
|
|
|
|
// CFileSet::FILEBOMTYPEDAT(EV_BT_UTF32_BE, &CVarArgA<UCHAR_MAX>("%c%c%c%c", 0x00,0x00,0xFE,0xFF), 4),
|
|
|
|
|
|
};
|
|
|
|
|
|
#pragma warning (default:4238)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// TYPE : FUNCTION
|
|
|
|
|
|
// NAME : CFileSet::CFileSet
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// DESC : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PARM : N/A
|
|
|
|
|
|
// RETV : N/A
|
|
|
|
|
|
// PRGM : B4nFter
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
CFileSet::CFileSet()
|
|
|
|
|
|
{
|
|
|
|
|
|
Reset();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// TYPE : FUNCTION
|
|
|
|
|
|
// NAME : CFileSet::~CFileSet
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// DESC : <20>Ҹ<EFBFBD><D2B8><EFBFBD>
|
|
|
|
|
|
// PARM : N/A
|
|
|
|
|
|
// RETV : N/A
|
|
|
|
|
|
// PRGM : B4nFter
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
CFileSet::~CFileSet()
|
|
|
|
|
|
{
|
|
|
|
|
|
Close();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// TYPE : FUNCTION
|
|
|
|
|
|
// NAME : CFileSet::Reset
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// DESC : <20><><EFBFBD>ϰ<EFBFBD><CFB0><EFBFBD> <20>ڿ<EFBFBD> <20>ʱ<EFBFBD>ȭ
|
|
|
|
|
|
// PARM : N/A
|
|
|
|
|
|
// RETV : N/A
|
|
|
|
|
|
// PRGM : B4nFter
|
|
|
|
|
|
// P.S.>
|
|
|
|
|
|
// - <20>ڵ<EFBFBD><DAB5><EFBFBD> <20>ݴ°<DDB4><C2B0><EFBFBD> <20>ƴϹǷ<CFB9> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
VOID CFileSet::Reset()
|
|
|
|
|
|
{
|
|
|
|
|
|
m_hFile = INVALID_HANDLE_VALUE;
|
|
|
|
|
|
::memset(m_szFileFullPath, 0, sizeof(m_szFileFullPath));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// TYPE : FUNCTION
|
|
|
|
|
|
// NAME : CFileSet::Open
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// DESC : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ڿ<EFBFBD><DABF><EFBFBD> <20>Ҵ<EFBFBD>
|
|
|
|
|
|
// PARM : 1 . lpszFileName - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20≯<EFBFBD><CCB8><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// 2 . bIsReadOnly - <20>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// 3 . bIsAppend - <20><><EFBFBD>Ͽ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>߰<EFBFBD><DFB0>ϴ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> (bIsReadOnly == FALSE <20><> <20><><EFBFBD><EFBFBD> <20><>ȿ)
|
|
|
|
|
|
// 4 . bIsReadShare - <20>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// RETV : NOERROR - <20><><EFBFBD><EFBFBD> / <20><EFBFBD> - <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PRGM : B4nFter
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
DWORD CFileSet::Open(LPCTSTR lpszFileName, BOOL bIsReadOnly, BOOL bIsAppend, BOOL bIsReadShare)
|
|
|
|
|
|
{
|
|
|
|
|
|
BASE_ASSERT(FALSE == IsOpen(), "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(NULL != lpszFileName, "Invalid!");
|
|
|
|
|
|
|
|
|
|
|
|
DWORD dwDesiredAccess;
|
|
|
|
|
|
DWORD dwShareMode;
|
|
|
|
|
|
DWORD dwCreationDisposition;
|
|
|
|
|
|
DWORD dwFlagsAndAttributes;
|
|
|
|
|
|
|
|
|
|
|
|
if (bIsReadOnly) {
|
|
|
|
|
|
dwDesiredAccess = GENERIC_READ;
|
|
|
|
|
|
dwShareMode = FILE_SHARE_READ;
|
|
|
|
|
|
dwCreationDisposition = OPEN_EXISTING;
|
|
|
|
|
|
dwFlagsAndAttributes = FILE_FLAG_SEQUENTIAL_SCAN | FILE_ATTRIBUTE_READONLY;
|
|
|
|
|
|
if (!bIsReadShare) {
|
|
|
|
|
|
dwShareMode |= FILE_SHARE_WRITE;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else {
|
|
|
|
|
|
dwDesiredAccess = GENERIC_READ | GENERIC_WRITE;
|
|
|
|
|
|
dwShareMode = FILE_SHARE_READ;
|
|
|
|
|
|
dwFlagsAndAttributes = FILE_ATTRIBUTE_NORMAL;
|
|
|
|
|
|
if (bIsAppend) {
|
|
|
|
|
|
dwCreationDisposition = OPEN_ALWAYS;
|
|
|
|
|
|
}
|
|
|
|
|
|
else {
|
|
|
|
|
|
dwCreationDisposition = CREATE_NEW;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DWORD dwRetVal = Open(lpszFileName, dwDesiredAccess, dwShareMode, dwCreationDisposition, dwFlagsAndAttributes, NULL, NULL);
|
|
|
|
|
|
if (NOERROR != dwRetVal) {
|
|
|
|
|
|
return dwRetVal;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!bIsReadOnly) {
|
|
|
|
|
|
if (bIsAppend) {
|
|
|
|
|
|
dwRetVal = Seek(FILE_END, 0, 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
else {
|
|
|
|
|
|
if (FALSE == ::SetEndOfFile(m_hFile)) {
|
|
|
|
|
|
dwRetVal = ::GetLastError();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return dwRetVal;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// TYPE : FUNCTION
|
|
|
|
|
|
// NAME : CFileSet::Open
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// DESC : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ڿ<EFBFBD><DABF><EFBFBD> <20>Ҵ<EFBFBD>
|
|
|
|
|
|
// PARM : 1 . lpszFileName - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20≯<EFBFBD><CCB8><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// 2 . dwDesiredAccess - <20><><EFBFBD>ٸ<EFBFBD><D9B8><EFBFBD>
|
|
|
|
|
|
// 3 . dwShareMode - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
// 4 . dwCreationDisposition - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȹ
|
|
|
|
|
|
// 5 . dwFlagsAndAttributes - <20>÷<EFBFBD><C3B7><EFBFBD>, <20>Ӽ<EFBFBD> (<28>ټ<EFBFBD><D9BC><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>)
|
|
|
|
|
|
// 6 . lpSecurityAttributes - <20><><EFBFBD>ȼӼ<C8BC>
|
|
|
|
|
|
// 7 . hTemplateFile - <20><><EFBFBD>ø<EFBFBD> <20><><EFBFBD><EFBFBD> <20>ڵ<EFBFBD>
|
|
|
|
|
|
// RETV : NOERROR - <20><><EFBFBD><EFBFBD> / <20><EFBFBD> - <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PRGM : B4nFter
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
DWORD CFileSet::Open(
|
|
|
|
|
|
LPCTSTR lpszFileName,
|
|
|
|
|
|
DWORD dwDesiredAccess,
|
|
|
|
|
|
DWORD dwShareMode,
|
|
|
|
|
|
DWORD dwCreationDisposition,
|
|
|
|
|
|
DWORD dwFlagsAndAttributes,
|
|
|
|
|
|
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
|
|
|
|
|
|
HANDLE hTemplateFile
|
|
|
|
|
|
)
|
|
|
|
|
|
{
|
|
|
|
|
|
BASE_ASSERT(FALSE == IsOpen(), "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(NULL != lpszFileName, "Invalid!");
|
|
|
|
|
|
if (NULL == lpszFileName) {
|
|
|
|
|
|
return HASERROR;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
m_hFile = ::CreateFile(lpszFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile);
|
|
|
|
|
|
if (INVALID_HANDLE_VALUE == m_hFile) {
|
|
|
|
|
|
return(::GetLastError());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TCHAR szFileFullPath[MAX_PATH] = { _T('\0') };
|
|
|
|
|
|
STRNCPY(szFileFullPath, lpszFileName, _countof(szFileFullPath));
|
|
|
|
|
|
LPTSTR lpszFilePart;
|
|
|
|
|
|
DWORD dwRetVal = ::GetFullPathName(szFileFullPath, _countof(m_szFileFullPath), m_szFileFullPath, &lpszFilePart);
|
|
|
|
|
|
if (0 == dwRetVal) {
|
|
|
|
|
|
return(::GetLastError());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return NOERROR;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// TYPE : FUNCTION
|
|
|
|
|
|
// NAME : CFileSet::Close
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// DESC : <20><><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD> <20>ݰ<EFBFBD> <20><>ü<EFBFBD>ڿ<EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PARM : N/A
|
|
|
|
|
|
// RETV : N/A
|
|
|
|
|
|
// PRGM : B4nFter
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
VOID CFileSet::Close()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (INVALID_HANDLE_VALUE != m_hFile) {
|
|
|
|
|
|
::CloseHandle(m_hFile);
|
|
|
|
|
|
Reset();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// TYPE : FUNCTION
|
|
|
|
|
|
// NAME : CFileSet::Flush
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// DESC : <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> ó<><C3B3><EFBFBD>ϰ<EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PARM : N/A
|
|
|
|
|
|
// RETV : TRUE - <20><><EFBFBD><EFBFBD> / FALSE - <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PRGM : B4nFter
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
BOOL CFileSet::Flush()
|
|
|
|
|
|
{
|
|
|
|
|
|
BASE_ASSERT(TRUE == IsOpen(), "Invalid!");
|
|
|
|
|
|
if (FALSE == IsOpen()) {
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return(::FlushFileBuffers(m_hFile));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// TYPE : FUNCTION
|
|
|
|
|
|
// NAME : CFileSet::IsOpen
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// DESC : <20><><EFBFBD>ϰ<EFBFBD>ü<EFBFBD><C3BC> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>ȯ
|
|
|
|
|
|
// PARM : N/A
|
|
|
|
|
|
// RETV : TRUE - <20><><EFBFBD><EFBFBD> / FALSE - <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PRGM : B4nFter
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
BOOL CFileSet::IsOpen() const
|
|
|
|
|
|
{
|
|
|
|
|
|
return(INVALID_HANDLE_VALUE != m_hFile);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// TYPE : FUNCTION
|
|
|
|
|
|
// NAME : CFileSet::GetFullPath
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// DESC : <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ü<EFBFBD><C3BC><EFBFBD>θ<EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PARM : 1 . lpszBuffer - <20><><EFBFBD>ڿ<EFBFBD> <20><><EFBFBD>¹<EFBFBD><C2B9><EFBFBD>
|
|
|
|
|
|
// 2 . nBufferSize - <20><><EFBFBD>ڿ<EFBFBD> <20><><EFBFBD>¹<EFBFBD><C2B9><EFBFBD><EFBFBD><EFBFBD> ũ<><C5A9>
|
|
|
|
|
|
// RETV : TRUE - <20><><EFBFBD><EFBFBD> / FALSE - <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PRGM : B4nFter
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
BOOL CFileSet::GetFullPath(/*out*/ LPTSTR lpszBuffer, DWORD nBufferSize) const
|
|
|
|
|
|
{
|
|
|
|
|
|
BASE_ASSERT(TRUE == IsOpen(), "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(NULL != lpszBuffer, "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(0 != nBufferSize, "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(_T('\0') != m_szFileFullPath[0], "Invalid!");
|
|
|
|
|
|
if (FALSE == IsOpen() ||
|
|
|
|
|
|
NULL == lpszBuffer ||
|
|
|
|
|
|
0 == nBufferSize ||
|
|
|
|
|
|
!_tcsncmp(m_szFileFullPath, _T(""), _countof(m_szFileFullPath))
|
|
|
|
|
|
)
|
|
|
|
|
|
{
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if (_MSC_VER >= 1400) // VS.NET 2005 <20>̻<EFBFBD>
|
|
|
|
|
|
return (_tcsncpy_s(lpszBuffer, nBufferSize, m_szFileFullPath, _TRUNCATE)?(TRUE):(FALSE));
|
|
|
|
|
|
#else // #if (_MSC_VER >= 1400)
|
|
|
|
|
|
return (_tcsncpy(lpszBuffer, m_szFileFullPath, nBufferSize)?(TRUE):(FALSE));
|
|
|
|
|
|
#endif // #if (_MSC_VER >= 1400)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// TYPE : FUNCTION
|
|
|
|
|
|
// NAME : CFileSet::GetDrive
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// DESC : <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>̺긦 <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PARM : 1 . lpszBuffer - <20><><EFBFBD>ڿ<EFBFBD> <20><><EFBFBD>¹<EFBFBD><C2B9><EFBFBD>
|
|
|
|
|
|
// 2 . nBufferSize - <20><><EFBFBD>ڿ<EFBFBD> <20><><EFBFBD>¹<EFBFBD><C2B9><EFBFBD><EFBFBD><EFBFBD> ũ<><C5A9>
|
|
|
|
|
|
// RETV : TRUE - <20><><EFBFBD><EFBFBD> / FALSE - <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PRGM : B4nFter
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
BOOL CFileSet::GetDrive(/*out*/ LPTSTR lpszBuffer, DWORD nBufferSize) const
|
|
|
|
|
|
{
|
|
|
|
|
|
BASE_ASSERT(TRUE == IsOpen(), "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(NULL != lpszBuffer, "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(0 != nBufferSize, "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(_T('\0') != m_szFileFullPath[0], "Invalid!");
|
|
|
|
|
|
if (FALSE == IsOpen() ||
|
|
|
|
|
|
NULL == lpszBuffer ||
|
|
|
|
|
|
0 == nBufferSize ||
|
|
|
|
|
|
!_tcsncmp(m_szFileFullPath, _T(""), _countof(m_szFileFullPath))
|
|
|
|
|
|
)
|
|
|
|
|
|
{
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if (_MSC_VER >= 1400) // VS.NET 2005 <20>̻<EFBFBD>
|
|
|
|
|
|
return (!_tsplitpath_s(m_szFileFullPath, lpszBuffer, nBufferSize, NULL, 0, NULL, 0, NULL, 0)?(TRUE):(FALSE));
|
|
|
|
|
|
#else // #if (_MSC_VER >= 1400)
|
|
|
|
|
|
return (!_tsplitpath(m_szFileFullPath, lpszBuffer, NULL, NULL, NULL)?(TRUE):(FALSE));
|
|
|
|
|
|
#endif // #if (_MSC_VER >= 1400)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// TYPE : FUNCTION
|
|
|
|
|
|
// NAME : CFileSet::GetPath
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// DESC : <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>θ<EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PARM : 1 . lpszBuffer - <20><><EFBFBD>ڿ<EFBFBD> <20><><EFBFBD>¹<EFBFBD><C2B9><EFBFBD>
|
|
|
|
|
|
// 2 . nBufferSize - <20><><EFBFBD>ڿ<EFBFBD> <20><><EFBFBD>¹<EFBFBD><C2B9><EFBFBD><EFBFBD><EFBFBD> ũ<><C5A9>
|
|
|
|
|
|
// RETV : TRUE - <20><><EFBFBD><EFBFBD> / FALSE - <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PRGM : B4nFter
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
BOOL CFileSet::GetPath(/*out*/ LPTSTR lpszBuffer, DWORD nBufferSize) const
|
|
|
|
|
|
{
|
|
|
|
|
|
BASE_ASSERT(TRUE == IsOpen(), "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(NULL != lpszBuffer, "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(0 != nBufferSize, "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(_T('\0') != m_szFileFullPath[0], "Invalid!");
|
|
|
|
|
|
if (FALSE == IsOpen() ||
|
|
|
|
|
|
NULL == lpszBuffer ||
|
|
|
|
|
|
0 == nBufferSize ||
|
|
|
|
|
|
!_tcsncmp(m_szFileFullPath, _T(""), _countof(m_szFileFullPath))
|
|
|
|
|
|
)
|
|
|
|
|
|
{
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if (_MSC_VER >= 1400) // VS.NET 2005 <20>̻<EFBFBD>
|
|
|
|
|
|
return (!_tsplitpath_s(m_szFileFullPath, NULL, 0, lpszBuffer, nBufferSize, NULL, 0, NULL, 0)?(TRUE):(FALSE));
|
|
|
|
|
|
#else // #if (_MSC_VER >= 1400)
|
|
|
|
|
|
return (!_tsplitpath(m_szFileFullPath, NULL, lpszBuffer, NULL, NULL)?(TRUE):(FALSE));
|
|
|
|
|
|
#endif // #if (_MSC_VER >= 1400)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// TYPE : FUNCTION
|
|
|
|
|
|
// NAME : CFileSet::GetName
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// DESC : <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20≯<EFBFBD><CCB8><EFBFBD> <20><><EFBFBD><EFBFBD> (Ȯ<><C8AE><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>)
|
|
|
|
|
|
// PARM : 1 . lpszBuffer - <20><><EFBFBD>ڿ<EFBFBD> <20><><EFBFBD>¹<EFBFBD><C2B9><EFBFBD>
|
|
|
|
|
|
// 2 . nBufferSize - <20><><EFBFBD>ڿ<EFBFBD> <20><><EFBFBD>¹<EFBFBD><C2B9><EFBFBD><EFBFBD><EFBFBD> ũ<><C5A9>
|
|
|
|
|
|
// RETV : TRUE - <20><><EFBFBD><EFBFBD> / FALSE - <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PRGM : B4nFter
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
BOOL CFileSet::GetName(/*out*/ LPTSTR lpszBuffer, DWORD nBufferSize) const
|
|
|
|
|
|
{
|
|
|
|
|
|
BASE_ASSERT(TRUE == IsOpen(), "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(NULL != lpszBuffer, "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(0 != nBufferSize, "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(_T('\0') != m_szFileFullPath[0], "Invalid!");
|
|
|
|
|
|
if (FALSE == IsOpen() ||
|
|
|
|
|
|
NULL == lpszBuffer ||
|
|
|
|
|
|
0 == nBufferSize ||
|
|
|
|
|
|
!_tcsncmp(m_szFileFullPath, _T(""), _countof(m_szFileFullPath))
|
|
|
|
|
|
)
|
|
|
|
|
|
{
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if (_MSC_VER >= 1400) // VS.NET 2005 <20>̻<EFBFBD>
|
|
|
|
|
|
return (!_tsplitpath_s(m_szFileFullPath, NULL, 0, NULL, 0, lpszBuffer, nBufferSize, NULL, 0)?(TRUE):(FALSE));
|
|
|
|
|
|
#else // #if (_MSC_VER >= 1400)
|
|
|
|
|
|
return (!_tsplitpath(m_szFileFullPath, NULL, NULL, lpszBuffer, NULL)?(TRUE):(FALSE));
|
|
|
|
|
|
#endif // #if (_MSC_VER >= 1400)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// TYPE : FUNCTION
|
|
|
|
|
|
// NAME : CFileSet::GetExt
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// DESC : <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ȯ<><C8AE><EFBFBD>ڸ<EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PARM : 1 . lpszBuffer - <20><><EFBFBD>ڿ<EFBFBD> <20><><EFBFBD>¹<EFBFBD><C2B9><EFBFBD>
|
|
|
|
|
|
// 2 . nBufferSize - <20><><EFBFBD>ڿ<EFBFBD> <20><><EFBFBD>¹<EFBFBD><C2B9><EFBFBD><EFBFBD><EFBFBD> ũ<><C5A9>
|
|
|
|
|
|
// RETV : TRUE - <20><><EFBFBD><EFBFBD> / FALSE - <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PRGM : B4nFter
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
BOOL CFileSet::GetExt(/*out*/ LPTSTR lpszBuffer, DWORD nBufferSize) const
|
|
|
|
|
|
{
|
|
|
|
|
|
BASE_ASSERT(TRUE == IsOpen(), "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(NULL != lpszBuffer, "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(0 != nBufferSize, "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(_T('\0') != m_szFileFullPath[0], "Invalid!");
|
|
|
|
|
|
if (FALSE == IsOpen() ||
|
|
|
|
|
|
NULL == lpszBuffer ||
|
|
|
|
|
|
0 == nBufferSize ||
|
|
|
|
|
|
!_tcsncmp(m_szFileFullPath, _T(""), _countof(m_szFileFullPath))
|
|
|
|
|
|
)
|
|
|
|
|
|
{
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if (_MSC_VER >= 1400) // VS.NET 2005 <20>̻<EFBFBD>
|
|
|
|
|
|
return (!_tsplitpath_s(m_szFileFullPath, NULL, 0, NULL, 0, NULL, 0, lpszBuffer, nBufferSize)?(TRUE):(FALSE));
|
|
|
|
|
|
#else // #if (_MSC_VER >= 1400)
|
|
|
|
|
|
return (!_tsplitpath(m_szFileFullPath, NULL, NULL, NULL, lpszBuffer)?(TRUE):(FALSE));
|
|
|
|
|
|
#endif // #if (_MSC_VER >= 1400)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// TYPE : FUNCTION
|
|
|
|
|
|
// NAME : CFileSet::GetTitle
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// DESC : <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20≯<EFBFBD> + Ȯ<><C8AE><EFBFBD>ڸ<EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PARM : 1 . lpszBuffer - <20><><EFBFBD>ڿ<EFBFBD> <20><><EFBFBD>¹<EFBFBD><C2B9><EFBFBD>
|
|
|
|
|
|
// 2 . nBufferSize - <20><><EFBFBD>ڿ<EFBFBD> <20><><EFBFBD>¹<EFBFBD><C2B9><EFBFBD><EFBFBD><EFBFBD> ũ<><C5A9>
|
|
|
|
|
|
// RETV : TRUE - <20><><EFBFBD><EFBFBD> / FALSE - <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PRGM : B4nFter
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
BOOL CFileSet::GetTitle(/*out*/ LPTSTR lpszBuffer, DWORD nBufferSize) const
|
|
|
|
|
|
{
|
|
|
|
|
|
BASE_ASSERT(TRUE == IsOpen(), "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(NULL != lpszBuffer, "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(0 != nBufferSize, "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(_T('\0') != m_szFileFullPath[0], "Invalid!");
|
|
|
|
|
|
if (FALSE == IsOpen() ||
|
|
|
|
|
|
NULL == lpszBuffer ||
|
|
|
|
|
|
0 == nBufferSize ||
|
|
|
|
|
|
!_tcsncmp(m_szFileFullPath, _T(""), _countof(m_szFileFullPath))
|
|
|
|
|
|
)
|
|
|
|
|
|
{
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TCHAR szFileName[MAX_PATH] = { _T('\0'), };
|
|
|
|
|
|
TCHAR szExtName[MAX_PATH] = { _T('\0'), };
|
|
|
|
|
|
#if (_MSC_VER >= 1400) // VS.NET 2005 <20>̻<EFBFBD>
|
|
|
|
|
|
INT iRetVal = _tsplitpath_s(m_szFileFullPath, NULL, 0, NULL, 0, szFileName, _countof(szFileName), szExtName, _countof(szExtName));
|
|
|
|
|
|
#else // #if (_MSC_VER >= 1400)
|
|
|
|
|
|
INT iRetVal = _tsplitpath(m_szFileFullPath, NULL, NULL, szFileName, szExtName);
|
|
|
|
|
|
#endif // #if (_MSC_VER >= 1400)
|
|
|
|
|
|
if (iRetVal) {
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if (_MSC_VER >= 1400) // VS.NET 2005 <20>̻<EFBFBD>
|
|
|
|
|
|
iRetVal = _stprintf_s(lpszBuffer, nBufferSize, _T("%s%s"), szFileName, szExtName);
|
|
|
|
|
|
#else // #if (_MSC_VER >= 1400)
|
|
|
|
|
|
iRetVal = _sntprintf(lpszBuffer, nBufferSize, _T("%s%s"), szFileName, szExtName);
|
|
|
|
|
|
#endif // #if (_MSC_VER >= 1400)
|
|
|
|
|
|
if (iRetVal < 0) {
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// TYPE : FUNCTION
|
|
|
|
|
|
// NAME : CFileSet::Seek
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// DESC : <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ư<><C6AF> <20><>ġ<EFBFBD><C4A1> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ġ<EFBFBD><C4A1>Ŵ
|
|
|
|
|
|
// PARM : 1 . dwMoveMethod - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>̵<EFBFBD><CCB5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
/*
|
|
|
|
|
|
FILE_BEGIN : <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ư<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ġ<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ó<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ã<EFBFBD><EFBFBD>
|
|
|
|
|
|
FILE_CURRENT : <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ư<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ġ<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ġ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> ã<EFBFBD><EFBFBD>
|
|
|
|
|
|
FILE_END : <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ư<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ġ<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ã<EFBFBD><EFBFBD>
|
|
|
|
|
|
*/
|
|
|
|
|
|
// 2 . lOffsetLow - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>̵<EFBFBD><CCB5><EFBFBD>ų <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ġ (<28><><EFBFBD><EFBFBD> LONG)
|
|
|
|
|
|
// 3 . lOffsetHigh - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>̵<EFBFBD><CCB5><EFBFBD>ų <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ġ (<28><><EFBFBD><EFBFBD> LONG)
|
|
|
|
|
|
// 4 . lpu64Offset - <20>̵<EFBFBD><CCB5><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ġ<EFBFBD><C4A1>
|
|
|
|
|
|
// RETV : NOERROR - <20><><EFBFBD><EFBFBD> / <20><EFBFBD> - <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PRGM : B4nFter
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
DWORD CFileSet::Seek(DWORD dwMoveMethod, LONG lOffsetLow, LONG lOffsetHigh, ULONGLONG* lpu64Offset)
|
|
|
|
|
|
{
|
|
|
|
|
|
BASE_ASSERT(TRUE == IsOpen(), "Invalid!");
|
|
|
|
|
|
if (FALSE == IsOpen()) {
|
|
|
|
|
|
return HASERROR;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
LPLONG lpOffsetHigh = NULL;
|
|
|
|
|
|
if (lOffsetHigh > 0) {
|
|
|
|
|
|
lpOffsetHigh = &lOffsetHigh;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DWORD dwOffsetLow = ::SetFilePointer(m_hFile, lOffsetLow, lpOffsetHigh, dwMoveMethod);
|
|
|
|
|
|
if (INVALID_SET_FILE_POINTER == dwOffsetLow) {
|
|
|
|
|
|
DWORD dwErrNo = ::GetLastError();
|
|
|
|
|
|
if (NO_ERROR != dwErrNo) {
|
|
|
|
|
|
return dwErrNo;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (lpu64Offset) {
|
|
|
|
|
|
if (lpOffsetHigh) {
|
|
|
|
|
|
*lpu64Offset = MAKELONGLONG(dwOffsetLow, *lpOffsetHigh);
|
|
|
|
|
|
}
|
|
|
|
|
|
else {
|
|
|
|
|
|
*lpu64Offset = MAKELONGLONG(dwOffsetLow, 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return NOERROR;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// TYPE : FUNCTION
|
|
|
|
|
|
// NAME : CFileSet::SetLength
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// DESC : <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ũ<>⸦ Ư<><C6AF> <20><>ġ<EFBFBD><C4A1>ŭ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PARM : 1 . dwFileLength - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ũ<><C5A9>
|
|
|
|
|
|
// RETV : NOERROR - <20><><EFBFBD><EFBFBD> / <20><EFBFBD> - <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PRGM : B4nFter
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
DWORD CFileSet::SetLength(ULONGLONG dwFileLength)
|
|
|
|
|
|
{
|
|
|
|
|
|
BASE_ASSERT(IsOpen(), "Invalid!");
|
|
|
|
|
|
|
|
|
|
|
|
DWORD dwRetVal = Seek(FILE_BEGIN, LOLONG(dwFileLength), HILONG(dwFileLength));
|
|
|
|
|
|
if (NOERROR != dwRetVal) {
|
|
|
|
|
|
return dwRetVal;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!::SetEndOfFile(m_hFile)) {
|
|
|
|
|
|
dwRetVal = ::GetLastError();
|
|
|
|
|
|
if (::GetLastError() != NO_ERROR) {
|
|
|
|
|
|
return dwRetVal;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return NOERROR;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// TYPE : FUNCTION
|
|
|
|
|
|
// NAME : CFileSet::GetLength
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// DESC : <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ũ<>⸦ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PARM : 1 . dwFileLength - <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ũ<><C5A9>
|
|
|
|
|
|
// RETV : NOERROR - <20><><EFBFBD><EFBFBD> / <20><EFBFBD> - <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PRGM : B4nFter
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
DWORD CFileSet::GetLength(/*out*/ ULONGLONG& dwFileLength) const
|
|
|
|
|
|
{
|
|
|
|
|
|
BASE_ASSERT(IsOpen(), "Invalid!");
|
|
|
|
|
|
|
|
|
|
|
|
ULARGE_INTEGER unFileSize;
|
|
|
|
|
|
unFileSize.LowPart = ::GetFileSize(m_hFile, &unFileSize.HighPart);
|
|
|
|
|
|
if (unFileSize.LowPart == INVALID_FILE_SIZE) {
|
|
|
|
|
|
DWORD dwRetVal = ::GetLastError();
|
|
|
|
|
|
if (NO_ERROR != dwRetVal) {
|
|
|
|
|
|
return dwRetVal;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
dwFileLength = unFileSize.QuadPart;
|
|
|
|
|
|
|
|
|
|
|
|
return NOERROR;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// TYPE : FUNCTION
|
|
|
|
|
|
// NAME : CFileSet::Read
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// DESC : <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͺ<EFBFBD><CDBA><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PARM : 1 . lpBuffer - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
// 2 . nBufferSize - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ũ<><C5A9>
|
|
|
|
|
|
// RETV : NOERROR - <20><><EFBFBD><EFBFBD> / ERROR_HANDLE_EOF - <20><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD> / <20><EFBFBD> - <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PRGM : B4nFter
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
DWORD CFileSet::Read(/*out*/ LPVOID lpBuffer, /*int,out*/ DWORD& nBufferSize)
|
|
|
|
|
|
{
|
|
|
|
|
|
BASE_ASSERT(TRUE == IsOpen(), "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(NULL != lpBuffer, "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(0 != nBufferSize, "Invalid!");
|
|
|
|
|
|
if (FALSE == IsOpen() ||
|
|
|
|
|
|
NULL == lpBuffer ||
|
|
|
|
|
|
0 == nBufferSize
|
|
|
|
|
|
)
|
|
|
|
|
|
{
|
|
|
|
|
|
return HASERROR;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DWORD dwRetVal = ::ReadFile(m_hFile, lpBuffer, nBufferSize, &nBufferSize, NULL);
|
|
|
|
|
|
if (0 == dwRetVal) {
|
|
|
|
|
|
return(::GetLastError());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return NOERROR;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// TYPE : FUNCTION
|
|
|
|
|
|
// NAME : CFileSet::Write
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// DESC : <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͺ<EFBFBD><CDBA><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PARM : 1 . lpBuffer - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
// 2 . nBufferSize - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ũ<><C5A9>
|
|
|
|
|
|
// RETV : NOERROR - <20><><EFBFBD><EFBFBD> / <20><EFBFBD> - <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PRGM : B4nFter
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
DWORD CFileSet::Write(LPCVOID lpBuffer, /*int,out*/ DWORD& nBufferSize)
|
|
|
|
|
|
{
|
|
|
|
|
|
BASE_ASSERT(TRUE == IsOpen(), "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(NULL != lpBuffer, "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(0 != nBufferSize, "Invalid!");
|
|
|
|
|
|
if (FALSE == IsOpen() ||
|
|
|
|
|
|
NULL == lpBuffer ||
|
|
|
|
|
|
0 == nBufferSize
|
|
|
|
|
|
)
|
|
|
|
|
|
{
|
|
|
|
|
|
return HASERROR;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DWORD dwRetVal = ::WriteFile(m_hFile, lpBuffer, nBufferSize, &nBufferSize, NULL);
|
|
|
|
|
|
if (0 == dwRetVal) {
|
|
|
|
|
|
return(::GetLastError());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return NOERROR;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// TYPE : FUNCTION
|
|
|
|
|
|
// NAME : CFileSet::LockRange
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// DESC : <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ư<><C6AF> <20><>ġ<EFBFBD><C4A1> <20>ٸ<EFBFBD> <20><><EFBFBD>μ<EFBFBD><CEBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD> <20><>Ÿ<EFBFBD><C5B8> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PARM : 1 . uOffset - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ġ<EFBFBD><C4A1> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ġ
|
|
|
|
|
|
// 2 . uNumberOfBytes - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ <20><>
|
|
|
|
|
|
// RETV : NOERROR - <20><><EFBFBD><EFBFBD> / <20><EFBFBD> - <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PRGM : B4nFter
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
DWORD CFileSet::LockRange(ULONGLONG uOffset, ULONGLONG uNumberOfBytes)
|
|
|
|
|
|
{
|
|
|
|
|
|
BASE_ASSERT(IsOpen(), "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(0 != uNumberOfBytes, "Invalid!");
|
|
|
|
|
|
|
|
|
|
|
|
ULARGE_INTEGER unULargeInterger;
|
|
|
|
|
|
ULARGE_INTEGER unCount;
|
|
|
|
|
|
|
|
|
|
|
|
unULargeInterger.QuadPart = uOffset;
|
|
|
|
|
|
unCount.QuadPart = uNumberOfBytes;
|
|
|
|
|
|
if (!::LockFile(m_hFile, unULargeInterger.LowPart, unULargeInterger.HighPart, unCount.LowPart, unCount.HighPart)) {
|
|
|
|
|
|
return (::GetLastError());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return NOERROR;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// TYPE : FUNCTION
|
|
|
|
|
|
// NAME : CFileSet::SkipBOM
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// DESC : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD>¸<EFBFBD> <20><>Ÿ<EFBFBD><C5B8><EFBFBD><EFBFBD> BOM (Byte Order Mark) <20><> <20><><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD> <20>ѱ<EFBFBD>
|
|
|
|
|
|
// PARM : N/A
|
|
|
|
|
|
// RETV : BOM Ÿ<><C5B8> (EV_BT_NONE <20≯<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>)
|
|
|
|
|
|
// PRGM : B4nFter
|
|
|
|
|
|
// P.S.>
|
|
|
|
|
|
// - <20>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>̵<EFBFBD><CCB5>ǰ<EFBFBD> <20><><EFBFBD>Ŀ<EFBFBD> BOM<4F><4D> ũ<>⸸ŭ <20>̵<EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD> BOM <20>ڿ<EFBFBD> <20><>ġ
|
|
|
|
|
|
// - BOM<4F><4D> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>̵<EFBFBD>
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
CFileSet::EF_BOMTYPE CFileSet::SkipBOM()
|
|
|
|
|
|
{
|
|
|
|
|
|
BASE_ASSERT(IsOpen(), "Invalid!");
|
|
|
|
|
|
|
|
|
|
|
|
if (!IsOpen()) {
|
|
|
|
|
|
return EV_BT_NONE;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BYTE btData[UCHAR_MAX];
|
|
|
|
|
|
DWORD dwSize, dwRetVal;
|
|
|
|
|
|
for (DWORD dwIndex = 0 ; dwIndex < EV_BT_NONE ; ++dwIndex) {
|
|
|
|
|
|
dwRetVal = Seek(FILE_BEGIN, 0, 0);
|
|
|
|
|
|
if (NOERROR != dwRetVal) {
|
|
|
|
|
|
BASE_CONTINUE;
|
|
|
|
|
|
}
|
|
|
|
|
|
dwSize = m_stBomTypeDat[dwIndex].m_nSize;
|
|
|
|
|
|
dwRetVal = Read(btData, dwSize);
|
|
|
|
|
|
if (NOERROR != dwRetVal) {
|
|
|
|
|
|
BASE_CONTINUE;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (dwSize != m_stBomTypeDat[dwIndex].m_nSize) {
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!::memcmp(btData, m_stBomTypeDat[dwIndex].m_btData, m_stBomTypeDat[dwIndex].m_nSize)) {
|
|
|
|
|
|
return m_stBomTypeDat[dwIndex].m_eType;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return EV_BT_NONE;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// TYPE : FUNCTION
|
|
|
|
|
|
// NAME : CFileSet::WriteBOM
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// DESC : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20>տ<EFBFBD> Ư<><C6AF> BOM (Byte Order Mark) <20><> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PARM : 1 . eBomType - <20><><EFBFBD>⸦ <20><><EFBFBD>ϴ<EFBFBD> BOM Ÿ<><C5B8>
|
|
|
|
|
|
// RETV : NOERROR - <20><><EFBFBD><EFBFBD> / <20><EFBFBD> - <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PRGM : B4nFter
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
DWORD CFileSet::WriteBOM(CFileSet::EF_BOMTYPE eBomType)
|
|
|
|
|
|
{
|
|
|
|
|
|
BASE_ASSERT(IsOpen(), "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(CHECK_LIMIT(eBomType, EV_BT_NONE), "Invalid!");
|
|
|
|
|
|
|
|
|
|
|
|
if (!IsOpen() ||
|
|
|
|
|
|
!CHECK_LIMIT(eBomType, EV_BT_NONE)
|
|
|
|
|
|
)
|
|
|
|
|
|
{
|
|
|
|
|
|
return HASERROR;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DWORD dwRetVal = Seek(FILE_BEGIN, 0, 0);
|
|
|
|
|
|
if (NOERROR != dwRetVal) {
|
|
|
|
|
|
BASE_RETURN(dwRetVal);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DWORD dwSize = m_stBomTypeDat[eBomType].m_nSize;
|
|
|
|
|
|
dwRetVal = Write(m_stBomTypeDat[eBomType].m_btData, dwSize);
|
|
|
|
|
|
if (NOERROR != dwRetVal) {
|
|
|
|
|
|
BASE_RETURN(dwRetVal);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (dwSize != m_stBomTypeDat[eBomType].m_nSize) {
|
|
|
|
|
|
BASE_RETURN(HASERROR);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return NOERROR;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// TYPE : FUNCTION
|
|
|
|
|
|
// NAME : CFileSet::UnlockRange
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// DESC : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Lock <20>Ǿ<EFBFBD><C7BE><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ư<><C6AF> <20><>ġ<EFBFBD><C4A1> <20><>Ÿ<EFBFBD><C5B8> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PARM : 1 . uOffset - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ġ<EFBFBD><C4A1> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ġ
|
|
|
|
|
|
// 2 . uNumberOfBytes - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ʈ <20><>
|
|
|
|
|
|
// RETV : NOERROR - <20><><EFBFBD><EFBFBD> / <20><EFBFBD> - <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PRGM : B4nFter
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
DWORD CFileSet::UnlockRange(ULONGLONG uOffset, ULONGLONG uNumberOfBytes)
|
|
|
|
|
|
{
|
|
|
|
|
|
BASE_ASSERT(IsOpen(), "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(0 != uNumberOfBytes, "Invalid!");
|
|
|
|
|
|
|
|
|
|
|
|
ULARGE_INTEGER unULargeInterger;
|
|
|
|
|
|
ULARGE_INTEGER unCount;
|
|
|
|
|
|
|
|
|
|
|
|
unULargeInterger.QuadPart = uOffset;
|
|
|
|
|
|
unCount.QuadPart = uNumberOfBytes;
|
|
|
|
|
|
if (!::UnlockFile(m_hFile, unULargeInterger.LowPart, unULargeInterger.HighPart, unCount.LowPart, unCount.HighPart)) {
|
|
|
|
|
|
return (::GetLastError());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return NOERROR;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// TYPE : FUNCTION
|
|
|
|
|
|
// NAME : CFileSet::GetPosition
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// DESC : <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ġ<EFBFBD><C4A1> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PARM : 1 . u64FilePositon - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ġ<EFBFBD><C4A1> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// RETV : NOERROR - <20><><EFBFBD><EFBFBD> / <20><EFBFBD> - <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PRGM : B4nFter
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
DWORD CFileSet::GetPosition(/*out*/ ULONGLONG& u64FilePositon) const
|
|
|
|
|
|
{
|
|
|
|
|
|
BASE_ASSERT(IsOpen(), "Invalid!");
|
|
|
|
|
|
|
|
|
|
|
|
LARGE_INTEGER unLargeInteger;
|
|
|
|
|
|
unLargeInteger.QuadPart = 0;
|
|
|
|
|
|
unLargeInteger.LowPart = ::SetFilePointer(m_hFile, unLargeInteger.LowPart, &unLargeInteger.HighPart , FILE_CURRENT);
|
|
|
|
|
|
if (unLargeInteger.LowPart == (DWORD)-1) {
|
|
|
|
|
|
DWORD dwErrNo = ::GetLastError();
|
|
|
|
|
|
if (NO_ERROR != dwErrNo) {
|
|
|
|
|
|
return dwErrNo;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
u64FilePositon = unLargeInteger.QuadPart;
|
|
|
|
|
|
|
|
|
|
|
|
return NOERROR;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// TYPE : FUNCTION
|
|
|
|
|
|
// NAME : CFileSet::GetTime
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// DESC : <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>Ͻð<CFBD><C3B0><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PARM : 1 . lpstCreateFileTime - <20><><EFBFBD><EFBFBD><EFBFBD>ð<EFBFBD>
|
|
|
|
|
|
// 2 . lpstAccessFileTime - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ٽð<D9BD>
|
|
|
|
|
|
// 3 . lpstWriteFileTime - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>Ͻð<CFBD>
|
|
|
|
|
|
// RETV : NOERROR - <20><><EFBFBD><EFBFBD> / <20><EFBFBD> - <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PRGM : B4nFter
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
DWORD CFileSet::GetTime(/*out*/ LPFILETIME lpstCreateFileTime, /*out*/ LPFILETIME lpstAccessFileTime, /*out*/ LPFILETIME lpstWriteFileTime) const
|
|
|
|
|
|
{
|
|
|
|
|
|
BASE_ASSERT(NULL != lpstCreateFileTime, "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(NULL != lpstAccessFileTime, "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(NULL != lpstWriteFileTime, "Invalid!");
|
|
|
|
|
|
|
|
|
|
|
|
DWORD dwRetVal = 0;
|
|
|
|
|
|
if (INVALID_HANDLE_VALUE != m_hFile)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!::GetFileTime(m_hFile, lpstCreateFileTime, lpstAccessFileTime, lpstWriteFileTime))
|
|
|
|
|
|
{
|
|
|
|
|
|
dwRetVal = ::GetLastError();
|
|
|
|
|
|
BASE_ASSERT(0, "Error!");
|
|
|
|
|
|
}
|
|
|
|
|
|
// DN_VERIFY(::CloseHandle(m_hFile), TRUE, "error!");
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
BASE_RETURN(HASERROR);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return(dwRetVal);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// TYPE : FUNCTION
|
|
|
|
|
|
// NAME : CFileSet::GetTime
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// DESC : Ư<><C6AF> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>Ͻð<CFBD><C3B0><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD> <20><EFBFBD><DEBC><EFBFBD>)
|
|
|
|
|
|
// PARM : 1 . lpszFileName - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20≯<EFBFBD><CCB8><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// 2 . lpstCreateFileTime - <20><><EFBFBD><EFBFBD><EFBFBD>ð<EFBFBD>
|
|
|
|
|
|
// 3 . lpstAccessFileTime - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ٽð<D9BD>
|
|
|
|
|
|
// 4 . lpstWriteFileTime - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>Ͻð<CFBD>
|
|
|
|
|
|
// RETV : NOERROR - <20><><EFBFBD><EFBFBD> / <20><EFBFBD> - <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PRGM : B4nFter
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
DWORD CFileSet::GetTime(LPCTSTR lpszFileName, /*out*/ LPFILETIME lpstCreateFileTime, /*out*/ LPFILETIME lpstAccessFileTime, /*out*/ LPFILETIME lpstWriteFileTime)
|
|
|
|
|
|
{
|
|
|
|
|
|
BASE_ASSERT(NULL != lpstCreateFileTime, "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(NULL != lpstCreateFileTime, "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(NULL != lpstAccessFileTime, "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(NULL != lpstWriteFileTime, "Invalid!");
|
|
|
|
|
|
|
|
|
|
|
|
DWORD dwRetVal = 0;
|
|
|
|
|
|
HANDLE hFile = ::CreateFile(lpszFileName, FILE_READ_ATTRIBUTES, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
|
|
|
|
|
if (INVALID_HANDLE_VALUE != hFile)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!::GetFileTime(hFile, lpstCreateFileTime, lpstAccessFileTime, lpstWriteFileTime))
|
|
|
|
|
|
{
|
|
|
|
|
|
dwRetVal = ::GetLastError();
|
|
|
|
|
|
BASE_ASSERT(0, "Error!");
|
|
|
|
|
|
}
|
|
|
|
|
|
BASE_VERIFY(::CloseHandle(hFile), TRUE, "Error!");
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
BASE_RETURN(HASERROR);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return(dwRetVal);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// TYPE : FUNCTION
|
|
|
|
|
|
// NAME : CFileSet::GetVersion
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// DESC : Ư<><C6AF> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD> <20><EFBFBD><DEBC><EFBFBD>)
|
|
|
|
|
|
// PARM : 1 . lpszFileName - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20≯<EFBFBD><CCB8><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// 2 . dwFileVersion1 - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1
|
|
|
|
|
|
// 3 . dwFileVersion2 - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2
|
|
|
|
|
|
// 4 . dwFileVersion3 - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 3
|
|
|
|
|
|
// 5 . dwFileVersion4 - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 4
|
|
|
|
|
|
// RETV : NOERROR - <20><><EFBFBD><EFBFBD> / <20><EFBFBD> - <20><><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD> <20><><EFBFBD>̳ʸ<CCB3><CAB8><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ERROR_RESOURCE_TYPE_NOT_FOUND (1813L) <20><>ȯ)
|
|
|
|
|
|
// PRGM : B4nFter
|
|
|
|
|
|
// P.S.>
|
|
|
|
|
|
// - <20><><EFBFBD><EFBFBD> <20><><EFBFBD>̳ʸ<CCB3><CAB8><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD> <20>̹<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ؾ<EFBFBD> <20><>
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
DWORD CFileSet::GetVersion(LPCTSTR lpszFileName, DWORD& dwFileVersion1, DWORD& dwFileVersion2, DWORD& dwFileVersion3, DWORD& dwFileVersion4)
|
|
|
|
|
|
{
|
|
|
|
|
|
DWORD dwHandle= 0;
|
|
|
|
|
|
DWORD dwFileVersionInfoSize = ::GetFileVersionInfoSize(lpszFileName, &dwHandle);
|
|
|
|
|
|
if (0 == dwFileVersionInfoSize)
|
|
|
|
|
|
{
|
|
|
|
|
|
return (::GetLastError()); // Version Resource<63><65> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ERROR_RESOURCE_TYPE_NOT_FOUND (1813L)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
std::auto_ptr<BYTE> aVerBuf(NEW BYTE[dwFileVersionInfoSize]);
|
|
|
|
|
|
if (NULL == aVerBuf.get())
|
|
|
|
|
|
{
|
|
|
|
|
|
return ERROR_NOT_ENOUGH_MEMORY;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DWORD dwRetVal = 0;
|
|
|
|
|
|
if (TRUE == ::GetFileVersionInfo(lpszFileName, dwHandle, dwFileVersionInfoSize, aVerBuf.get()))
|
|
|
|
|
|
{
|
|
|
|
|
|
UINT uLength = 0;
|
|
|
|
|
|
VS_FIXEDFILEINFO* lpVsFixedFileInfo = NULL;
|
|
|
|
|
|
if (TRUE == ::VerQueryValue(aVerBuf.get(), _T("\\"), (LPVOID*)&lpVsFixedFileInfo, &uLength))
|
|
|
|
|
|
{
|
|
|
|
|
|
BASE_ASSERT(sizeof(VS_FIXEDFILEINFO) == uLength, "Error!");
|
|
|
|
|
|
dwFileVersion1 = HIWORD(lpVsFixedFileInfo->dwFileVersionMS);
|
|
|
|
|
|
dwFileVersion2 = LOWORD(lpVsFixedFileInfo->dwFileVersionMS);
|
|
|
|
|
|
dwFileVersion3 = HIWORD(lpVsFixedFileInfo->dwFileVersionLS);
|
|
|
|
|
|
dwFileVersion4 = LOWORD(lpVsFixedFileInfo->dwFileVersionLS);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
dwRetVal = ERROR_NOT_FOUND; // 1168L
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
dwRetVal = ::GetLastError();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return dwRetVal;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// TYPE : FUNCTION
|
|
|
|
|
|
// NAME : CFileSet::GetAttributes
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// DESC : Ư<><C6AF> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ӽ<EFBFBD><D3BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD> <20><EFBFBD><DEBC><EFBFBD>)
|
|
|
|
|
|
// PARM : 1 . lpszFileName - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20≯<EFBFBD><CCB8><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// RETV : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ӽ<EFBFBD> : <20><><EFBFBD><EFBFBD> / INVALID_FILE_ATTRIBUTES : <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PRGM : B4nFter
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
DWORD CFileSet::GetAttributes(LPCTSTR lpszFileName)
|
|
|
|
|
|
{
|
|
|
|
|
|
BASE_ASSERT(NULL != lpszFileName, "Invalid!");
|
|
|
|
|
|
return (::GetFileAttributes(lpszFileName));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// TYPE : FUNCTION
|
|
|
|
|
|
// NAME : CFileSet::SetAttributes
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// DESC : Ư<><C6AF> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ӽ<EFBFBD><D3BC><EFBFBD> <20><><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD> <20><EFBFBD><DEBC><EFBFBD>)
|
|
|
|
|
|
// PARM : 1 . lpszFileName - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20≯<EFBFBD><CCB8><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// 2 . dwFileAttributes - <20><><EFBFBD><EFBFBD> <20>Ӽ<EFBFBD>
|
|
|
|
|
|
/*
|
|
|
|
|
|
FILE_ATTRIBUTE_READONLY 0x00000001
|
|
|
|
|
|
FILE_ATTRIBUTE_HIDDEN 0x00000002
|
|
|
|
|
|
FILE_ATTRIBUTE_SYSTEM 0x00000004
|
|
|
|
|
|
FILE_ATTRIBUTE_DIRECTORY 0x00000010
|
|
|
|
|
|
FILE_ATTRIBUTE_ARCHIVE 0x00000020
|
|
|
|
|
|
FILE_ATTRIBUTE_DEVICE 0x00000040
|
|
|
|
|
|
FILE_ATTRIBUTE_NORMAL 0x00000080
|
|
|
|
|
|
FILE_ATTRIBUTE_TEMPORARY 0x00000100
|
|
|
|
|
|
FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
|
|
|
|
|
|
FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
|
|
|
|
|
|
FILE_ATTRIBUTE_COMPRESSED 0x00000800
|
|
|
|
|
|
FILE_ATTRIBUTE_OFFLINE 0x00001000
|
|
|
|
|
|
FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
|
|
|
|
|
|
FILE_ATTRIBUTE_ENCRYPTED 0x00004000
|
|
|
|
|
|
*/
|
|
|
|
|
|
// RETV : TRUE - <20><><EFBFBD><EFBFBD> / FALSE - <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PRGM : B4nFter
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
BOOL CFileSet::SetAttributes(LPCTSTR lpszFileName, DWORD dwFileAttributes)
|
|
|
|
|
|
{
|
|
|
|
|
|
BASE_ASSERT(NULL != lpszFileName, "Invalid!");
|
|
|
|
|
|
return (::SetFileAttributes(lpszFileName, dwFileAttributes));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// TYPE : FUNCTION
|
|
|
|
|
|
// NAME : CFileSet::Remove
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// DESC : Ư<><C6AF> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD> <20><EFBFBD><DEBC><EFBFBD>)
|
|
|
|
|
|
// PARM : 1 . lpszSrcFileName - <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// 2 . lpszTgtFileName - <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// 3 . pIsFailIfExist - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>з<EFBFBD> ó<><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> (TRUE:<3A><><EFBFBD><EFBFBD> / FALSE:<3A><><EFBFBD><EFBFBD>(<28><><EFBFBD>))
|
|
|
|
|
|
// RETV : TRUE - <20><><EFBFBD><EFBFBD> / FALSE - <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PRGM : B4nFter
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
BOOL CFileSet::Copy(LPCTSTR lpszSrcFileName, LPCTSTR lpszTgtFileName, BOOL pIsFailIfExist)
|
|
|
|
|
|
{
|
|
|
|
|
|
BASE_ASSERT(NULL != lpszSrcFileName, "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(NULL != lpszTgtFileName, "Invalid!");
|
|
|
|
|
|
|
|
|
|
|
|
return (::CopyFile(lpszSrcFileName, lpszTgtFileName, pIsFailIfExist));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// TYPE : FUNCTION
|
|
|
|
|
|
// NAME : CFileSet::Remove
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// DESC : Ư<><C6AF> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD> <20><EFBFBD><DEBC><EFBFBD>)
|
|
|
|
|
|
// PARM : 1 . lpszFileName - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20≯<EFBFBD><CCB8><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// RETV : TRUE - <20><><EFBFBD><EFBFBD> / FALSE - <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PRGM : B4nFter
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
BOOL CFileSet::Remove(LPCTSTR lpszFileName)
|
|
|
|
|
|
{
|
|
|
|
|
|
BASE_ASSERT(NULL != lpszFileName, "Invalid!");
|
|
|
|
|
|
|
|
|
|
|
|
return (::DeleteFile(lpszFileName));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// TYPE : FUNCTION
|
|
|
|
|
|
// NAME : CFileSet::Rename
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// DESC : Ư<><C6AF> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20≯<EFBFBD><CCB8><EFBFBD> <20><><EFBFBD>θ<EFBFBD> <20><><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD> <20><EFBFBD><DEBC><EFBFBD>)
|
|
|
|
|
|
// PARM : 1 . lpszOldFileName - <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20≯<EFBFBD><CCB8><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// 2 . lpszNewFileName - <20>ű<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20≯<EFBFBD><CCB8><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// RETV : TRUE - <20><><EFBFBD><EFBFBD> / FALSE - <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PRGM : B4nFter
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
BOOL CFileSet::Rename(LPCTSTR lpszOldFileName, LPCTSTR lpszNewFileName)
|
|
|
|
|
|
{
|
|
|
|
|
|
BASE_ASSERT(NULL != lpszOldFileName, "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(NULL != lpszNewFileName, "Invalid!");
|
|
|
|
|
|
|
|
|
|
|
|
return (::MoveFile(lpszOldFileName, lpszNewFileName));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// TYPE : FUNCTION
|
|
|
|
|
|
// NAME : CFileSet::GetTempName
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// DESC : Ư<><C6AF> <20><><EFBFBD>ο<EFBFBD> <20><><EFBFBD>λ<EFBFBD>, <20><><EFBFBD>ڸ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ӽ<EFBFBD><D3BD><EFBFBD><EFBFBD><EFBFBD> <20≯<EFBFBD><CCB8><EFBFBD> <20><><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD> <20><EFBFBD><DEBC><EFBFBD>)
|
|
|
|
|
|
// PARM : 1 . lpPathName - <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// 2 . lpPrefixString - <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>λ<EFBFBD>
|
|
|
|
|
|
// 3 . uUnique - <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// 4 . lpTempFileName - <20>ӽ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD≯<EFBFBD><CCB8><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// RETV : TRUE - <20><><EFBFBD><EFBFBD> / FALSE - <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PRGM : B4nFter
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
BOOL CFileSet::GetTempName(LPCTSTR lpPathName, LPCTSTR lpPrefixString, UINT uUnique, /*out*/ LPTSTR lpTempFileName)
|
|
|
|
|
|
{
|
|
|
|
|
|
BASE_ASSERT(NULL != lpPathName, "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(NULL != lpPrefixString, "Invalid!");
|
|
|
|
|
|
BASE_ASSERT(NULL != lpTempFileName, "Invalid!");
|
|
|
|
|
|
if (NULL == lpPathName) { return FALSE; }
|
|
|
|
|
|
if (NULL == lpPrefixString) { return FALSE; }
|
|
|
|
|
|
if (NULL == lpTempFileName) { return FALSE; }
|
|
|
|
|
|
|
|
|
|
|
|
UINT uRetVal = ::GetTempFileName(lpPathName, lpPrefixString, uUnique, lpTempFileName);
|
|
|
|
|
|
if (0 == uRetVal) {
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// TYPE : FUNCTION
|
|
|
|
|
|
// NAME : CFileSet::GetBomTypeDat
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
// DESC : Ư<><C6AF> BOM Ÿ<>Կ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PARM : 1 . pBomType - Ư<><C6AF> BOM Ÿ<>Կ<EFBFBD> <20><><EFBFBD><EFBFBD> EF_BOMTYPE <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>
|
|
|
|
|
|
// RETV : Ư<><C6AF> BOM Ÿ<>Կ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
// PRGM : B4nFter
|
|
|
|
|
|
//*---------------------------------------------------------------
|
|
|
|
|
|
CFileSet::LPFILEBOMTYPEDAT CFileSet::GetBomTypeDat(EF_BOMTYPE pBomType)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!CHECK_LIMIT(pBomType, EV_BT_NONE)) {
|
|
|
|
|
|
BASE_RETURN(NULL);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return &m_stBomTypeDat[pBomType];
|
|
|
|
|
|
}
|
|
|
|
|
|
|