-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFile.cpp
More file actions
49 lines (42 loc) · 830 Bytes
/
File.cpp
File metadata and controls
49 lines (42 loc) · 830 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// File.cpp : implementation file
//
#include "pch.h"
#include "CdBurnApp.h"
#include "File.h"
#define SECTOR_SIZE 2048
// File
IMPLEMENT_DYNAMIC(File, Base)
File::File(const CString& path) : Base(path)
{
m_pStream = NULL;
}
File::~File()
{
if (m_pStream != NULL)
{
m_pStream->Release();
}
}
//CreateStreamOnHGlobal
IStream* File::createStream() {
if (m_pStream == NULL )
{
SHCreateStreamOnFileEx(m_path,
STGM_READ | STGM_SHARE_DENY_NONE | STGM_DELETEONRELEASE,
FILE_ATTRIBUTE_NORMAL,
FALSE,
NULL,
&m_pStream);
}
return m_pStream;
}
ULONGLONG File::GetSize() {
CFileStatus fileStatus;
if (CFile::GetStatus(m_path, fileStatus)) {
if (fileStatus.m_size>0)
{
return ((fileStatus.m_size / SECTOR_SIZE) + 1) * SECTOR_SIZE;
}
}
return 0;
}