Jump to content

Yuraj

Active Members
  • Posts

    56
  • Joined

  • Last visited

Profile Information

  • WWW
    http://www.yuraj.ucoz.com

Yuraj's Achievements

Wayfarer

Wayfarer (2/7)

0

Reputation

  1. OK, this works for me: #include <GUIConstants.au3> #include <GUIEdit.au3> Dim $line = 0 GUICreate("SelLine",320,240) $Edit1 = GUICtrlCreateEdit("test" & @CRLF & "blaa"& @CRLF & "blaa"& @CRLF & "blaa",0,30,320,210) $Btn1 = GUICtrlCreateButton("Select line",0,0) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Switch $msg Case $Btn1 OnBtnClick() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func OnBtnClick() If $line > (_GUICtrlEdit_GetLineCount($Edit1)-1) Then $line = 0 GUICtrlSetState($Edit1,$GUI_FOCUS) SelectLine($Edit1,$line) $line += 1 EndFunc Func SelectLine($edit,$i) $cStart = _GUICtrlEdit_LineIndex($edit,$i) $cEnd = _GUICtrlEdit_LineIndex($edit,$i+1) _GUICtrlEdit_SetSel($edit,$cStart,$cEnd-1) EndFunc Func GetCurLineIndex($edit) $curPos = _GUICtrlEdit_GetSel($edit) Return _GUICtrlEdit_LineFromChar($edit,$curPos[0]) EndFunc
  2. Try this ($i is line index, zero-based): Func SelectLine($edit,$i) $cStart = _GUICtrlEdit_LineIndex($edit,$i) $cEnd = _GUICtrlEdit_LineIndex($edit,$i+1) _GUICtrlEdit_SetSel($edit,$cStart,$cEnd-1) EndFunc $line += 1 SelectLine($edit1,$line) And one function more: Func GetCurLineIndex($edit) $curPos = _GUICtrlEdit_GetSel($edit) Return _GUICtrlEdit_LineFromChar($edit,$curPos[0]) EndFunc To select current selected line in edit: SelectLine($edit1,GetCurLineIndex($edit1))
  3. Hi, you can look at my old test: server_client_commands.rar You can send commands/scripts encrypted from client to server >_< So there are only two base commands: 0x9D + encrypted code - for executing code , 0x22 - for terminating server. You can add more..
  4. I mean executable old dos com file >_<
  5. Hi, I've written a small com compiler, but It's not very good. It writtes machine code to file, but there's a one problem. You must manualy got adresses of DBs, buffers etc. using some hex editor. It's harder to fix it, that's my opinion. For now not very practical :-( There are few base instructions... Here is the code with simple example: ; COM compiler test ;Written by Yuraj #include <string.au3> #include <array.au3> $DBs = _DB("What's your name?" & @LF) $DBs &= _DB("Hello, ") $DBs &= _DB(@LF & "Press any key to close ..." & @LF) ; INSTRUCTIONS, 100 + OFFSET $r= _Print(0x14D) & _ ; offset of: "what's your..." _Read(0x128) & _ ; offset of input buffer _Print(0x160) & _ ; offset of: "hello..." _Print(0x128+2) & _ ; offset of input buffer + 2 ;_WriteChar('.') & _ ; write char _Print(0x168) & _ ; offset of "press any key" _ReadChar() & _ ; wait for key press, result in AL _Terminate() & _ ; return _CREATE_BUFFER(0x20,0x00,0x22) & _ ; Max. input string length 32 $DBs ; COMPILE OUTPUT $f = FileOpen("C:\test.com",18) FileWrite($f, $r) FileClose($f) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func DBLen($db) Return (StringLen($db)/2)-2 EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; FUNCTIONS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func _ClrScr() Return _MOV_AH(0x00) & _INT(0x10) EndFunc Func _Print($adr) $r = _MOV_DX($adr) ; > OFFSET OF STRING TO OUTPUT $r &= _MOV_AH(0x09) ; > FUNCTION: OUTPUT $r &= _INT(0x21) ; > INTERRUPT: IO... Return $r EndFunc Func _Read($adr) $r = _MOV_DX($adr) ; > OFFSET OF BUFFER $r &= _MOV_AH(0x0A) ; > FUNCTION: INPUT $r &= _INT(0x21) ; > INTERRUPT: IO... Return $r EndFunc Func _ReadChar() ; result is stored in AL $r = _MOV_AH(0x01) ; > FUNCTION: INPUT CHAR $r &= _INT(0x21) ; > INTERRUPT: IO... Return $r EndFunc Func _WriteChar($char) ; result is stored in AL $r = _MOV_DL(Asc($char)) ; > OFFSET OF BUFFER $r &= _MOV_AH(0x02) ; > FUNCTION: OUTPUT CHAR $r &= _INT(0x21) ; > INTERRUPT: IO... Return $r EndFunc Func _GetSystemDate() ; return: CX = year (1980-2099). DH = month. DL = day. AL = day of week (00h=Sunday) $r = _MOV_AH(0x2A) ; > FUNCTION: GET DATE $r &= _INT(0x21) ; > INTERRUPT: IO... Return $r EndFunc Func _Terminate() Return _INT(0x20) ; > INTERRUPT: TERMINATE... EndFunc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; BASE INSTRUCTIONS ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func _INT($num) Return Binary("0xCD" & Hex($num,2)) EndFunc Func _MOV_AH($num) Return Binary("0xB4" & Hex($num,2)) EndFunc Func _MOV_DL($num) Return Binary("0xB2" & Hex($num,2)) EndFunc Func _MOV_DX($adr) Return Binary("0xBA" & SwapEndian($adr)) EndFunc Func _NOP() Return Binary("0x00") EndFunc Func _DB($str) Return Binary($str & "$") EndFunc ; max,count,BUFFER_LEN (max+2) Func _CREATE_BUFFER($a,$b,$c) Return Binary("0x" & Hex($a,2) & Hex($b,2)) & Binary(_StringRepeat("$",$c)) EndFunc Func SwapEndian($iValue) Return Hex(BinaryMid($iValue, 1, 2)) EndFunc ;==>SwapEndian
  6. Ok, if nobody, then please somebody write my an C/++ example of PKWARE.dll usage of Uncompress function . I can't get it >_
  7. Thanks, but it isn't what I need.It's a compressed file without any (zip...) header, only compressed stream.
  8. Hello, I need help to translate this code from C to AutoIt. It's pkware uncompress function for compressed files: // decompression function -- returns zero on success DWORD (__cdecl *Uncompress) ( char *outputBuffer, DWORD *pOutSize, char *inputBuffer, DWORD dwSize ); // first, load the library HINSTANCE hDllInst=LoadLibrary("pkware.dll"); // get the decompression function address Uncompress=(DWORD (__cdecl *)(char*, DWORD*, char*, DWORD))GetProcAddress(hDllInst,"Uncompress"); // decompress file -- it's assumed here that input buffer contains compressed // file loaded from BLB archive and output buffer is allocated and has proper // size (that is, (dwOutSize) value from the corresponding directory entry) Uncompress(outputBuffer,&dwOutSize,inputBuffer,dwSize); // now (outputBuffer) contains decompressed file and (dwOutSize) is set to // decompressed file size (you should use directory entry value of output // size for output buffer allocation) I have done this example, it returns 0 but still it doesn't work: $a = DllStructCreate("char[50]") $b = DllStructCreate("dword") $c = DllStructCreate("char[50]") $handle = FileOpen("F00A_compressed",16) $data = FileRead($handle) DllStructSetData($c,1,$data) $p1 = DllStructGetPtr($a) $p2 = DllStructGetPtr($b) $p3 = DllStructGetPtr($c) $res = DllCall("pkware.dll","dword","Uncompress","char*",$p1,"dword*",$p2,"char*",$p3,"dword",FileGetSize("F00A_compressed")) ConsoleWrite($res) $out = DllStructGetData($a,1) FileWrite("C:\test.txt", $out) FileClose($handle)
  9. TODO: Add feature for adding multiple http header entries and function will return array of results, for example: GetServerHTTPHeader("www.google.com","date;server")
  10. Hi all, I have written this script - it's for getting HTTP header entry of host, it doesn't read entire HTTP response, only header and if it found that entry then stops receiving datas. Func GetServerHTTPHeader($host,$httpEntry,$port=80) ; INITIALIZE TCP TCPStartup() ; CONNECT $ip = TCPNameToIP($host) $socket = TCPConnect($ip,$port) ; SEND HTTP GET $sent = TCPSend($socket,"GET / HTTP/1.1"&@CRLF&"Host: "&$host&@CRLF&"User-agent: none"&@CRLF&"Connection: close"&@CRLF&@CRLF) ; RECIEVE DATA Local $recData = "" Local $data = "" Local $lastData = "" Local $date = "" While 1 $recData = TCPRecv($socket,1) ; Recieve byte ; Check if is end of HTTP header or @error If @error Or ($lastData & $data) == @CRLF Then ExitLoop ; Join last recieved char If $recData <> "" Then $data &= $recData EndIf ; If is current char end of line, get current line If $recData == @LF Then $ln = StringStripWS(StringTrimRight($data,2),2) ; Check for date HTTP header section If StringLeft(StringLower($ln),StringLen($httpEntry)) == $httpEntry Then $date = $ln ExitLoop Else ; if not found - continue $lastData = $data ; Set last data $data = "" ; Clear current line EndIf EndIf WEnd ; CLOSE SOCKET TCPCloseSocket($socket) TCPShutdown() If $date == "" Then SetError(1) ; Set error cuz not found date Return $date EndFunc //Sorry for my bad english
  11. This is the best solution for you: $vol = 0 while $vol < 10 MsgBox (0,"",StringFormat("%04d",$vol)) $vol += 1 WEnd
  12. Great! I Like It!
  13. Thanks! It works ! :-)
  14. Thanks! Do you know how to fix them?
×
×
  • Create New...