Skip to content

Commit

Permalink
b4304 -- Уточнение 4302.
Browse files Browse the repository at this point in the history
  • Loading branch information
w17 committed Mar 12, 2015
1 parent 9d6eb0d commit 13c11b3
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
19 changes: 12 additions & 7 deletions far/cache.cpp
Expand Up @@ -54,16 +54,21 @@ void CachedRead::AdjustAlignment()
if (!file.Opened())
return;

DWORD ret;
size_t buff_size = Buffer.size();
DISK_GEOMETRY g;
auto buff_size = Buffer.size();

if (file.IoControl(IOCTL_DISK_GET_DRIVE_GEOMETRY, nullptr,0, &g, sizeof(g), &ret, nullptr))
STORAGE_PROPERTY_QUERY q;
DWORD ret = 0;
STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR a = {0};

q.QueryType = PropertyStandardQuery;
q.PropertyId = StorageAccessAlignmentProperty;

if (file.IoControl(IOCTL_STORAGE_QUERY_PROPERTY, &q,sizeof(q), &a,sizeof(a), &ret, nullptr))
{
if (g.BytesPerSector > 512 && g.BytesPerSector <= 256*1024)
if (a.BytesPerPhysicalSector > 512 && a.BytesPerPhysicalSector <= 256*1024)
{
Alignment = (int)g.BytesPerSector;
buff_size = 16 * g.BytesPerSector;
Alignment = (int)a.BytesPerPhysicalSector;
buff_size = 16 * a.BytesPerPhysicalSector;
}
file.IoControl(FSCTL_ALLOW_EXTENDED_DASD_IO, nullptr,0, nullptr,0, &ret,nullptr);
}
Expand Down
6 changes: 1 addition & 5 deletions far/cddrv.cpp
Expand Up @@ -38,7 +38,6 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "drivemix.hpp"
#include "flink.hpp"
#include "pathmix.hpp"
#include "elevation.hpp"

enum CDROM_DeviceCapabilities
{
Expand Down Expand Up @@ -441,12 +440,9 @@ UINT FAR_GetDriveType(const string& RootDir, DWORD Detect)
string drive = HasPathPrefix(strRootDir) ? strRootDir : L"\\\\?\\" + strRootDir;
DeleteEndSlash(drive);

SCOPED_ACTION(elevation::suppress);

DrvType = DRIVE_USBDRIVE; // default type if detection failed

api::fs::file Device;
if (Device.Open(drive, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, nullptr, OPEN_EXISTING))
if (Device.Open(drive, STANDARD_RIGHTS_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, nullptr, OPEN_EXISTING))
{
DISK_GEOMETRY g;
DWORD dwOutBytes;
Expand Down
6 changes: 5 additions & 1 deletion far/changelog
@@ -1,4 +1,8 @@
drkns 11.03.2015 20:07:31 +0200 - build 4303
w17 12.03.2015 17:40:22 +0300 - build 4304

1. Уточнение 4302.

drkns 11.03.2015 20:07:31 +0200 - build 4303

1. Уточнение 4298.

Expand Down
2 changes: 1 addition & 1 deletion far/vbuild.m4
@@ -1 +1 @@
m4_define(BUILD,4303)m4_dnl
m4_define(BUILD,4304)m4_dnl

0 comments on commit 13c11b3

Please sign in to comment.