Solved

CPU Serial Nnumber?

Posted on 1997-05-12
2
275 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 100 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

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

12 Experts available now in Live!

Get 1:1 Help Now