* * *

Author Topic: Read SDCard ID on WinCE?  (Read 13871 times)

AndieSphinx

  • New member
  • *
  • Posts: 23
Read SDCard ID on WinCE?
« on: April 18, 2007, 04:35:11 pm »
Now, I'm reached a point, which is white spot before me.
I would like to read the ID of the inserted SD card in the PDA. This is because for some protection and legacy reasons.
How can I access this ID? Is the SDCard some device?

I've found a C sample here: http://www.pcreview.co.uk/forums/thread-1301261.php

I've tried to port it to freepascal, but I'm stucked at IOCTL_DISK_GET_STORAGEID. I couldn't find such routine.

Any idea to retrieve such unique ID of the SDcard?

(I've checked registry, if I insert the card, some new line appears:

[HKEY_LOCAL_MACHINE\Drivers\Active\27]
"Hnd"=dword:005e6360
"Name"="DSK1:"
"Key"="\\Drivers\\SDCARD\\ClientDrivers\\Class\\SDMemory_Class"
"ClientInfo"=dword:005e5b48
"Sckt"=dword:00000000

But this is not the ID, my SD card ID is something like 440000E3.
(I've found a program, called CardID.exe, which retrieves this ID somehow)

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3537
Re: Read SDCard ID on WinCE?
« Reply #1 on: April 18, 2007, 04:49:23 pm »
Quote from: "AndieSphinx"
I've tried to port it to freepascal, but I'm stucked at IOCTL_DISK_GET_STORAGEID. I couldn't find such routine.


It´s not a routine. It´s a a constant. There are several approaches to get it.

I would start with a full text search on the free pascal sources to see if it´s on windows.pas or another file. Lazarus has a extremely convenient dialog to make full text searches on a directory and all it´s subdirs. It´s on Search -> Find in Files

If this doesn´t work google for the value of this constant and manually add it to your code

AndieSphinx

  • New member
  • *
  • Posts: 23
RE: Re: Read SDCard ID on WinCE?
« Reply #2 on: April 18, 2007, 05:17:13 pm »
Umm, I'll try this.
But btw I've found a new path: GetVolumeInformation
This works in delphi, uses the Windows.pas, but its missing in Lazarus :(

Perhaps I could use it somehow? I've found this function in defines.inc and redef.inc (in winCE directory of lazarus)
which unit uses this inc ?

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3537
Re: RE: Re: Read SDCard ID on WinCE?
« Reply #3 on: April 18, 2007, 05:34:54 pm »
Quote from: "AndieSphinx"
which unit uses this inc ?


Windows.pas

AndieSphinx

  • New member
  • *
  • Posts: 23
RE: Re: RE: Re: Read SDCard ID on WinCE?
« Reply #4 on: April 18, 2007, 07:25:13 pm »
Sure. But its included, and GetVolumeInformation still undefined :(

antonio

  • Hero Member
  • *****
  • Posts: 605
RE: Re: RE: Re: Read SDCard ID on WinCE?
« Reply #5 on: April 18, 2007, 08:07:43 pm »
GetVolumeInformation is a function declared on C:\lazarus\fpc\2.0.4\source\fcl\netware\nwnit.pp.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3537
RE: Re: RE: Re: Read SDCard ID on WinCE?
« Reply #6 on: April 18, 2007, 08:31:33 pm »
The netware directory isn´t for windows operating system AFAIK

To see who includes redef.inc and defines.inc do another search, this time for {$include defines.inc} or similar

Zaher

  • Hero Member
  • *****
  • Posts: 542
    • parmaja.com
RE: Re: RE: Re: Read SDCard ID on WinCE?
« Reply #7 on: April 19, 2007, 12:15:27 am »

AndieSphinx

  • New member
  • *
  • Posts: 23
RE: Re: RE: Re: Read SDCard ID on WinCE?
« Reply #8 on: April 19, 2007, 09:56:52 am »
sekel: I've found the {$i defines.inc} line in the ...\units\arm-wince\windows.pp, \rtl\windows.o, .ppu files. I tought, that this unit (windows) will recognize the GetVolumeInformation, but unfortunately, it doesn't. I even can't find such function in the windows unit. :( I don't know, how could I proceed further.

zaher: Thanx for the sources, my only problem, that these must be ported to FP, and I'm a bit weak in C, so I think, I will need an already pascalized code :(

heller_andrei

  • Newbie
  • Posts: 1
Re: Read SDCard ID on WinCE?
« Reply #9 on: February 17, 2014, 06:49:20 pm »
Good afternoon. Please help. How to get the ID SD Card?

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus