Sign in to follow this  
Followers 0
Slang

AutoIt v3.3.6.1 - 3.3.8.1 ( Stopped working ).

8 posts in this topic

#1 ·  Posted (edited)

The following code does no longer return the proper value; it works fine in 3.3.6.1.

Func _Ptr_Read($iv_Address, $ah_Handle, $av_Offset, $sv_Type = 'dword')

If IsArray($av_Offset) Then
If IsArray($ah_Handle) Then
Local $iv_PointerCount = UBound($av_Offset) - 1
Else
SetError(2)
Return 0
EndIf
Else
SetError(1)
Return 0
EndIf

Local $iv_Data[2], $i
Local $v_Buffer = DllStructCreate('dword')

For $i = 0 To $iv_PointerCount

If $i = $iv_PointerCount Then
$v_Buffer = DllStructCreate($sv_Type)
If @error Then
SetError(@error + 2)
Return 0
EndIf

$iv_Address = '0x' & Hex($iv_Data[1] + $av_Offset[$i])
DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')
If @error Then
SetError(7)
Return 0
EndIf

$iv_Data[1] = DllStructGetData($v_Buffer, 1)

ElseIf $i = 0 Then
DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')
If @error Then
SetError(7)
Return 0
EndIf

$iv_Data[1] = DllStructGetData($v_Buffer, 1)

Else
$iv_Address = '0x' & Hex($iv_Data[1] + $av_Offset[$i])
DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')
If @error Then
SetError(7)
Return 0
EndIf

$iv_Data[1] = DllStructGetData($v_Buffer, 1)

EndIf

Next

$iv_Data[0] = $iv_Address

Return $iv_Data

EndFunc ;==>_Ptr_Read

I have read the change history and realized that they replaced DllStructGetPtr with struct* thus I adjusted the code accordingly.

Fixed #2055: replaced DllStructGetPtr with "struct*" throughout UDFs.

Func _Ptr_Read($iv_Address, $ah_Handle, $av_Offset, $sv_Type = 'dword')

If IsArray($av_Offset) Then
If IsArray($ah_Handle) Then
Local $iv_PointerCount = UBound($av_Offset) - 1
Else
SetError(2)
Return 0
EndIf
Else
SetError(1)
Return 0
EndIf

Local $iv_Data[2], $i
Local $v_Buffer = DllStructCreate('dword')

For $i = 0 To $iv_PointerCount

If $i = $iv_PointerCount Then
$v_Buffer = DllStructCreate($sv_Type)
If @error Then
SetError(@error + 2)
Return 0
EndIf

$iv_Address = '0x' & Hex($iv_Data[1] + $av_Offset[$i])
DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'struct*', $v_Buffer, 'int', DllStructGetSize($v_Buffer), 'int', '')
If @error Then
SetError(7)
Return 0
EndIf

$iv_Data[1] = DllStructGetData($v_Buffer, 1)

ElseIf $i = 0 Then
DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'struct*', $v_Buffer, 'int', DllStructGetSize($v_Buffer), 'int', '')
If @error Then
SetError(7)
Return 0
EndIf

$iv_Data[1] = DllStructGetData($v_Buffer, 1)

Else
$iv_Address = '0x' & Hex($iv_Data[1] + $av_Offset[$i])
DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'struct*', $v_Buffer, 'int', DllStructGetSize($v_Buffer), 'int', '')
If @error Then
SetError(7)
Return 0
EndIf

$iv_Data[1] = DllStructGetData($v_Buffer, 1)

EndIf

Next

$iv_Data[0] = $iv_Address

Return $iv_Data

EndFunc ;==>_Ptr_Read

I also read about some changes in the function Hex ( but that seems to return the same output as in 3.3.6.1 ).

Changed: Hex() detects doubles internally and processes them respecting binary format.

Changed: Dec() and Hex() work with 64bit integers.

Am I missing something, or did something go wrong in the last update? Edited by Slang

Share this post


Link to post
Share on other sites



You might check the results returned by Hex again. I had to change some of my scripts due to the changes made to Hex.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Thank you. It handled it like an 8 byte pointer ( x64 ).

This problem is resolved.

Share this post


Link to post
Share on other sites
;)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

I don't quiet understand what happen here.

Would it be possible for you to upload the nomadMemory file you are now using for version 3.3.8.1?

Thanks

Share this post


Link to post
Share on other sites

Buzzer9990,

This has nothing to do with NomadMemory - it was a change in the return from the Hex function that caused the problem. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Melba23,

Thanks for the quick reply. I don't understand memory that well or how/what the changes did to the Hex function. Can you elaborate on what Slang ment when he said "Thank you. It handled it like an 8 byte pointer ( x64 ).

This problem is resolved."

Share this post


Link to post
Share on other sites

Thanks for you help. I kept searching and found this link I think my script is working again. Thanks again.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0