Skip to content

Commit

Permalink
Pulled from archives
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinPerris committed Aug 13, 2016
1 parent 31cd87e commit 6ebbda4
Show file tree
Hide file tree
Showing 102 changed files with 51,581 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Crystalshire
46 changes: 46 additions & 0 deletions authentication/authentication.vbp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Type=Exe
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\Windows\SysWOW64\stdole2.tlb#OLE Automation
Reference=*\G{00000206-0000-0010-8000-00AA006D2EA4}#2.6#0#C:\Program Files (x86)\Common Files\System\ado\msado26.tlb#Microsoft ActiveX Data Objects 2.6 Library
Object={248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0; MSWINSCN.OCX
Form=src\frmMain.frm
Module=modMain; src\modMain.bas
Module=modHandleData; src\modHandleData.bas
Module=modTCP; src\modTCP.bas
Module=modVars; src\modVars.bas
Class=clsBuffer; src\clsBuffer.cls
Class=clsMD5; src\clsMD5.cls
Module=modSQL; src\modSQL.bas
Module=modSysTray; src\modSysTray.bas
IconForm="frmMain"
Startup="Sub Main"
HelpFile=""
Title="Authentication"
ExeName32="Authentication.exe"
Command32=""
Name="Authentication"
HelpContextID="0"
CompatibleMode="0"
MajorVer=1
MinorVer=0
RevisionVer=0
AutoIncrementVer=0
ServerSupportFiles=0
VersionCompanyName="Robin Perris Corp."
CompilationType=0
OptimizationType=0
FavorPentiumPro(tm)=0
CodeViewDebugInfo=0
NoAliasing=0
BoundsCheck=0
OverflowCheck=0
FlPointCheck=0
FDIVCheck=0
UnroundedFP=0
StartMode=0
Unattended=0
Retained=0
ThreadPerObject=0
MaxNumberOfThreads=1

[MS Transaction Server]
AutoRefresh=1
3 changes: 3 additions & 0 deletions authentication/log.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
8/13/2015 5:13:02 AM: Connected to Game Server: False
8/13/2015 5:13:02 AM: Connected to SQL Server: False
8/13/2015 5:13:02 AM: Initialization complete. AuthServer loaded.
175 changes: 175 additions & 0 deletions authentication/src/clsBuffer.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "clsBuffer"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit

Private Buffer() As Byte
Private BufferSize As Long
Private WriteHead As Long
Private ReadHead As Long

Private Sub Class_Initialize()
Flush
End Sub

Public Sub PreAllocate(ByVal nLength As Long)
WriteHead = 0
ReadHead = 0
BufferSize = nLength - 1
ReDim Buffer(0 To BufferSize)
End Sub

Public Sub Allocate(ByVal nLength As Long)
If BufferSize = 0 And nLength > 1 Then nLength = nLength - 1
BufferSize = BufferSize + nLength
ReDim Preserve Buffer(0 To BufferSize)
End Sub

Public Sub Flush()
WriteHead = 0
ReadHead = 0
BufferSize = 0
ReDim Buffer(0)
End Sub

Public Sub Trim()
' If the readhead is past the buffersize, this means everything has been read in the array, flush it
If ReadHead >= Count Then Flush
End Sub

Public Sub WriteByte(ByVal nByte As Byte)

If WriteHead > BufferSize Then Allocate 1

Buffer(WriteHead) = nByte
WriteHead = WriteHead + 1
End Sub

Public Sub WriteBytes(ByRef nByte() As Byte)
Dim nLength As Long

On Error Resume Next

nLength = (UBound(nByte) - LBound(nByte)) + 1

If WriteHead + nLength - 1 > BufferSize Then Allocate nLength

CopyMemory Buffer(WriteHead), nByte(0), nLength
WriteHead = WriteHead + nLength
End Sub

Public Sub WriteInteger(ByVal nInteger As Integer)

If WriteHead + 1 > BufferSize Then Allocate 2

CopyMemory Buffer(WriteHead), nInteger, 2
WriteHead = WriteHead + 2
End Sub

Public Sub WriteLong(ByVal nLong As Long)

If WriteHead + 3 > BufferSize Then Allocate 4

CopyMemory Buffer(WriteHead), nLong, 4
WriteHead = WriteHead + 4
End Sub

Public Sub WriteString(ByRef nString As String)
Dim sBytes() As Byte
Dim sLength As Long

sLength = Len(nString)
sBytes = StrConv(nString, vbFromUnicode)

WriteLong sLength

If sLength <= 0 Then Exit Sub

If WriteHead + sLength - 1 > BufferSize Then Allocate sLength

CopyMemory Buffer(WriteHead), sBytes(0), sLength
WriteHead = WriteHead + sLength
End Sub

Public Function ReadByte(Optional MoveReadHead As Boolean = True) As Byte

If ReadHead > BufferSize Then Exit Function

ReadByte = Buffer(ReadHead)
If MoveReadHead Then ReadHead = ReadHead + 1
End Function

Public Function ReadBytes(ByVal nLength As Long, Optional MoveReadHead As Boolean = True) As Byte()
Dim Data() As Byte

If nLength = 0 Then Exit Function
If ReadHead + nLength - 1 > BufferSize Then Exit Function

ReDim Data(nLength - 1)

CopyMemory Data(0), Buffer(ReadHead), nLength
If MoveReadHead Then ReadHead = ReadHead + nLength

ReadBytes = Data
End Function

Public Function ReadInteger(Optional MoveReadHead As Boolean = True) As Integer

If ReadHead + 1 > BufferSize Then Exit Function

CopyMemory ReadInteger, Buffer(ReadHead), 2
If MoveReadHead Then ReadHead = ReadHead + 2
End Function

Public Function ReadLong(Optional MoveReadHead As Boolean = True) As Long

If ReadHead + 3 > BufferSize Then Exit Function

CopyMemory ReadLong, Buffer(ReadHead), 4
If MoveReadHead Then ReadHead = ReadHead + 4
End Function

Public Function ReadString(Optional MoveReadHead As Boolean = True) As String
Dim sLength As Long
Dim sBytes() As Byte

sLength = ReadLong(False)
If sLength <= 0 Then
If MoveReadHead Then ReadHead = ReadHead + 4
Exit Function
End If

ReDim sBytes(sLength - 1)

CopyMemory sBytes(0), Buffer(ReadHead + 4), sLength

ReadString = StrConv(sBytes, vbUnicode)
If MoveReadHead Then ReadHead = ReadHead + sLength + 4
End Function

Public Function Count() As Long
Count = (UBound(Buffer) - LBound(Buffer)) + 1
End Function

Public Function Length() As Long
Length = Count - ReadHead
End Function

Public Function ToArray() As Byte()
ToArray = Buffer()
End Function

Public Function ToString() As String
ToString = StrConv(Buffer, vbUnicode)
End Function

Loading

0 comments on commit 6ebbda4

Please sign in to comment.