Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Disk Identification

Posted on 2003-03-03
14
Medium Priority
?
532 Views
Last Modified: 2010-04-16
I want to find the identification reference of a CD-ROM so that I can include it as part of the copy security for a program. There seem to be a host of routines for finding the size, type and location of disks but I have drawn a blank on the Disk Identifiation refernce. The API DRIVE_LAYOUT_INFORMATION function looks promising but I have yet to try it.

Anyone have any simple ideas?
0
Comment
Question by:KCBrecks
[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
  • 3
  • +4
14 Comments
 
LVL 3

Expert Comment

by:marcoszorrilla
ID: 8057551
Try this function:

function TipoDeDisco(RaizDisco: string): string;
               var
                 i: word;
               begin
                 i := GetDriveType(PChar(LowerCase(RaizDisco)));
                 case i of
                   { Unknown }
                   0:               result := 'no puedo determinarlo';
                   { it doesn't exist }
                   1:               result := 'no existe';
                   { Floppy }
                   DRIVE_REMOVABLE: result := 'floppy/extraible';
                   { Fixed }
                   DRIVE_FIXED:     result := 'disco fijo';
                   { Net unit }
                   DRIVE_REMOTE:    result := 'unidad de red';
                   { CD-ROM }
                   DRIVE_CDROM:     result := 'cd-rom';
                   { Ram Drive }
                   DRIVE_RAMDISK:   result := 'disco-ram';
                 end;
               end;


Example of Call:

procedure TForm1.Button1Click(Sender: TObject);
Var
nCont:Integer;
begin
  for nCont:=1 to 26 do
  begin

    if tipoDedisco(chr(nCont+64)+':\') ='cd-rom' then
    listbox1.Items.Add( chr(nCont+64)+':\ es una unidad CD-Rom');

  end;

end;

Best Regards
Marcos.
0
 
LVL 1

Expert Comment

by:Wax0r
ID: 8057931
After having a quick look at the code above it doesn't seem to do more but show you the type of disc.

What you might want to do is a CRC check on the CDROM on several files and include these in your program.

CRC values are unique and if the CRC checks on any of the files fail when you are matching them with the ones you've already made you know something is wrong..

If this is not what you are looking for please explain the contex of what you're doing, thanks.
0
 
LVL 3

Accepted Solution

by:
tongalite earned 200 total points
ID: 8058143
Hi,

Will this do what you want? :-)

T.
=====================

procedure TForm1.Button1Click(Sender: TObject);
var
  VolumeName,
  FileSystemName     : array [0..MAX_PATH-1] of Char;
  VolumeSerialNo     : DWord;
  MaxComponentLength,
  FileSystemFlags    : Integer;
begin
  GetVolumeInformation('D:\',VolumeName,MAX_PATH,@VolumeSerialNo,
                       MaxComponentLength,FileSystemFlags,
                       FileSystemName,MAX_PATH);
  Memo1.Lines.Add('VName = '+VolumeName);
  Memo1.Lines.Add('SerialNo = $'+IntToHex(VolumeSerialNo,8));
  Memo1.Lines.Add('CompLen = '+IntToStr(MaxComponentLength));
  Memo1.Lines.Add('Flags = $'+IntToHex(FileSystemFlags,4));
  Memo1.Lines.Add('FSName = '+FileSystemName);
end;
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 3

Expert Comment

by:tongalite
ID: 8058155
Oops!
Thought you meant disk
T.
0
 

Author Comment

by:KCBrecks
ID: 8063247
The solution offered by tongalite has worked. It needed one slight alteration though as the 'MaxComponentLength,
 FileSystemFlags    : Integer;' variable declaration needed changing to DWord variables. It gives all the information I want.

0
 
LVL 12

Expert Comment

by:esoftbg
ID: 8244538
you can download a programm DISKSN.exe from:
http://eo-soft.addr.com/
0
 

Author Comment

by:KCBrecks
ID: 8246509
For esoftbq

I downloaded your DISKSN.exe and yes it does give the serial number, however that is the bit of code I was looking for so that I could incorporate it into a setup routine.

You also mention your Catalog software. I was surprised to see you were linking this to Interbase wich seems a bit overkill as not many people would have this database program available. I have written the sort of cataloguing software you list, without using databse engines at all. They are fast, capable and small. The storage and interpretation takes a bit more work but in the end you have a much more sleable product.

A pointer to the Serial Number code could be responded to with a suggestion of alternatives to dabase engines.
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 8247804
Dear KCBrecks,
if you like i will give you DISKSN.exe's code.
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 8303066
Dear KCBrecks,
I would like to say that my application Catalogs works using FIREBIRD or INTERBASE. firebird-1.0.2.908-win32.exe is a freeware and it's size is only 2.62 MB. It can be downloaded directly from my site (as INTERBASE 6.0 too).
Firebird is a relational database that offers excellent concurrency, high performance, and powerful language support. Firebird is a commercially independent project based on the source code released by Borland Software Corp.
Borland ® InterBase ® is a high-performance, cross-platform embeddable database that is relied upon by millions of users around the world. Combining easy installation, automatic crash recovery, and minimal maintenance, the InterBase database is extremely well suited for embedding within disbuted applications.
I think that is not overkill, that is just high quality application, created by BORLAND PRODUCTS !!!
At the end: if you need Delphi 6.0 code of DISKSN.exe I can send it to your e-mail address. Just call me, I am here.
Emil
0
 

Author Comment

by:KCBrecks
ID: 8305434
Sorry esoftbq. Now criticism intended. I just have this thing about using database engines as I have had some nasty moments with configurations in the past. I went down a road a few years ago which needed me to be able create data stores and manipulate the data without having to load up or configure a database engine. It worked and so I carried on down that route. It does make life a little more tedious when writing the applications but it has saved a lot of trouble on site.

I have used your DISKSN.exe and realised the code you have used. Thanks for your efforts.

Best Regards


KC.
0
 

Expert Comment

by:CleanupPing
ID: 9316972
KCBrecks:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 5

Expert Comment

by:snehanshu
ID: 10033339
Hi!
No comment has been added lately and this question is therefore classified abandoned.

If asker wishes to close the question, then refer to
http://www.experts-exchange.com/help/closing.jsp

Otherwise, I will leave a recommendation in the Cleanup topic area that this question is:

Answered by: tongalite

Please leave any comments here within the next seven days. It is assumed that any participant not responding to this request is no longer interested in its final disposition.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

...Snehanshu
EE Cleanup Volunteer
0
 
LVL 3

Expert Comment

by:tongalite
ID: 10087163
Thanks for the points.... It;s been along time :-)
T
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

715 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