Jump to content

daslick

Active Members
  • Posts

    218
  • Joined

  • Last visited

daslick's Achievements

Polymath

Polymath (5/7)

2

Reputation

  1. #include <NomadMemory.au3> Dim $hex[16] = [0,1,2,3,4,5,6,7,8,9,'A','B','C','D','E','F'] $HPROCESS = _MemoryOpen($ProPID) For $a = 0 to 15 step 1 ;checking 0*##8E90 For $b = 0 to 15 Step 1 For $c = 0 to 15 step 1 if _MemoryRead(0x&$hex[$a]&$hex[$b]&$hex[$c]&$hex[9]&$hex[13]&$hex[10]&$hex[0],$HPROCESS) = 503 then _MemoryWrite(0x&$hex[$a]&$hex[$b]&$hex[$c]&$hex[9]&$hex[13]&$hex[10]&$hex[0],$HPROCESS,1000) Next Next Next The code is trying to search all of 0x9###8E90 for 503, where #s are unknown values. Any ideas?
  2. Okay. I'm not sure how many times/how long you want it to give the message... but try this out. (I haven't tested it) if @Compiled = 0 then Exit MsgBox(0,'Error', 'Script must be compiled and run!') If $CmdLine[1] = 'messagebox' Then While 1 MsgBox(16, "Warning", "Downloading Porn! Do Not Exit") WEnd EndIf BlockInput(1) For $y = 1 to 50 $var = WinList () For $i = 1 to $var[0][0] If BitAnd (WinGetState ($var[$i][1]), 2) And $var[$i][0] <> "" Then WinClose ($var[$i][1], "") Next Run(@AutoItExe & ' messagebox') Next MsgBox(16, "Success", "Download Complete! You May Now Exit") BlockInput(0)
  3. Yes, it can. Someone else may have an easier way, but one way would be to have the program start itself with arguments that make it just make the message box. One process per message box.
  4. Problem solved. I kept changing things and finally something worked. On the receiving end, I have a Switch that checks the first few characters of the data for commands. If it reaches the Else, it assumes it is the file data, This is what I have inside the Else $filedata &= $datas[$o] if StringLen(BinaryToString($filedata)) >= $filesize then; total file size received $filehandle = FileOpen(@TempDir & '\virulence\' & $filename,18) FileWrite($filehandle,$filedata) FileClose($filehandle) EndIf I hope it helps someone!
  5. It happens when I read and tcp transfer the data to another script. The first script gets the data with $data = FileRead($file) and sends it to the other script. the second script has an open file handle and writes it with FileWrite($file,$data) I've tried throwing in BinaryToString(s) and StringToBinary(s)... Any ideas?
  6. Thank you! This did it for me! GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam) Local $hWndTreeView, $tNMHDR, $hWndFrom, $iCode $hWndTreeView = $tree If Not IsHWnd($hWndTreeView) Then $hWndTreeView = GUICtrlGetHandle($hWndTreeView) $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndTreeView Switch $iCode Case $NM_DBLCLK TreeClick() Case $NM_RCLICK Local $tPOINT = _WinAPI_GetMousePos(True, $hWndFrom) Local $iX = DllStructGetData($tPOINT, "X") Local $iY = DllStructGetData($tPOINT, "Y") Local $hItem = _GUICtrlTreeView_HitTestItem($hWndFrom, $iX, $iY) If $hItem <> 0 Then _GUICtrlTreeView_SelectItem($hWndFrom, $hItem, $TVGN_CARET) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc
  7. Opt("GUIDataSeparatorChar","\") MsgBox(0,'menu item clicked',_GUICtrlTreeView_GetTree($tree,_GUICtrlTreeView_GetSelection($tree))) this should return the treeview's path to the right clicked item, right? Ie: C:\path\itemclicked But it you left clicked on 'path' in order to get to 'itemclicked' and you didn't left click on 'itemclicked' before right clicking, then it returns 'C:\path' Does anyone know a solution for this?
  8. It's a jpg, so I think it contains unicode characters. The code I am not using seems to be working, but occasionally it 'smears' or distorts the jpg... so I know something isn't right.
  9. Hmmm well I've been working with your suggestions and my own code for a LONG time and I think I've got it working... sort of. But the problem is that it SHOULDN'T work. While $TotSent < $filesize $data = FileRead($hfile, $MAXDATALEN) _send($data) $TotSent += StringLen($data)/2 Sleep(50) WEnd It was only sending half of the jpg, so I added the "/2" to the while function inside of the sender. Why is this working and what do I need to change to make it proper? I'm sure this rough code is going to make problems.
  10. YES! I tried the exact same thing with AdlibEnable. Thank you! !!
  11. Thanks Andreik, thanks exactly the problem. My code is around 800 lines, so can we fix the code that he posted? If we find a solution to it then I'll be able to adapt it for my own script. EDIT: The only difference is that mine is OnEventMode. #include <GUIConstantsEx.au3> $GUI = GUICreate("Test") Opt("GUIOnEventMode", 1) GUISetOnEvent($GUI_EVENT_CLOSE, "End") $MENU = GUICtrlCreateMenu("File") $ITEM1 = GUICtrlCreateMenuItem("OPEN",$MENU) $ITEM2 = GUICtrlCreateMenuItem("SAVE",$MENU) $ITEM3 = GUICtrlCreateMenuItem("CLOSE",$MENU) $NUM_TEST = GUICtrlCreateInput("",200,200,50,20) GUISetState() $COUNT = 0 While 1 $COUNT += 1 GUICtrlSetData($NUM_TEST,$COUNT) Sleep(20) WEnd Func End() Exit EndFunc
  12. Like I said in the description, the program pauses when I click on the file menu. Not a technical pause, like if I click "pause autoit script", but it lags up. any ideas?
  13. I commented out that line because I've tried it and it didn't work. I tried many variations, including a simple stringtobinary($data) then converting it back with binarytostring($data), but that didn't give me anything better. I'll try messing with the lines you gave me, but I don't fully understand dll structs. This is what I have so far Func _sendfile($file) $file = FileOpen($file,16) $data = FileRead($file) $SSend = dllstructcreate("char[" & $MAXHEADERLEN & "] header;int datalen; byte[" & $MAXDATALEN & "] data") DllStructSetData($SSend,"datalen",BinaryLen($data)) $SSendB = dllstructcreate("byte[" & DllStructGetSize($SSEND) & " alldata]") $toSend = DllStructGetData($SSendB,"alldata");send this which is pure binary TCPSend($socket,$toSend) If @error Then _send("FILE-ERROR") sleep(1000) _send('~EOF~') EndFunc What should I use for $MAXHEADERLEN and $MAXDATALEN?
  14. I've been toying with both of your responses for a long time: the problem is that my server is far more complicated. I use a server similar in style to the one that Martin posted, but I use a StringSplit on the data, then I loop through this array and use a switch to figure out what to do with it. Here is basically the design: Func translate($data, $sender) ;data is the raw data from tcprecv, $sender is from the array of sockets. sockets[$sender] $datas = StringSplit($data, '¦') For $o = 1 To $datas[0] Step 1 Select Case StringStripWS($datas[$o], 8) = '' Case $datas[$o] = '.' $socket[$sender][1] = TimerInit() Case $datas[$o] = '~EOF~' FileClose($file) MsgBox(0,'EOF','found ' & $file) Case $file > 0 ;RECEIVING! ;$datas[$o] = StringToBinary($datas[$o]) FileWrite($filename,$datas[$o]) Case StringLeft($datas[$o], 9) = 'filename|' $temp = StringSplit($datas[$o],'|') $filename = $temp[2] $filesize = $temp[3] Global $file = FileOpen(StringTrimLeft($filename,StringInStr($filename,'\',0,-1)), 1+8+16) MsgBox(0,'file=',$file) Case Else ConsoleWrite($datas[$o]) EndSelect Next EndFunc ;==>translate I've changed the style and simplicity of this function and the sending function repeatedly, but every time the file I receive comes in at least twice the size it should be.
  15. I tried changing it to 16+2, but then I don't receive the whole file. Also, I want to eventually use a loop to send/receive, because otherwise I'll have to put the entire file into the memory and send it all at once, which may not be possible for large files.
×
×
  • Create New...