mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-08 04:07:02 -06:00
9.38
This commit is contained in:
committed by
Kornel Lesiński
parent
7e021179cd
commit
0713a3ab80
@@ -2,8 +2,10 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Windows/COM.h"
|
||||
#include "Common/StringConvert.h"
|
||||
/*
|
||||
|
||||
#include "COM.h"
|
||||
#include "../Common/StringConvert.h"
|
||||
|
||||
namespace NWindows {
|
||||
namespace NCOM {
|
||||
@@ -35,3 +37,5 @@ HRESULT StringToGUIDA(const char *string, GUID &classID)
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
*/
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
|
||||
namespace NWindows {
|
||||
|
||||
bool CClipboard::Open(HWND wndNewOwner)
|
||||
bool CClipboard::Open(HWND wndNewOwner) throw()
|
||||
{
|
||||
m_Open = BOOLToBool(::OpenClipboard(wndNewOwner));
|
||||
return m_Open;
|
||||
}
|
||||
|
||||
bool CClipboard::Close()
|
||||
bool CClipboard::Close() throw()
|
||||
{
|
||||
if (!m_Open)
|
||||
return true;
|
||||
@@ -96,7 +96,7 @@ static bool ClipboardSetData(UINT uFormat, const void *data, size_t size) throw(
|
||||
{
|
||||
NMemory::CGlobalLock globalLock(global);
|
||||
LPVOID p = globalLock.GetPointer();
|
||||
if (p == NULL)
|
||||
if (!p)
|
||||
return false;
|
||||
memcpy(p, data, size);
|
||||
}
|
||||
@@ -117,11 +117,12 @@ bool ClipboardSetText(HWND owner, const UString &s)
|
||||
bool res;
|
||||
res = ClipboardSetData(CF_UNICODETEXT, (const wchar_t *)s, (s.Len() + 1) * sizeof(wchar_t));
|
||||
#ifndef _UNICODE
|
||||
AString a;
|
||||
a = UnicodeStringToMultiByte(s, CP_ACP);
|
||||
res |= ClipboardSetData(CF_TEXT, (const char *)a, (a.Len() + 1) * sizeof(char));
|
||||
AString a = UnicodeStringToMultiByte(s, CP_ACP);
|
||||
if (ClipboardSetData(CF_TEXT, (const char *)a, (a.Len() + 1) * sizeof(char)))
|
||||
res = true;
|
||||
a = UnicodeStringToMultiByte(s, CP_OEMCP);
|
||||
res |= ClipboardSetData(CF_OEMTEXT, (const char *)a, (a.Len() + 1) * sizeof(char));
|
||||
if (ClipboardSetData(CF_OEMTEXT, (const char *)a, (a.Len() + 1) * sizeof(char)))
|
||||
res = true;
|
||||
#endif
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
void Finish() { *Buf = 0; }
|
||||
};
|
||||
|
||||
bool CDoubleZeroStringListA::Add(LPCSTR s)
|
||||
bool CDoubleZeroStringListA::Add(LPCSTR s) throw()
|
||||
{
|
||||
unsigned len = MyStringLen(s) + 1;
|
||||
if (len >= Size)
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
void Finish() { *Buf = 0; }
|
||||
};
|
||||
|
||||
bool CDoubleZeroStringListW::Add(LPCWSTR s)
|
||||
bool CDoubleZeroStringListW::Add(LPCWSTR s) throw()
|
||||
{
|
||||
unsigned len = MyStringLen(s) + 1;
|
||||
if (len >= Size)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Windows/Console.h"
|
||||
#include "Console.h"
|
||||
|
||||
namespace NWindows{
|
||||
namespace NConsole{
|
||||
|
||||
@@ -81,7 +81,7 @@ bool CDialog::OnButtonClicked(int buttonID, HWND /* buttonHWND */)
|
||||
static bool GetWorkAreaRect(RECT *rect)
|
||||
{
|
||||
// use another function for multi-monitor.
|
||||
return BOOLToBool(::SystemParametersInfo(SPI_GETWORKAREA, NULL, rect, NULL));
|
||||
return BOOLToBool(::SystemParametersInfo(SPI_GETWORKAREA, 0, rect, 0));
|
||||
}
|
||||
|
||||
bool IsDialogSizeOK(int xSize, int ySize)
|
||||
|
||||
@@ -2,10 +2,9 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Windows/Control/ImageList.h"
|
||||
#include "ImageList.h"
|
||||
|
||||
namespace NWindows {
|
||||
namespace NControl {
|
||||
|
||||
}}
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
// Windows/Control/ImageList.h
|
||||
|
||||
#ifndef __WINDOWS_CONTROL_IMAGELIST_H
|
||||
#define __WINDOWS_CONTROL_IMAGELIST_H
|
||||
#ifndef __WINDOWS_CONTROL_IMAGE_LIST_H
|
||||
#define __WINDOWS_CONTROL_IMAGE_LIST_H
|
||||
|
||||
#include <commctrl.h>
|
||||
|
||||
#include "../Defs.h"
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#ifndef __WINDOWS_CONTROL_PROPERTYPAGE_H
|
||||
#define __WINDOWS_CONTROL_PROPERTYPAGE_H
|
||||
|
||||
#include <prsht.h>
|
||||
|
||||
#include "Dialog.h"
|
||||
|
||||
namespace NWindows {
|
||||
|
||||
@@ -56,8 +56,8 @@ bool CWindow2::CreateEx(DWORD exStyle, LPCTSTR className, LPCTSTR windowName,
|
||||
// wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wc.style = 0;
|
||||
wc.lpfnWndProc = WindowProcedure;
|
||||
wc.cbClsExtra = NULL;
|
||||
wc.cbWndExtra = NULL;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hInstance = instance;
|
||||
wc.hIcon = NULL;
|
||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
@@ -103,8 +103,8 @@ bool CWindow2::CreateEx(DWORD exStyle, LPCWSTR className, LPCWSTR windowName,
|
||||
// wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wc.style = 0;
|
||||
wc.lpfnWndProc = WindowProcedure;
|
||||
wc.cbClsExtra = NULL;
|
||||
wc.cbWndExtra = NULL;
|
||||
wc.cbClsExtra = 0;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.hInstance = instance;
|
||||
wc.hIcon = NULL;
|
||||
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
|
||||
@@ -13,7 +13,7 @@ extern HINSTANCE g_hInstance;
|
||||
namespace NWindows {
|
||||
namespace NDLL {
|
||||
|
||||
bool CLibrary::Free()
|
||||
bool CLibrary::Free() throw()
|
||||
{
|
||||
if (_module == 0)
|
||||
return true;
|
||||
@@ -23,7 +23,7 @@ bool CLibrary::Free()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CLibrary::LoadEx(CFSTR path, DWORD flags)
|
||||
bool CLibrary::LoadEx(CFSTR path, DWORD flags) throw()
|
||||
{
|
||||
if (!Free())
|
||||
return false;
|
||||
@@ -40,7 +40,7 @@ bool CLibrary::LoadEx(CFSTR path, DWORD flags)
|
||||
return (_module != NULL);
|
||||
}
|
||||
|
||||
bool CLibrary::Load(CFSTR path)
|
||||
bool CLibrary::Load(CFSTR path) throw()
|
||||
{
|
||||
if (!Free())
|
||||
return false;
|
||||
|
||||
@@ -54,7 +54,7 @@ bool MyGetDiskFreeSpace(CFSTR rootPath, UInt64 &clusterSize, UInt64 &totalSize,
|
||||
|
||||
namespace NFind {
|
||||
|
||||
bool CFileInfo::IsDots() const
|
||||
bool CFileInfo::IsDots() const throw()
|
||||
{
|
||||
if (!IsDir() || Name.IsEmpty())
|
||||
return false;
|
||||
@@ -104,7 +104,7 @@ static void Convert_WIN32_FIND_DATA_to_FileInfo(const WIN32_FIND_DATA &fd, CFile
|
||||
////////////////////////////////
|
||||
// CFindFile
|
||||
|
||||
bool CFindFileBase::Close()
|
||||
bool CFindFileBase::Close() throw()
|
||||
{
|
||||
if (_handle == INVALID_HANDLE_VALUE)
|
||||
return true;
|
||||
@@ -187,7 +187,7 @@ struct CFindStreamLoader
|
||||
}
|
||||
} g_FindStreamLoader;
|
||||
|
||||
bool CStreamInfo::IsMainStream() const
|
||||
bool CStreamInfo::IsMainStream() const throw()
|
||||
{
|
||||
return Name == L"::$DATA";
|
||||
};
|
||||
@@ -278,7 +278,7 @@ bool CStreamEnumerator::Next(CStreamInfo &si, bool &found)
|
||||
|
||||
#define MY_CLEAR_FILETIME(ft) ft.dwLowDateTime = ft.dwHighDateTime = 0;
|
||||
|
||||
void CFileInfoBase::Clear()
|
||||
void CFileInfoBase::Clear() throw()
|
||||
{
|
||||
Size = 0;
|
||||
MY_CLEAR_FILETIME(CTime);
|
||||
@@ -486,7 +486,7 @@ bool CEnumerator::Next(CFileInfo &fi, bool &found)
|
||||
// CFindChangeNotification
|
||||
// FindFirstChangeNotification can return 0. MSDN doesn't tell about it.
|
||||
|
||||
bool CFindChangeNotification::Close()
|
||||
bool CFindChangeNotification::Close() throw()
|
||||
{
|
||||
if (!IsHandleAllocated())
|
||||
return true;
|
||||
|
||||
@@ -30,6 +30,22 @@ bool MyGetDiskFreeSpace(CFSTR rootPath, UInt64 &clusterSize, UInt64 &totalSize,
|
||||
|
||||
namespace NIO {
|
||||
|
||||
/*
|
||||
WinXP-64 CreateFile():
|
||||
"" - ERROR_PATH_NOT_FOUND
|
||||
:stream - OK
|
||||
.:stream - ERROR_PATH_NOT_FOUND
|
||||
.\:stream - OK
|
||||
|
||||
folder\:stream - ERROR_INVALID_NAME
|
||||
folder:stream - OK
|
||||
|
||||
c:\:stream - OK
|
||||
|
||||
c::stream - ERROR_INVALID_NAME, if current dir is NOT ROOT ( c:\dir1 )
|
||||
c::stream - OK, if current dir is ROOT ( c:\ )
|
||||
*/
|
||||
|
||||
bool CFileBase::Create(CFSTR path, DWORD desiredAccess,
|
||||
DWORD shareMode, DWORD creationDisposition, DWORD flagsAndAttributes)
|
||||
{
|
||||
@@ -55,9 +71,9 @@ bool CFileBase::Create(CFSTR path, DWORD desiredAccess,
|
||||
#ifdef WIN_LONG_PATH
|
||||
if (_handle == INVALID_HANDLE_VALUE && USE_SUPER_PATH)
|
||||
{
|
||||
UString longPath;
|
||||
if (GetSuperPath(path, longPath, USE_MAIN_PATH))
|
||||
_handle = ::CreateFileW(longPath, desiredAccess, shareMode,
|
||||
UString superPath;
|
||||
if (GetSuperPath(path, superPath, USE_MAIN_PATH))
|
||||
_handle = ::CreateFileW(superPath, desiredAccess, shareMode,
|
||||
(LPSECURITY_ATTRIBUTES)NULL, creationDisposition, flagsAndAttributes, (HANDLE)NULL);
|
||||
}
|
||||
#endif
|
||||
@@ -65,7 +81,7 @@ bool CFileBase::Create(CFSTR path, DWORD desiredAccess,
|
||||
return (_handle != INVALID_HANDLE_VALUE);
|
||||
}
|
||||
|
||||
bool CFileBase::Close()
|
||||
bool CFileBase::Close() throw()
|
||||
{
|
||||
if (_handle == INVALID_HANDLE_VALUE)
|
||||
return true;
|
||||
@@ -75,12 +91,12 @@ bool CFileBase::Close()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CFileBase::GetPosition(UInt64 &position) const
|
||||
bool CFileBase::GetPosition(UInt64 &position) const throw()
|
||||
{
|
||||
return Seek(0, FILE_CURRENT, position);
|
||||
}
|
||||
|
||||
bool CFileBase::GetLength(UInt64 &length) const
|
||||
bool CFileBase::GetLength(UInt64 &length) const throw()
|
||||
{
|
||||
#ifdef SUPPORT_DEVICE_FILE
|
||||
if (IsDeviceFile && SizeDefined)
|
||||
@@ -99,7 +115,7 @@ bool CFileBase::GetLength(UInt64 &length) const
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CFileBase::Seek(Int64 distanceToMove, DWORD moveMethod, UInt64 &newPosition) const
|
||||
bool CFileBase::Seek(Int64 distanceToMove, DWORD moveMethod, UInt64 &newPosition) const throw()
|
||||
{
|
||||
#ifdef SUPPORT_DEVICE_FILE
|
||||
if (IsDeviceFile && SizeDefined && moveMethod == FILE_END)
|
||||
@@ -118,18 +134,18 @@ bool CFileBase::Seek(Int64 distanceToMove, DWORD moveMethod, UInt64 &newPosition
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CFileBase::Seek(UInt64 position, UInt64 &newPosition) const
|
||||
bool CFileBase::Seek(UInt64 position, UInt64 &newPosition) const throw()
|
||||
{
|
||||
return Seek(position, FILE_BEGIN, newPosition);
|
||||
}
|
||||
|
||||
bool CFileBase::SeekToBegin() const
|
||||
bool CFileBase::SeekToBegin() const throw()
|
||||
{
|
||||
UInt64 newPosition;
|
||||
return Seek(0, newPosition);
|
||||
}
|
||||
|
||||
bool CFileBase::SeekToEnd(UInt64 &newPosition) const
|
||||
bool CFileBase::SeekToEnd(UInt64 &newPosition) const throw()
|
||||
{
|
||||
return Seek(0, FILE_END, newPosition);
|
||||
}
|
||||
@@ -316,7 +332,7 @@ bool CInFile::Open(CFSTR fileName)
|
||||
|
||||
static UInt32 kChunkSizeMax = (1 << 22);
|
||||
|
||||
bool CInFile::Read1(void *data, UInt32 size, UInt32 &processedSize)
|
||||
bool CInFile::Read1(void *data, UInt32 size, UInt32 &processedSize) throw()
|
||||
{
|
||||
DWORD processedLoc = 0;
|
||||
bool res = BOOLToBool(::ReadFile(_handle, data, size, &processedLoc, NULL));
|
||||
@@ -324,14 +340,14 @@ bool CInFile::Read1(void *data, UInt32 size, UInt32 &processedSize)
|
||||
return res;
|
||||
}
|
||||
|
||||
bool CInFile::ReadPart(void *data, UInt32 size, UInt32 &processedSize)
|
||||
bool CInFile::ReadPart(void *data, UInt32 size, UInt32 &processedSize) throw()
|
||||
{
|
||||
if (size > kChunkSizeMax)
|
||||
size = kChunkSizeMax;
|
||||
return Read1(data, size, processedSize);
|
||||
}
|
||||
|
||||
bool CInFile::Read(void *data, UInt32 size, UInt32 &processedSize)
|
||||
bool CInFile::Read(void *data, UInt32 size, UInt32 &processedSize) throw()
|
||||
{
|
||||
processedSize = 0;
|
||||
do
|
||||
@@ -367,12 +383,12 @@ bool COutFile::Create(CFSTR fileName, bool createAlways)
|
||||
bool COutFile::CreateAlways(CFSTR fileName, DWORD flagsAndAttributes)
|
||||
{ return Open(fileName, FILE_SHARE_READ, GetCreationDisposition(true), flagsAndAttributes); }
|
||||
|
||||
bool COutFile::SetTime(const FILETIME *cTime, const FILETIME *aTime, const FILETIME *mTime)
|
||||
bool COutFile::SetTime(const FILETIME *cTime, const FILETIME *aTime, const FILETIME *mTime) throw()
|
||||
{ return BOOLToBool(::SetFileTime(_handle, cTime, aTime, mTime)); }
|
||||
|
||||
bool COutFile::SetMTime(const FILETIME *mTime) { return SetTime(NULL, NULL, mTime); }
|
||||
bool COutFile::SetMTime(const FILETIME *mTime) throw() { return SetTime(NULL, NULL, mTime); }
|
||||
|
||||
bool COutFile::WritePart(const void *data, UInt32 size, UInt32 &processedSize)
|
||||
bool COutFile::WritePart(const void *data, UInt32 size, UInt32 &processedSize) throw()
|
||||
{
|
||||
if (size > kChunkSizeMax)
|
||||
size = kChunkSizeMax;
|
||||
@@ -382,7 +398,7 @@ bool COutFile::WritePart(const void *data, UInt32 size, UInt32 &processedSize)
|
||||
return res;
|
||||
}
|
||||
|
||||
bool COutFile::Write(const void *data, UInt32 size, UInt32 &processedSize)
|
||||
bool COutFile::Write(const void *data, UInt32 size, UInt32 &processedSize) throw()
|
||||
{
|
||||
processedSize = 0;
|
||||
do
|
||||
@@ -401,9 +417,9 @@ bool COutFile::Write(const void *data, UInt32 size, UInt32 &processedSize)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool COutFile::SetEndOfFile() { return BOOLToBool(::SetEndOfFile(_handle)); }
|
||||
bool COutFile::SetEndOfFile() throw() { return BOOLToBool(::SetEndOfFile(_handle)); }
|
||||
|
||||
bool COutFile::SetLength(UInt64 length)
|
||||
bool COutFile::SetLength(UInt64 length) throw()
|
||||
{
|
||||
UInt64 newPosition;
|
||||
if (!Seek(length, newPosition))
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
#ifndef __WINDOWS_FILE_IO_H
|
||||
#define __WINDOWS_FILE_IO_H
|
||||
|
||||
#if defined(_WIN32) && !defined(UNDER_CE)
|
||||
#include <winioctl.h>
|
||||
#endif
|
||||
|
||||
#include "../Common/MyString.h"
|
||||
#include "../Common/MyBuffer.h"
|
||||
|
||||
@@ -19,7 +23,9 @@
|
||||
namespace NWindows {
|
||||
namespace NFile {
|
||||
|
||||
#if defined(_WIN32) && !defined(UNDER_CE)
|
||||
bool FillLinkData(CByteBuffer &dest, const wchar_t *path, bool isSymLink);
|
||||
#endif
|
||||
|
||||
struct CReparseShortInfo
|
||||
{
|
||||
|
||||
@@ -279,12 +279,12 @@ bool CReparseShortInfo::Parse(const Byte *p, size_t size)
|
||||
len -= 8;
|
||||
p += 8;
|
||||
|
||||
UInt32 Flags = 0;
|
||||
// UInt32 Flags = 0;
|
||||
if (Tag == _my_IO_REPARSE_TAG_SYMLINK)
|
||||
{
|
||||
if (len < 4)
|
||||
return false;
|
||||
Flags = Get32(p);
|
||||
// Flags = Get32(p);
|
||||
len -= 4;
|
||||
p += 4;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Windows/FileMapping.h"
|
||||
#include "FileMapping.h"
|
||||
|
||||
namespace NWindows {
|
||||
namespace NFile {
|
||||
|
||||
@@ -47,7 +47,7 @@ static const wchar_t *kSuperUncPrefix = L"\\\\?\\UNC\\";
|
||||
((s)[2] == 'C' || (s)[2] == 'c') && \
|
||||
(s)[3] == '\\')
|
||||
|
||||
bool IsDevicePath(CFSTR s)
|
||||
bool IsDevicePath(CFSTR s) throw()
|
||||
{
|
||||
#ifdef UNDER_CE
|
||||
|
||||
@@ -80,20 +80,20 @@ bool IsDevicePath(CFSTR s)
|
||||
#endif
|
||||
}
|
||||
|
||||
bool IsSuperUncPath(CFSTR s) { return (IS_SUPER_PREFIX(s) && IS_UNC_WITH_SLASH(s + kSuperPathPrefixSize)); }
|
||||
bool IsSuperUncPath(CFSTR s) throw() { return (IS_SUPER_PREFIX(s) && IS_UNC_WITH_SLASH(s + kSuperPathPrefixSize)); }
|
||||
|
||||
bool IsDrivePath(const wchar_t *s) { return IS_LETTER_CHAR(s[0]) && s[1] == ':' && s[2] == '\\'; }
|
||||
bool IsSuperPath(const wchar_t *s) { return IS_SUPER_PREFIX(s); }
|
||||
bool IsSuperOrDevicePath(const wchar_t *s) { return IS_SUPER_OR_DEVICE_PATH(s); }
|
||||
bool IsDrivePath(const wchar_t *s) throw() { return IS_LETTER_CHAR(s[0]) && s[1] == ':' && s[2] == '\\'; }
|
||||
bool IsSuperPath(const wchar_t *s) throw() { return IS_SUPER_PREFIX(s); }
|
||||
bool IsSuperOrDevicePath(const wchar_t *s) throw() { return IS_SUPER_OR_DEVICE_PATH(s); }
|
||||
// bool IsSuperUncPath(const wchar_t *s) { return (IS_SUPER_PREFIX(s) && IS_UNC_WITH_SLASH(s + kSuperPathPrefixSize)); }
|
||||
|
||||
#ifndef USE_UNICODE_FSTRING
|
||||
bool IsDrivePath(CFSTR s) { return IS_LETTER_CHAR(s[0]) && s[1] == ':' && s[2] == '\\'; }
|
||||
bool IsSuperPath(CFSTR s) { return IS_SUPER_PREFIX(s); }
|
||||
bool IsSuperOrDevicePath(CFSTR s) { return IS_SUPER_OR_DEVICE_PATH(s); }
|
||||
bool IsDrivePath(CFSTR s) throw() { return IS_LETTER_CHAR(s[0]) && s[1] == ':' && s[2] == '\\'; }
|
||||
bool IsSuperPath(CFSTR s) throw() { return IS_SUPER_PREFIX(s); }
|
||||
bool IsSuperOrDevicePath(CFSTR s) throw() { return IS_SUPER_OR_DEVICE_PATH(s); }
|
||||
#endif // USE_UNICODE_FSTRING
|
||||
|
||||
bool IsAbsolutePath(const wchar_t *s)
|
||||
bool IsAbsolutePath(const wchar_t *s) throw()
|
||||
{
|
||||
return s[0] == WCHAR_PATH_SEPARATOR || IsDrivePath(s);
|
||||
}
|
||||
@@ -102,7 +102,7 @@ static const unsigned kDrivePrefixSize = 3; /* c:\ */
|
||||
|
||||
#ifndef USE_UNICODE_FSTRING
|
||||
|
||||
static unsigned GetRootPrefixSize_Of_NetworkPath(CFSTR s)
|
||||
static unsigned GetRootPrefixSize_Of_NetworkPath(CFSTR s) throw()
|
||||
{
|
||||
// Network path: we look "server\path\" as root prefix
|
||||
int pos = FindCharPosInString(s, '\\');
|
||||
@@ -114,7 +114,7 @@ static unsigned GetRootPrefixSize_Of_NetworkPath(CFSTR s)
|
||||
return pos + pos2 + 2;
|
||||
}
|
||||
|
||||
static unsigned GetRootPrefixSize_Of_SimplePath(CFSTR s)
|
||||
static unsigned GetRootPrefixSize_Of_SimplePath(CFSTR s) throw()
|
||||
{
|
||||
if (IsDrivePath(s))
|
||||
return kDrivePrefixSize;
|
||||
@@ -124,7 +124,7 @@ static unsigned GetRootPrefixSize_Of_SimplePath(CFSTR s)
|
||||
return (size == 0) ? 0 : 2 + size;
|
||||
}
|
||||
|
||||
static unsigned GetRootPrefixSize_Of_SuperPath(CFSTR s)
|
||||
static unsigned GetRootPrefixSize_Of_SuperPath(CFSTR s) throw()
|
||||
{
|
||||
if (IS_UNC_WITH_SLASH(s + kSuperPathPrefixSize))
|
||||
{
|
||||
@@ -138,7 +138,7 @@ static unsigned GetRootPrefixSize_Of_SuperPath(CFSTR s)
|
||||
return kSuperPathPrefixSize + pos + 1;
|
||||
}
|
||||
|
||||
unsigned GetRootPrefixSize(CFSTR s)
|
||||
unsigned GetRootPrefixSize(CFSTR s) throw()
|
||||
{
|
||||
if (IS_DEVICE_PATH(s))
|
||||
return kDevicePathPrefixSize;
|
||||
@@ -149,7 +149,7 @@ unsigned GetRootPrefixSize(CFSTR s)
|
||||
|
||||
#endif // USE_UNICODE_FSTRING
|
||||
|
||||
static unsigned GetRootPrefixSize_Of_NetworkPath(const wchar_t *s)
|
||||
static unsigned GetRootPrefixSize_Of_NetworkPath(const wchar_t *s) throw()
|
||||
{
|
||||
// Network path: we look "server\path\" as root prefix
|
||||
int pos = FindCharPosInString(s, L'\\');
|
||||
@@ -161,7 +161,7 @@ static unsigned GetRootPrefixSize_Of_NetworkPath(const wchar_t *s)
|
||||
return pos + pos2 + 2;
|
||||
}
|
||||
|
||||
static unsigned GetRootPrefixSize_Of_SimplePath(const wchar_t *s)
|
||||
static unsigned GetRootPrefixSize_Of_SimplePath(const wchar_t *s) throw()
|
||||
{
|
||||
if (IsDrivePath(s))
|
||||
return kDrivePrefixSize;
|
||||
@@ -171,7 +171,7 @@ static unsigned GetRootPrefixSize_Of_SimplePath(const wchar_t *s)
|
||||
return (size == 0) ? 0 : 2 + size;
|
||||
}
|
||||
|
||||
static unsigned GetRootPrefixSize_Of_SuperPath(const wchar_t *s)
|
||||
static unsigned GetRootPrefixSize_Of_SuperPath(const wchar_t *s) throw()
|
||||
{
|
||||
if (IS_UNC_WITH_SLASH(s + kSuperPathPrefixSize))
|
||||
{
|
||||
@@ -185,7 +185,7 @@ static unsigned GetRootPrefixSize_Of_SuperPath(const wchar_t *s)
|
||||
return kSuperPathPrefixSize + pos + 1;
|
||||
}
|
||||
|
||||
unsigned GetRootPrefixSize(const wchar_t *s)
|
||||
unsigned GetRootPrefixSize(const wchar_t *s) throw()
|
||||
{
|
||||
if (IS_DEVICE_PATH(s))
|
||||
return kDevicePathPrefixSize;
|
||||
@@ -196,12 +196,12 @@ unsigned GetRootPrefixSize(const wchar_t *s)
|
||||
|
||||
#else // _WIN32
|
||||
|
||||
bool IsAbsolutePath(const wchar_t *s) { return s[0] == WCHAR_PATH_SEPARATOR }
|
||||
bool IsAbsolutePath(const wchar_t *s) throw() { return s[0] == WCHAR_PATH_SEPARATOR }
|
||||
|
||||
#ifndef USE_UNICODE_FSTRING
|
||||
unsigned GetRootPrefixSize(CFSTR s) { return s[0] == CHAR_PATH_SEPRATOR ? 1 : 0; }
|
||||
unsigned GetRootPrefixSize(CFSTR s) throw() { return s[0] == CHAR_PATH_SEPRATOR ? 1 : 0; }
|
||||
#endif
|
||||
unsigned GetRootPrefixSize(const wchar_t *s) { return s[0] == CHAR_PATH_SEPRATOR ? 1 : 0; }
|
||||
unsigned GetRootPrefixSize(const wchar_t *s) throw() { return s[0] == CHAR_PATH_SEPRATOR ? 1 : 0; }
|
||||
|
||||
#endif // _WIN32
|
||||
|
||||
@@ -340,7 +340,7 @@ There are 3 cases:
|
||||
kSuperPathType_UseMainAndSuper : not Super, Good Path
|
||||
*/
|
||||
|
||||
int GetUseSuperPathType(CFSTR s)
|
||||
int GetUseSuperPathType(CFSTR s) throw()
|
||||
{
|
||||
if (IsSuperOrDevicePath(s))
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
namespace NWindows {
|
||||
namespace NMemory {
|
||||
|
||||
bool CGlobal::Alloc(UINT flags, SIZE_T size)
|
||||
bool CGlobal::Alloc(UINT flags, SIZE_T size) throw()
|
||||
{
|
||||
HGLOBAL newBlock = ::GlobalAlloc(flags, size);
|
||||
if (newBlock == NULL)
|
||||
@@ -16,7 +16,7 @@ bool CGlobal::Alloc(UINT flags, SIZE_T size)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CGlobal::Free()
|
||||
bool CGlobal::Free() throw()
|
||||
{
|
||||
if (_global == NULL)
|
||||
return true;
|
||||
@@ -24,7 +24,7 @@ bool CGlobal::Free()
|
||||
return (_global == NULL);
|
||||
}
|
||||
|
||||
bool CGlobal::ReAlloc(SIZE_T size)
|
||||
bool CGlobal::ReAlloc(SIZE_T size) throw()
|
||||
{
|
||||
HGLOBAL newBlock = ::GlobalReAlloc(_global, size, GMEM_MOVEABLE);
|
||||
if (newBlock == NULL)
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace NSecurity {
|
||||
#ifndef UNDER_CE
|
||||
|
||||
#ifdef _UNICODE
|
||||
#define MY_FUNC_SELECT(f) :: ## f
|
||||
#define MY_FUNC_SELECT(f) :: f
|
||||
#else
|
||||
#define MY_FUNC_SELECT(f) my_ ## f
|
||||
extern "C" {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Windows/NationalTime.h"
|
||||
#include "NationalTime.h"
|
||||
|
||||
namespace NWindows {
|
||||
namespace NNational {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// Windows/NationalTime.h
|
||||
|
||||
#ifndef __WINDOWS_NATIONALTIME_H
|
||||
#define __WINDOWS_NATIONALTIME_H
|
||||
#ifndef __WINDOWS_NATIONAL_TIME_H
|
||||
#define __WINDOWS_NATIONAL_TIME_H
|
||||
|
||||
#include "Common/String.h"
|
||||
#include "../Common/MyString.h"
|
||||
|
||||
namespace NWindows {
|
||||
namespace NNational {
|
||||
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
#endif
|
||||
bool SetPriorityClass(DWORD dwPriorityClass) { return BOOLToBool(::SetPriorityClass(_handle, dwPriorityClass)); }
|
||||
DWORD GetPriorityClass() { return ::GetPriorityClass(_handle); }
|
||||
bool GetIoCounters(PIO_COUNTERS lpIoCounters ) { return BOOLToBool(::GetProcessIoCounters(_handle, lpIoCounters )); }
|
||||
// bool GetIoCounters(PIO_COUNTERS lpIoCounters ) { return BOOLToBool(::GetProcessIoCounters(_handle, lpIoCounters )); }
|
||||
|
||||
bool GetTimes(LPFILETIME creationTime, LPFILETIME exitTime, LPFILETIME kernelTime, LPFILETIME userTime)
|
||||
{ return BOOLToBool(::GetProcessTimes(_handle, creationTime, exitTime, kernelTime, userTime)); }
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
namespace NWindows {
|
||||
namespace NCOM {
|
||||
|
||||
HRESULT PropVarEm_Alloc_Bstr(PROPVARIANT *p, unsigned numChars)
|
||||
HRESULT PropVarEm_Alloc_Bstr(PROPVARIANT *p, unsigned numChars) throw()
|
||||
{
|
||||
p->bstrVal = ::SysAllocStringLen(0, numChars);
|
||||
if (!p->bstrVal)
|
||||
@@ -22,10 +22,10 @@ HRESULT PropVarEm_Alloc_Bstr(PROPVARIANT *p, unsigned numChars)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT PropVarEm_Set_Str(PROPVARIANT *p, const char *s)
|
||||
HRESULT PropVarEm_Set_Str(PROPVARIANT *p, const char *s) throw()
|
||||
{
|
||||
UINT len = (UINT)strlen(s);
|
||||
p->bstrVal = ::SysAllocStringByteLen(0, (UINT)len * sizeof(OLECHAR));
|
||||
p->bstrVal = ::SysAllocStringLen(0, len);
|
||||
if (!p->bstrVal)
|
||||
{
|
||||
p->vt = VT_ERROR;
|
||||
@@ -88,7 +88,7 @@ CPropVariant& CPropVariant::operator=(LPCOLESTR lpszSrc)
|
||||
vt = VT_BSTR;
|
||||
wReserved1 = 0;
|
||||
bstrVal = ::SysAllocString(lpszSrc);
|
||||
if (bstrVal == NULL && lpszSrc != NULL)
|
||||
if (!bstrVal && lpszSrc)
|
||||
{
|
||||
throw kMemException;
|
||||
// vt = VT_ERROR;
|
||||
@@ -103,8 +103,8 @@ CPropVariant& CPropVariant::operator=(const char *s)
|
||||
vt = VT_BSTR;
|
||||
wReserved1 = 0;
|
||||
UINT len = (UINT)strlen(s);
|
||||
bstrVal = ::SysAllocStringByteLen(0, (UINT)len * sizeof(OLECHAR));
|
||||
if (bstrVal == NULL)
|
||||
bstrVal = ::SysAllocStringLen(0, len);
|
||||
if (!bstrVal)
|
||||
{
|
||||
throw kMemException;
|
||||
// vt = VT_ERROR;
|
||||
@@ -118,7 +118,7 @@ CPropVariant& CPropVariant::operator=(const char *s)
|
||||
return *this;
|
||||
}
|
||||
|
||||
CPropVariant& CPropVariant::operator=(bool bSrc)
|
||||
CPropVariant& CPropVariant::operator=(bool bSrc) throw()
|
||||
{
|
||||
if (vt != VT_BOOL)
|
||||
{
|
||||
@@ -136,7 +136,7 @@ BSTR CPropVariant::AllocBstr(unsigned numChars)
|
||||
vt = VT_BSTR;
|
||||
wReserved1 = 0;
|
||||
bstrVal = ::SysAllocStringLen(0, numChars);
|
||||
if (bstrVal == NULL)
|
||||
if (!bstrVal)
|
||||
{
|
||||
throw kMemException;
|
||||
// vt = VT_ERROR;
|
||||
@@ -146,7 +146,7 @@ BSTR CPropVariant::AllocBstr(unsigned numChars)
|
||||
}
|
||||
|
||||
#define SET_PROP_FUNC(type, id, dest) \
|
||||
CPropVariant& CPropVariant::operator=(type value) \
|
||||
CPropVariant& CPropVariant::operator=(type value) throw() \
|
||||
{ if (vt != id) { InternalClear(); vt = id; } \
|
||||
dest = value; return *this; }
|
||||
|
||||
@@ -191,14 +191,14 @@ HRESULT PropVariant_Clear(PROPVARIANT *prop) throw()
|
||||
// PropVariantClear can clear VT_BLOB.
|
||||
}
|
||||
|
||||
HRESULT CPropVariant::Clear()
|
||||
HRESULT CPropVariant::Clear() throw()
|
||||
{
|
||||
if (vt == VT_EMPTY)
|
||||
return S_OK;
|
||||
return PropVariant_Clear(this);
|
||||
}
|
||||
|
||||
HRESULT CPropVariant::Copy(const PROPVARIANT* pSrc)
|
||||
HRESULT CPropVariant::Copy(const PROPVARIANT* pSrc) throw()
|
||||
{
|
||||
::VariantClear((tagVARIANT *)this);
|
||||
switch(pSrc->vt)
|
||||
@@ -226,7 +226,7 @@ HRESULT CPropVariant::Copy(const PROPVARIANT* pSrc)
|
||||
}
|
||||
|
||||
|
||||
HRESULT CPropVariant::Attach(PROPVARIANT *pSrc)
|
||||
HRESULT CPropVariant::Attach(PROPVARIANT *pSrc) throw()
|
||||
{
|
||||
HRESULT hr = Clear();
|
||||
if (FAILED(hr))
|
||||
@@ -236,7 +236,7 @@ HRESULT CPropVariant::Attach(PROPVARIANT *pSrc)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CPropVariant::Detach(PROPVARIANT *pDest)
|
||||
HRESULT CPropVariant::Detach(PROPVARIANT *pDest) throw()
|
||||
{
|
||||
if (pDest->vt != VT_EMPTY)
|
||||
{
|
||||
@@ -249,7 +249,7 @@ HRESULT CPropVariant::Detach(PROPVARIANT *pDest)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CPropVariant::InternalClear()
|
||||
HRESULT CPropVariant::InternalClear() throw()
|
||||
{
|
||||
if (vt == VT_EMPTY)
|
||||
return S_OK;
|
||||
@@ -274,7 +274,7 @@ void CPropVariant::InternalCopy(const PROPVARIANT *pSrc)
|
||||
}
|
||||
}
|
||||
|
||||
int CPropVariant::Compare(const CPropVariant &a)
|
||||
int CPropVariant::Compare(const CPropVariant &a) throw()
|
||||
{
|
||||
if (vt != a.vt)
|
||||
return MyCompare(vt, a.vt);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#define UINT_TO_STR_2(c, val) { s[0] = (c); s[1] = (char)('0' + (val) / 10); s[2] = (char)('0' + (val) % 10); s += 3; }
|
||||
|
||||
bool ConvertFileTimeToString(const FILETIME &ft, char *s, bool includeTime, bool includeSeconds)
|
||||
bool ConvertFileTimeToString(const FILETIME &ft, char *s, bool includeTime, bool includeSeconds) throw()
|
||||
{
|
||||
SYSTEMTIME st;
|
||||
if (!BOOLToBool(FileTimeToSystemTime(&ft, &st)))
|
||||
@@ -43,7 +43,7 @@ bool ConvertFileTimeToString(const FILETIME &ft, char *s, bool includeTime, bool
|
||||
return true;
|
||||
}
|
||||
|
||||
void ConvertFileTimeToString(const FILETIME &ft, wchar_t *dest, bool includeTime, bool includeSeconds)
|
||||
void ConvertFileTimeToString(const FILETIME &ft, wchar_t *dest, bool includeTime, bool includeSeconds) throw()
|
||||
{
|
||||
char s[32];
|
||||
ConvertFileTimeToString(ft, s, includeTime, includeSeconds);
|
||||
@@ -56,7 +56,7 @@ void ConvertFileTimeToString(const FILETIME &ft, wchar_t *dest, bool includeTime
|
||||
}
|
||||
}
|
||||
|
||||
void ConvertPropVariantToShortString(const PROPVARIANT &prop, char *dest)
|
||||
void ConvertPropVariantToShortString(const PROPVARIANT &prop, char *dest) throw()
|
||||
{
|
||||
*dest = 0;
|
||||
switch (prop.vt)
|
||||
@@ -77,7 +77,7 @@ void ConvertPropVariantToShortString(const PROPVARIANT &prop, char *dest)
|
||||
}
|
||||
}
|
||||
|
||||
void ConvertPropVariantToShortString(const PROPVARIANT &prop, wchar_t *dest)
|
||||
void ConvertPropVariantToShortString(const PROPVARIANT &prop, wchar_t *dest) throw()
|
||||
{
|
||||
*dest = 0;
|
||||
switch (prop.vt)
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace NRegistry {
|
||||
|
||||
LONG CKey::Create(HKEY parentKey, LPCTSTR keyName,
|
||||
LPTSTR keyClass, DWORD options, REGSAM accessMask,
|
||||
LPSECURITY_ATTRIBUTES securityAttributes, LPDWORD disposition)
|
||||
LPSECURITY_ATTRIBUTES securityAttributes, LPDWORD disposition) throw()
|
||||
{
|
||||
MYASSERT(parentKey != NULL);
|
||||
DWORD dispositionReal;
|
||||
@@ -35,7 +35,7 @@ LONG CKey::Create(HKEY parentKey, LPCTSTR keyName,
|
||||
return res;
|
||||
}
|
||||
|
||||
LONG CKey::Open(HKEY parentKey, LPCTSTR keyName, REGSAM accessMask)
|
||||
LONG CKey::Open(HKEY parentKey, LPCTSTR keyName, REGSAM accessMask) throw()
|
||||
{
|
||||
MYASSERT(parentKey != NULL);
|
||||
HKEY key = NULL;
|
||||
@@ -49,7 +49,7 @@ LONG CKey::Open(HKEY parentKey, LPCTSTR keyName, REGSAM accessMask)
|
||||
return res;
|
||||
}
|
||||
|
||||
LONG CKey::Close()
|
||||
LONG CKey::Close() throw()
|
||||
{
|
||||
LONG res = ERROR_SUCCESS;
|
||||
if (_object != NULL)
|
||||
@@ -62,13 +62,13 @@ LONG CKey::Close()
|
||||
|
||||
// win95, win98: deletes sunkey and all its subkeys
|
||||
// winNT to be deleted must not have subkeys
|
||||
LONG CKey::DeleteSubKey(LPCTSTR subKeyName)
|
||||
LONG CKey::DeleteSubKey(LPCTSTR subKeyName) throw()
|
||||
{
|
||||
MYASSERT(_object != NULL);
|
||||
return RegDeleteKey(_object, subKeyName);
|
||||
}
|
||||
|
||||
LONG CKey::RecurseDeleteKey(LPCTSTR subKeyName)
|
||||
LONG CKey::RecurseDeleteKey(LPCTSTR subKeyName) throw()
|
||||
{
|
||||
CKey key;
|
||||
LONG res = key.Open(_object, subKeyName, KEY_READ | KEY_WRITE);
|
||||
@@ -97,7 +97,7 @@ static inline UInt32 BoolToUINT32(bool value) { return (value ? 1: 0); }
|
||||
static inline bool UINT32ToBool(UInt32 value) { return (value != 0); }
|
||||
|
||||
|
||||
LONG CKey::DeleteValue(LPCTSTR name)
|
||||
LONG CKey::DeleteValue(LPCTSTR name) throw()
|
||||
{
|
||||
MYASSERT(_object != NULL);
|
||||
return ::RegDeleteValue(_object, name);
|
||||
@@ -113,23 +113,23 @@ LONG CKey::DeleteValue(LPCWSTR name)
|
||||
}
|
||||
#endif
|
||||
|
||||
LONG CKey::SetValue(LPCTSTR name, UInt32 value)
|
||||
LONG CKey::SetValue(LPCTSTR name, UInt32 value) throw()
|
||||
{
|
||||
MYASSERT(_object != NULL);
|
||||
return RegSetValueEx(_object, name, NULL, REG_DWORD,
|
||||
return RegSetValueEx(_object, name, 0, REG_DWORD,
|
||||
(BYTE * const)&value, sizeof(UInt32));
|
||||
}
|
||||
|
||||
LONG CKey::SetValue(LPCTSTR name, bool value)
|
||||
LONG CKey::SetValue(LPCTSTR name, bool value) throw()
|
||||
{
|
||||
return SetValue(name, BoolToUINT32(value));
|
||||
}
|
||||
|
||||
LONG CKey::SetValue(LPCTSTR name, LPCTSTR value)
|
||||
LONG CKey::SetValue(LPCTSTR name, LPCTSTR value) throw()
|
||||
{
|
||||
MYASSERT(value != NULL);
|
||||
MYASSERT(_object != NULL);
|
||||
return RegSetValueEx(_object, name, NULL, REG_SZ,
|
||||
return RegSetValueEx(_object, name, 0, REG_SZ,
|
||||
(const BYTE * )value, (lstrlen(value) + 1) * sizeof(TCHAR));
|
||||
}
|
||||
|
||||
@@ -159,11 +159,11 @@ LONG CKey::SetValue(LPCWSTR name, LPCWSTR value)
|
||||
#endif
|
||||
|
||||
|
||||
LONG CKey::SetValue(LPCTSTR name, const void *value, UInt32 size)
|
||||
LONG CKey::SetValue(LPCTSTR name, const void *value, UInt32 size) throw()
|
||||
{
|
||||
MYASSERT(value != NULL);
|
||||
MYASSERT(_object != NULL);
|
||||
return RegSetValueEx(_object, name, NULL, REG_BINARY,
|
||||
return RegSetValueEx(_object, name, 0, REG_BINARY,
|
||||
(const BYTE *)value, size);
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ LONG SetValue(HKEY parentKey, LPCTSTR keyName, LPCTSTR valueName, LPCTSTR value)
|
||||
return res;
|
||||
}
|
||||
|
||||
LONG CKey::SetKeyValue(LPCTSTR keyName, LPCTSTR valueName, LPCTSTR value)
|
||||
LONG CKey::SetKeyValue(LPCTSTR keyName, LPCTSTR valueName, LPCTSTR value) throw()
|
||||
{
|
||||
MYASSERT(value != NULL);
|
||||
CKey key;
|
||||
@@ -187,9 +187,9 @@ LONG CKey::SetKeyValue(LPCTSTR keyName, LPCTSTR valueName, LPCTSTR value)
|
||||
return res;
|
||||
}
|
||||
|
||||
LONG CKey::QueryValue(LPCTSTR name, UInt32 &value)
|
||||
LONG CKey::QueryValue(LPCTSTR name, UInt32 &value) throw()
|
||||
{
|
||||
DWORD type = NULL;
|
||||
DWORD type = 0;
|
||||
DWORD count = sizeof(DWORD);
|
||||
LONG res = RegQueryValueEx(_object, (LPTSTR)name, NULL, &type,
|
||||
(LPBYTE)&value, &count);
|
||||
@@ -198,7 +198,7 @@ LONG CKey::QueryValue(LPCTSTR name, UInt32 &value)
|
||||
return res;
|
||||
}
|
||||
|
||||
LONG CKey::QueryValue(LPCTSTR name, bool &value)
|
||||
LONG CKey::QueryValue(LPCTSTR name, bool &value) throw()
|
||||
{
|
||||
UInt32 uintValue = BoolToUINT32(value);
|
||||
LONG res = QueryValue(name, uintValue);
|
||||
@@ -206,7 +206,7 @@ LONG CKey::QueryValue(LPCTSTR name, bool &value)
|
||||
return res;
|
||||
}
|
||||
|
||||
LONG CKey::GetValue_IfOk(LPCTSTR name, UInt32 &value)
|
||||
LONG CKey::GetValue_IfOk(LPCTSTR name, UInt32 &value) throw()
|
||||
{
|
||||
UInt32 newVal;
|
||||
LONG res = QueryValue(name, newVal);
|
||||
@@ -215,7 +215,7 @@ LONG CKey::GetValue_IfOk(LPCTSTR name, UInt32 &value)
|
||||
return res;
|
||||
}
|
||||
|
||||
LONG CKey::GetValue_IfOk(LPCTSTR name, bool &value)
|
||||
LONG CKey::GetValue_IfOk(LPCTSTR name, bool &value) throw()
|
||||
{
|
||||
bool newVal;
|
||||
LONG res = QueryValue(name, newVal);
|
||||
@@ -224,10 +224,10 @@ LONG CKey::GetValue_IfOk(LPCTSTR name, bool &value)
|
||||
return res;
|
||||
}
|
||||
|
||||
LONG CKey::QueryValue(LPCTSTR name, LPTSTR value, UInt32 &count)
|
||||
LONG CKey::QueryValue(LPCTSTR name, LPTSTR value, UInt32 &count) throw()
|
||||
{
|
||||
MYASSERT(count != NULL);
|
||||
DWORD type = NULL;
|
||||
DWORD type = 0;
|
||||
LONG res = RegQueryValueEx(_object, (LPTSTR)name, NULL, &type, (LPBYTE)value, (DWORD *)&count);
|
||||
MYASSERT((res != ERROR_SUCCESS) || (type == REG_SZ) || (type == REG_MULTI_SZ) || (type == REG_EXPAND_SZ));
|
||||
return res;
|
||||
@@ -236,7 +236,7 @@ LONG CKey::QueryValue(LPCTSTR name, LPTSTR value, UInt32 &count)
|
||||
LONG CKey::QueryValue(LPCTSTR name, CSysString &value)
|
||||
{
|
||||
value.Empty();
|
||||
DWORD type = NULL;
|
||||
DWORD type = 0;
|
||||
UInt32 currentSize = 0;
|
||||
LONG res = RegQueryValueEx(_object, (LPTSTR)name, NULL, &type, NULL, (DWORD *)¤tSize);
|
||||
if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA)
|
||||
@@ -250,7 +250,7 @@ LONG CKey::QueryValue(LPCTSTR name, CSysString &value)
|
||||
LONG CKey::QueryValue(LPCWSTR name, LPWSTR value, UInt32 &count)
|
||||
{
|
||||
MYASSERT(count != NULL);
|
||||
DWORD type = NULL;
|
||||
DWORD type = 0;
|
||||
LONG res = RegQueryValueExW(_object, name, NULL, &type, (LPBYTE)value, (DWORD *)&count);
|
||||
MYASSERT((res != ERROR_SUCCESS) || (type == REG_SZ) || (type == REG_MULTI_SZ) || (type == REG_EXPAND_SZ));
|
||||
return res;
|
||||
@@ -258,7 +258,7 @@ LONG CKey::QueryValue(LPCWSTR name, LPWSTR value, UInt32 &count)
|
||||
LONG CKey::QueryValue(LPCWSTR name, UString &value)
|
||||
{
|
||||
value.Empty();
|
||||
DWORD type = NULL;
|
||||
DWORD type = 0;
|
||||
UInt32 currentSize = 0;
|
||||
|
||||
LONG res;
|
||||
@@ -280,9 +280,9 @@ LONG CKey::QueryValue(LPCWSTR name, UString &value)
|
||||
}
|
||||
#endif
|
||||
|
||||
LONG CKey::QueryValue(LPCTSTR name, void *value, UInt32 &count)
|
||||
LONG CKey::QueryValue(LPCTSTR name, void *value, UInt32 &count) throw()
|
||||
{
|
||||
DWORD type = NULL;
|
||||
DWORD type = 0;
|
||||
LONG res = RegQueryValueEx(_object, (LPTSTR)name, NULL, &type, (LPBYTE)value, (DWORD *)&count);
|
||||
MYASSERT((res != ERROR_SUCCESS) || (type == REG_BINARY));
|
||||
return res;
|
||||
@@ -291,7 +291,7 @@ LONG CKey::QueryValue(LPCTSTR name, void *value, UInt32 &count)
|
||||
|
||||
LONG CKey::QueryValue(LPCTSTR name, CByteBuffer &value, UInt32 &dataSize)
|
||||
{
|
||||
DWORD type = NULL;
|
||||
DWORD type = 0;
|
||||
dataSize = 0;
|
||||
LONG res = RegQueryValueEx(_object, (LPTSTR)name, NULL, &type, NULL, (DWORD *)&dataSize);
|
||||
if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA)
|
||||
@@ -321,7 +321,7 @@ LONG CKey::EnumKeys(CSysStringVector &keyNames)
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
LONG CKey::SetValue_Strings(LPCTSTR valueName, const UStringVector &strings)
|
||||
LONG CKey::SetValue_Strings(LPCTSTR valueName, const UStringVector &strings) throw()
|
||||
{
|
||||
UInt32 numChars = 0;
|
||||
unsigned i;
|
||||
|
||||
@@ -16,7 +16,7 @@ static const UInt64 kUnixTimeOffset =
|
||||
(UInt64)60 * 60 * 24 * (89 + 365 * (kUnixTimeStartYear - kFileTimeStartYear));
|
||||
static const UInt64 kNumSecondsInFileTime = (UInt64)(Int64)-1 / kNumTimeQuantumsInSecond;
|
||||
|
||||
bool DosTimeToFileTime(UInt32 dosTime, FILETIME &ft)
|
||||
bool DosTimeToFileTime(UInt32 dosTime, FILETIME &ft) throw()
|
||||
{
|
||||
#if defined(_WIN32) && !defined(UNDER_CE)
|
||||
return BOOLToBool(::DosDateTimeToFileTime((UInt16)(dosTime >> 16), (UInt16)(dosTime & 0xFFFF), &ft));
|
||||
@@ -41,7 +41,7 @@ static const UInt32 kLowDosTime = 0x210000;
|
||||
#define PERIOD_100 (PERIOD_4 * 25 - 1)
|
||||
#define PERIOD_400 (PERIOD_100 * 4 + 1)
|
||||
|
||||
bool FileTimeToDosTime(const FILETIME &ft, UInt32 &dosTime)
|
||||
bool FileTimeToDosTime(const FILETIME &ft, UInt32 &dosTime) throw()
|
||||
{
|
||||
#if defined(_WIN32) && !defined(UNDER_CE)
|
||||
|
||||
@@ -115,31 +115,25 @@ bool FileTimeToDosTime(const FILETIME &ft, UInt32 &dosTime)
|
||||
return true;
|
||||
}
|
||||
|
||||
void UnixTimeToFileTime(UInt32 unixTime, FILETIME &ft)
|
||||
void UnixTimeToFileTime(UInt32 unixTime, FILETIME &ft) throw()
|
||||
{
|
||||
UInt64 v = (kUnixTimeOffset + (UInt64)unixTime) * kNumTimeQuantumsInSecond;
|
||||
ft.dwLowDateTime = (DWORD)v;
|
||||
ft.dwHighDateTime = (DWORD)(v >> 32);
|
||||
}
|
||||
|
||||
bool UnixTime64ToFileTime(Int64 unixTime, FILETIME &ft)
|
||||
bool UnixTime64ToFileTime(Int64 unixTime, FILETIME &ft) throw()
|
||||
{
|
||||
Int64 v = (Int64)kUnixTimeOffset + unixTime;
|
||||
if (unixTime < 0)
|
||||
if (unixTime > kNumSecondsInFileTime - kUnixTimeOffset)
|
||||
{
|
||||
if (v < 0)
|
||||
{
|
||||
ft.dwLowDateTime = ft.dwHighDateTime = 0;
|
||||
return false;
|
||||
}
|
||||
ft.dwLowDateTime = ft.dwHighDateTime = (UInt32)(Int32)-1;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
Int64 v = (Int64)kUnixTimeOffset + unixTime;
|
||||
if (v < 0)
|
||||
{
|
||||
if (v < unixTime || v > kNumSecondsInFileTime)
|
||||
{
|
||||
ft.dwLowDateTime = ft.dwHighDateTime = (UInt32)(Int32)-1;
|
||||
return false;
|
||||
}
|
||||
ft.dwLowDateTime = ft.dwHighDateTime = 0;
|
||||
return false;
|
||||
}
|
||||
UInt64 v2 = (UInt64)v * kNumTimeQuantumsInSecond;
|
||||
ft.dwLowDateTime = (DWORD)v2;
|
||||
@@ -147,13 +141,13 @@ bool UnixTime64ToFileTime(Int64 unixTime, FILETIME &ft)
|
||||
return true;
|
||||
}
|
||||
|
||||
Int64 FileTimeToUnixTime64(const FILETIME &ft)
|
||||
Int64 FileTimeToUnixTime64(const FILETIME &ft) throw()
|
||||
{
|
||||
UInt64 winTime = (((UInt64)ft.dwHighDateTime) << 32) + ft.dwLowDateTime;
|
||||
return (Int64)(winTime / kNumTimeQuantumsInSecond) - kUnixTimeOffset;
|
||||
}
|
||||
|
||||
bool FileTimeToUnixTime(const FILETIME &ft, UInt32 &unixTime)
|
||||
bool FileTimeToUnixTime(const FILETIME &ft, UInt32 &unixTime) throw()
|
||||
{
|
||||
UInt64 winTime = (((UInt64)ft.dwHighDateTime) << 32) + ft.dwLowDateTime;
|
||||
winTime /= kNumTimeQuantumsInSecond;
|
||||
@@ -173,7 +167,7 @@ bool FileTimeToUnixTime(const FILETIME &ft, UInt32 &unixTime)
|
||||
}
|
||||
|
||||
bool GetSecondsSince1601(unsigned year, unsigned month, unsigned day,
|
||||
unsigned hour, unsigned min, unsigned sec, UInt64 &resSeconds)
|
||||
unsigned hour, unsigned min, unsigned sec, UInt64 &resSeconds) throw()
|
||||
{
|
||||
resSeconds = 0;
|
||||
if (year < kFileTimeStartYear || year >= 10000 || month < 1 || month > 12 ||
|
||||
@@ -192,7 +186,7 @@ bool GetSecondsSince1601(unsigned year, unsigned month, unsigned day,
|
||||
return true;
|
||||
}
|
||||
|
||||
void GetCurUtcFileTime(FILETIME &ft)
|
||||
void GetCurUtcFileTime(FILETIME &ft) throw()
|
||||
{
|
||||
// Both variants provide same low resolution on WinXP: about 15 ms.
|
||||
// But GetSystemTimeAsFileTime is much faster.
|
||||
|
||||
@@ -238,7 +238,7 @@ public:
|
||||
|
||||
bool SetText(LPCTSTR s) { return BOOLToBool(::SetWindowText(_window, s)); }
|
||||
#ifndef _UNICODE
|
||||
bool CWindow::SetText(LPCWSTR s) { return MySetWindowText(_window, s); }
|
||||
bool SetText(LPCWSTR s) { return MySetWindowText(_window, s); }
|
||||
#endif
|
||||
|
||||
int GetTextLength() const
|
||||
|
||||
Reference in New Issue
Block a user