Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Read CD Serial Number by code

Posted on 2002-06-26
9
Medium Priority
?
190 Views
Last Modified: 2010-04-04
Dear friends,

you can see a serial number( I guess it is the Serial Number) at the face of a CD when you buy a Empty CD ( for write ). is it realy the S/N ? if yes, is there any way to read it by code ? I used GetVolumeInformation API function. but it got me the Volume S/N which is not my need. I need It for CD copy Protection.

best regards
Hamed
0
Comment
Question by:h_mohsenian
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 8

Accepted Solution

by:
Cesario earned 900 total points
ID: 7110131
Hi Hamed,

you can try this code :

The cd may or may not have a serial number and/or Universal Product
Code embedded in the cd. The MCI Windows extension does provide this
functionality through the MCI_INFO_MEDIA_IDENTITY command. This
command will return a unique ID string consisting of 16 hexadecimal
digits.

Example:

uses MMSystem, MPlayer;

procedure TForm1.Button1Click(Sender: TObject);
var
  mp : TMediaPlayer;
  msp : TMCI_INFO_PARMS;
  MediaString : array[0..255] of char;
  ret : longint;
begin
  mp := TMediaPlayer.Create(nil);
  mp.Visible := false;
  mp.Parent := Application.MainForm;
  mp.Shareable := true;
  mp.DeviceType := dtCDAudio;
  mp.FileName := 'D:';
  mp.Open;
  Application.ProcessMessages;
  FillChar(MediaString, sizeof(MediaString), #0);
  FillChar(msp, sizeof(msp), #0);
  msp.lpstrReturn := @MediaString;
  msp.dwRetSize := 255;
  ret := mciSendCommand(Mp.DeviceId,
                        MCI_INFO,
                        MCI_INFO_MEDIA_IDENTITY,
                        longint(@msp));
  if Ret <> 0 then begin
   MciGetErrorString(ret, @MediaString, sizeof(MediaString));
   Memo1.Lines.Add(StrPas(MediaString));
  end else
    Memo1.Lines.Add(StrPas(MediaString));
  mp.Close;
  Application.ProcessMessages;
  mp.free;
end;

I wish you good luck

Cesario
0
 
LVL 12

Expert Comment

by:Lee_Nover
ID: 7110153
you can't really use that S/N as cd copy protection
the thing is everytime you write to a CD it changes !!
so you might think of another protection

a good protection utility is ProActivate from TurboPower
http://www.turbopower.com/products/proactivate/
0
 
LVL 3

Expert Comment

by:lopem
ID: 7111597
listening...
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:lopem
ID: 7111600
hi there!

what happens  when you copy a complete CD. Is this a bit to bit perfect copy? or there is a way to find out if the CD is a copy or an original?

best regards
Manuel Lopez (lopem)
0
 
LVL 1

Author Comment

by:h_mohsenian
ID: 7114137
thanks for all,

1.Cesario:
I have a problem with your code, you have this line :

 mp.FileName := 'D:';

my CD drive is "H:" , and I guess I should changed your code as :
 
mp.FileName := 'H:';

am I right ? but there is not any difference in result. infact it shows the same Number that if I use "C:" , "D:" and other HDD drives.

can you tell me what is the problem ?

---------------------------------------------------

Lee_Nover :

you are right, after each CD write the S/N changes ( the S/N which can be read by GetVolumeInformation ) but S/N CD protection was my recomendation to one of my friends :p :D , there for I have to find a similar way ;-) .

lopem :
I dont know , but I think about Files copy it must be a byte to byte copy like our Block read write in pascal. ( just I guess ).

Hamed
0
 
LVL 12

Expert Comment

by:Lee_Nover
ID: 7114372
the .Filename part should be :='d:\' .. don't forget the backslash
0
 
LVL 1

Author Comment

by:h_mohsenian
ID: 7116958
I tested again by BACKSLASH. but there was not any differance in Result ( again I saw equal Numbers for HDD drievs and CD Driv ).
0
 
LVL 1

Author Comment

by:h_mohsenian
ID: 7117013
I test it again by two different CD and it works. infact BACKSLASH was not important. it works just by CD Dirve and HDD Drive Char is not works. infact i saw a more interesting result . THE DRIVE SETTING IS NOT IMPORTANT, it means that I checked this by 'C:' not 'H:' and it got me the CD Number again :-))) . I recomend you to test it yourself.

anyways, As I said it worked and got me a different number for two different CD. but now I have a question, are you sure that by CD writing it will not changed ( like Volume serial Number that I mentioned above ). and also is it a unique number for each CD ??? I will test the first question ( S/N change with write ) but I can not test the second question ( the unique number )

thanks
Hamed
0
 
LVL 12

Expert Comment

by:Lee_Nover
ID: 7164397
buy a pack of cd's ... they will probably be of the same production class
with disks this results in them having the same ID
dunno bout CDs .. you'll just have to check
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question