
Ontosy
-
Posts
469 -
Joined
-
Last visited
Reputation Activity
-
Ontosy reacted to Jos in InputBox Secure strings - (Moved)
So here is the story of the last questions posted by you:
1. This one : wrong forum.. needed to be moved.
2. Resurected an very old topic, not really related, so i closed it.
3. Posted in the wrong forum so i had to move it.
You get one Guess what will happen to the next post you make that is wrong.
Jos
-
Ontosy reacted to Jos in InputBox Secure strings - (Moved)
Moved to the appropriate forum.
Moderation Team
-
Ontosy reacted to Jos in InputBox Secure strings - (Moved)
You ask for support on a autoit3 script... Nothing else!
-
Ontosy reacted to Jos in InputBox Secure strings - (Moved)
Stop arguing and simply post in this support forum when you have a question. Now either go back on the topic or i will simply close the topic.
-
Ontosy reacted to Jos in InputBox Secure strings - (Moved)
Ok have it your way.... Can't say I haven't tried.
-
Ontosy reacted to pixelsearch in DllCall pass string containing zero chrd
Though the preceding script works, I'm not a big fan of these C char[] arrays that you can't display because there is a chr(0) inside and their manipulation isn't very easy.
I tried initially to use std::string but I couldn't make it (i.e. to fill a std::string directly from both parameters) though I guess it's doable.
Anyway, now that the char[] array is created and functional in the preceding script, I succeeded to create a std::string based on the char[] array, which gives good results for displaying the variable at once (no for loop). Also, manipulating std::string is easier than manipulating char[]
So if we add the 3 following lines at the end of the preceding C++ code, this is the good result that will be displayed in Scite Console :
std::string true_string(string_text, string_length); cout << "True String : size = " << true_string.size() << endl; cout << "True String : text = " << true_string << endl;
Now that's fresh air
If I find a way to create the std::string directly (without the char[] lines) then I'll add a post here.
-
Ontosy got a reaction from mLipok in Error in Wiki
In Wiki
Local $g_idButton3 = GUICtrlCreateButton("MsgBox 2", 10, 10, 80, 30)
is wrong.
Correct is:
$g_idButton3 = GUICtrlCreateButton("MsgBox 2", 10, 10, 80, 30)
-
-
Ontosy reacted to czardas in _IsPressed(0x13) without {PAUSE}
I get a different result to you in every situation. Run the following script first without pressing pause:
#include <Misc.au3> MsgBox(0, "_IsPressed(0x13)", _IsPressed(0x13), 2) ; message will time out in 2 seconds Sleep(500) ; slow it down a bit MsgBox(0, "_IsPressed(""13"")", _IsPressed("13"), 2) ; correct syntax You should get False in both cases. Now repeat the experiment while holding down the pause key: after which I get two different results.
-
Ontosy got a reaction from mLipok in ObjCreateInterface with custom object
I have tryed to compile this "com object" and then use with AutoIt3 but not work: "err.number 0x80020006.
How to do?
#include-once Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") Local Const $sCLSID_TaskbarList = "{7233b105-bc01-41ff-b72e-582c5954b76d}" Local Const $sIID_ITaskbarList = "{702d63b3-d7d1-4f17-ab11-2f2ed770fdc8}" Local Const $sTagITaskbarList = 'SetString(wstr:cdecl);wstr:cdecl GetString();' Local $oIExample = ObjCreateInterface($sCLSID_TaskbarList, $sIID_ITaskbarList, $sTagITaskbarList) $a=$oIExample.SetString("Abc") msgbox(0,@error,$a) $a=$oIExample.GetString() ;.GetRootElement.CurrentClassName exit msgbox(0,0,$a) Func _ErrFunc($oError) ; Do anything here. ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_ErrFunc
-
Ontosy reacted to Danyfirex in Error 6: ERROR_INVALID_HANDLE
Hello. As LarsJ says funtions are not implemented properly. So I wrote this example with correct implementation. (tested in windows 10 x64. Compiled as x86 and x64)
Global Const $sTagSERVICE_STATUS = "DWORD dwServiceType;" & _ "DWORD dwCurrentState;" & _ "DWORD dwControlsAccepted;" & _ "DWORD dwWin32ExitCode;" & _ "DWORD dwServiceSpecificExitCode;" & _ "DWORD dwCheckPoint;" & _ "DWORD dwWaitHint;" Global $STANDARD_RIGHTS_REQUIRED = 0x000F0000 Global $SC_MANAGER_CONNECT = 0x0001 Global $SC_MANAGER_CREATE_SERVICE = 0x0002 Global $SC_MANAGER_ENUMERATE_SERVICE = 0x0004 Global $SC_MANAGER_LOCK = 0x0008 Global $SC_MANAGER_QUERY_LOCK_STATUS = 0x0010 Global $SC_MANAGER_MODIFY_BOOT_CONFIG = 0x0020 Global $SC_MANAGER_ALL_ACCESS = BitOR($STANDARD_RIGHTS_REQUIRED, _ $SC_MANAGER_CONNECT, _ $SC_MANAGER_CREATE_SERVICE, _ $SC_MANAGER_ENUMERATE_SERVICE, _ $SC_MANAGER_LOCK, _ $SC_MANAGER_QUERY_LOCK_STATUS, _ $SC_MANAGER_MODIFY_BOOT_CONFIG) Global Const $hAdvapi32 = DllOpen("advapi32.dll") MsgBox(64, "Info", "Make sure youre running Admin") Local $aRet = 0 Local $sServiceName = "Spooler" $aRet = DllCall($hAdvapi32, "handle", "OpenSCManagerW", _ "wstr", Null, _ "wstr", Null, _ "dword", $SC_MANAGER_ALL_ACCESS) If $aRet[0] = 0 Then If $aRet[0] = 0 And Not @error Then ConsoleWrite("!Error in OpenSCManager" & @CRLF) Exit EndIf Local $hSCManager = $aRet[0] ;~ MsgBox(0, "", $hSCManager) ConsoleWrite(">$hSCManager: " & $hSCManager & @CRLF) $aRet = DllCall($hAdvapi32, "handle", "OpenServiceW", _ "handle",$hSCManager, _ "wstr", $sServiceName, _ "long", $SC_MANAGER_ALL_ACCESS) If $aRet[0] = 0 Then If $aRet[0] = 0 And Not @error Then ConsoleWrite("!Error in OpenServiceW" & @CRLF) Exit EndIf Local $hServ = $aRet[0] ;~ MsgBox(0, "", $hServ) ConsoleWrite(">$hSCManager: " & $hServ & @CRLF) Local $tStatus = DllStructCreate($sTagSERVICE_STATUS) $aRet = DllCall($hAdvapi32, "bool", "QueryServiceStatus", _ "handle", $hServ, _ "ptr", DllStructGetPtr($tStatus)) If $aRet[0] = 0 Then If $aRet[0] = 0 And Not @error Then ConsoleWrite("!Error in QueryServiceStatus" & @CRLF) Exit EndIf ConsoleWrite("+Spooler Status: " & $tStatus.dwCurrentState & @CRLF) MsgBox(0, "", "Spooler Status: " & $tStatus.dwCurrentState) DllCall($hAdvapi32, "bool", "CloseServiceHandle", "handle", $hServ) DllCall($hAdvapi32, "bool", "CloseServiceHandle", "handle", $hSCManager) DllClose($hAdvapi32) Saludos
-
Ontosy reacted to LarsJ in ObjCreateInterface with custom object
It's a nice little example you found there. You have to download, compile and run the C-code in the link. Then you create an object with ObjCreateInterface in this way:
#include <WinAPIConstants.au3> Opt( "MustDeclareVars", 1 ) Global Const $sCLSID_Example = "{6899A2A3-405B-44d4-A415-E08CEE2A97CB}" Global Const $sIID_IExample = "{74666CAC-C2B1-4fa8-A049-97F3214802F0}" Global Const $dtag_IExample = _ "SetString hresult(str);" & _ "GetString hresult(str;int);" Example() Func Example() Local $oExample = ObjCreateInterface( $sCLSID_Example, $sIID_IExample, $dtag_IExample ) If Not IsObj( $oExample ) Then Return ConsoleWrite( "ObjCreateInterface ERR" & @CRLF ) ConsoleWrite( "ObjCreateInterface OK" & @CRLF ) If Not $oExample.SetString( "My grandmother could do that too" ) = $S_OK Then _ Return ConsoleWrite( "SetString method ERR" & @CRLF ) ConsoleWrite( "SetString method OK" & @CRLF ) Local $sStr1, $sStr2 = "is a cool coder" If Not $oExample.GetString( $sStr1, 16 ) = $S_OK Then _ Return ConsoleWrite( "GetString method ERR" & @CRLF ) ConsoleWrite( "GetString method OK" & @CRLF ) ConsoleWrite( $sStr1 & $sStr2 & @CRLF ) EndFunc #cs SciTE console: ObjCreateInterface OK SetString method OK GetString method OK My grandmother is a cool coder #ce
-
Ontosy reacted to AutoBert in GUI_EVENT_SECONDARYDOWN
This script also working, but you forgot to edit line 32 to display the right message.
May be some app is hooking your mouse and destroy the event? Did your secondary mousebutton work in other applications?
-
Ontosy got a reaction from jaberwacky in bug in date.au3?
In the file: AutoIt3IncludeDate.au3
in the function: _SetTime
at line: 1045
have:
If $iSecond > 0 Then DllStructSetData($tSYSTEMTIME, "MSeconds", $iSecond) It should not be
If $iSecond > 0 Then DllStructSetData($tSYSTEMTIME, "Second", $iSecond) ?
Do it is possible to add mSeconds also to library?
-
-
Ontosy reacted to FireFox in Winpcap filter and TCP/UDP packet splitter
@Ontosy
Here you go :
#include <String.au3> ... Global $aPacket = _TCP_Recv(...) If Dec($aPacket[13]) = 80 Then ;Source port = 80 $sPacketText = _HexToString($aTCPPacket[20]) ... ;process EndIf In the $sPacketText you will have the request header where you will be able to retreive the URI.
Br, FireFox.
-
-
Ontosy reacted to LarsJ in WM_COPYDATA to fb2k
Have you removed the "+1" added to the string lengths?
I have testet the code in the first post with the modifications in post #10. It works for me (XP).
-
Ontosy reacted to LarsJ in WM_COPYDATA to fb2k
Ontosy, I don't think you need the "+1" (none of them), but I think you need to take care of the spaces in the path so use a $cmd like this:
$Cmd = Chr(34) & $Path & "\foobar2000.exe" & Chr(34) & " " & $Cmd & Chr(0) & Chr(34) & $Path & Chr(34) & Chr(0)
-
Ontosy reacted to Kealper in TCPRecv truncated
I've come across this problem myself... The problem is that TCPRecv is a non-blocking function, meaning it will return what data it has received so far instead of waiting for all of it, and since TCP is a stream-based protocol, there is no way for it to determine if your application's packet has been fully read by itself.
Because of those two things I mentioned, what is happening is that when you call TCPRecv, it is only returning the data that has been sent to it so far (because sending data over a network is actually not instantaneous, it is just really fast). To fix this, you need to implement a receive buffer in your program. The buffer would temporarily hold the received data until your application has determined that the whole packet it is looking for has arrived.
If speed is not an issue, the easiest way would just be to throw like a Sleep(100) in just above the TCPRecv call, giving your program just a bit more time to receive all of the data before you go to read it. This has it's drawbacks because it still has some corner-cases where it won't return all of the data, but it should fix most of them.
If speed is an issue, then a more complex buffering system would have to be made...And I wouldn't mind helping with that if you were unable to figure out how to go about doing it.
EDIT: Also forgot to mention that it isn't a problem with receiving null characters, the TCP functions don't seem to be null-terminated from my experience.
SECOND EDIT: I whipped together a simple example to show what I mean by a receive buffer. This is a very basic "echo" server which listens for telnet connections, and when it gets them, it will echo back any message that you type as soon as you press the enter key. If you are using Microsoft's telnet client, this example will show exactly what I mean, since Microsoft's telnet client sends out letters as you type them.
TCPStartup() Global $Listen = TCPListen("0.0.0.0", 1234) ;Listen on all addresses on port 1234 If @error Then ;Uh-oh! ConsoleWrite("Error! Couldn't listen for clients on port 1234! Is another instance of this example already running?" & @CRLF) Exit 1 ;Exit with error-code 1 EndIf While 1 Local $iSock = TCPAccept($Listen) ;Check for new connections If $iSock = -1 Then ContinueLoop ;If no new connections are present, go back to the top of the loop and check again ConsoleWrite("A new client has connected!" & @CRLF) ;A wild connection appears! Local $sBuffer = "" ;Create a local receive buffer variable While 1 ;Go in to a loop to read everything the client sends in to the buffer Local $sRecv = TCPRecv($iSock, 512) ;Write up to 512 characters at a time in to the buffer If @error Then ;If the client disconnected, stop right here and check for new clients again ConsoleWrite("Client has disconnected. Now waiting for more clients..." & @CRLF) ExitLoop EndIf If $sRecv = "" Then ContinueLoop ;Client sent no data, go check again... $sBuffer &= $sRecv ;Client did send data, throw this new data in to the buffer ConsoleWrite("Client sent: " & $sRecv & @CRLF) If StringInStr($sBuffer, @CRLF) Then ;If the client has sent an @CRLF (an enter button press), then do this TCPSend($iSock, "received: " & $sBuffer & @CRLF) ;Send their message they sent back to them $sBuffer = "" ;Empty the temporary buffer and start waiting for more data EndIf WEnd WEnd -
Ontosy reacted to guinness in get type control
Was in the progress of creating this >>
#include <ButtonConstants.au3> #include <Constants.au3> #include <WinAPI.au3> Example() Func Example() Local $hGUI = GUICreate('') Local $iLabel = GUICtrlCreateButton('', 0, 0, 50, 50) Local $iCheckbox = GUICtrlCreateCheckbox('', 0, 0, 100, 20) ; This is considered a 'Button' by _WinAPI_GetClassName too. GUISetState(@SW_SHOW, $hGUI) MsgBox(4096, '', 'AutoIt Button ID: ' & _IsButton($iLabel) & @CRLF & _ 'AutoIt Button Handle: ' & _IsButton(GUICtrlGetHandle($iLabel)) & @CRLF & _ 'AutoIt Checkbox ID: ' & _IsButton($iCheckbox) & @CRLF & _ 'AutoIt Checkbox Handle: ' & _IsButton(GUICtrlGetHandle($iCheckbox)) & @CRLF) Return GUIDelete($hGUI) EndFunc ;==>Example ; Check if a variable is referencing a Button control. Func _IsButton($hWnd) If IsHWnd($hWnd) = 0 Then $hWnd = GUICtrlGetHandle($hWnd) EndIf Local $sClassName = _WinAPI_GetClassName($hWnd) If $sClassName = 'Button' Then Local $aStyle[5] = [4, $BS_CHECKBOX, $BS_AUTOCHECKBOX, $BS_RADIOBUTTON, $BS_AUTORADIOBUTTON] Local $iLong = _WinAPI_GetWindowLong($hWnd, $GWL_STYLE) For $i = 1 To $aStyle[0] If BitAND($iLong, $aStyle[$i]) = $aStyle[$i] Then Return False EndIf Next Return True EndIf Return False EndFunc ;==>_IsButton