Injector for nostale [vb.net]

03/17/2018 18:55 Limoo#1
Hello
I'm creating an automatic injector for Nostale, I found, on the internet, these codes to inject the dll files.
It doesn't work, do you know why?
Is it possible that Nostale has some security to neutralize?

Code:
    Private Sub Inject()
        On Error GoTo 1
        InjectTimer.Stop()
        Dim TargetProcess As Process() = Process.GetProcessesByName(TextBox1.Text)
        TargetProcessHandle = OpenProcess(PROCESS_CREATE_THREAD Or PROCESS_VM_OPERATION Or PROCESS_VM_WRITE, False, TargetProcess(0).Id)
        pszLibFileRemote = OpenFileDialog1.FileName
        pfnStartAddr = GetProcAddress(GetModuleHandle("Kernel32"), "LoadLibraryA")
        TargetBufferSize = 1 + Len(pszLibFileRemote)
        Dim Rtn As Integer
        Dim LoadLibParamAdr As Integer
        LoadLibParamAdr = VirtualAllocEx(TargetProcessHandle, 0, TargetBufferSize, MEM_COMMIT, PAGE_READWRITE)
        Rtn = WriteProcessMemory(TargetProcessHandle, LoadLibParamAdr, pszLibFileRemote, TargetBufferSize, 0)
        CreateRemoteThread(TargetProcessHandle, 0, 0, pfnStartAddr, LoadLibParamAdr, 0, 0)
        CloseHandle(TargetProcessHandle)
        Exit Sub
1:      MsgBox("Error. your dll was not injected into" & " " & TextBox1.Text, MsgBoxStyle.OkOnly, "Error")
        Application.Restart()
    End Sub