Results 1 to 3 of 3

Thread: Running of a unique cd

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2000
    Posts
    22
    Hello, Im making a game for school and I am almost finished. Not to waste time, in general the game uses losts of textfiles which are not encrypted, for I don't have time to write the code. What I want to do is make the game run off a CD which I will burn. How can i give that cd a unique number,if possible, so in Vb when the game loads it will check the current drive's whatever number, and match it to that number that i put in the code. In scence, all i want it is to do this:

    if x (some number which you obtain by one of the api calls) = 1234567890(the unique number that I would put in the info of the cd when burning, if possible)

    Also, how do I add the autorun feature on the cd. Do i just put a file called autorun.exe, and the o/s will automatically execute that file, if the autorun feature is on.

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    I think ytou would be better off encrypting your text files.

    You can do a simple encryption by converting a char to its ASCII value subtracting a number and converting it back to a string again

    eg Wk|u*]|oo?o} is Mark Sreeves with 10 added to each char


    Code:
    Option Explicit
    Const ASCII_SHIFT = 10
    
    Private Function deCode(strIn As String) As String
    Dim i As Long
    Dim strOut As String
    
    For i = 1 To Len(strIn)
      strOut = strOut & Chr(Asc(Mid(strIn, i, 1)) + ASCII_SHIFT)
    
    Next i
    
     deCode = strOut
    End Function
    
    
    Private Function enCode(strIn As String) As String
    
    Dim i As Long
    Dim strOut As String
    
    For i = 1 To Len(strIn)
      strOut = strOut & Chr(Asc(Mid(strIn, i, 1)) - ASCII_SHIFT)
    
    Next i
    
    enCode = strOut
    
    End Function
    
    Private Sub Command1_Click()
    Text1 = enCode(Text1)
    End Sub
    
    Private Sub Command2_Click()
    Text1 = deCode(Text1)
    End Sub

    you need a file called autorun.inf to autorun a CD.
    take a look at any cd to see what it does but basically you need this in the file to run an exe called setup.exe

    [autorun]
    open=setup.exe

    Mark
    -------------------

  3. #3
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    this would be a bit better actually so each letter would have a diffent value each time it occurs

    eg Mark Sreeves = Ncuo%Yymnvfu

    Code:
    Option Explicit
    Const ASCII_SHIFT = 10
    
    Private Function deCode(strIn As String) As String
    Dim i As Long
    Dim strOut As String
    
    For i = 1 To Len(strIn)
      strOut = strOut & Chr(Asc(Mid(strIn, i, 1)) + (i Mod ASCII_SHIFT))
    
    Next i
    
     deCode = strOut
    End Function
    
    
    Private Function enCode(strIn As String) As String
    
    Dim i As Long
    Dim strOut As String
    
    For i = 1 To Len(strIn)
      strOut = strOut & Chr(Asc(Mid(strIn, i, 1)) - (i Mod ASCII_SHIFT))
    
    Next i
    
    enCode = strOut
    
    End Function
    Mark
    -------------------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width