Question[Help] Dll Loading and Saving via .INI[Solved]

Posts 1–10 of 10 · Page 1 of 1
[Help] Dll Loading and Saving via .INI[Solved]
Hey ;D
I got my own Injector and I wanna add a Save/Load function that will use a ini file.
I got already a code but I need help to save the dll path and use it again...

Heres my code:

Code:
Private Sub Button6_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        Dim INI As New INIDatei, i As Integer
        INI.Pfad = My.Application******.DirectoryPath & "\savedlls.ini"
        For i = 1 To Dlls.Items.Count
            INI.WertSchreiben("Files", "Number of Files", Dlls.Items.Count)
            INI.WertSchreiben("Files", CStr(i), Dlls.tostring)
        Next i

    End Sub

    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        Dim INI As New INIDatei, max As Integer, i As Integer
        INI.Pfad = My.Application******.DirectoryPath & "\savedlls.ini"
        max = CInt(INI.WertLesen("Files", "Number of Files"))

        For i = 1 To max
            Dlls.Items.Add(INI.WertLesen("Files", CStr(i)))
        Next i
    End Sub
INI.wertlesen = read ini files.
INI.wertschreiben = write into ini files.
INI.pfad = the place where the ini will be loaded or created

I need help at the part of dll.tostring I get this message in the ini file:

Code:
[Files]
Number of Files=2
1=System.Windows.Forms.ListBox, Items.Count: 2, Items[0]: Mpgh CrossFire.dll
2=System.Windows.Forms.ListBox, Items.Count: 2, Items[0]: Mpgh CrossFire.dll
But I used 2 different dlls.
It can only save this and not the path...
Can someone help me ?

Scan:
Virustotal. MD5: 42bd80d5fd2049278ea917d09b58e7d4
Firstly, is the user loading the .dll's into a listbox in the injector? Please post more info?
ok I upload the full project so you can see ;D wait a sec
Quote Originally Posted by XxDragonSharKxX View Post
ok I upload the full project so you can see ;D wait a sec
Nah dw about uploading the whole thing.

But does the user browse for each file and then the .dll path is added to a listbox?

That's all I need to know.

Edit, can you just post a SS of your Injector with a .dll added to it? Then I can help you.
Sorry I'm german and good in English but not perfect xDD Just download it if you wanna have more information in the whole thing *please*
Here's the Injector:
http://www.mpgh.net/forum/290-crossf...stream-v2.html

The Save and Load feature is only in my Project because I need help at it ^^
I try to answer you eh:
The user browse it and it will be added to the listbox. There is only shown the name. And my new function have to save it and load it later ^^
Okay I got this.

Add this to your "Browse" button.

[php]
Dim ofd As New OpenFileDialog

ofd.Title = "Browse for your .dlls..."
ofd.RestoreDirectory = True
ofd.Filter = ".DLL files (*.dll)|*.dll"

If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then

Dim raw As String = ofd.FileName
Dim mod1 As String = raw.Replace(".dll", "")
Dim q1 As Integer = mod1.LastIndexOf("\") + 1


Dim final As String = mod1.Substring(q1)

ListBox1.Items.Add(final)

SaveSetting("InjectorDLLs", "Dlls", final, ofd.FileName)

End If
[/php]

This will add your .dll to the listbox, and save the path.

Now to inject you need the path of the .dll, so declare this at the top of the form just underneath "Public Class Form1"

[php]
dim dllLoc as String
[/php]

And add this to your "ListBox1_SelectedIndexChanged" sub

[php]
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
dllLoc = GetSetting("InjectorDLLs", "Dlls", ListBox1.SelectedItem)

End Sub
[/php]


This will give you the path of the selected .dll.


NOW, saving all this to a .ini

first declare this underneath "Public Class Form1"

[php]
dim path as string = (Application.StartupPath & "\SavedDlls.ini")
[/php]

THEN

add this sub to your project

[php]
Private Sub SaveList()

Using sWrite As New IO.StreamWriter(path)

For Each p As String In ListBox1.Items
sWrite.WriteLine(p)
Next

End Using


End Sub
[/php]

That will save all your listbox items.

Now this sub to load them

[php]
Private Sub LoadList()

Using sRead As New IO.StreamReader(path)

Do
Dim lbDLL As String = sRead.ReadLine()

If IsNothing(lbDLL) Then Exit Do

ListBox1.Items.Add(lbDLL)

Loop

End Using
End Sub
[/php]

This will add all your items back to the listbox.

so whenever you need to save the list simply type

[php]
SaveList()
[/php]

and whenever you need to load the list

[php]
LoadList()
[/php]

And that's it.

Problems, just ask.
testing right now ;D thank you for you help, Ill pm you if I got problems thannnkkk you

IT WORKS THANK YA D
But where the ini gets saved :O ? ^^
Quote Originally Posted by XxDragonSharKxX View Post
testing right now ;D thank you for you help, Ill pm you if I got problems thannnkkk you
No problems, any time.

Just remember that dllLoc contains the location of your currently .dll file.

So to inject make sure you're injecting dllLoc, it will be constantly updated to whichever .dll is selected in the listbox.
Quote Originally Posted by XxDragonSharKxX View Post
working yay No problem *.*
Naice, glad it worked
Posts 1–10 of 10 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us