select int_1 , zclm , updateid , dwmc , ver from update_rq using sqlca;
/* SQL Parameters List
0-> :li_int_1
1-> :ls_zclm
2-> :ls_zcm
3-> :ls_gsmc
4-> :ls_ver
*/
//取得数据库内容为:
1,'N',' ',' ','MorrowBudget Ver5.1 '
if li_int_1 < 1 then
li_int_1 = 1 //重要,指续费次数,后面会用到
end if
if ls_zclm = "N" and (len(ls_zcm) < 1 or isnull(ls_zcm)) then
ls_zcm = parent.wf_xlh() //软件序列号,相当于软件ID,升级ID
update update_rq set updateid =' ' using sqlca; //保存ID
/* SQL Parameters List
0-> :ls_zcm
*/
commit using sqlca;
parent.cb_2.enabled = false
else
if (ls_zclm = "" or len(ls_zclm) < 1) and (len(ls_zcm) < 1 or isnull(ls_zcm)) then
ls_zcm = parent.wf_xlh()
update update_rq set updateid =' ' using sqlca;
/* SQL Parameters List
0-> :ls_zcm
*/
commit using sqlca;
parent.cb_2.enabled = false
else
if ls_zclm = "Y" then
messagebox("注册提示","本软件已经注册,注册公司: " + ls_gsmc)
return
end if
if lb_rtn = true then //取 C:\ 磁盘序列号用随机数代替
ls_write_hard = trim(string(lul_volumeserialnumber))
else
ls_write_hard = "68" + string(rand(99)) + string(rand(99)) + string(rand(99)) + string(rand(99)) + string(rand(99))
end if
ls_write_macf = f_mac() //网卡序列号
if ls_write_macf = "" or isnull(ls_write_macf) then //失败用随机数代替
ls_write_macf = "37" + string(rand(99)) + string(rand(99)) + string(rand(99)) + string(rand(99)) + string(rand(99))
end if
select regpass from c_gsxx using sqlca;
/* SQL Parameters List
0-> :ls_regpass
*/
if len(ls_regpass) < 1 or isnull(ls_regpass) then //变量用途未知,估计是升级口令之类的
ls_write_regpass = parent.wf_round() + parent.wf_round() + parent.wf_round()
end if
for li_i = 1 to 91
ls_arry[li_i] = right(left(ls_source,li_i),li_i - (li_i - 1))
next
for li_i = 1 to li_long
ls_parm = ls_parm + ls_arry[rand(91)] + ls_mima[li_i] + ls_arry[rand(91)] + ls_arry[rand(91)] + ls_arry[rand(91)] +
ls_arry[rand(91)]
next
return ls_parm
本人不会PB,只好将代码翻译为Delphi 7.0的代码,为做注册机做准备(下同):
Delphi 7.0实现如下:
Function wf_jiami(Parm: String): String;
Const
ls_source: Array[0..90] Of Char = '0132456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ{},./?[]\|+=_-)(*&^%$#@!
`:<>';
Var
i: Integer;
Begin
For i := 1 To Length(Parm) Do
Result := Result + ls_source[Random(90)] + Parm[i] + ls_source[Random(90)] + ls_source[Random(90)] + ls_source[Random
for li_i = 1 to li_long
ls_mima[li_i] = mid(ls_parmstring,li_i,1)
next
for li_i = 2 to li_long step 5
ls_parm = ls_parm + ls_mima[li_i]
next
return ls_parm
Delphi 7.0实现如下:
Function wf_jiemi(Parm: String): String;
Var
i: Integer;
Begin
i := 2;
While i <= Length(Parm) Do
Begin
Result := Result + Parm[i];
i := i + 5;
End;
End;
for li_i = 1 to li_len
ls_mima[li_i] = mid(ls_parm,li_i,1)
if ls_mima[li_i] = "0" then
ls_mima[li_i] = "a"
end if
if ls_mima[li_i] = "1" then
ls_mima[li_i] = "b"
end if
if ls_mima[li_i] = "2" then
ls_mima[li_i] = "c"
end if
if ls_mima[li_i] = "3" then
ls_mima[li_i] = "d"
end if
if ls_mima[li_i] = "4" then
ls_mima[li_i] = "e"
end if
if ls_mima[li_i] = "5" then
ls_mima[li_i] = "f"
end if
if ls_mima[li_i] = "6" then
ls_mima[li_i] = "g"
end if
if ls_mima[li_i] = "7" then
ls_mima[li_i] = "h"
end if
if ls_mima[li_i] = "8" then
ls_mima[li_i] = "i"
end if
if ls_mima[li_i] = "9" then
ls_mima[li_i] = "j"
end if
next
for li_i = 1 to li_len
ls_parming = ls_parming + ls_mima[li_i]
next
return ls_parming
Delphi 7.0实现如下:
Function wf_numtochar(Parm: String): String;
Var
i: Integer;
Begin
Result := Parm;
For i := 1 To Length(Parm) Do
If Parm[i] In ['0'..'9'] Then Result[i] := Char(Ord(Parm[i]) + $31);
End;
for li_i = 1 to li_len
ls_mima[li_i] = mid(ls_parm,li_i,1)
if ls_mima[li_i] = "a" then
ls_mima[li_i] = "0"
end if
if ls_mima[li_i] = "b" then
ls_mima[li_i] = "1"
end if
if ls_mima[li_i] = "c" then
ls_mima[li_i] = "2"
end if
if ls_mima[li_i] = "d" then
ls_mima[li_i] = "3"
end if
if ls_mima[li_i] = "e" then
ls_mima[li_i] = "4"
end if
if ls_mima[li_i] = "f" then
ls_mima[li_i] = "5"
end if
if ls_mima[li_i] = "g" then
ls_mima[li_i] = "6"
end if
if ls_mima[li_i] = "h" then
ls_mima[li_i] = "7"
end if
if ls_mima[li_i] = "i" then
ls_mima[li_i] = "8"
end if
if ls_mima[li_i] = "j" then
ls_mima[li_i] = "9"
end if
next
for li_i = 1 to li_len
ls_parming = ls_parming + ls_mima[li_i]
next
return ls_parming
Delphi 7.0实现如下:
Function wf_chartonum(Parm: String): String;
Var
i: Integer;
Begin
Result := Parm;
For i := 1 To Length(Parm) Do
If Parm[i] In ['a'..'j'] Then Result[i] := Char(Ord(Parm[i]) - $31);
End;
if ll_file = -1 then
messagebox("操作提示","文件打开操作失败,确定文件的格式为.PAS")
return
end if
if fileread(ll_file,ls_ver) = -1 then
messagebox("操作提示","文件读操作失败,确定文件的格式为.PAS" + "/" + string(1)) //软件版本
fileclose(ll_file)
return
end if
if fileread(ll_file,ls_zcm) = -1 then
messagebox("操作提示","文件读操作失败,确定文件的格式为.PAS" + "/" + string(1)) //软件注册码 Update ID
fileclose(ll_file)
return
end if
if fileread(ll_file,ls_gsmc) = -1 then //公司名称
messagebox("操作提示","文件读操作失败,确定文件的格式为.PAS" + "/" + string(1))
fileclose(ll_file)
return
end if
if fileread(ll_file,ls_hard) = -1 then //硬盘序列号
messagebox("操作提示","文件读操作失败,确定文件的格式为.PAS" + "/" + string(2))
fileclose(ll_file)
return
end if
if fileread(ll_file,ls_cpu) = -1 then //CPU ID
messagebox("操作提示","文件读操作失败,确定文件的格式为.PAS" + "/" + string(3))
fileclose(ll_file)
return
end if
if fileread(ll_file,ls_macf) = -1 then //网卡 ID
messagebox("操作提示","文件读操作失败,确定文件的格式为.PAS" + "/" + string(4))
fileclose(ll_file)
return
end if
if fileread(ll_file,ls_regpass) = -1 then //随机数?
messagebox("操作提示","文件读操作失败,确定文件的格式为.PAS" + "/" + string(5))
fileclose(ll_file)
return
end if
if fileread(ll_file,ls_jqmatch) = -1 then //重要,判断是否是非法注册文件
messagebox("操作提示","文件读操作失败,确定文件的格式为.PAS" + "/" + string(7))
fileclose(ll_file)
return
end if
if fileread(ll_file,ls_maxuser) = -1 then
messagebox("操作提示","文件读操作失败,确定文件的格式为.PAS" + "/" + string(6))
fileclose(ll_file)
return
end if
if fileread(ll_file,ls_yhzt) = -1 then //用户状态
messagebox("操作提示","文件读操作失败,确定文件的格式为.PAS" + "/" + string(6))
fileclose(ll_file)
return
end if
if fileread(ll_file,ls_dqcs) = -1 then
messagebox("操作提示","文件读操作失败,确定文件的格式为.PAS" + "/" + string(6))
fileclose(ll_file)
return
end if
if fileread(ll_file,ls_bzcs) = -1 then
messagebox("操作提示","文件读操作失败,确定文件的格式为.PAS" + "/" + string(6))
fileclose(ll_file)
return
end if
if fileread(ll_file,ls_dqsj) = -1 then //到期时间
messagebox("操作提示","文件读操作失败,确定文件的格式为.PAS" + "/" + string(6))
fileclose(ll_file)
return
end if
if fileread(ll_file,ls_zcsj) = -1 then //注册时间
messagebox("操作提示","文件读操作失败,确定文件的格式为.PAS" + "/" + string(6))
fileclose(ll_file)
return
end if
if fileread(ll_file,ls_dlsj) = -1 then //最后登入时间
messagebox("操作提示","文件读操作失败,确定文件的格式为.PAS" + "/" + string(6))
fileclose(ll_file)
return
end if
if ls_yhzt1 = "2" then //系统状态,2为试用版 9为正式版
ls_zclm = "N"
else
ls_zclm = "Y"
end if
update c_gsxx set gsmc =' ' , zcmc =' ' using sqlca; //下面更新一下数据库信息
/* SQL Parameters List
0-> :ls_gsmc
1-> :ls_regcompany
*/
commit using sqlca;
update update_rq set dwmc =' ' , zclm =' ' , updateid =' ' , zcrq ={d '2005-08-31' } , updatepass ='8888' , ver =' ' using
sqlca;
/* SQL Parameters List
0-> :ls_gsmc
1-> :ls_zclm
2-> :ls_zcm
3-> :ldt_dlsjnew
4-> :ls_ver
*/
commit using sqlca;
update lcs set qhkg ='n' , yhzt =' ' , dqcs =' ' , bzcs =' ' , dqsj =' ' , zcsj =' ' , dlsj =' ' using sqlca;
/* SQL Parameters List
0-> :ls_yhzt
1-> :ls_dqcs
2-> :ls_bzcs
3-> :ls_dqsj
4-> :ls_zcsj
5-> :ls_dlsj
*/
commit using sqlca;
select count ( *) from c_maxuser using sqlca;
/* SQL Parameters List
0-> :li_max
*/
if not ls_maxuser = "A" then
if li_max > 1 then
delete from c_maxuser using sqlca;
insert into c_maxuser ( maxuser ) values ( ' ' ) using sqlca;
/* SQL Parameters List
0-> :ls_maxuser
*/
else
update c_maxuser set maxuser =' ' using sqlca;
/* SQL Parameters List
0-> :ls_maxuser
*/
end if
end if
update c_gsxx SET gsmc =' ' , cpu =' ' , hard =' ' , macf =' ' , regpass =' ' using sqlca;
/* SQL Parameters List
0-> :ls_gsmc
1-> :ls_cpu
2-> :ls_hard
3-> :ls_macf
4-> :ls_regpass
*/
if sqlca.sqlcode <> 0 then
rollback using sqlca;
messagebox("操作提示","机器注册出错1")
return
else
commit using sqlca;
messagebox("祝贺!","机器注册成功,请登陆并使用!")
parent.cb_2.enabled = false
openwithparm(w_xufeichenggong,ls_zcm)
end if
return
--------------------------------------------------------------------------
根据注册授权文件要求,结合注册信息文件的内容,用Delphi 7实现下注册授权文件如下:
Procedure TForm1.btn1Click(Sender: TObject); //读取注册信息
Var
Reg: TMemo;
Begin
If dlgOpenRegFile.Execute Then
Begin
Reg := TMemo.Create(Self);
Reg.Parent := Self;
Reg.WordWrap := False;
Reg.Visible := False;
Reg.Lines.LoadFromFile(dlgOpenRegFile.FileName);
If Reg.Lines.Count <> 22 Then
Begin
Application.MessageBox('选择的不是注册文件!', '信息提示', MB_OK + MB_ICONWARNING);
Exit;
End;
With Reg Do
Begin
edtgsmc.Text := Lines[1];
edtgsdz.Text := Lines[2];
edtlxr.Text := Lines[6];
edtyb.Text := Lines[5];
edtTel.Text := Lines[3];
edtFax.Text := Lines[4];
edtEmail.Text := Lines[7];
Procedure TForm1.btn2Click(Sender: TObject);
Var
Reg: TMemo;
Begin
If (edtgsmc.Text = '') Or (edtgsdz.Text = '') Or (edtlxr.Text = '') Or (edtTel.Text = '') Then
Begin
Application.MessageBox('注册信息不全,请重新读取注册文件!', '信息提示', MB_OK + MB_ICONWARNING);
Exit;
End;
if not fileexists(ls_driver) and fileexists(ls_start) then
messagebox("错误",as_dir + "目录中没有安装dbeng8.exe和dbodbc8.dll文件!",stopsign!)
return
else
registryset("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App
if answer = -1 or answer1 = -1 or answer2 = -1 or answer3 = -1 or answer4 = -1 or answer5 = -1 or answer6 =
-1 or answer7 = -1 then
messagebox("错误","应用程序无法设置ODBC SYSTEM DATA SOURCE,运行不能继续!",stopsign!)
return
end if
sqlca.dbms = "ODBC"
sqlca.autocommit = false
sqlca.dbparm = "ConnectString='DSN=mldbase;UID=mulong;PWD=68483059'"
sqlca.autocommit = false
else
halt close
end if
end if
connect using sqlca;
if sqlca.sqlcode <> 0 then
messagebox("操作提示","数据库连接失败")
return
end if
//上面是检查运行环境等,不重要
gs_yhdm = "sa"
ls_parm = wf_login()
ldt_xtsj = date(today()) //系统时间
select zclm , ver , dwmc from update_rq using sqlca;
/* SQL Parameters List
0-> :ls_zclm
1-> :ls_ver
2-> :ls_dwmc
*/
for li_i = 1 to li_zishu
ls_arry[li_i] = right(left(ls_pinyinma,li_i),li_i - (li_i - 1)) //取一个字符
li_asc = asc(ls_arry[li_i]) //ascii
if ((li_asc >= 97 and li_asc <= 122) or (li_asc >= 65 and li_asc <= 90)) or (li_asc >= 48 and li_asc <= 57) then
ls_zcm1 = ls_zcm1 + ls_arry[li_i] //过滤一些字符
end if
--------------------------------------------------------------------------------------
涉及函数 转拼音函数 f_get_spellcn
--------------------------------------------------------------------------------------
long i
string ls_ch
string ls_returnstr
for i = 1 to 2 * lenw(as_inputstring) step 2
ls_ch = mid(as_inputstring,i,2)
if asc(ls_ch) < 128 then
ls_returnstr = ls_returnstr + ls_ch
else
choose case ls_ch
case IS >= "匝"
ls_returnstr = ls_returnstr + "Z"
continue
case IS >= "丫"
ls_returnstr = ls_returnstr + "Y"
continue
case IS >= "夕"
ls_returnstr = ls_returnstr + "X"
continue
case IS >= "哇"
ls_returnstr = ls_returnstr + "W"
continue
case IS >= "他"
ls_returnstr = ls_returnstr + "T"
continue
case IS >= "撒"
ls_returnstr = ls_returnstr + "S"
continue
case IS >= "然"
ls_returnstr = ls_returnstr + "R"
continue
case IS >= "七"
ls_returnstr = ls_returnstr + "Q"
continue
case IS >= "趴"
ls_returnstr = ls_returnstr + "P"
continue
case IS >= "哦"
ls_returnstr = ls_returnstr + "O"
continue
case IS >= "拿"
ls_returnstr = ls_returnstr + "N"
continue
case IS >= "妈"
ls_returnstr = ls_returnstr + "M"
continue
case IS >= "廓"
ls_returnstr = ls_returnstr + "L"
continue
case IS >= "咖"
ls_returnstr = ls_returnstr + "K"
continue
case IS >= "讥"
ls_returnstr = ls_returnstr + "J"
continue
case IS >= "哈"
ls_returnstr = ls_returnstr + "H"
continue
case IS >= "嘎"
ls_returnstr = ls_returnstr + "G"
continue
case IS >= "发"
ls_returnstr = ls_returnstr + "F"
continue
case IS >= "讹"
ls_returnstr = ls_returnstr + "E"
continue
case IS >= "搭"
ls_returnstr = ls_returnstr + "D"
continue
case IS >= "擦"
ls_returnstr = ls_returnstr + "C"
continue
case IS >= "八"
ls_returnstr = ls_returnstr + "B"
continue
case IS >= "阿"
ls_returnstr = ls_returnstr + "A"
end choose
For li_i := 1 To Length(r_ls_pinyinma) Do
Begin
li_asc := Ord(r_ls_pinyinma[li_i]); //ascii
If ((li_asc >= 97) And (li_asc <= 122)) Or ((li_asc >= 65) And (li_asc <= 90)) Or ((li_asc >= 48) And (li_asc <= 57))
Then
ls_zcm1 := ls_zcm1 + r_ls_pinyinma[li_i]; //过滤一些字符
End;
ls_zcm1 := ls_zcm1 + ls_zcm1; //剩余字符+剩余字符
If li_int < 1 Then li_int_1 := 10 Else li_int_1 := li_int;