Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help for how to access SD memory card using DeviceIoControl - mmj81

258 views
Skip to first unread message

mmyy

unread,
Sep 25, 2008, 11:47:07 PM9/25/08
to
any solution to this ?

Chris P.

unread,
Sep 26, 2008, 10:14:06 AM9/26/08
to
On Thu, 25 Sep 2008 20:47:07 -0700, mmyy wrote:

> any solution to this ?

What are you trying to accomplish? By default they operate as a disk
device so you can use the disk DeviceIO messages.

--
http://www.chrisnet.net/code.htm
[MS MVP for DirectShow / MediaFoundation]

mmyy

unread,
Oct 2, 2008, 4:54:07 AM10/2/08
to
As mmj81 stated, user-mode application could use DeviceIoControl() to send SD commands (cmd0, ... those defined in SD card physical specification) to SD memory card directly.
(Of couse this memory card must be plugged into NoteBook computer directly instead of employing a card reader).

For example, DeviceIoControl(hVol, IOCTL_SFFDISK_DEVICE_COMMAND, structure of SFFDISK_DEVICE_COMMAND_DATA, ...)

Here comes the problem:
In SFFDISK_DEVICE_COMMAND_DATA structure in sffdisk.h, one field "Command" of enumeration type SFFDISK_DCMD indicate "the kind of action" to be performed.

This field could be
SFFDISK_DC_GET_VERSION,
SFFDISK_DC_LOCK_CHANNEL,
SFFDISK_DC_UNLOCK_CHANNEL,
SFFDISK_DC_DEVICE_COMMAND

For the three former cases, DeviceIoControl() works correctly, but for the later one, it always fails with errorce 5 (access denied)

This user-mode application is run under "Administrator" logon session.

I tried to clear DACL of this SD card such that everyone has fully access to this memory card.

But DeviceIoControl() still terminates with ERROR_ACCESS_DENIED.

Accroding to MSDN cc500400,
Handle to Logical and Physical disk drives might be different. I tried both cases but DeviceIoControl() still does not function.

Any one could help this ?

mmyy

unread,
Oct 2, 2008, 5:26:33 AM10/2/08
to
Would pay for a total solution. (one hundred united states dolloars thru PayPal; nevertheless expect it by 10 Oct 08

Chris P.

unread,
Oct 2, 2008, 11:32:55 AM10/2/08
to
On Thu, 02 Oct 2008 01:54:07 -0700, mm yy wrote:

> But DeviceIoControl() still terminates with ERROR_ACCESS_DENIED.
>
> Accroding to MSDN cc500400,
> Handle to Logical and Physical disk drives might be different. I tried both cases but DeviceIoControl() still does not function.

How are you opening the device handle, as a drive letter or a volume?

You may get different results with:

CreateFile("\\.\PhysicalDrive2" ...
vs
CreateFile("\\.\X:" ...

Also you may have different results (due to different device permissions)
on Vista vs XP. I'm no expert on SD memory devices unfortunately.

0 new messages