EldoS | Feel safer!

Software components for data protection, secure storage and transfer

RawDisk and CDRom

Also by EldoS: CallbackProcess
A component to control process creation and termination in Windows and .NET applications.
#20661
Posted: 06/28/2012 12:45:56
by Oleg Akopov (Standard support level)
Joined: 05/06/2012
Posts: 5

I'm facing a disturbing problem - Open/OpenEx works perfectly fot "\??\PhysicalDrive0", but fails for "\??\Cdrom0" with ErrorCode 5 (Access Denied). The same parameters for normal CreateFile/CreateFileEx work fine, so this cannot be a problem with authorization. Is it a known limitation? I would like to have a single point for getting device handlers, without special handling of CdRoms.
#20697
Posted: 06/30/2012 13:05:57
by Volodymyr Zinin (EldoS Corp.)

Check if you open "\??\Cdrom0" with "read-only" access.
Also the cdrom devices usually (or always) have 4096 byte sector size. So reading from them is allowed only by chunks that are multiple and aligned to 4096.
#20700
Posted: 07/01/2012 11:03:21
by Oleg Akopov (Standard support level)
Joined: 05/06/2012
Posts: 5

Yes, with GENERIC_WRITE it's OpenEx fails with Access Denied. But if I use only GENERIC_READ, then DeviceIOControl fails with the same "Access Denied" error. Without changing anything in my code, but just using the handle got from standard CreateFile, DeviceIOControl works fine.

One important note: I call RawDisk from Delphi XE2 directly using CreateFile with proper parameters, without standard VCL (which does not support XE2).
#20701
Posted: 07/01/2012 18:00:32
by Oleg Akopov (Standard support level)
Joined: 05/06/2012
Posts: 5

Ok, an only type of operation which fails so far with DeviceIOControl is IOCTL_SCSI_PASS_THROUGH / IOCTL_SCSI_PASS_THROUGH_DIRECT.

After further experiments I've found out that on 64-bit platform RawDisk expects SCSI_PASS_THROUGH / SCSI_PASS_THROUGH_DIRECT structures in 64-bit format even from 32-bit application. In all other cases it fails with error 1306.

But now there is a new problem: even for PhysicalDrive it still fails, this time with error 87. When I use absolutely the same parameters with Handle received from CreateFile directly (admin access, UAC off) - everything is fine.

Any ideas?
#20704
Posted: 07/02/2012 03:38:33
by Volodymyr Zinin (EldoS Corp.)

Quote
Oleg Akopov wrote:
Ok, an only type of operation which fails so far with DeviceIOControl is IOCTL_SCSI_PASS_THROUGH / IOCTL_SCSI_PASS_THROUGH_DIRECT.

This is because these IOCTLs require read-write access for a handle which is used for these calls. Please create a ticket in HelpDesk and I'll give you a test driver where it will be possible to create such handle.

Quote
Oleg Akopov wrote:
After further experiments I've found out that on 64-bit platform RawDisk expects SCSI_PASS_THROUGH / SCSI_PASS_THROUGH_DIRECT structures in 64-bit format even from 32-bit application.

Kernel mode drivers on 64-bit OSes are always 64-bit. So they expect 64-bit format for the structures. RawDisk does nothing with input/output data, so your code should check on what a platform it's running and correct the data.

Quote
Oleg Akopov wrote:
But now there is a new problem: even for PhysicalDrive it still fails, this time with error 87. When I use absolutely the same parameters with Handle received from CreateFile directly (admin access, UAC off) - everything is fine.

Let's continue the discussion in HelpDesk.
#20709
Posted: 07/02/2012 08:29:36
by Oleg Akopov (Standard support level)
Joined: 05/06/2012
Posts: 5

Ticket # 21072. Спасибо!
Also by EldoS: BizCrypto
Components for BizTalk® and SQL Server® Integration Services that let you securely store and transfer information in your business automation solutions.

Reply

Statistics

Topic viewed 5494 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!