Lazarus

Installation => PDAs and Smartphones => Topic started by: AndieSphinx on April 18, 2007, 04:35:11 pm

Title: Read SDCard ID on WinCE?
Post by: AndieSphinx 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)
Title: Re: Read SDCard ID on WinCE?
Post by: felipemdc 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
Title: RE: Re: Read SDCard ID on WinCE?
Post by: AndieSphinx 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 ?
Title: Re: RE: Re: Read SDCard ID on WinCE?
Post by: felipemdc on April 18, 2007, 05:34:54 pm
Quote from: "AndieSphinx"
which unit uses this inc ?


Windows.pas
Title: RE: Re: RE: Re: Read SDCard ID on WinCE?
Post by: AndieSphinx on April 18, 2007, 07:25:13 pm
Sure. But its included, and GetVolumeInformation still undefined :(
Title: RE: Re: RE: Re: Read SDCard ID on WinCE?
Post by: antonio 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.
Title: RE: Re: RE: Re: Read SDCard ID on WinCE?
Post by: felipemdc 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
Title: RE: Re: RE: Re: Read SDCard ID on WinCE?
Post by: Zaher on April 19, 2007, 12:15:27 am
I have this links in my favorite but not tested yet.
http://www.pocketpcdn.com/articles/serial_number2002.html
http://www.pocketpcdn.com/articles/serial_number.html
Title: RE: Re: RE: Re: Read SDCard ID on WinCE?
Post by: AndieSphinx 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 :(
Title: Re: Read SDCard ID on WinCE?
Post by: heller_andrei on February 17, 2014, 06:49:20 pm
Good afternoon. Please help. How to get the ID SD Card?
TinyPortal © 2005-2018