Solved

How to get the Client Hard Disk No Using C#

Posted on 2004-08-05
12
928 Views
Last Modified: 2008-01-09
Hello,

i need to validate the client using his hard disk number. So how to get the Client hard disk number using c# language.

thanks in advance
sen007
0
Comment
Question by:sen007
  • 5
  • 3
  • 2
  • +1
12 Comments
 
LVL 17

Expert Comment

by:AerosSaga
ID: 11726140
Public Declare Function GetVolumeSerialNumber Lib "kernel32" Alias "GetVolumeInformationA" (ByVal

lpRootPathName As String, ByVal lpVolumeNameBuffer As Long, ByVal nVolumeNameSize As Long,

lpVolumeSerialNumber As Long, ByVal lpMaximumComponentLength As Long, ByVal lpFileSystemFlags As

Long, ByVal lpFileSystemNameBuffer As Long, ByVal nFileSystemNameSize As Long) As Long

Public Function VolumeSerial(DriveLetter) As Long
    Dim Serial As Long
    Call GetVolumeSerialNumber(UCase(DriveLetter) & ":\", 0&, 0&, Serial, 0&, 0&, 0&, 0&)
    VolumeSerial = Serial
End Function

 
Example Usage

MsgBox VolumeSerial("C")

I am currently trying to convert this to C# for you

Regards,

Aeros
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 11726201
Heres the function part:

public long VolumeSerial(object DriveLetter)
{
 long Serial;
 GetVolumeSerialNumber(UCase(DriveLetter) + ":\", 0, 0, Serial, 0, 0, 0, 0);
 VolumeSerial = Serial;
}
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 11726238
Heres the rest of it:

public class abcd
{
[System.Runtime.InteropServices.DllImport("kernel32", EntryPoint="GetVolumeInformationA")]
public long GetVolumeSerialNumber(string lpRootPathName, long lpVolumeNameBuffer, long nVolumeNameSize, long lpVolumeSerialNumber, long lpMaximumComponentLength, long lpFileSystemFlags, long lpFileSystemNameBuffer, long nFileSystemNameSize);
0
 
LVL 33

Expert Comment

by:raterus
ID: 11726815
I don't see how that will get you the "client" hard-disk number, maybe the servers...  Getting anything like that of the client would be off limits from an asp.net application.
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 11726955
I don't believe that will be possible, as it is a security risk

0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 33

Expert Comment

by:raterus
ID: 11727027
yeah, I think that is what the author is after.  To do it using your code, he'll probably have to embed a client-side control in IE.

http://msdn.microsoft.com/msdnmag/issues/02/01/UserCtrl/default.aspx
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 11727123
wasn't aware of the safe initizlization for activeX

http://msdn.microsoft.com/workshop/components/activex/safety.asp
0
 
LVL 33

Expert Comment

by:raterus
ID: 11727216
Here is probably a better way to authenticate clients if you are interested, all the stuff Aeros and I were talking about is fairly bloated if you are dealing with real clients.  (I sure wouldn't want to download a program to access their website..who knows what "else" they are looking at)

http://support.microsoft.com/default.aspx?scid=kb;EN-US;315588
0
 
LVL 9

Expert Comment

by:crescendo
ID: 11727222
Just hang around your local high school and ask a spotty teenager which exploit to use...
0
 
LVL 9

Expert Comment

by:crescendo
ID: 12060095
No offence intended to Aerosaga, who's worked hard on this one, but his solution doesn't actually solve the problem as it gives the server's disk serial number, not the client's.
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 12096939
PAQed, with points refunded (70)

modulo
Community Support Moderator
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

744 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now