
tlman12
Active Members-
Posts
158 -
Joined
-
Last visited
Everything posted by tlman12
-
Disable touch input with BlockInput
tlman12 replied to tlman12's topic in AutoIt General Help and Support
I am blocking right and left mouse buttons I am using #RequireAdmin, and yes it does not work at all without it. #RequireAdmin is fully compatible (i'm using it on windows 8.1) I wrote in some logging for the _BlockInputEx() include i found. i was logging this info FileWriteLine(".\Mouse.txt",$nCode & "," & $wParam & "," & $lParam & "," & $MOUSEHOOKSTRUCT & "," & $iExtraInfo & "," & $iMouse_Event & "," & $iBlockAllInput) and got this 0,0x00000200,0x0139F598,,1,512,0 0,0x00000200,0x0139F598,,1,512,0 0,0x00000201,0x0139F598,,4294967295,513,0 0,0x00000202,0x0139F598,,4294967295,514,0 from what i could find out, $iMouse_event 512 is a mouse move, 513 is a left click down and 514 is a left click up the $iExtraInfo is where it looses me, can't find any info about that but if i use a normal mouse click this information is 0, if i modify the function to run even if that info is a non 0 i bock most input but for some reason i am still allowed to open the charms bar, scroll through windows that were already open and highlight (not open) files on the desktop. so something is defiantly happening that isn't being picked up by a lowlevel mouse hook. this is the udf i'm using to block input it seems like i'd have to hook into some other message interface to grab the touchscreen interaction but it is not well documented at all -
Disable touch input with BlockInput
tlman12 replied to tlman12's topic in AutoIt General Help and Support
Bump -
look at _IEFormElementCheckBoxSelect in the help file. I think that's what your gonna want.
-
it may be saying that because your defining $unlocker within an if statement and if there is no logic for $unlocker to be created then there is no variable for a case statement (without seeing more of your code i can't be sure) try creating the unlocker button during the gui creation and then do a GUICtrlSetState(-1,$GUI_HIDE) right below it then in your if statement (if logic says for the button to be available do GUICtrlSetState(-1,$GUI_SHOW) that way there is no possibility of $unlocker being undefined.
-
If i'm understanding you correctly, your going to need 2 scripts. in your script (the one you want to pause) you'll need to add these lines (or something similar) HotKeySet("{1}","_Pause") $paused = False "{1}" being whatever key you can get away with stealing from the computer and this function Func _Pause() If $paused Then $paused = False Else $paused = True EndIf While $paused Sleep(50) ; so you don't overrun your cpu, you can increase this to suite your needs but if you want near real time leave it at 50 WEnd EndFunc then in the other script you'll need to write the winactive monitor portion in a while loop and send the hot key based on your logic once your logic has passed use a Send("{1}") and that should pause your other script, using a Send("{1}") again should un-pause it and allow it to pick up at the exact spot it left off.
-
Mapped Drive not visible in the explorer
tlman12 replied to shivamfet's topic in AutoIt General Help and Support
are you using a #RequireAdmin or running the script as admin? if so you are mapping the drive under admin context and it would only be accessible by another process running in admin context. as a test you can try running the command prompt as administrator and see if you can see the mapping, or running a DriveMapGet($driveName) within admin context. -
Script to fix Win 7 Default Profile Problem
tlman12 replied to ViciousXUSMC's topic in AutoIt General Help and Support
I know you figured this out but the reason powershell didn't work was you had your quotes wrong, in powershell ' and " have different meanings they aren't interchangeable like in autoit, also in shellexecute you need to specify an application and parameters, sometimes it doesn't like being fed a single string. so your ShellExecute('powershell.exe Rename-Item ' & '"HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\' & $sub & '"' & ' -NewName ' & '"' & $sub & '.old"') should look like ShellExecute("powershell.exe","Rename-Item 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\" & $sub & "'" & " -NewName " & "'" & $sub & ".old'") in theory the double quote should have worked but the difference is single quote denotes a string only and double quote says that the string should be parsed for a nested variable. in the grand scheme of things for this it may not make much of a difference between a reg command and a Rename-Item cmdlet but if you had larger keys structures to rename powershell would be the faster solution. also in the future Micro$oft will probably start phasing out those legacy commands -
Script to fix Win 7 Default Profile Problem
tlman12 replied to ViciousXUSMC's topic in AutoIt General Help and Support
you can use powershell to rename the registry with a built in cmdlet Rename-Item 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\[key to be renamed]' '[new name of key]' just do a shellexecute or a run powershell.exe Rename-Item 'HKLM:SOFTWAREMicrosoftWindows NTCurrentVersionProfileList[key to be renamed]' '[new name of key]' obviously must be run as administrator. -
I'm trying to run a script where I do not want the user to interact and potentially stop the process in the middle. not as worried about the ctrl+alt+del as i am of them clicking the window because one of the commands takes a while to run and windows marks the process as not responding allowing them to close it if they try enough times. the problem is we have surface pro devices that are primarily used in touch screen and it appears the the user is still allowed to interact with the screen even during a blockinput. I also tried the _BlockInputEX() and that still allows touch screen interaction. I only want to use something like devcon as to disable the screen as a last resort because if it doesn't re-enable for some reason it would be a decent pain in the @$$ any ideas?
-
Unlock bitlocker drive with AutoIt/VBScript
tlman12 replied to tlman12's topic in AutoIt General Help and Support
Thank you that was exactly the feed back from my script that i needed. I got it to work and cleaned it up a little bit, here is the finished product if anyone is interested. the reason i wrote this is because i wanted to be able to distribute my BitLocker DRA cert without distributing a static password. this script works by generating a hashing a set of data retrieved from the computer (common knowledge) that can be generated with minimal knowledge of the PC by a tech with the proper generator. I removed that feature from the script because i can't release exactly how i was doing it. it was based on a hash with a date salt that way it would change constantly. this is tested and working in the Windows 8.1 Command Prompt recovery option. enjoy #RequireAdmin #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Compile_Both=y #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ;Ref@MSDN: ;http://msdn.microsoft.com/en-us/library/windows/desktop/aa376483(v=vs.85).aspx Local $oErrorHandler = ObjEvent('AutoIt.Error', '_ObjErrorHandler') Const $S_OK = 0 Const $UNKNOWN = 1 Const $ERROR_FILE_NOT_FOUND = 2 Const $BITLOCKER_NOT_ACTIVATED = 80310008 Const $FAILED_AUTHENTICATION = 80310027 Const $BITLOCKE_PROTECTOR_NOT_FOUND = 80310033 Const $CERTIFICATE_PRIVATEKEY_AUTH_FAILED = 80310094 Const $CERTIFICATE_NOT_FOUND = 80070002 Const $CERTIFICATE_PIN_INCORRECT = 80092009 #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> ;~ Changeable Fields ; Instructions, ; Export the BitLocker Drive Recovery Agent certificate (WITH PRIVATE KEY) ; Place it in the same directory as this script before you compile it. ; Change $sPIN below to reflect the pfx password you exported with. ; $sPassword will set a password to run the script, if left blank unlock will occur automatically without any need for a password. Dim $sPIN = "Secure_Cert_Password" ;Don't forget to change this Dim $sPassword = "Password to run script" Dim $sCertName = "BitLocker.pfx" ;Make sure to name your certificate whatever you put here. FileInstall("BitLocker.pfx",@TempDir & "\BitLocker.pfx",1) ;and change the cert name here Dim $strComputer = "." ;Possiblity to add remote computer later ;~ No need to change below here Dim $sDeviceID $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $strComputer & "\root\CIMV2\Security\MicrosoftVolumeEncryption") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_EncryptableVolume") For $objItem in $colItems If $objItem.ProtectionStatus > 0 Then ClipPut($objitem.DeviceID) $sDeviceID = $sDeviceID & "|" & $objItem.DeviceID EndIf Next If $sDeviceID = "" Then MsgBox(64,"Not Encrypted","No BitLocker encrypted drives were found on this computer") Exit Else $sDeviceID = StringTrimLeft($sDeviceID,1) #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 325, 105, -1, -1) $Label1 = GUICtrlCreateLabel("Pick the drive you would like to unlock", 64, 8, 192, 17) $Combo1 = GUICtrlCreateCombo($sDeviceID, 8, 32, 305, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL)) $Button1 = GUICtrlCreateButton("Ok", 123, 64, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 GUISetState(@SW_HIDE) $sDeviceID = GUICtrlRead($Combo1) If $sPassword <> "" Then $string = InputBox("Password required","Please type the correct password to advance","") If $string = $sPassword Then $ret = _UnlockWithCertificateFile(@TempDir & "\" & $sCertName,$sPIN,$sDeviceID) FileDelete(@TempDir & "\" & $sCertName) Switch $ret Case $S_OK MsgBox(64,"Success","Drive should now be unlocked") Case $UNKNOWN MsgBox(16,"Error","An unknown error has occured") Case $ERROR_FILE_NOT_FOUND MsgBox(16,"Error","File Not Found") Case $BITLOCKER_NOT_ACTIVATED MsgBox(16,"Error","BitLocker is not activated on the specified drive") Case $FAILED_AUTHENTICATION MsgBox(16,"Error","Failed Authentication") Case $BITLOCKE_PROTECTOR_NOT_FOUND MsgBox(16,"Error","Specified BitLocker Protector not found") Case $CERTIFICATE_PRIVATEKEY_AUTH_FAILED MsgBox(16,"Error","Certificate Private Key authentication failed") Case $CERTIFICATE_NOT_FOUND MsgBox(16,"Error","Certificate path must be incorrect") Case $CERTIFICATE_PIN_INCORRECT MsgBox(16,"Error","Certificate PIN is incorrect") Case Else MsgBox(16,"Error","An unknown error has occured") EndSwitch Else MsgBox(16,"Error","Password is incorrect") EndIf Exit EndSwitch WEnd EndIf Func _UnlockWithCertificateFile($inPath, $inPinCode, $inDeviceID, $strComputer = '.') Local $objWMI, $objShare, $objInParam, $objOutParams $objWMI = ObjGet('winmgmts:{ImpersonationLevel=Impersonate,AuthenticationLevel=PktPrivacy,(Debug,Security)}!\\' & _ $strComputer & '\root\CIMV2\Security\MicrosoftVolumeEncryption') ; Obtain an instance of the the class ; using a key property value. $objShare = $objWMI.Get("Win32_EncryptableVolume.DeviceID='" & $inDeviceID &"'") ; Obtain an InParameters object specific ; to the method. $objInParam = $objShare.Methods_("UnlockWithCertificateFile").inParameters.SpawnInstance_() ; Add the input parameters. $objInParam.PathWithFileName = $inPath $objInParam.Pin = $inPinCode ; Execute the method and obtain the return status. ; The OutParameters object in objOutParams ; is created by the provider. $objOutParams = $objShare.ExecMethod_('UnlockWithCertificateFile', $objInParam) ; Return OutParams Return Hex($objOutParams.ReturnValue) EndFunc Func _ObjErrorHandler() Local $AOE1 = $oErrorHandler.ScriptLine Local $AOE2 = Hex($oErrorHandler.Number, 8) Local $AOE3 = $oErrorHandler.Description Local $AOE4 = $oErrorHandler.WinDescription $oErrorHandler.Clear Local $eMsg = '' If $AOE1 Then $eMsg &= 'Line:' & $AOE1 & ' ' If $AOE2 Then $eMsg &= '(0x' & $AOE2 & ') ' If $AOE3 Then $eMsg &= $AOE3 & ' ' If $AOE4 Then $eMsg &= $AOE4 MsgBox(8240, 'Object Error', $eMsg) Exit EndFunc -
I'm trying to script out the unlocking of a bitlocker drive using a DRA certificate. I'm attempting to use the WMI Method UnlockWithCertificateFile and I can't for the life of me figure out what i'm doing wrong or even find an example. I know the certificate and pin work because i can manually unlock the drive using manage-bde -unlock.... when i run my script i get a return value of -2146885623 wich i've looked up to be -2146885623, "Cannot find the requested object." i'm not sure what object its talking about. here is the code started with (minus the pin), its vbscript but i'm getting the same error whether it's vbscript or autoit so i think theres something wrong with my base vbscript code. i cant find any examples online for this method. i generated this script from "WMI Code Creator strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2\Security\MicrosoftVolumeEncryption") ' Obtain an instance of the the class ' using a key property value. Set objShare = objWMIService.Get("Win32_EncryptableVolume.DeviceID='\\?\Volume{a2965903-4af0-11e2-be65-806e6f6e6963}\'") ' Obtain an InParameters object specific ' to the method. Set objInParam = objShare.Methods_("UnlockWithCertificateFile"). _ inParameters.SpawnInstance_() ' Add the input parameters. objInParam.Properties_.Item("PathWithFileName") = "D:\BitLocker.pfx" objInParam.Properties_.Item("Pin") = "PinCode ' Execute the method and obtain the return status. ' The OutParameters object in objOutParams ' is created by the provider. Set objOutParams = objWMIService.ExecMethod("Win32_EncryptableVolume.DeviceID='\\?\Volume{a2965903-4af0-11e2-be65-806e6f6e6963}\'", "UnlockWithCertificateFile", objInParam) ' List OutParams Wscript.Echo "Out Parameters: " Wscript.echo "ReturnValue: " & objOutParams.ReturnValue has anyone ever used this method or can anyone see something i may be doing wrong? also i'm using the windows 8 commandline recovery option, i'm not sure if that makes a difference because i have tested calling other methods and wmi and scripting seem to be fully implemented. i did get it to work in vb.net but vb.net has not been implemented in the recover
-
Autoit not seeing [out] parameters
tlman12 replied to tlman12's topic in AutoIt General Help and Support
alright, like i said its not a big deal to me i'm just happy to know it wasn't something i was doing wrong. i consider myself to be "fairly" programming savvy and i just couldn't figure out why it would work in on language and not another considering the similarities between vb and auotit. i would post this in the bug tracker but i don't enough about the problem you described to answer any questions they may have. if you want to post it that would be great and i will, like i said, be available to test and confirm a resolution. if not, that's fine too. -
Autoit not seeing [out] parameters
tlman12 replied to tlman12's topic in AutoIt General Help and Support
slightly over my head haha so is this a bug that is going to be fixed or is it just not worth it? i went ahead and wrote it in vb.net. accomplished the same goals but i just won't be able to integrate it into a program I've already got written in autoit as well lol. oh well works just fine compiling it and calling it with with a run from my other program :-P if it is something that is going to be fixed i will be happy to help by testing these particular functions. thank you though for all of your help. -
Autoit not seeing [out] parameters
tlman12 replied to tlman12's topic in AutoIt General Help and Support
Yes, http://www.sophos.com/en-us/medialibrary/PDFs/documentation/sgn_60_m_eng_api.pdf -
Autoit not seeing [out] parameters
tlman12 replied to tlman12's topic in AutoIt General Help and Support
Update. I found a dll called Utimaco.SafeGuard.AdministrationConsole.Scripting.Base.dll but when i used your script to try to open it i got "No MSFT Typelib inside file!" -
Autoit not seeing [out] parameters
tlman12 replied to tlman12's topic in AutoIt General Help and Support
Ran that, didn't get a file path so i added the rest of the numbers in that objName() and got that console print. Release: +>15:50:41 Starting AutoIt3Wrapper v.2.1.0.33 Environment(Language:0409 Keyboard:00000409 OS:WIN_8/ CPU:X64 OS:X64) >Running AU3Check (1.54.22.0) from:C:Program Files (x86)AutoIt3 +>15:50:41 AU3Check ended.rc:0 >Running:(3.3.8.1):C:Program Files (x86)AutoIt3autoit3.exe "10.65.19.2Laptop_ScriptSource_testing_partsTL_workspaceIn ProgressSGNtestobj.au3" --> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop 3.3.8.1 Object Object Name: Base Description: ProgID: File: Module: C:WindowsMicrosoft.NETFrameworkv4.0.30319clr.dll CLSID: {80EECC7E-3861-3E69-AE2F-3369F1C9E1EA} IID {B5B0629F-1BD3-3417-B4A0-C5CDE6A50150} +>15:50:41 AutoIT3.exe ended.rc:0 >Exit code: 0 Time: 2.013 Beta: +>15:51:44 Starting AutoIt3Wrapper v.2.1.0.33 Environment(Language:0409 Keyboard:00000409 OS:WIN_8/ CPU:X64 OS:X64) >Running AU3Check (3.3.9.4) from:C:Program Files (x86)AutoIt3beta +>15:51:44 AU3Check ended.rc:0 >Running:(3.3.9.4):C:\Program Files (x86)\AutoIt3\Beta\autoit3.exe "10.65.19.2Laptop_ScriptSource_testing_partsTL_workspaceIn ProgressSGNtestobj.au3" --> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop 3.3.9.4 Object Object Name: Base Description: ProgID: File: Module: C:\Program Files (x86)\AutoIt3\Beta\autoit3.exe CLSID: {80EECC7E-3861-3E69-AE2F-3369F1C9E1EA} IID {B5B0629F-1BD3-3417-B4A0-C5CDE6A50150} +>15:51:44 AutoIT3.exe ended.rc:0 >Exit code: 0 Time: 2.011 not sure where to go from here. -
Autoit not seeing [out] parameters
tlman12 replied to tlman12's topic in AutoIt General Help and Support
it's not just GetLastError. i only used that as an easy example it is any function that returns its data with a byref or an [out] variable but based on the return values it is accepting the byval or [in] variables also $ErrorText in the GetLastError us supposed to return "OK" on a good return. -
Autoit not seeing [out] parameters
tlman12 replied to tlman12's topic in AutoIt General Help and Support
didn't work with beta either. is there any reason this wouldn't be working? i would think that if it works in vbscript it should work in autoit. and like i said, based on the actual return values, i know the functions are working properly. i'm just not getting the info i need. -
Autoit not seeing [out] parameters
tlman12 replied to tlman12's topic in AutoIt General Help and Support
beta? cause 3.3.8.1 is the current version -
Autoit not seeing [out] parameters
tlman12 replied to tlman12's topic in AutoIt General Help and Support
$ret is set to the success/fail number value from my list above, so 0 means the function ran properly 1 means it failed. The API reference that i posted a link to has this as the description of that function Uint32 Base::GetLastError(out string errorText) Retrieves a textual representation of the last (internal) error occurred. Note: In contrast to other API methods this method returns an unsigned integer which holds the internal error code. i'm using the most current version 3.3.8.1 -
ha your right, didn't even notice that. i only copied what he had and added the if statement. didn't try to run it
-
What about Func IsTest($id) If $id = 25834 Then Return True Else For $i = 3675 To 3682 If $id = Hex($i, 8) Then Return True Else Return False EndIf Next EndIf EndFunc ;==>IsTest
-
Autoit not seeing [out] parameters
tlman12 replied to tlman12's topic in AutoIt General Help and Support
the autoit code is practically verbatim of the vbs code so i'm not sure how it's going to help, but imho this script is worthless to anyone trying to help me that doesn't have sophos safeguard encryption unless you know what the problem may be. it doesn't get past line 38 without the software installed. and on my computer everything works but the [out] variables in the functions. ;~ '---------------------------------------------------------------------------------------------------------- ;~ 'Do a challenge/$response by script ;~ ' ;~ 'Arguments: $mode = 1: logon recovery ;~ ' $mode = 2: bitLocker recovery ;~ ' $mode = 3: suspension ;~ ' ;~ ' user: username (only needed if $mode = 1 or $mode 3) ;~ ' challenge: the computer's challenge code (only needed if $mode = 1 or $mode 3) ;~ ' computer: computername (not needed for $mode 3) ;~ ' drive: BitLocker drive letter (only needed if $mode = 2) ;~ ' ;~ 'Call $mode 1: e. g. cscript Challenge$responsebyScript.vbs 1 computer user S9LWR99TKGZU8G115Z93C18C31JKSV ;~ 'Call $mode 2: e. g. cscript Challenge$responsebyScript.vbs 2 computer C ;~ 'Call $mode 3: e. g. cscript Challenge$responsebyScript.vbs 3 user 20 S9LWR99TKG ;~ '---------------------------------------------------------------------------------------------------------- Dim $Scripting Dim $ScriptingDirectory Dim $ScriptingCR Dim $adsDomain Dim $adsMachine Dim $adsUser Dim $challengeFlags Dim $response Dim $msoName Dim $sgnPassword Dim $opCode Dim $ret Dim $result Dim $ErrorText Dim $adsType Dim $arg Dim $mode ;'Bitlocker, SGN-Client Suspension $arg = $cmdLine $msoName = "mso" $sgnPassword = "1234" $Scripting = ObjCreate("Utimaco.SafeGuard.AdministrationConsole.$Scripting.Base") $ScriptingDirectory = $Scripting.CreateDirectoryClassInstance() $ScriptingCR = $Scripting.CreateCRClassInstance() $result = $Scripting.Initialize() $ret = $Scripting.GetLastError($ErrorText) msgbox(0,"","Init $Scripting: " & $ErrorText) $result = $Scripting.AuthenticateOfficer($msoName, $sgnPassword, "") $result = $ScriptingDirectory.Initialize() $ret = $Scripting.GetLastError($ErrorText) msgbox(0,"","Init $ScriptingDirectory: " + $ErrorText) $result = $ScriptingCR.Initialize() $ret = $Scripting.GetLastError($ErrorText) msgbox(0,"","Init $ScriptingCR: " + $ErrorText) $adsDomain = "DC=mydomain,dc=com" $mode = $arg[1] If ($mode = 1 OR $mode = 2) Then $result = $ScriptingDirectory.GetOneObject($arg[2], $adsDomain, 0, $adsMachine, $adsType) $ret = $Scripting.GetLastError($ErrorText) msgbox(0,"","GetOneObject Machine :" + $ErrorText & " -> " & $result) EndIf If $mode = 1 Then ;' logon recovery $result = $ScriptingDirectory.GetOneObject($arg[3], $adsDomain, 0, $adsUser, $adsType) $ret = $Scripting.GetLastError($ErrorText) msgbox(0,"","GetOneObject User :" + $ErrorText & " -> " & $result) msgbox(0,"","CR-Flag for User : " & " adsUser: " & $arg[3] & " adsMachine: " & $arg[2] & " " & $arg[4]) $result = $ScriptingCR.GetChallengeFlags($adsMachine, $arg[4], $challengeFlags) $ret = $Scripting.GetLastError($ErrorText) msgbox(0,"","GetChallengeFlags :" & $ErrorText & " -> " & $result & " ChallangeFlags: " & $challengeFlags) $result = $ScriptingCR.Computeresponse($adsUser, $adsMachine, $arg[4], 0, $response) $ret = $Scripting.GetLastError($ErrorText) msgbox(0,"","Compute$response 1 :" & $ErrorText & " -> " & $result & " " & $response) ElseIf $mode = 2 Then ;' BitLocker recovery $result = $ScriptingCR.BitLockerRecovery($adsMachine, $arg[3], $response) $ret = $Scripting.GetLastError($ErrorText) msgbox(0,"","Compute$response 1 :" & $ErrorText & " -> " & $result & " " & $response) ElseIf $mode = 3 Then ;' Suspension $result = $ScriptingDirectory.GetOneObject($arg[2], $adsDomain, 0, $adsUser, $adsType) $ret = $Scripting.GetLastError($ErrorText) msgbox(0,"","GetOneObject User :" + $ErrorText & " -> " & $result & " " & $adsUser) $result = $ScriptingCR.SuspensionComputeresponse($arg[4], $adsUser, $arg[3], $opCode , $response) $ret = $Scripting.GetLastError($ErrorText) msgbox(0,"","SuspendCompute$response 3:" & $ErrorText & " -> " & $result & " " & " Suspend module " & $opCode & " $response " & $response) Else msgbox(0,"","unknown $mode!") EndIf $result = $ScriptingCR.FreeResources() $result = $ScriptingDirectory.FreeResources() $result = $Scripting.FreeResources() If @error <> 0 Then If @error = 9 Then msgbox(0,"","The syntax is incorrect for C/R: E.g. cscript Challenge$responsebyScript.vbs 1 computer user challenge") msgbox(0,"","The syntax is incorrect for Bitlocker: E.g. cscript Challenge$responsebyScript.vbs 2 computer drive-letter") msgbox(0,"","The syntax is incorrect for Suspension: E.g. cscript Challenge$responsebyScript.vbs 3 user time_in_minutes challenge") Else msgbox(0,"","An error has occurred " & @error) EndIf EndIf -
Autoit not seeing [out] parameters
tlman12 replied to tlman12's topic in AutoIt General Help and Support
sorry for the lack of info before, i was hopeing maybe i was doing something stupid and someone would key on on what it was. it's for Sophos SafeGuard encryption http://www.sophos.com/en-us/medialibrary/PDFs/documentation/sgn_60_m_eng_api.pdf and basically all i did was convert this VBscript to AutoIT. '---------------------------------------------------------------------------------------------------------- 'Do a challenge/response by script ' 'Arguments: mode = 1: logon recovery ' mode = 2: bitLocker recovery ' mode = 3: suspension ' ' user: username (only needed if mode = 1 or mode 3) ' challenge: the computer's challenge code (only needed if mode = 1 or mode 3) ' computer: computername (not needed for mode 3) ' drive: BitLocker drive letter (only needed if mode = 2) ' 'Call mode 1: e. g. cscript ChallengeResponsebyScript.vbs 1 computer user S9LWR99TKGZU8G115Z93C18C31JKSV 'Call mode 2: e. g. cscript ChallengeResponsebyScript.vbs 2 computer C 'Call mode 3: e. g. cscript ChallengeResponsebyScript.vbs 3 user 20 S9LWR99TKG '---------------------------------------------------------------------------------------------------------- Option Explicit On Error Resume Next Dim Scripting Dim ScriptingDirectory Dim ScriptingCR Dim adsDomain Dim adsMachine Dim adsUser Dim challengeFlags Dim response Dim msoName Dim sgnPassword Dim opCode Dim ret, result Dim ErrorText Dim adsType Dim arg Dim mode 'Bitlocker, SGN-Client Suspension Set arg = wscript.arguments msoName = "mso" sgnPassword = "1234" Set Scripting = WScript.CreateObject("Utimaco.SafeGuard.AdministrationConsole.Scripting.Base") Set ScriptingDirectory = Scripting.CreateDirectoryClassInstance() Set ScriptingCR = Scripting.CreateCRClassInstance() result = Scripting.Initialize() ret = Scripting.GetLastError(ErrorText) wscript.echo("Init Scripting: " & ErrorText) result = Scripting.AuthenticateOfficer(msoName, sgnPassword, "") result = ScriptingDirectory.Initialize() ret = Scripting.GetLastError(ErrorText) wscript.echo("Init ScriptingDirectory: " + ErrorText) result = ScriptingCR.Initialize() ret = Scripting.GetLastError(ErrorText) wscript.echo("Init ScriptingCR: " + ErrorText) adsDomain = "DC=mydomain,dc=com" mode = arg(0) If (mode = 1 OR mode = 2) Then result = ScriptingDirectory.GetOneObject(arg(1), adsDomain, 0, adsMachine, adsType) ret = Scripting.GetLastError(ErrorText) wscript.echo("GetOneObject Machine :" + ErrorText & " -> " & result) End If If mode = 1 Then ' logon recovery result = ScriptingDirectory.GetOneObject(arg(2), adsDomain, 0, adsUser, adsType) ret = Scripting.GetLastError(ErrorText) WScript.echo("GetOneObject User :" + ErrorText & " -> " & result) WScript.Echo("CR-Flag for User : " & " adsUser: " & arg(2) & " adsMachine: " & arg(1) & " " & arg(3)) result = ScriptingCR.GetChallengeFlags(adsMachine, arg(3), challengeFlags) ret = Scripting.GetLastError(ErrorText) wscript.echo("GetChallengeFlags :" & ErrorText & " -> " & result & " ChallangeFlags: " & challengeFlags) result = ScriptingCR.ComputeResponse(adsUser, adsMachine, arg(3), 0, response) ret = Scripting.GetLastError(ErrorText) wscript.echo("ComputeResponse 1 :" & ErrorText & " -> " & result & " " & response) ElseIf mode = 2 Then ' BitLocker recovery result = ScriptingCR.BitLockerRecovery(adsMachine, arg(2), response) ret = Scripting.GetLastError(ErrorText) wscript.echo("ComputeResponse 1 :" & ErrorText & " -> " & result & " " & response) ElseIf mode = 3 Then ' Suspension result = ScriptingDirectory.GetOneObject(arg(1), adsDomain, 0, adsUser, adsType) ret = Scripting.GetLastError(ErrorText) wscript.echo("GetOneObject User :" + ErrorText & " -> " & result & " " & adsUser) result = ScriptingCR.SuspensionComputeResponse(arg(3), adsUser, arg(2), opCode , response) ret = Scripting.GetLastError(ErrorText) wscript.echo("SuspendComputeResponse 3:" & ErrorText & " -> " & result & " " & " Suspend module " & opCode & " Response " & response) Else wscript.echo("unknown mode!") End If result = ScriptingCR.FreeResources() result = ScriptingDirectory.FreeResources() result = Scripting.FreeResources() If Err.Number <> 0 Then If Err.Number = 9 Then WScript.Echo("The syntax is incorrect for C/R: E.g. cscript ChallengeResponsebyScript.vbs 1 computer user challenge") WScript.Echo("The syntax is incorrect for Bitlocker: E.g. cscript ChallengeResponsebyScript.vbs 2 computer drive-letter") WScript.Echo("The syntax is incorrect for Suspension: E.g. cscript ChallengeResponsebyScript.vbs 3 user time_in_minutes challenge") Else WScript.Echo("An error has occurred " & Err.Number) End If End If like i said most of it works, just nothing where the parameter is an [out] like this one ComputeResponse(string adsUser, string adsMachine, string challenge, int action, out string response) the return funcions properly returning a good error code from the table in the document so i know the function is working properly but the outs are more important OBJECT_OWN_MEMBER = -15 Object cannot be its own member. For example: a group cannot be its own member. ACTION_NOT_FINALIZED = -14 Action (e.g. wildcard search) not finalized. ACTION_NOT_INITIALIZED = -13 Action (e.g. wildcard search) not initialized. RESULT_NOT_UNIQUE = -12 Result set is not unique. INVALID_CHALLENGE_CODE = -11 Wrong challenge code entered for Challenge/ Response. NO_MORE_DATA = -10 End of data in any wildcard search method. INSUFFICIENT_RIGHTS = -9 Current Security Officer has insufficient rights. CONFIG_FILE_ERROR = -8 .conf file could not be found or is invalid. TOKEN_INVALID_SLOT = -7 Invalid token slot ID. NOT_AUTHENTICATED = -6 Security Officer has not authenticated. OBJECT_NOT_FOUND = -5 Object not found in the database. OBJECT_ALREADY_EXISTS = -4 Object already exists. TOKEN_NOT_PRESENT = -3 No token in the slot. NOT_INITIALIZED = -2 API was not initialized. FAILURE = -1 General failure. OK = 0 Success. -
so I'm trying to interface with a programs API and everything seems to work fine with autoit. i can create the object, initialize it, run the functions. the problem comes when the function has an [out] parameter. so like there's a function that is .GetLastError($errortext) but $errortext is an output and the function is supposed to write the results to that variable. instead of getting error text i get nothing. the functions accept inputs just fine, and it works properly in vbscript. i'd like to use autoit though so i can create a gui wrapper for the api calls. is there something i should be doing to get the info from the variables? or is there a special way to declare the variables? i've never had this problem before.