Exetools  

Go Back   Exetools > General > General Discussion

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 07-08-2009, 17:57
ahmadmansoor's Avatar
ahmadmansoor ahmadmansoor is offline
Coder
 
Join Date: Feb 2006
Location: Syria
Posts: 1,047
Rept. Given: 517
Rept. Rcvd 374 Times in 142 Posts
Thanks Given: 380
Thanks Rcvd at 416 Times in 119 Posts
ahmadmansoor Reputation: 300-399 ahmadmansoor Reputation: 300-399 ahmadmansoor Reputation: 300-399 ahmadmansoor Reputation: 300-399
Question VB 6.0 -GetProcAddress- ON Vista

anybody know why GetProcAddress not work on Vista .

I have write this code :

Dim hand,APIAdd as long
hand=GetModuleHandle ("advapi32.dll")
APIAdd=GetProcAddress(hand, "RegDeleteKeyA")

on windows Xp it work very fine and I got the address of the API .
but on Vista .... I got wrong Value ..
anybody have any explanation .
Thanks ....
__________________
Ur Best Friend Ahmadmansoor
Always My Best Friend: Aaron & JMI & ZeNiX
Reply With Quote
  #2  
Old 07-09-2009, 01:46
Zipdecode's Avatar
Zipdecode Zipdecode is offline
Unpack Safenet :)
 
Join Date: Oct 2005
Posts: 265
Rept. Given: 309
Rept. Rcvd 116 Times in 46 Posts
Thanks Given: 177
Thanks Rcvd at 67 Times in 24 Posts
Zipdecode Reputation: 100-199 Zipdecode Reputation: 100-199
hxxp://msdn.microsoft.com/en-us/vbrun/ms788708.aspx
__________________
Once finished the game, the king and the laborer they return to the same box
Reply With Quote
  #3  
Old 07-09-2009, 02:07
ahmadmansoor's Avatar
ahmadmansoor ahmadmansoor is offline
Coder
 
Join Date: Feb 2006
Location: Syria
Posts: 1,047
Rept. Given: 517
Rept. Rcvd 374 Times in 142 Posts
Thanks Given: 380
Thanks Rcvd at 416 Times in 119 Posts
ahmadmansoor Reputation: 300-399 ahmadmansoor Reputation: 300-399 ahmadmansoor Reputation: 300-399 ahmadmansoor Reputation: 300-399
Thanks I will check it ....

I have post in other site .. and I was note that it happen just with "advapi32.dll" .

this what happen :

00402870 . E8 BFF4FFFF call Project1.00401D34 here to GetProcAddress
then Eax hold the Correct value
00402875 . FF15 28104000 call near dword ptr [<&MSVBVM60.__vbaSetSystemError>] ; MSVBVM60.__vbaSetSystemError here will
then Eax hold the unCorrect value

I have small example
Attached Files
File Type: rar change some memory addreess.rar (9.7 KB, 8 views)
__________________
Ur Best Friend Ahmadmansoor
Always My Best Friend: Aaron & JMI & ZeNiX
Reply With Quote
  #4  
Old 07-09-2009, 03:52
IWarez IWarez is offline
Friend
 
Join Date: Jul 2003
Posts: 41
Rept. Given: 7
Rept. Rcvd 6 Times in 2 Posts
Thanks Given: 1
Thanks Rcvd at 0 Times in 0 Posts
IWarez Reputation: 7
You can't be sure that your dll is loaded. You can call loadlibrary and it will always work. If it's already loaded nothing will happen, if not it will be. Can't be better

Edit: I noticed in your source you call loadlibrary and then call GetModuleHandle. That's unnessecary as if I remember correctly you can use the handle from loadlibrary for your call to getprocaddress.

Last edited by IWarez; 07-09-2009 at 03:54. Reason: Correction
Reply With Quote
  #5  
Old 07-09-2009, 04:42
ahmadmansoor's Avatar
ahmadmansoor ahmadmansoor is offline
Coder
 
Join Date: Feb 2006
Location: Syria
Posts: 1,047
Rept. Given: 517
Rept. Rcvd 374 Times in 142 Posts
Thanks Given: 380
Thanks Rcvd at 416 Times in 119 Posts
ahmadmansoor Reputation: 300-399 ahmadmansoor Reputation: 300-399 ahmadmansoor Reputation: 300-399 ahmadmansoor Reputation: 300-399
yes my friend it is unnessecary ... but I was testting both .
because the probelm make me confuse -so I use the both -
__________________
Ur Best Friend Ahmadmansoor
Always My Best Friend: Aaron & JMI & ZeNiX
Reply With Quote
  #6  
Old 07-09-2009, 05:39
IWarez IWarez is offline
Friend
 
Join Date: Jul 2003
Posts: 41
Rept. Given: 7
Rept. Rcvd 6 Times in 2 Posts
Thanks Given: 1
Thanks Rcvd at 0 Times in 0 Posts
IWarez Reputation: 7
I see. I tried for myself on Vista and had no problem getting the address of the function you specified. I made my own VB6 test and attached it. Your problem might be in not using 'Option Explicit' and thus using undeclared variables and variants. I highly recommend to enable it.

An additional note: You can use Exit For to exit a For..Next loop. GoTo is forbidden, even in VB6
Attached Files
File Type: zip GetProcAddress.zip (4.3 KB, 13 views)
Reply With Quote
  #7  
Old 07-10-2009, 09:03
ahmadmansoor's Avatar
ahmadmansoor ahmadmansoor is offline
Coder
 
Join Date: Feb 2006
Location: Syria
Posts: 1,047
Rept. Given: 517
Rept. Rcvd 374 Times in 142 Posts
Thanks Given: 380
Thanks Rcvd at 416 Times in 119 Posts
ahmadmansoor Reputation: 300-399 ahmadmansoor Reputation: 300-399 ahmadmansoor Reputation: 300-399 ahmadmansoor Reputation: 300-399
Exclamation

Thanks my friend ....and I am sorry for late in replay ( it's my week end ) .
anyway I couldn't stop my self from laugh ..
I have tested ur Project1.exe file and it work very fine ...and I got the right value .
very good at this point . I start the VB 6.0 load the source code and run it inside ,and Ooops i got the wrong value again ...what happen here !!!???
is there a good logical reason for that pls

My friend the best command in basic was GoTo ....
I used it in many ways ...I like this command ,it is the best .
__________________
Ur Best Friend Ahmadmansoor
Always My Best Friend: Aaron & JMI & ZeNiX
Reply With Quote
  #8  
Old 07-12-2009, 23:03
IWarez IWarez is offline
Friend
 
Join Date: Jul 2003
Posts: 41
Rept. Given: 7
Rept. Rcvd 6 Times in 2 Posts
Thanks Given: 1
Thanks Rcvd at 0 Times in 0 Posts
IWarez Reputation: 7
Have you tried to step through your code from inside the ide? Are you maybe passing filenames with spaces? I don't use a PC with VB6 at the moment but if I find time tomorrow I'll try to tidy up your code and look for the problem.
Reply With Quote
  #9  
Old 07-14-2009, 03:53
IWarez IWarez is offline
Friend
 
Join Date: Jul 2003
Posts: 41
Rept. Given: 7
Rept. Rcvd 6 Times in 2 Posts
Thanks Given: 1
Thanks Rcvd at 0 Times in 0 Posts
IWarez Reputation: 7
I checked your code and made some modifications. You should check your immediate window after you press the 'Ready' button. You will see your IAT.TXT is badly formatted and sometimes your routines choke at that and try to find the wrong function or dll.

Do you have any way to modify the IAT.txt file? I suggest you use a <tab> to separate fields and use the vb command Split to get the fields. That makes your parsing much more readable and easier to debug.

Ps. I must say that when I checked your original code the address of the RegDeleteKeyA api was correct on my Vista system.
Attached Files
File Type: zip change some memory addreess.zip (20.0 KB, 8 views)
Reply With Quote
  #10  
Old 07-14-2009, 14:13
abest
 
Posts: n/a
Oh
Sorry.
Reply With Quote
  #11  
Old 07-15-2009, 05:13
ahmadmansoor's Avatar
ahmadmansoor ahmadmansoor is offline
Coder
 
Join Date: Feb 2006
Location: Syria
Posts: 1,047
Rept. Given: 517
Rept. Rcvd 374 Times in 142 Posts
Thanks Given: 380
Thanks Rcvd at 416 Times in 119 Posts
ahmadmansoor Reputation: 300-399 ahmadmansoor Reputation: 300-399 ahmadmansoor Reputation: 300-399 ahmadmansoor Reputation: 300-399
I have installed VB6.0 then I have installed VS2008 ....could this affect ???!!!
my friend the problem that I have tested ur code ..that all .
and I have the same result .I will try to compile ur source code ,and try to see the ruselt.

note : my friend can u help me in something else .
I have got this code form my frind Nieylana in accessroot.com
this is a function to Search Memory ...but it not work with some target:
+++++++++++++++++++++++
Public Function SearchMemory(searchString As String, Address As Long, LengthToSearch As Long) As Long
Dim x As Long
Dim y As Long
Dim SearchPointer As Long
Dim NumRead As Long
Dim nextByte As String
Dim isFound As Boolean
ReDim ByteArray((Len(searchString) / 2) - 1)
ReDim ByteMask((Len(searchString) / 2) - 1)

For x = 0 To UBound(ByteArray)
nextByte = Mid(searchString, (x * 2) + 1, 2)
If nextByte <> "??" Then
ByteArray(x) = Val("&H" & nextByte)
ByteMask(x) = 0
Else
ByteMask(x) = 1
End If
Next x
ReDim MemoryArray(LengthToSearch - 1)

Call ReadProcessMemory(ByVal mvarhProc, ByVal Address, MemoryArray(0), LengthToSearch, NumRead)
If NumRead = 0 Then
Call Err.Raise(7, , "Source memory could not be read!")
End If

For SearchPointer = 0 To LengthToSearch - 1
For x = 0 To UBound(ByteArray)
If SearchPointer + x = LengthToSearch Then
isFound = False
GoTo SearchedALL
End If
If MemoryArray(SearchPointer + x) <> ByteArray(x) And ByteMask(x) <> 1 Then
isFound = False
Exit For
End If
isFound = True
Next x
If isFound = True Then Exit For
Next SearchPointer
SearchedALL:
If isFound = True Then
SearchMemory = Address + SearchPointer
Else
SearchMemory = -1
End If
End Function
++++++++++++++++++++++
can u help me to write a function to search all memory in the target ,
like in olly .
and make it search for a pattern like this
"FF15????????90E9"
the function of Nieylana do this very will ..but cann't search all memory .
I think the problem in the size of the search .
I hope u can help me in this .
Many thanks for u .
__________________
Ur Best Friend Ahmadmansoor
Always My Best Friend: Aaron & JMI & ZeNiX
Reply With Quote
  #12  
Old 07-15-2009, 05:48
IWarez IWarez is offline
Friend
 
Join Date: Jul 2003
Posts: 41
Rept. Given: 7
Rept. Rcvd 6 Times in 2 Posts
Thanks Given: 1
Thanks Rcvd at 0 Times in 0 Posts
IWarez Reputation: 7
Hi Ahmadmansoor,

Have you read my post?

I think I clearly noted that your IAT.Txt file is not in a valid parseable format. It doesn't contain a clear standard for the separation of fields. I also noted you should check the output in the immediate window from VB6. You will see that the dllname and the functionname sometimes are wrong because of the wrong format of the IAT.txt.

About the memory searching problem:
I'm sorry but I'm not in the position to do the coding for you. I can assist you in the VB language and point at bugs but you have to do the majority of the work. That means you have to be specific on what doesn't work.

Questions:
- What error do you get on the search function?
- Are you aware you can step through the code and look at what the value of the variables are? (F8, F9 for breakpoint)
- Do you have complete sourcecode and a target where the function fails on?

IW
Reply With Quote
  #13  
Old 08-09-2010, 02:42
Sh4DoVV
 
Posts: n/a
Hi Dear Ahmadmansoor
Please Test This Module
Go0d Luck
Attached Files
File Type: rar modScanMem.rar (3.2 KB, 8 views)
Reply With Quote
The Following User Gave Reputation+1 to For This Useful Post:
ahmadmansoor (08-09-2010)
  #14  
Old 08-09-2010, 04:08
mafcin
 
Posts: n/a
i don't think that he still wants it
he wrote about it a year ago, but maybe somebody else will be have similar problem
Reply With Quote
  #15  
Old 08-09-2010, 16:55
ahmadmansoor's Avatar
ahmadmansoor ahmadmansoor is offline
Coder
 
Join Date: Feb 2006
Location: Syria
Posts: 1,047
Rept. Given: 517
Rept. Rcvd 374 Times in 142 Posts
Thanks Given: 380
Thanks Rcvd at 416 Times in 119 Posts
ahmadmansoor Reputation: 300-399 ahmadmansoor Reputation: 300-399 ahmadmansoor Reputation: 300-399 ahmadmansoor Reputation: 300-399
Oooo Thanks Sh4DoVV ..nice
about my problem I have solve it .... anyway many thanks for ur replay .
and I will try it on some targets ....
ps: r u the same guy on unpack and SND ?
__________________
Ur Best Friend Ahmadmansoor
Always My Best Friend: Aaron & JMI & ZeNiX
Reply With Quote
Reply


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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Vista x64 , Windows 7 limits? jump x64 OS 9 02-26-2010 01:00
Softice under Vista amigo General Discussion 14 03-09-2009 15:20
IDA and Vista nino General Discussion 2 10-12-2008 00:25
OllyDbg under Vista MR.HAANDI General Discussion 6 12-13-2006 19:12


All times are GMT +8. The time now is 07:51.


Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX, chessgod101
( Since 1998 )