Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

CPU Serial Nnumber?

Posted on 1997-05-12
2
Medium Priority
?
289 Views
Last Modified: 2012-08-14
Is it possible to obtain a PC's CPU serial number?

I'm trying to add functionality to an application to prevent
illegal copies.  I'm open for obtaining anything unique
on a PC so the application will recognize that it's been
copied and halt.

A dummy file in an obscure directory will not work..

Thanks,
 Jim..
0
Comment
Question by:jselman
2 Comments
 

Accepted Solution

by:
Lucas041697 earned 200 total points
ID: 1426224
Sorry, is not possible obtain CPU serial number.

You can obtain the HD serial number with:

16 bit
(use VBIO.VBX or VBASM.DLL)

32 bit
This program shows how to retrieve information about a specific file.
 1.      Create a new project in Visual Basic. Form1 is created by default.
 2.      From the Visual Basic Insert menu, select Module to create a new module. Module1.Bas is created by default.
 3.      Add the following code to Module1.Bas (note that each Declare statement must be typed as a single line of code):
 
Declare Function OpenFile Lib "kernel32" (ByVal lpFileName As String,
   lpReOpenBuff As OFSTRUCT, ByVal wStyle As Long) As Long
Declare Function GetFileInformationByHandle Lib "kernel32" (ByVal hFile
   As Long, lpFileInformation As BY_HANDLE_FILE_INFORMATION) As Long
Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Declare Function FileTimeToSystemTime Lib "kernel32" (lpFileTime As FileTime,
   lpSystemTime As SYSTEMTIME) As Long
Public Const OFS_MAXPATHNAME = 128
Public Const OF_READ = &H0
Type OFSTRUCT
        cBytes As Byte
        fFixedDisk As Byte
        nErrCode As Integer
        Reserved1 As Integer
        Reserved2 As Integer
        szPathName(OFS_MAXPATHNAME) As Byte
End Type
Type SYSTEMTIME
        wYear As Integer
        wMonth As Integer
        wDayOfWeek As Integer
        wDay As Integer
        wHour As Integer
        wMinute As Integer
        wSecond As Integer
        wMilliseconds As Integer
End Type
Type FileTime
        dwLowDateTime As Long
        dwHighDateTime As Long
End Type
Type BY_HANDLE_FILE_INFORMATION
        dwFileAttributes As Long
        ftCreationTime As FileTime
        ftLastAccessTime As FileTime
        ftLastWriteTime As FileTime
        dwVolumeSerialNumber As Long
        nFileSizeHigh As Long
        nFileSizeLow As Long
        nNumberOfLinks As Long
        nFileIndexHigh As Long
        nFileIndexLow As Long
End Type
 
 4.      Add a Command Button control to Form1. Command1 is created by default.
 5.      Add the following code to the Click event for Command1:
 
Private Sub Command1_Click()
    Dim Ret As Long
    Dim FileHandle As Long
    Dim FileInfo As BY_HANDLE_FILE_INFORMATION
    Dim lpReOpenBuff As OFSTRUCT
    Dim FileTime As SYSTEMTIME

    FileHandle = OpenFile("c:\autoexec.bat", lpReOpenBuff, OF_READ)
    Ret = GetFileInformationByHandle(FileHandle, FileInfo)

    Ret = FileTimeToSystemTime(FileInfo.ftCreationTime, FileTime)
    Print "File created on " & FileTime.wYear, FileTime.wMonth,
       FileTime.wDay

    Ret = FileTimeToSystemTime(FileInfo.ftLastAccessTime, FileTime)
    Print "File last accessed on: " & FileTime.wYear, FileTime.wMonth,
       FileTime.wDay

    Ret = FileTimeToSystemTime(FileInfo.ftLastWriteTime, FileTime)
    Print "File last written to: " & FileTime.wYear, FileTime.wMonth,
       FileTime.wDay

    Print "Volume Serial Number is: " & FileInfo.dwVolumeSerialNumber
    Print "File attributes are: " & FileInfo.dwFileAttributes


    Ret = CloseHandle(FileHandle)
End Sub
 
 
Run the example program by pressing F5. Click the Command Button control. The program displays the file's creation date, last access date, and last write date, as well as the disk's volume serial number and the attributes associated with the file.

! Use Serial Disk Number and merge with your protect string to
 obtain a secure attivation code. !!

--------------------------------------------------------------------------
P.S. Excuse for my english, i'm italian developer
-------------------------------------------------------------------------

I hope this help !
0
 

Author Comment

by:jselman
ID: 1426225
Thanks Lucas.  This will save me a a lot of research time digging
through API manuals, etc....


0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

971 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