[.NET] 記憶體陣列搜尋問題
請教前輩們 ,我 下面有一段程式 是參考網路上的 記憶體搜尋
我想把他改寫成 多數 數值尋找
意思 就是
當我 輸入 16 進位 多個
EX: "FF FC DA EE CD EE 12"
我想要把 這段在記憶體中 搜尋他的位置 , 而我只能搜尋到 第二個 BYTES 超過之後
卻只會停留在第二個 位置....
請教前輩 該怎麼改寫 ?
下面是我稍微改寫 的 程式碼..
'======================================
Dim mysearch1() As String = Split(Trim(TextBox7.Text), " ")
Dim mysearch(mysearch1.Length - 1) As Byte
'======================================
Dim mbi As MEMORY_BASIC_INFORMATION
Dim BassAddr() As Integer = {0}
Dim PageSize() As Integer, PageNum As Integer
Dim tmpBassAddr As Integer, lBassAddr As Integer
Dim big As Integer = &H400000 '取最小的搜尋位置
Dim testnum, testnum2 As Integer
Dim data() As Byte
Dim i, j, k, n As Integer
ListBox3.Items.Clear()
Do While VirtualQueryEx(hProcess, lBassAddr, mbi, Len(mbi))
tmpBassAddr = mbi.BaseAddress
If tmpBassAddr > big Then
'取得最小位置
'tmpBassAddr = tmpBassAddr + mbi.RegionSize
If tmpBassAddr > &H7FFF0000 - 1 Then
Exit Do
End If
If mbi.State = MEM_COMMIT Then
If mbi.Protect And (PAGE_READWRITE Or PAGE_EXECUTE_READWRITE Or
PAGE_EXECUTE_WRITECOPY) Then
ReDim Preserve BassAddr(PageNum)
ReDim Preserve PageSize(PageNum)
BassAddr(PageNum) = mbi.BaseAddress
PageSize(PageNum) = mbi.RegionSize
PageNum = PageNum + 1
End If
End If
End If
tmpBassAddr = tmpBassAddr + mbi.RegionSize
lBassAddr = tmpBassAddr
Loop
'開始搜尋
For i = 0 To mysearch.Length - 1
If mysearch1(i) <> "?" And mysearch1(i) <> "??" And mysearch1(i) <>
"**" Then
mysearch(i) = CByte(Convert.ToInt32(mysearch1(i), 16)) '轉16進位
End If
Next
Dim mysearch_num As Integer = mysearch.Length
For i = 0 To PageNum - 1
ReDim Data(PageSize(i))
TestRPM(hProcess, BassAddr(i), Data, PageSize(i), 0&)
For j = 0 To PageSize(i)
If data(j) = mysearch(mysearch_num - 1) Then
mysearch_num = +1
For j1 = 1 To mysearch_num
If data(j + j1) = mysearch(mysearch_num) Then
ListBox3.Items.Add(Hex(BassAddr(i) + j))
Application.DoEvents()
End If
Next
End If
Next
Next
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.36.34.140