mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-06 15:14:59 -06:00
9.04 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
8874e4fbc9
commit
829409452d
@@ -5,26 +5,29 @@
|
||||
|
||||
#include "../Common/Types.h"
|
||||
|
||||
#include "Defs.h"
|
||||
|
||||
namespace NWindows {
|
||||
namespace NFile {
|
||||
namespace NIO {
|
||||
|
||||
struct CByHandleFileInfo
|
||||
{
|
||||
DWORD Attributes;
|
||||
DWORD Attrib;
|
||||
FILETIME CTime;
|
||||
FILETIME ATime;
|
||||
FILETIME MTime;
|
||||
DWORD VolumeSerialNumber;
|
||||
UInt64 Size;
|
||||
DWORD NumberOfLinks;
|
||||
UInt64 FileIndex;
|
||||
DWORD VolumeSerialNumber;
|
||||
UInt64 Size;
|
||||
DWORD NumberOfLinks;
|
||||
UInt64 FileIndex;
|
||||
};
|
||||
|
||||
class CFileBase
|
||||
{
|
||||
protected:
|
||||
HANDLE _handle;
|
||||
|
||||
bool Create(LPCTSTR fileName, DWORD desiredAccess,
|
||||
DWORD shareMode, DWORD creationDisposition, DWORD flagsAndAttributes);
|
||||
#ifndef _UNICODE
|
||||
@@ -33,7 +36,13 @@ protected:
|
||||
#endif
|
||||
|
||||
public:
|
||||
CFileBase(): _handle(INVALID_HANDLE_VALUE){};
|
||||
#ifdef SUPPORT_DEVICE_FILE
|
||||
bool IsDeviceFile;
|
||||
bool LengthDefined;
|
||||
UInt64 Length;
|
||||
#endif
|
||||
|
||||
CFileBase(): _handle(INVALID_HANDLE_VALUE) {};
|
||||
~CFileBase();
|
||||
|
||||
bool Close();
|
||||
@@ -49,8 +58,42 @@ public:
|
||||
bool GetFileInformation(CByHandleFileInfo &fileInfo) const;
|
||||
};
|
||||
|
||||
#define IOCTL_CDROM_BASE FILE_DEVICE_CD_ROM
|
||||
#define IOCTL_CDROM_GET_DRIVE_GEOMETRY CTL_CODE(IOCTL_CDROM_BASE, 0x0013, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||
#define IOCTL_CDROM_MEDIA_REMOVAL CTL_CODE(IOCTL_CDROM_BASE, 0x0201, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||
|
||||
class CInFile: public CFileBase
|
||||
{
|
||||
#ifdef SUPPORT_DEVICE_FILE
|
||||
bool DeviceIoControl(DWORD controlCode, LPVOID inBuffer, DWORD inSize,
|
||||
LPVOID outBuffer, DWORD outSize, LPDWORD bytesReturned, LPOVERLAPPED overlapped) const
|
||||
{
|
||||
return BOOLToBool(::DeviceIoControl(_handle, controlCode, inBuffer, inSize,
|
||||
outBuffer, outSize, bytesReturned, overlapped));
|
||||
}
|
||||
|
||||
bool DeviceIoControl(DWORD controlCode, LPVOID inBuffer,
|
||||
DWORD inSize, LPVOID outBuffer, DWORD outSize) const
|
||||
{
|
||||
DWORD ret;
|
||||
return DeviceIoControl(controlCode, inBuffer, inSize, outBuffer, outSize, &ret, 0);
|
||||
}
|
||||
|
||||
bool DeviceIoControlOut(DWORD controlCode, LPVOID outBuffer, DWORD outSize) const
|
||||
{ return DeviceIoControl(controlCode, NULL, 0, outBuffer, outSize); }
|
||||
|
||||
bool GetGeometry(DISK_GEOMETRY *res) const
|
||||
{ return DeviceIoControlOut(IOCTL_DISK_GET_DRIVE_GEOMETRY, res, sizeof(*res)); }
|
||||
|
||||
bool GetCdRomGeometry(DISK_GEOMETRY *res) const
|
||||
{ return DeviceIoControlOut(IOCTL_CDROM_GET_DRIVE_GEOMETRY, res, sizeof(*res)); }
|
||||
|
||||
bool GetPartitionInfo(PARTITION_INFORMATION *res)
|
||||
{ return DeviceIoControlOut(IOCTL_DISK_GET_PARTITION_INFO, LPVOID(res), sizeof(*res)); }
|
||||
|
||||
void GetDeviceLength();
|
||||
#endif
|
||||
|
||||
public:
|
||||
bool Open(LPCTSTR fileName, DWORD shareMode, DWORD creationDisposition, DWORD flagsAndAttributes);
|
||||
bool OpenShared(LPCTSTR fileName, bool shareForWrite);
|
||||
@@ -60,15 +103,14 @@ public:
|
||||
bool OpenShared(LPCWSTR fileName, bool shareForWrite);
|
||||
bool Open(LPCWSTR fileName);
|
||||
#endif
|
||||
bool Read1(void *data, UInt32 size, UInt32 &processedSize);
|
||||
bool ReadPart(void *data, UInt32 size, UInt32 &processedSize);
|
||||
bool Read(void *data, UInt32 size, UInt32 &processedSize);
|
||||
};
|
||||
|
||||
class COutFile: public CFileBase
|
||||
{
|
||||
// DWORD m_CreationDisposition;
|
||||
public:
|
||||
// COutFile(): m_CreationDisposition(CREATE_NEW){};
|
||||
bool Open(LPCTSTR fileName, DWORD shareMode, DWORD creationDisposition, DWORD flagsAndAttributes);
|
||||
bool Open(LPCTSTR fileName, DWORD creationDisposition);
|
||||
bool Create(LPCTSTR fileName, bool createAlways);
|
||||
@@ -79,13 +121,6 @@ public:
|
||||
bool Create(LPCWSTR fileName, bool createAlways);
|
||||
#endif
|
||||
|
||||
/*
|
||||
void SetOpenCreationDisposition(DWORD creationDisposition)
|
||||
{ m_CreationDisposition = creationDisposition; }
|
||||
void SetOpenCreationDispositionCreateAlways()
|
||||
{ m_CreationDisposition = CREATE_ALWAYS; }
|
||||
*/
|
||||
|
||||
bool SetTime(const FILETIME *cTime, const FILETIME *aTime, const FILETIME *mTime);
|
||||
bool SetMTime(const FILETIME *mTime);
|
||||
bool WritePart(const void *data, UInt32 size, UInt32 &processedSize);
|
||||
|
||||
Reference in New Issue
Block a user