Visual Basic .NET Forums  

Go Back   Visual Basic .NET Forums > VB.NET > VB.NET General Discussion

VB.NET General Discussion VB.NET general discussion area

VB.NET Forums Newsletter Signup:
Email address:


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-07-2009, 3:39 PM
VB.NET Forum Newbie
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Jan 2009
Posts: 4
Reputation: 0
Vertraag is on a distinguished programming path ahead
Default Reading a string from memory.

Hello,

I am creating a function that will read a string from another application's memory. However, the current function I have only returns a maximum of 15 characters (due to the max number of bytes being 15, apparently?):

Code:
    Public Function ReadMemory(ByVal address As String, ByVal retChars As Int32)
        Dim loc = ReadProcessMemory(processHandle, address, vBuffer(0), 15, 0)
        Dim bits() As Byte
        Dim newStr = ""

        bits = BitConverter.GetBytes(vBuffer(0))
        For x = 0 To 7
            If bits(x) >= 65 And bits(x) <= 90 Or bits(x) >= 97 And bits(x) <= 122 Or bits(x) = 32 Then
                newStr = newStr & Chr(bits(x))
            End If
        Next

        bits = BitConverter.GetBytes(vBuffer(1))
        For x = 0 To 7
            If bits(x) >= 65 And bits(x) <= 90 Or bits(x) >= 97 And bits(x) <= 122 Or bits(x) = 32 Then
                newStr = newStr & Chr(bits(x))
            End If
        Next

        Return newStr
    End Function
This is probably also a pretty "dirty" way of doing this to begin with.

Could someone please explain how I would go about reading a string of, say, 40 characters from memory?

Last edited by Vertraag; 01-08-2009 at 1:47 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-09-2009, 10:36 AM
VB.NET Forum Newbie
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Jan 2009
Posts: 4
Reputation: 0
Vertraag is on a distinguished programming path ahead
Default

Bump

10 chars
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





All times are GMT -4. The time now is 5:13 PM.

Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0


For advertising opportunities click here.