Jump to content

911 ProxyAPI tool: Not getting Message on handler


Go to solution Solved by Guddu07,

Recommended Posts

  • Solution

#include <WindowsConstants.au3>

Global Const $tagCOPYDATA = "dword data;dword len;ptr str"
Global Const $_WCD_LOGFILE = "WCD_Logfile.log"

HotKeySet("{ESC}", _Exit)

Global $_WCD_ClientResponse[3]
Global $_WCD_Verbose = True

Example()

Func Example()
  Local $hWnd = _WCD_CreateClient("Test 911")
  ;~ $tool_path = "C:\Users\Amit kumar\Desktop\3.35\ProxyTool\"
  Local $iPID = Run("C:\Users\Amit kumar\Desktop\3.35\ProxyTool\Autoproxytool.exe -changeproxy/ -ip=104.3.245.94 -proxyport=5000 -hwnd=" & $hWnd)
  If $_WCD_Verbose Then __WCD_Verbose("Run = " & @error & "/" & $iPID)
  Local $sString = WaitForResponse()
  ConsoleWrite($sString & @CRLF)
  While Sleep(100)
  WEnd
EndFunc   ;==>Example

Func WaitForResponse()
  Local $sResp
  While Sleep(10)
    $sResp = _WCD_Client_GetResponse()
    If $sResp <> "" Then Return $sResp
    ConsoleWrite(".")
  WEnd
EndFunc   ;==>WaitForResponse

Func _WCD_Client_GetResponse()
  If Not $_WCD_ClientResponse[0] Then Return ""
  $_WCD_ClientResponse[0] = False
  If $_WCD_Verbose Then __WCD_Verbose("Client Response cleared with data " & $_WCD_ClientResponse[1] & " and string " & $_WCD_ClientResponse[2])
  Return SetExtended($_WCD_ClientResponse[1], $_WCD_ClientResponse[2])
EndFunc   ;==>_WCD_Client_GetResponse

Func _WCD_CreateClient($sWindowTitle = "")
  If $_WCD_Verbose Then __WCD_Verbose("--------------  Client initiated --------------")
  Local $hWCD = GUICreate($sWindowTitle)
  If $_WCD_Verbose Then __WCD_Verbose("Client handle = " & $hWCD)
  GUIRegisterMsg($WM_COPYDATA, _WCD_WM_COPYDATA_CLIENT_HANDLER)
  Return $hWCD
EndFunc   ;==>_WCD_CreateClient

Func _WCD_WM_COPYDATA_CLIENT_HANDLER($hWnd, $iMsg, $wParam, $lParam)
  Local $tData = DllStructCreate($tagCOPYDATA, $lParam), $sString = ""
  If $tData.len Then
    Local $tStr = DllStructCreate('char str[' & $tData.len - 1 & ']', $tData.str)
    $sString = $tStr.str
  EndIf
  $_WCD_ClientResponse[0] = True
  $_WCD_ClientResponse[1] = $tData.data
  $_WCD_ClientResponse[2] = $sString
  If $_WCD_Verbose Then __WCD_Verbose("Client Reception From " & $wParam & " To " & $hWnd & " with Data " & $tData.data & " and String " & $sString)
  Return 1
EndFunc   ;==>_WCD_WM_COPYDATA_CLIENT_HANDLER

Func __WCD_Verbose($sMessage)
  Local Const $sTime = "[" & @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & "] "
  FileWriteLine($_WCD_LOGFILE, $sTime & $sMessage)
EndFunc   ;==>__WCD_Verbose

Func _Exit()
  Exit
EndFunc   ;==>_Exit


We are not able to get any info after all the proxy API call . Neither in windows shell running the API nor through the code

Link to post
Share on other sites
2 minutes ago, Guddu07 said:
#include <WindowsConstants.au3>

Global Const $tagCOPYDATA = "dword data;dword len;ptr str"
Global Const $_WCD_LOGFILE = "WCD_Logfile.log"

HotKeySet("{ESC}", _Exit)

Global $_WCD_ClientResponse[3]
Global $_WCD_Verbose = True

Example()

Func Example()
  Local $hWnd = _WCD_CreateClient("Test 911")
  ;~ $tool_path = "C:\Users\Amit kumar\Desktop\3.35\ProxyTool\"
  Local $iPID = Run("C:\Users\Amit kumar\Desktop\3.35\ProxyTool\Autoproxytool.exe -changeproxy/ -ip=104.3.245.94 -proxyport=5000 -hwnd=" & $hWnd)
  If $_WCD_Verbose Then __WCD_Verbose("Run = " & @error & "/" & $iPID)
  Local $sString = WaitForResponse()
  ConsoleWrite($sString & @CRLF)
  While Sleep(100)
  WEnd
EndFunc   ;==>Example

Func WaitForResponse()
  Local $sResp
  While Sleep(10)
    $sResp = _WCD_Client_GetResponse()
    If $sResp <> "" Then Return $sResp
    ConsoleWrite(".")
  WEnd
EndFunc   ;==>WaitForResponse

Func _WCD_Client_GetResponse()
  If Not $_WCD_ClientResponse[0] Then Return ""
  $_WCD_ClientResponse[0] = False
  If $_WCD_Verbose Then __WCD_Verbose("Client Response cleared with data " & $_WCD_ClientResponse[1] & " and string " & $_WCD_ClientResponse[2])
  Return SetExtended($_WCD_ClientResponse[1], $_WCD_ClientResponse[2])
EndFunc   ;==>_WCD_Client_GetResponse

Func _WCD_CreateClient($sWindowTitle = "")
  If $_WCD_Verbose Then __WCD_Verbose("--------------  Client initiated --------------")
  Local $hWCD = GUICreate($sWindowTitle)
  If $_WCD_Verbose Then __WCD_Verbose("Client handle = " & $hWCD)
  GUIRegisterMsg($WM_COPYDATA, _WCD_WM_COPYDATA_CLIENT_HANDLER)
  Return $hWCD
EndFunc   ;==>_WCD_CreateClient

Func _WCD_WM_COPYDATA_CLIENT_HANDLER($hWnd, $iMsg, $wParam, $lParam)
  Local $tData = DllStructCreate($tagCOPYDATA, $lParam), $sString = ""
  If $tData.len Then
    Local $tStr = DllStructCreate('char str[' & $tData.len - 1 & ']', $tData.str)
    $sString = $tStr.str
  EndIf
  $_WCD_ClientResponse[0] = True
  $_WCD_ClientResponse[1] = $tData.data
  $_WCD_ClientResponse[2] = $sString
  If $_WCD_Verbose Then __WCD_Verbose("Client Reception From " & $wParam & " To " & $hWnd & " with Data " & $tData.data & " and String " & $sString)
  Return 1
EndFunc   ;==>_WCD_WM_COPYDATA_CLIENT_HANDLER

Func __WCD_Verbose($sMessage)
  Local Const $sTime = "[" & @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & "] "
  FileWriteLine($_WCD_LOGFILE, $sTime & $sMessage)
EndFunc   ;==>__WCD_Verbose

Func _Exit()
  Exit
EndFunc   ;==>_Exit




We are not able to get any info after all the proxy API call . Neither in windows shell running the API nor through the code

 

Link to post
Share on other sites
#include <WindowsConstants.au3>

Global Const $tagCOPYDATA = "dword data;dword len;ptr str"
Global Const $_WCD_LOGFILE = "WCD_Logfile.log"

HotKeySet("{ESC}", _Exit)

Global $_WCD_ClientResponse[3]
Global $_WCD_Verbose = True

Example()

Func Example()
  Local $hWnd = _WCD_CreateClient("Test 911")
  ;~ $tool_path = "C:\Users\Amit kumar\Desktop\3.35\ProxyTool\"
  Local $iPID = Run("C:\Users\Amit kumar\Desktop\3.35\ProxyTool\Autoproxytool.exe -changeproxy/ -ip=104.3.245.94 -proxyport=5000 -hwnd=" & $hWnd)
  If $_WCD_Verbose Then __WCD_Verbose("Run = " & @error & "/" & $iPID)
  Local $sString = WaitForResponse()
  ConsoleWrite($sString & @CRLF)
  While Sleep(100)
  WEnd
EndFunc   ;==>Example

Func WaitForResponse()
  Local $sResp
  While Sleep(10)
    $sResp = _WCD_Client_GetResponse()
    If $sResp <> "" Then Return $sResp
    ConsoleWrite(".")
  WEnd
EndFunc   ;==>WaitForResponse

Func _WCD_Client_GetResponse()
  If Not $_WCD_ClientResponse[0] Then Return ""
  $_WCD_ClientResponse[0] = False
  If $_WCD_Verbose Then __WCD_Verbose("Client Response cleared with data " & $_WCD_ClientResponse[1] & " and string " & $_WCD_ClientResponse[2])
  Return SetExtended($_WCD_ClientResponse[1], $_WCD_ClientResponse[2])
EndFunc   ;==>_WCD_Client_GetResponse

Func _WCD_CreateClient($sWindowTitle = "")
  If $_WCD_Verbose Then __WCD_Verbose("--------------  Client initiated --------------")
  Local $hWCD = GUICreate($sWindowTitle)
  If $_WCD_Verbose Then __WCD_Verbose("Client handle = " & $hWCD)
  GUIRegisterMsg($WM_COPYDATA, _WCD_WM_COPYDATA_CLIENT_HANDLER)
  Return $hWCD
EndFunc   ;==>_WCD_CreateClient

Func _WCD_WM_COPYDATA_CLIENT_HANDLER($hWnd, $iMsg, $wParam, $lParam)
  Local $tData = DllStructCreate($tagCOPYDATA, $lParam), $sString = ""
  If $tData.len Then
    Local $tStr = DllStructCreate('char str[' & $tData.len - 1 & ']', $tData.str)
    $sString = $tStr.str
  EndIf
  $_WCD_ClientResponse[0] = True
  $_WCD_ClientResponse[1] = $tData.data
  $_WCD_ClientResponse[2] = $sString
  If $_WCD_Verbose Then __WCD_Verbose("Client Reception From " & $wParam & " To " & $hWnd & " with Data " & $tData.data & " and String " & $sString)
  Return 1
EndFunc   ;==>_WCD_WM_COPYDATA_CLIENT_HANDLER

Func __WCD_Verbose($sMessage)
  Local Const $sTime = "[" & @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & "] "
  FileWriteLine($_WCD_LOGFILE, $sTime & $sMessage)
EndFunc   ;==>__WCD_Verbose

Func _Exit()
  Exit
EndFunc   ;==>_Exit

 

Link to post
Share on other sites
  • Moderators
Posted (edited)

Moved to the appropriate forum, as the Developer General Discussion forum very clearly states:

Quote

General development and scripting discussions.


Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

 

Also merged topics, please stick to one from now on.

 

Moderation Team

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...