Yeah Latch is right but you can just use REGEDIT to get the information too.
execute file "REGEDIT.EXE","/E C:\CheckComp.reg HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersion",windir$()
The /E means export data from the registry into the file "C:\CheckComp.reg". The only weird thing is it saves one character as a string... so if you use "READ STRING 1,a$" it'll only extract one character at a time. And those strings are so weird you have to add them to a string using "b$=b$+chr$(asc(a$))". If you use the strings themselves with "b$=b$+a$" the string doesn't work right with MID$. It's a big hassle but it's nice when it works right.
You can use that to extract the ProductID, combine it with your game code, encrypt it, and add it to the windows registry with your own key. When they run the program you extract the ProductID and your own key in the windows registry, decrypt it and check if it's the right game code before they can play.
Making your own key in the windows registry:
` Create a key in the windows registry 6-19-09
` Get the windows directory
Win$=windir$()
` Set the directory to the root (regedit doesn't like spaces in filenames)
set dir "C:\"
randomize timer()
Key$="2830-0028-9204-4542-"+str$(rnd(8999)+1000)
` Create the registry file to save
open to write 1,"Grog.reg"
write string 1,"Windows Registry Editor Version 5.00"
write string 1,"[HKEY_LOCAL_MACHINE\SOFTWARE\Grog]"
write string 1,chr$(34)+"RegKey"+chr$(34)+"="+chr$(34)+Key$+chr$(34)
close file 1
text 0,0,"Adding Key to Windows Registry."
` Run regedit to add registry entry /S for no output to screen
execute file "REGEDIT.EXE","/S C:\Grog.reg",Win$
` Wait for the file to be read by regedit
wait 3000
` File Cleanup
delete file "Grog.reg"
text 0,20,"Exporting Windows Registry Key."
` Export registry data to another file to check key /E to export data
execute file "REGEDIT.EXE","/E C:\RegCheck.reg HKEY_LOCAL_MACHINE\SOFTWARE\Grog",Win$
` Wait for the file to be written by regedit
wait 3000
open to read 1,"RegCheck.reg"
do
` Check for end of file
if file end(1) then exit
` Read one character (regedit saves weird for some reason)
read string 1,a$
` If the actual string is used it produces weird results for the mids function so it must be chr$(asc(a$))
if asc(a$)=>32 and asc(a$)=<126 then b$=b$+chr$(asc(a$))
` Check whole string
if asc(a$)=0 and b$<>""
c$=""
for t=0 to len(b$)
c$=mids(b$,t,6)
` Check for RegKey
if c$="RegKey"
` Extract the key
RegKey$=mids(b$,9,24)
exit
endif
next t
if RegKey$<>"" then exit
` Clear b$ for next line
b$=""
endif
loop
close file 1
` File Cleanup
delete file "RegCheck.reg"
` Show the results
text 0,60,"Key saved to Windows Registry = "+Key$
text 0,80,"Key exported from Windows Registry = "+RegKey$
text 0,120,"Press any key to delete the added key in the Windows Registry"
wait key
` Create the registry file to delete the registry entry - in front of HKEY means delete entry
open to write 1,"Grog.reg"
write string 1,"Windows Registry Editor Version 5.00"
write string 1,"[-HKEY_LOCAL_MACHINE\SOFTWARE\Grog]"
close file 1
text 0,140, "Deleting Windows Registry Key [HKEY_LOCAL_MACHINE\SOFTWARE\Grog]."
` Run regedit to delete Grog registry key /S for no output to screen
execute file "REGEDIT.EXE","/S C:\Grog.reg",Win$
` Wait for the file to be read by regedit
wait 3000
` File Cleanup
delete file "Grog.reg"
end
` True basic mid$ command
function Mids(t$,a,b)
a$=left$(right$(t$,len(t$)-a+1),b)
endfunction a$
Edit: Only been tested in Windows XP.