This is for a project i am writing and i found some awesome code that works beautiful, however since i have two forms i have either to create a dll with the function in it or to only use the one function bit not have anything touch the function otherwise... since i feel i will be useing this function again i decided to stuff the function in a dll file. i think that i did something wrong when i created the dll or when i tried to link to it... but it said that i didnt have a function entry point for the dll... the code for the forms and the dll are below... i dont know mayne i am just not doing something right...
'general decs.
Dim x As Long
Private Declare Function FileEncodeAndDecode Lib "TCP.DLL" (ByVal InputFile As String, ByVal OutputFile As String, ByVal PasswordKey As String) As String
Option Explicit
then the main code for the two forms... (general looks the same no need to waste space...
' my splash screen for decoding the files...
If x = 1 Then
Dim InputFile As String
Dim OutputFile As String
Dim PasswordKey As String
InputFile = App.Path & "\TCPData\Readme.txt" ' file to be decrypted
OutputFile = App.Path & "\TCPData\Readme.txt" ' file being saved to.
PasswordKey = "sudoyesper"
Call FileEncodeAndDecode(InputFile, OutputFile, PasswordKey)
'Call FileEncodeAndDecode(InputFile, OutputFile, PasswordKey)
ElseIf x = 2 Then
InputFile = App.Path & "\TCPData\FTS Help.txt" ' file to be decrypted
OutputFile = App.Path & "\TCPData\FTS Help.txt" ' file being saved to.
PasswordKey = "sudoyesper"
Call FileEncodeAndDecode(InputFile, OutputFile, PasswordKey)
'Call FileEncodeAndDecode(InputFile, OutputFile, PasswordKey)
ElseIf x = 3 Then... 'more below looks the same...
' the code from the main form....
Private Sub Command11_Click()
Dim FTS As Object 'set variable for code
Set FTS = CreateObject("Scripting.FileSystemObject") 'setting var to work as an object
If FTS.FileExists(App.Path & "\HOME\logs\log.dll") Then 'sets the logfile
Open App.Path & "\HOME\logs\log.dll" For Append As #3 'log file key is #253 and will be used here and on form 1
Print #3, "FTS - DO NOT DELETE!"
Print #3, "~=({|<|lkjhslkjsdg654dfg654d98fg7987dfs65g13er2g16d5fg498dg746100d8g76d5g16s7g8df7gd6f4g6sd54gsd687jh6jgh4j8y7j6g51hj6f5g4h6j576g8j46gf5j54hflsdhflkajshflkajdfhlkasjdfhlkjadfhlkjashfliuyflakjsbhf7q3869r8q76stf897534897690847ryjsfbhkjhdfkjfafgafhafiuyaoiuheflksajdhfliausydflahsdkjfha3eyli6y87df57a6s4f76as2saf5a87sghfkjle;lkqhfdg4d56g79d64g654s7*|`~!?/=~!?/=?@@%*?^}$]`?!&&~=({|(<`~%)}$><]*\$#~=({|~}/*(]*\$#<|*|`~!?/=~=({|~-{)|`?!&&?^}$]~-{)|)(\*+~!?/=~=({|~!?/=(<`~%~-{)|]*\$#)}$><~=({|(<`~%~}/*(>=!]!~!?/=@/[]%|~~`*^`?\^(&]>`(-)^>{{>/&(&]>`\$-^-@/%!%(-)^>}/~==&&/]_|~~`*{{>/&(-)^>}-<{\?@@%*|~~`*(&]>`\$-^-{{>/&\$-^-@/[]%@}^$/~!?/=<|*|`+%{=#[][^!@/[]%?@@%*(&]>`\$-^-@/[]%}-<{\>=!]![][^!@/[]%~=({|+%{=#(<`~%(&]>`?@@%*\$-^-]*\$#~}/*(`?!&&<!+(<?^}$]~=({|~}/*(}-<{\{{>/&?@@%*\$-^-{{>/&@/[]%+%{=#~}/*(<|*|`+%{=#@/[]%(<`~%~}/*(~!?/=}-<{\>=!]!\$-^-{{>/&~!?/=+%{=#~!?/=}-<{\<|*|`~=({|@}^$/~}/*(}-<{\`?!&&<|*|`~}/*(>=!]!\$-^-}-<{\[][^!@/[]%@}^$/`?!&&?^}$]@}^$/~=({|"
Close #3 'closeing the file
Else
Open App.Path & "\HOME\logs\log.dll" For Output As #3 'tells the file what to do
Print #3, "FTS - DO NOT DELETE!"
Print #3, "~=({|<|lkjhslkjsdg654dfg654d98fg7987dfs65g13er2g16d5fg498dg746100d8g76d5g16s7g8df7gd6f4g6sd54gsd687jh6jgh4j8y7j6g51hj6f5g4h6j576g8j46gf5j54hflsdhflkajshflkajdfhlkasjdfhlkjadfhlkjashfliuyflakjsbhf7q3869r8q76stf897534897690847ryjsfbhkjhdfkjfafgafhafiuyaoiuheflksajdhfliausydflahsdkjfha3eyli6y87df57a6s4f76as2saf5a87sghfkjle;lkqhfdg4d56g79d64g654s7*|`~!?/=~!?/=?@@%*?^}$]`?!&&~=({|(<`~%)}$><]*\$#~=({|~}/*(]*\$#<|*|`~!?/=~=({|~-{)|`?!&&?^}$]~-{)|)(\*+~!?/=~=({|~!?/=(<`~%~-{)|]*\$#)}$><~=({|(<`~%~}/*(>=!]!~!?/=@/[]%|~~`*^`?\^(&]>`(-)^>{{>/&(&]>`\$-^-@/%!%(-)^>}/~==&&/]_|~~`*{{>/&(-)^>}-<{\?@@%*|~~`*(&]>`\$-^-{{>/&\$-^-@/[]%@}^$/~!?/=<|*|`+%{=#[][^!@/[]%?@@%*(&]>`\$-^-@/[]%}-<{\>=!]![][^!@/[]%~=({|+%{=#(<`~%(&]>`?@@%*\$-^-]*\$#~}/*(`?!&&<!+(<?^}$]~=({|~}/*(}-<{\{{>/&?@@%*\$-^-{{>/&@/[]%+%{=#~}/*(<|*|`+%{=#@/[]%(<`~%~}/*(~!?/=}-<{\>=!]!\$-^-{{>/&~!?/=+%{=#~!?/=}-<{\<|*|`~=({|@}^$/~}/*(}-<{\`?!&&<|*|`~}/*(>=!]!\$-^-}-<{\[][^!@/[]%@}^$/`?!&&?^}$]@}^$/~=({|"
Close #3 'closeing the file
End If
'encoding the file so that it cant be read...
Dim InputFile As String
Dim OutputFile As String
Dim PasswordKey As String
InputFile = App.Path & "\HOME\logs\log.dll"
OutputFile = App.Path & "\HOME\logs\log.dll"
PasswordKey = PApashshnd0w1234
Call FileEncodeAndDecode(InputFile, OutputFile, PasswordKey) 'FileEncodeAndDecode(InputFile, OutputFile, PasswordKey)
'encoding is complete :)
'and the last bit to pass the files back through the dll to encode them so that people wont mess with them.
ProgressBar2.Value = u
u = u + 1
'reencrypting the files
Dim InputFile As String
Dim OutputFile As String
Dim PasswordKey As String
If u = 1 Then
Label41.Caption = "Securing Files... Please Wait"
InputFile = App.Path & "\TCPData\Readme.txt" ' file to be decrypted
OutputFile = App.Path & "\TCPData\Readme.txt" ' file being saved to.
PasswordKey = "sudoyesper"
Call FileEncodeAndDecode(InputFile, OutputFile, PasswordKey)
ElseIf u = 2 Then
InputFile = App.Path & "\TCPData\FTS Help.txt" ' file to be decrypted
OutputFile = App.Path & "\TCPData\FTS Help.txt" ' file being saved to.
PasswordKey = "sudoyesper"
Call FileEncodeAndDecode(InputFile, OutputFile, PasswordKey)
ElseIf u = 3 Then '.... looks the same... as the splash screen...
now the dll file code as i am losthere this was the first dll i have ever attempted to write, so this is where i probly went wrong...
'General decl.s and this is it...
Sub FileEncodeAndDecode(InputFile As String, OutputFile As String, PasswordKey As String)
Dim temp As Single
Dim Char As String * 1
Dim XORMask As Single
Dim temp1 As Integer
Dim x As Long, y As Long, z As Long, Counter As Long
Open InputFile For Binary As #1
Open OutputFile For Binary As #2
For x = 1 To Len(PasswordKey)
temp = Asc(Mid$(PasswordKey, x, 1))
For y = 1 To temp
temp1 = Rnd
Next y
' Re-seed to throw off prying eyes
Randomize temp1
Next x
Counter = 0
For z = 1 To FileLen(InputFile)
'Generate random mask
XORMask = Int(Rnd * 256)
'Get the char & change it
Get 1, , Char
Char = Chr$((Asc(Char) Xor XORMask))
Put 2, , Char
Counter = Counter + 1
If Counter > Len(PasswordKey) Then Counter = 1
' ' Pull random numbers from the hat
For x = 1 To (Asc(Mid$(PasswordKey, Counter, 1)) * 2)
temp = Rnd
Next x
Next z
Close #1
Close #2
End Sub
like i said i am not sure what i did wrong...
any help would be appric.
J Fender