Y
Yordy Corrales
Guest
Hi Everyone,
I need some help with this, and know if it is good:
I create a VB NET DLL with this code:
Imports System.Windows.forms
Public Class YCE_DLL
Public Shared Function GetForm(Name As String) As Form
Dim frm As Form
Dim frms = Application.OpenForms
For Each i As Form In frms
If (i.Name = Name) Then
frm = i
Exit For
End If
Next
GetForm = frm
End Function
End Class
So its to get the form of the application. I want to get the form object
Now i Want to inject this DLL into this custom .NET application:
and get the textbox for example. so i thought... maybe if i can inject a DLL into the application to get the form it could be possible to get Textbox object to view its native properties.
There's any way to do that? and how i can do it? i have try with this:
Dim dllpath As String = "path to custom YCE_DLL.dll"
GetWindowThreadProcessId(aeProgram.Current.NativeWindowHandle, pid)
Dim hHandle = OpenProcess(ProcessAccessFlags.All, False, pid)
'-----Allocating Memory------------
Dim dllPathAddr = VirtualAllocEx(hHandle, 0, Len(dllpath), AllocationType.Reserve Or AllocationType.Commit, MemoryProtection.ExecuteReadWrite)
'-----Expanded---------------------
Dim tf = WriteProcessMemory(hHandle, dllPathAddr, dllpath, Len(dllpath), 0) 'tf=true
Dim j
RemoteLibraryFunction(hHandle, "YCE_DLL.dll", "getform", ListBox1.Items(ListBox1.SelectedIndex), 1, j)
Private Function RemoteLibraryFunction(ByVal hProcess As IntPtr, ByVal lpModuleName As String, ByVal lpProcName As String, ByVal lpParameters As Object, ByVal dwParamSize As IntPtr, ByVal ppReturn() As Object) As Boolean
Dim lpRemoteParams As Object = Nothing
Dim lpFunctionAddress As Object = GetProcAddress(GetModuleHandle(lpModuleName), lpProcName) 'Result=0 (fail)
Dim o1 = GetModuleHandle(lpModuleName) 'It retrieves a handle
end function
what i'm doing wrong or maybe i'm missing something, please help!
the final objective its this:
Yordy Corrales
This question it's related with this one: Get External ErrorProvider tooltip message
Continue reading...
I need some help with this, and know if it is good:
I create a VB NET DLL with this code:
Imports System.Windows.forms
Public Class YCE_DLL
Public Shared Function GetForm(Name As String) As Form
Dim frm As Form
Dim frms = Application.OpenForms
For Each i As Form In frms
If (i.Name = Name) Then
frm = i
Exit For
End If
Next
GetForm = frm
End Function
End Class
So its to get the form of the application. I want to get the form object
Now i Want to inject this DLL into this custom .NET application:
and get the textbox for example. so i thought... maybe if i can inject a DLL into the application to get the form it could be possible to get Textbox object to view its native properties.
There's any way to do that? and how i can do it? i have try with this:
Dim dllpath As String = "path to custom YCE_DLL.dll"
GetWindowThreadProcessId(aeProgram.Current.NativeWindowHandle, pid)
Dim hHandle = OpenProcess(ProcessAccessFlags.All, False, pid)
'-----Allocating Memory------------
Dim dllPathAddr = VirtualAllocEx(hHandle, 0, Len(dllpath), AllocationType.Reserve Or AllocationType.Commit, MemoryProtection.ExecuteReadWrite)
'-----Expanded---------------------
Dim tf = WriteProcessMemory(hHandle, dllPathAddr, dllpath, Len(dllpath), 0) 'tf=true
Dim j
RemoteLibraryFunction(hHandle, "YCE_DLL.dll", "getform", ListBox1.Items(ListBox1.SelectedIndex), 1, j)
Private Function RemoteLibraryFunction(ByVal hProcess As IntPtr, ByVal lpModuleName As String, ByVal lpProcName As String, ByVal lpParameters As Object, ByVal dwParamSize As IntPtr, ByVal ppReturn() As Object) As Boolean
Dim lpRemoteParams As Object = Nothing
Dim lpFunctionAddress As Object = GetProcAddress(GetModuleHandle(lpModuleName), lpProcName) 'Result=0 (fail)
Dim o1 = GetModuleHandle(lpModuleName) 'It retrieves a handle
end function
what i'm doing wrong or maybe i'm missing something, please help!
the final objective its this:
Yordy Corrales
This question it's related with this one: Get External ErrorProvider tooltip message
Continue reading...