1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. funkey

Beiträge von funkey

  • CreateResourceDLL

    • funkey
    • 23. November 2014 um 13:27
    Zitat von Alina

    Bei CreateResourceDLL.au3
    muss ich noch oben ein Global setzen vor der Nutzung: Global $ghGDIPDll


    Nein nicht einfach eine neue globale Variable erzeugen, sondern $ghGDIPDll in $__g_hGDIPDll umbenennen für die aktuelle AutoIt-Version.

    Zitat von Alina

    Frage mal. Kann man so auch Zahlen und / oder Worte in eine DLL "packen" und auch wieder auslesen?
    Wenn "Ja", wie, bitte. ?(


    Mann kann alles in eine DLL packen und es sind auch einige Beispiele dazu enthalten in der aktuellen AutoIt-Version. Am besten Mal die Beispiele zu den Funktionen in der WinAPIRes.au3 anschauen.

  • DLL auslesen

    • funkey
    • 23. November 2014 um 13:21

    In deinem Fall geht das so:

    Spoiler anzeigen
    [autoit]

    #include <WinAPI.au3>
    #include <WinAPIRes.au3>
    #include <APIResConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Global $hModul = _WinAPI_LoadLibraryEx("Resourcen_neu.dll", $LOAD_LIBRARY_AS_DATAFILE)

    [/autoit] [autoit][/autoit] [autoit]

    Global $hRes1 = _WinAPI_FindResource($hModul, $RT_RCDATA, "DATEN_1")
    Global $iSizeRes1 = _WinAPI_SizeOfResource($hModul, $hRes1)
    Global $hData1 = _WinAPI_LoadResource($hModul, $hRes1)
    Global $pData1 = _WinAPI_LockResource($hData1)
    Global $tData1 = DllStructCreate("char[" & $iSizeRes1 & "]", $pData1)
    ConsoleWrite(DllStructGetData($tData1, 1) & @CRLF)

    [/autoit] [autoit][/autoit] [autoit]

    Global $hRes2 = _WinAPI_FindResource($hModul, $RT_RCDATA, "DATEN_2")
    Global $iSizeRes2 = _WinAPI_SizeOfResource($hModul, $hRes2)
    Global $hData2 = _WinAPI_LoadResource($hModul, $hRes2)
    Global $pData2 = _WinAPI_LockResource($hData2)
    Global $tData2 = DllStructCreate("char[" & $iSizeRes2 & "]", $pData2)
    ConsoleWrite(DllStructGetData($tData2, 1) & @CRLF)

    [/autoit] [autoit][/autoit] [autoit]

    _WinAPI_FreeLibrary($hModul)

    [/autoit] [autoit][/autoit] [autoit][/autoit]
  • Dateiname in Titel einfügen

    • funkey
    • 20. November 2014 um 12:14

    Schau dir mal das Komandozeilen-Tool ExifTool an. Das müsste das können und kann über AutoIt angesteuert werden.

  • Programme durch ausschalten des Monitors beenden

    • funkey
    • 18. November 2014 um 11:50
    Spoiler anzeigen
    [autoit]


    Global Const $WM_POWERBROADCAST = 0x0218
    Global Const $PBT_POWERSETTINGCHANGE = 0x8013

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $WM_SYSCOMMAND = 0x0112
    Global Const $SC_MONITORPOWER = 0xF170
    Global Const $MONITOR_ON = -1
    Global Const $MONITOR_OFF = 2
    Global Const $MONITOR_STANDBY = 1

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $tagGUID = "struct; ulong Data1;ushort Data2;ushort Data3;byte Data4[8]; endstruct"
    Global Const $tagPOWERBROADCAST_SETTING = $tagGUID & ";DWORD DataLength;DWORD Data;"

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $DEVICE_NOTIFY_WINDOW_HANDLE = 0
    Global Const $DEVICE_NOTIFY_SERVICE_HANDLE = 1

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $GUID_CONSOLE_DISPLAY_STATE = "{6fe69556-704a-47a0-8f24-c28d936fda47}" ; Win8
    Global Const $GUID_MONITOR_POWER_ON = "{02731015-4510-4526-99e6-e5a17ebd1aea}" ; Vista and Win7

    [/autoit] [autoit][/autoit] [autoit]

    Global $hGui = GUICreate("Gui for registering Windows Message", 600, 200)
    GUIRegisterMsg($WM_POWERBROADCAST, "_PowerSettingNotification")
    Global $nBtnSleep = GUICtrlCreateButton("Hey monitors, please sleep!", 50, 50, 500, 100)
    GUICtrlSetFont(-1, 25)

    [/autoit] [autoit][/autoit] [autoit]

    Global $hNotify

    [/autoit] [autoit][/autoit] [autoit]

    If @OSBuild < 9000 Then
    $hNotify = _RegisterPowerSettingNotification($hGui, $GUID_MONITOR_POWER_ON)
    Else
    $hNotify = _RegisterPowerSettingNotification($hGui, $GUID_CONSOLE_DISPLAY_STATE)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    Global $iMsg
    Do
    $iMsg = GUIGetMsg()
    If $iMsg = $nBtnSleep Then DllCall('user32.dll', 'int', 'SendMessage', 'hwnd', $hGui, 'int', $WM_SYSCOMMAND, 'int', $SC_MONITORPOWER, 'int', $MONITOR_OFF)
    Until $iMsg = -3

    [/autoit] [autoit][/autoit] [autoit]

    _UnregisterPowerSettingNotification($hNotify)

    [/autoit] [autoit][/autoit] [autoit]

    Func _PowerSettingNotification($hWndGUI, $MsgID, $wParam, $lParam)
    Local $tSetting, $iSetting
    If $wParam = $PBT_POWERSETTINGCHANGE Then
    $tSetting = DllStructCreate($tagPOWERBROADCAST_SETTING, $lParam)
    $iSetting = DllStructGetData($tSetting, "Data")
    Switch $iSetting
    Case 2 ;The display is dimmed --> Win8 and above
    ConsoleWrite("The display is dimmed now" & @CRLF)
    Case 1 ;The monitor in on
    ConsoleWrite("The display is on now" & @CRLF)
    Case 0 ;The monitor in off
    ConsoleWrite("The display is off now" & @CRLF)
    EndSwitch
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _RegisterPowerSettingNotification($hGui, $GUID)
    Local $tGuid = DllStructCreate($tagGUID)
    DllCall('ole32.dll', 'uint', 'CLSIDFromString', 'wstr', $GUID, 'struct*', $tGUID)
    Local $aRet = DllCall("user32.dll", "handle", "RegisterPowerSettingNotification", "handle", $hGui, "struct*", $tGUID, "DWORD", $DEVICE_NOTIFY_WINDOW_HANDLE)
    If @error Or $aRet[0] = 0 Then Return SetError(1, @error, 0)
    Return $aRet[0]
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _UnregisterPowerSettingNotification($hNotify)
    Local $aRet = DllCall("user32.dll", "BOOL", "UnregisterPowerSettingNotification", "handle", $hNotify)
    If @error Or $aRet[0] = 0 Then Return SetError(1, @error, 0)
    Return $aRet[0]
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit]

    Edit: Beispiel verschönert

  • Icons aus ICL einbinden

    • funkey
    • 13. November 2014 um 05:37

    Schau dir mal das von ProgAndy an: http://www.autoitscript.com/forum/topic/78…ct/#entry564395

  • Arbeiten mit BSTR

    • funkey
    • 23. September 2014 um 12:36

    Nichts zu danken, hab's wieder deinstalliert. Du hast Glück, wenn es bei dir mit AutoIt alles funktioniert, wie es soll. Hoffe, das wird mal besser.

  • Arbeiten mit BSTR

    • funkey
    • 23. September 2014 um 10:47

    Hab mal die Demo-Version installiert, danach gesucht wie ich den COM-Server registrieren kann, dann getestet, dann zu folgendem Ergebnis gekommen:

    Spoiler anzeigen
    [autoit]


    Global $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Global $oKissSoft = ObjCreate("KISSsoftCOM.KISSsoft")
    If @error Then
    MsgBox(0 + 48, "ERROR", "Failed to open KISSsoft!")
    Exit
    EndIf

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;$oKissSoft.SetSilentMode( True )
    $oKissSoft.GetModule("Z012", True)

    [/autoit] [autoit][/autoit] [autoit]

    Global $sIni = $oKissSoft.GetININame()
    ConsoleWrite("> GetININame: " & $sIni & @CRLF)

    [/autoit] [autoit][/autoit] [autoit]

    Global $sVar = $oKissSoft.GetVar("var")
    ConsoleWrite("> Var: " & $sVar & @CRLF)

    [/autoit] [autoit][/autoit] [autoit]

    $oKissSoft.ReleaseModule

    [/autoit] [autoit][/autoit] [autoit]

    ; User's COM error function. Will be called if COM error occurs
    Func _ErrFunc($oError)
    ; Do anything here.
    ConsoleWrite("err.number is: " & @TAB & "0x" & Hex($oError.number, 8) & @CRLF & _
    "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
    "err.description is: " & @TAB & $oError.description & @CRLF & _
    "err.source is: " & @TAB & $oError.source & @CRLF & _
    "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
    "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
    "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
    "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
    "err.retcode is: " & @TAB & $oError.retcode & @CRLF & @CRLF)
    EndFunc ;==>_ErrFunc

    [/autoit]


    Bei mir bringt das zwar Fehlermeldungen, aber bei dir dürfte es funktionieren.

    Edit:
    Hier noch die COM-Schnittstelle, wie sie im PowerBasic COM-Browser dargestellt wird. Da sieht man auch wie die Funktionen in AutoIt aufgerufen werden müssen ;)

    Spoiler anzeigen
    Code
    ' Interface Name  : IKSoftArc
    ' Description     : IKSoftArc-Schnittstelle
    ' Class Name      : CKSoftArc
    ' ClassID         : $CLSID_KISSsoftCOM_CKSoftArc
    ' ProgID          : $PROGID_KISSsoftCOM_CKSoftArc
    ' Version ProgID  : $PROGID_KISSsoftCOM_CKSoftArc1
    Interface IKSoftArc $IID_KISSsoftCOM_IKSoftArc 
        Inherit IDispatch
    
    
        Method GetParams <1> (ByRef x1 As Double, ByRef y1 As Double, ByRef x2 As Double, ByRef y2 As Double, ByRef xc As Double, _
            ByRef yc As Double, ByRef clockwise As Integer)
        Method GetParams2 <2> (ByRef x1 As Double, ByRef y1 As Double, ByRef x2 As Double, ByRef y2 As Double, ByRef x3 As _
            Double, ByRef y3 As Double)
    End Interface
    
    
    ' Interface Name  : IKSoftLine
    ' Description     : IKSoftLine-Schnittstelle
    ' Class Name      : CKSoftLine
    ' ClassID         : $CLSID_KISSsoftCOM_CKSoftLine
    ' ProgID          : $PROGID_KISSsoftCOM_CKSoftLine
    ' Version ProgID  : $PROGID_KISSsoftCOM_CKSoftLine1
    Interface IKSoftLine $IID_KISSsoftCOM_IKSoftLine 
        Inherit IDispatch
    
    
        Method GetParams <1> (ByRef x1 As Double, ByRef y1 As Double, ByRef x2 As Double, ByRef y2 As Double)
    End Interface
    
    
    ' Interface Name  : IKSoftPoly
    ' Description     : IKSoftPoly-Schnittstelle
    ' Class Name      : CKSoftPoly
    ' ClassID         : $CLSID_KISSsoftCOM_CKSoftPoly
    ' ProgID          : $PROGID_KISSsoftCOM_CKSoftPoly
    ' Version ProgID  : $PROGID_KISSsoftCOM_CKSoftPoly1
    Interface IKSoftPoly $IID_KISSsoftCOM_IKSoftPoly 
        Inherit IDispatch
    
    
        Method GetParams <1> (ByRef x1 As Double, ByRef y1 As Double, ByRef x2 As Double, ByRef y2 As Double)
    End Interface
    
    
    ' Interface Name  : IKSoftSpline
    ' Description     : IKSoftSpline-Schnittstelle
    ' Class Name      : CKSoftSpline
    ' ClassID         : $CLSID_KISSsoftCOM_CKSoftSpline
    ' ProgID          : $PROGID_KISSsoftCOM_CKSoftSpline
    ' Version ProgID  : $PROGID_KISSsoftCOM_CKSoftSpline1
    Interface IKSoftSpline $IID_KISSsoftCOM_IKSoftSpline 
        Inherit IDispatch
    
    
        Method GetParams <1> (ByRef x1 As Double, ByRef y1 As Double, ByRef x2 As Double, ByRef y2 As Double, ByRef ordnung As _
            Long, ByRef anzSteuerpkt As Long)
        Method GetControl <2> (Byval i As Long, ByRef x As Double, ByRef y As Double)
        Method GetKnots <3> (Byval i As Long, ByRef knotsparam As Double)
    End Interface
    
    
    ' Interface Name  : IKSoftCurve
    ' Description     : IKSoftCurve-Schnittstelle
    ' Class Name      : CKSoftCurve
    ' ClassID         : $CLSID_KISSsoftCOM_CKSoftCurve
    ' ProgID          : $PROGID_KISSsoftCOM_CKSoftCurve
    ' Version ProgID  : $PROGID_KISSsoftCOM_CKSoftCurve1
    Interface IKSoftCurve $IID_KISSsoftCOM_IKSoftCurve 
        Inherit IDispatch
    
    
        Method GetCount <1> (ByRef count As Long)
        Method GetAsLine <2> (Byval number As Long, ByRef PB_line As IKSoftLine)
        Method GetAsArc <3> (Byval number As Long, ByRef arc As IKSoftArc)
        Method GetAsPoly <4> (Byval number As Long, ByRef poly As IKSoftPoly)
        Method GetAsSpline <5> (Byval number As Long, ByRef spline As IKSoftSpline)
        Method GetAsCurve <6> (Byval number As Long, ByRef curve As IKSoftCurve)
    End Interface
    
    
    ' Interface Name  : IKSoftShaft
    ' Description     : IKSoftShaft-Schnittstelle
    ' Class Name      : CKSoftShaft
    ' ClassID         : $CLSID_KISSsoftCOM_CKSoftShaft
    ' ProgID          : $PROGID_KISSsoftCOM_CKSoftShaft
    ' Version ProgID  : $PROGID_KISSsoftCOM_CKSoftShaft1
    Interface IKSoftShaft $IID_KISSsoftCOM_IKSoftShaft 
        Inherit IDispatch
    
    
        Method GetCountCylinder <1> (Byval outer As Integer, ByRef count As Long)
        Method GetCylParams <2> (Byval i As Long, Byval outer As Integer, ByRef dl As Double, ByRef dr As Double, ByRef b As _
            Double)
    End Interface
    
    
    ' Interface Name  : IKSoftParameter
    ' Description     : IKSoftParameter-Schnittstelle
    ' Class Name      : CKSoftParameter
    ' ClassID         : $CLSID_KISSsoftCOM_CKSoftParameter
    ' ProgID          : $PROGID_KISSsoftCOM_CKSoftParameter
    ' Version ProgID  : $PROGID_KISSsoftCOM_CKSoftParameter1
    Interface IKSoftParameter $IID_KISSsoftCOM_IKSoftParameter 
        Inherit IDispatch
    
    
        Method GetCount <1> (ByRef count As Long)
        Method GetParameter <2> (Byval i As Long, ByRef value As WString, ByRef text As WString, ByRef unit As WString, ByRef _
            PB_type As WString)
    End Interface
    
    
    ' Interface Name  : IKSoftRunoutParameter
    ' Description     : IKSoftRunoutParameter-Schnittstelle
    ' Class Name      : CKSoftRunoutParameter
    ' ClassID         : $CLSID_KISSsoftCOM_CKSoftRunoutParameter
    ' ProgID          : $PROGID_KISSsoftCOM_CKSoftRunoutParameter
    ' Version ProgID  : $PROGID_KISSsoftCOM_CKSoftRunoutParameter1
    Interface IKSoftRunoutParameter $IID_KISSsoftCOM_IKSoftRunoutParameter 
        Inherit IDispatch
    
    
        Method GetParameter <1> (ByRef runout As Long, ByRef bcI As Double, ByRef rcI As Double, ByRef brtotI As Double, ByRef _
            bcII As Double, ByRef rcII As Double, ByRef brtotII As Double)
    End Interface
    
    
    ' Interface Name  : IKISSsoftCallback
    ' Description     : IKISSsoftCallback-Schnittstelle
    ' Class Name      : CKISSsoftCallback
    ' ClassID         : $CLSID_KISSsoftCOM_CKISSsoftCallback
    ' ProgID          : $PROGID_KISSsoftCOM_CKISSsoftCallback
    ' Version ProgID  : $PROGID_KISSsoftCOM_CKISSsoftCallback1
    ' This Interface cannot be created directly it can only
    ' be returned by a Method or Property in this library. 
    Interface IKISSsoftCallback $IID_KISSsoftCOM_IKISSsoftCallback 
        Inherit IUnknown
    
    
        Method Finished() As Long
        Method GenerateCylindricalGear(Byval doublehelical As Integer, Byval z As Double, Byval b As Double, Byval bs As Double, _
            Byval da As Double, Byval di As Double, Byval pz As Double, Byval isLeft As Integer, Byval datafromfile As _
            WString, Byval dateibuffer As WString, Byval exprToCAD As IKSoftParameter, Byval filename As WString, Byval _
            runout As IKSoftRunoutParameter, Byval curve As IKSoftCurve) As Long
        Method GenerateRack(Byval doublehelical As Integer, Byval Hz As Double, Byval z As Double, Byval leff As Double, Byval _
            beff As Double, Byval pt As Double, Byval Hf As Double, Byval beta As Double, Byval isLeft As Integer, Byval bs _
            As Double, Byval datafromfile As WString, Byval dateibuffer As WString, Byval exprToCAD As IKSoftParameter, _
            Byval filename As WString, Byval runout As IKSoftRunoutParameter, Byval curve As IKSoftCurve) As Long
        Method GenerateWorm(Byval z As Double, Byval b As Double, Byval da As Double, Byval di As Double, Byval pz As Double, _
            Byval isLeft As Integer, Byval datafromfile As WString, Byval dateibuffer As WString, Byval exprToCAD As _
            IKSoftParameter, Byval filename As WString, Byval runout As IKSoftRunoutParameter, Byval curve As IKSoftCurve) As Long
        Method GenerateBevelGear(Byval z As Double, Byval b As Double, Byval dm As Double, Byval dam As Double, Byval dfm As _
            Double, Byval dfe As Double, Byval dfi As Double, Byval delta As Double, Byval di As Double, Byval y1 As Double, _
            Byval y2 As Double, Byval datafromfile As WString, Byval dateibuffer As WString, Byval exprToCAD As _
            IKSoftParameter, Byval filename As WString, Byval curve As IKSoftCurve) As Long
        Method GenerateShaft(Byval dateibuffer As WString, Byval exprToCAD As IKSoftParameter, Byval filename As WString, Byval _
            shaftCAD As IKSoftShaft) As Long
        Method GetExpressionsToCAD(Byval exprToCAD As IKSoftParameter) As Long
    End Interface
    
    
    ' Interface Name  : IKISSsoft
    ' Description     : IKISSsoft-Schnittstelle
    ' Class Name      : CKISSsoft
    ' ClassID         : $CLSID_KISSsoftCOM_CKISSsoft
    ' ProgID          : $PROGID_KISSsoftCOM_CKISSsoft
    ' Version ProgID  : $PROGID_KISSsoftCOM_CKISSsoft0
    Interface IKISSsoft $IID_KISSsoftCOM_IKISSsoft 
        Inherit IDispatch
    
    
        Method GetModule <1> (Byval modul As WString, Byval interactive As Integer)
        Method Calculate <2> ()
        Method CalculateRetVal <3> () As Integer
        Method CallFunc <4> (Byval PB_name As WString)
        Method SetVar <5> (Byval PB_name As WString, Byval value As WString)
        Method GetVar <6> (Byval PB_name As WString) As WString
        Method ShowInterface <7> (Byval wait As Integer)
        Method IsActiveInterface <8> () As Integer
        Method isActive <9> () As Integer
        Method ReleaseModule <10> ()
        Method SetCallback <11> (Byval PB_name As WString, Byval PB_callback As IUnknown)
        Method LoadFile <12> (Byval filename As WString)
        Method LoadFileData <13> (Byval PB_data As WString)
        Method CheckLicense <14> (Byval PB_name As WString)
        Method GetININame <15> () As WString
        Method SaveFile <16> (Byval filename As WString)
        Method GetVersionFromFile <17> (Byval filename As WString) As WString
        Method GetModulFromFile <18> (Byval filename As WString) As WString
        Method GetKsoftVersionFromFile <19> (Byval filename As WString) As WString
        Method GetKsoftVersion <20> () As WString
        Method SetSilentMode <21> (Byval silent As Integer)
        Method Report <22> (Byval PB_show As Long)
        Method ReportWithParameters <23> (Byval infile As WString, Byval outfile As WString, Byval PB_show As Long, Byval art As _
            Long)
        Method CallFuncNParam <24> (Byval paramArray As Variant)
        Method Message <25> (ByRef strings As Variant, ByRef types As Variant, ByRef numElem As Long)
        Method GetModuleOEM <26> (Byval modul As WString, Byval interactive As Integer, Byval OEMcode As WString)
        Method GetKsoftVersionSettings <27> () As WString
    End Interface
    Alles anzeigen
  • Arbeiten mit BSTR

    • funkey
    • 22. September 2014 um 10:39

    Hast du es mit einem normalen AutoIt- String auch versucht?
    Um welche Software handelt es sich. Könnte ich die auch installieren zum testen? Ansonsten ist guter Rat teuer. Ich weiß nur, dass noch lange nicht alles was COM betrifft mit AutoIt auch funktioniert, leider! Hab mich auch schon des öfteren geärgert.

  • Arbeiten mit BSTR

    • funkey
    • 18. September 2014 um 18:15

    Versuchs mal mit SysAllocString.
    Hier die Funktionen in AutoIt gewrappt: http://www.autoitscript.com/forum/topic/13…od/#entry955338

  • CryptProtectData & CryptUnprotectData

    • funkey
    • 13. August 2014 um 11:08

    Hab eine UDF daraus gemacht und im ersten Post angehängt!

  • CryptProtectData & CryptUnprotectData

    • funkey
    • 12. August 2014 um 10:17

    Hallo,
    mit den Funktionen _CryptProtectData() und _CryptUnprotectData() kann man Daten sicher verschlüsseln, so dass im Normalfall nur der angemeldete User und nur der gleiche Computer die Daten wieder entschlüsseln kann. Man kann ein Passwort als zusätzliche Sicherheit setzen, wird aber nicht unbedingt benötigt.

    Auf MSDN gibt hier weitere Informationen:
    * CryptProtectData: http://msdn.microsoft.com/en-us/library/…1(v=vs.85).aspx
    * CryptUnprotectData: http://msdn.microsoft.com/en-us/library/…2(v=vs.85).aspx


    Viel Spaß damit!

    Spoiler anzeigen
    [autoit]

    #include <WinAPI.au3>

    [/autoit] [autoit][/autoit] [autoit]

    ;When this flag is set, it associates the data encrypted with the current computer instead of with an individual user.
    ;Any user on the computer on which CryptProtectData is called can use CryptUnprotectData to decrypt the data.
    Global Const $CRYPTPROTECT_LOCAL_MACHINE = 0x4

    [/autoit] [autoit][/autoit] [autoit]

    ;This flag is used for remote situations where presenting a user interface (UI) is not an option. When this flag is set
    ;and a UI is specified for either the protect or unprotect operation, the operation fails and GetLastError returns the ERROR_PASSWORD_RESTRICTION code.
    Global Const $CRYPTPROTECT_UI_FORBIDDEN = 0x1

    [/autoit] [autoit][/autoit] [autoit]

    ;This flag generates an audit on protect and unprotect operations.
    Global Const $CRYPTPROTECT_LOCAL_AUDIT = 0x10

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $CRYPTPROTECT_VERIFY_PROTECTION = 0x40

    [/autoit] [autoit][/autoit] [autoit]

    ;This flag is used to provide the prompt for the protect phase.
    Global Const $CRYPTPROTECT_PROMPT_ON_PROTECT = 0x2

    [/autoit] [autoit][/autoit] [autoit]

    ;This flag can be combined with CRYPTPROTECT_PROMPT_ON_PROTECT to enforce the UI (user interface) policy of the caller.
    ;When CryptUnprotectData is called, the dwPromptFlags specified in the CryptProtectData call are enforced.
    Global Const $CRYPTPROTECT_PROMPT_ON_UNPROTECT = 0x1

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Global Const $ERROR_INVALID_DATA = 13

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $tagDATA_BLOB = "DWORD cbData;ptr pbData;"
    Global Const $tagCRYPTPROTECT_PROMPTSTRUCT = "DWORD cbSize;DWORD dwPromptFlags;HWND hwndApp;ptr szPrompt;"

    [/autoit] [autoit][/autoit] [autoit]

    Global $hDLL_CryptProtect = DllOpen("crypt32.dll")

    [/autoit] [autoit][/autoit] [autoit]

    Global $sString2Hide = "This is a test string to protect!"

    [/autoit] [autoit][/autoit] [autoit]

    Global $bData, $sData, $sDesc = ""

    [/autoit] [autoit][/autoit] [autoit]

    $bData = _CryptProtectData($sString2Hide, "Some information")
    ConsoleWrite("Error protecting: " & @error & " - " & @extended & @LF)
    ConsoleWrite("Protected data: " & $bData & @LF)

    [/autoit] [autoit][/autoit] [autoit]

    $sData = _CryptUnprotectData($bData, $sDesc)
    ConsoleWrite("Error unprotecting: " & @error & " - " & @extended & @LF)
    ConsoleWrite("Unprotected string: " & $sData & @LF)
    ConsoleWrite("Unprotected description: " & $sDesc & @LF)

    [/autoit] [autoit][/autoit] [autoit]

    ConsoleWrite(@LF & @LF)

    [/autoit] [autoit][/autoit] [autoit]

    $bData = _CryptProtectData($sString2Hide, "Some other information", "pass")
    ConsoleWrite("Error protecting: " & @error & " - " & @extended & @LF)
    ConsoleWrite("Protected data: " & $bData & @LF)

    [/autoit] [autoit][/autoit] [autoit]

    $sData = _CryptUnprotectData($bData, $sDesc, "")
    ConsoleWrite("Error unprotecting: " & @error & " - " & @extended & @LF)
    ConsoleWrite("Unprotected string: " & $sData & @LF)
    ConsoleWrite("Unprotected description: " & $sDesc & @LF)

    [/autoit] [autoit][/autoit] [autoit]

    ConsoleWrite(@LF & @LF)

    [/autoit] [autoit][/autoit] [autoit]

    $bData = _CryptProtectData($sString2Hide, "Some other information", "pwd")
    ConsoleWrite("Error protecting: " & @error & " - " & @extended & @LF)
    ConsoleWrite("Protected data: " & $bData & @LF)

    [/autoit] [autoit][/autoit] [autoit]

    $sData = _CryptUnprotectData($bData, $sDesc, "pwd")
    ConsoleWrite("Error unprotecting: " & @error & " - " & @extended & @LF)
    ConsoleWrite("Unprotected string: " & $sData & @LF)
    ConsoleWrite("Unprotected description: " & $sDesc & @LF)

    [/autoit] [autoit][/autoit] [autoit]

    ConsoleWrite(@LF & @LF)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Global $sPromptString = "Data protection will be done"
    Global $tPromptString = DllStructCreate("wchar szPrompt[256]")
    DllStructSetData($tPromptString, "szPrompt", $sPromptString)

    [/autoit] [autoit][/autoit] [autoit]

    Global $tPrompt = DllStructCreate($tagCRYPTPROTECT_PROMPTSTRUCT)
    DllStructSetData($tPrompt, "cbSize", DllStructGetSize($tPrompt))
    DllStructSetData($tPrompt, "dwPromptFlags", BitOR($CRYPTPROTECT_PROMPT_ON_PROTECT, $CRYPTPROTECT_PROMPT_ON_UNPROTECT))
    DllStructSetData($tPrompt, "szPrompt", DllStructGetPtr($tPromptString))

    [/autoit] [autoit][/autoit] [autoit]

    $bData = _CryptProtectData($sString2Hide, "Protection example with Gui", "pwd", 0, DllStructGetPtr($tPrompt))
    ConsoleWrite("Error protecting: " & @error & " - " & @extended & @LF)
    ConsoleWrite("Protected data: " & $bData & @LF)

    [/autoit] [autoit][/autoit] [autoit]

    $sPromptString = "Data unprotection will be done"
    DllStructSetData($tPromptString, "szPrompt", $sPromptString)

    [/autoit] [autoit][/autoit] [autoit]

    $sData = _CryptUnprotectData($bData, $sDesc, "pwd", 0, DllStructGetPtr($tPrompt))
    ConsoleWrite("Error unprotecting: " & @error & " - " & @extended & @LF)
    ConsoleWrite("Unprotected string: " & $sData & @LF)
    ConsoleWrite("Unprotected description: " & $sDesc & @LF)

    [/autoit] [autoit][/autoit] [autoit]

    DllClose($hDLL_CryptProtect)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;http://msdn.microsoft.com/en-us/library/…1(v=vs.85).aspx
    Func _CryptProtectData($sString, $sDesc = "", $sPwd = "", $iFlag = 0, $pPrompt = 0)
    ;funkey 2014.08.11th
    Local $aRet, $iError, $tEntropy, $tDesc, $pEntropy = 0, $pDesc = 0
    Local $tDataIn = _DataToBlob($sString)
    If $sPwd <> "" Then
    $tEntropy = _DataToBlob($sPwd)
    $pEntropy = DllStructGetPtr($tEntropy)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $sDesc <> "" Then
    $tDesc = DllStructCreate("wchar desc[" & StringLen($sDesc) + 1 & "]")
    DllStructSetData($tDesc, "desc", $sDesc)
    $pDesc = DllStructGetPtr($tDesc)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Local $tDataBuf = DllStructCreate($tagDATA_BLOB)

    [/autoit] [autoit][/autoit] [autoit]

    $aRet = DllCall($hDLL_CryptProtect, "BOOL", "CryptProtectData", "struct*", $tDataIn, "ptr", $pDesc, "ptr", $pEntropy, "ptr", 0, "ptr", $pPrompt, "DWORD", $iFlag, "struct*", $tDataBuf)
    $iError = @error

    [/autoit] [autoit][/autoit] [autoit]

    _WinAPI_LocalFree(DllStructGetData($tDataIn, "pbData"))

    [/autoit] [autoit][/autoit] [autoit]

    If $sPwd <> "" Then _WinAPI_LocalFree(DllStructGetData($tEntropy, "pbData"))
    If $iError Then Return SetError(1, 0, "")
    If $aRet[0] = 0 Then Return SetError(2, _WinAPI_GetLastError(), "")

    [/autoit] [autoit][/autoit] [autoit]

    Local $tDataOut = DllStructCreate("byte data[" & DllStructGetData($tDataBuf, "cbData") & "]", DllStructGetData($tDataBuf, "pbData"))
    Local $bData = DllStructGetData($tDataOut, "data")

    [/autoit] [autoit][/autoit] [autoit]

    _WinAPI_LocalFree(DllStructGetData($tDataBuf, "pbData"))

    [/autoit] [autoit][/autoit] [autoit]

    Return $bData
    EndFunc ;==>_CryptProtectData

    [/autoit] [autoit][/autoit] [autoit]

    ;http://msdn.microsoft.com/en-us/library/…2(v=vs.85).aspx
    Func _CryptUnprotectData($bData, ByRef $sDesc, $sPwd = "", $iFlag = 0, $pPrompt = 0)
    ;funkey 2014.08.11th
    Local $aRet, $iError, $tEntropy, $pEntropy = 0
    Local $tDataIn = _DataToBlob($bData)
    $sDesc = ""

    [/autoit] [autoit][/autoit] [autoit]

    If $sPwd <> "" Then
    $tEntropy = _DataToBlob($sPwd)
    $pEntropy = DllStructGetPtr($tEntropy)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Local $tDataBuf = DllStructCreate($tagDATA_BLOB)
    Local $tDesc = DllStructCreate("ptr desc")
    Local $pDesc = DllStructGetPtr($tDesc)

    [/autoit] [autoit][/autoit] [autoit]

    $aRet = DllCall($hDLL_CryptProtect, "BOOL", "CryptUnprotectData", "struct*", $tDataIn, "ptr*", $pDesc, "ptr", $pEntropy, "ptr", 0, "ptr", $pPrompt, "DWORD", $iFlag, "struct*", $tDataBuf)
    $iError = @error

    [/autoit] [autoit][/autoit] [autoit]

    _WinAPI_LocalFree(DllStructGetData($tDataIn, "pbData"))

    [/autoit] [autoit][/autoit] [autoit]

    If $sPwd <> "" Then _WinAPI_LocalFree(DllStructGetData($tEntropy, "pbData"))
    If $iError Then Return SetError(1, 0, "")
    If $aRet[0] = 0 Then Return SetError(2, _WinAPI_GetLastError(), "")

    [/autoit] [autoit][/autoit] [autoit]

    Local $tDataOut = DllStructCreate("char data[" & DllStructGetData($tDataBuf, "cbData") & "]", DllStructGetData($tDataBuf, "pbData"))
    Local $sData = DllStructGetData($tDataOut, "data")

    [/autoit] [autoit][/autoit] [autoit]

    Local $aLen = DllCall("msvcrt.dll", "UINT:cdecl", "wcslen", "ptr", $aRet[2])
    Local $tDesc = DllStructCreate("wchar desc[" & $aLen[0] + 1 & "]", $aRet[2])
    $sDesc = DllStructGetData($tDesc, "desc")

    [/autoit] [autoit][/autoit] [autoit]

    _WinAPI_LocalFree($aRet[2])
    _WinAPI_LocalFree(DllStructGetData($tDataBuf, "pbData"))

    [/autoit] [autoit][/autoit] [autoit]

    Return $sData
    EndFunc ;==>_CryptUnprotectData

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;Creates a DATA_BLOB structure where the function stores the decrypted data.
    ;When you have finished using the DATA_BLOB structure, free its pbData member by calling the _WinAPI_LocalFree function.
    Func _DataToBlob($data)
    ;funkey 2014.08.11th
    Local $iLen, $tDataIn, $tData, $aMem
    Local Const $LMEM_ZEROINIT = 0x40
    Select
    Case IsString($data)
    $iLen = StringLen($data)
    Case IsBinary($data)
    $iLen = BinaryLen($data)
    Case Else
    Return SetError(1, 0, 0)
    EndSelect

    [/autoit] [autoit][/autoit] [autoit]

    $tDataIn = DllStructCreate($tagDATA_BLOB)
    $aMem = DllCall("Kernel32.dll", "handle", "LocalAlloc", "UINT", $LMEM_ZEROINIT, "UINT", $iLen)
    $tData = DllStructCreate("byte[" & $iLen & "]", $aMem[0])

    [/autoit] [autoit][/autoit] [autoit]

    DllStructSetData($tData, 1, $data)
    DllStructSetData($tDataIn, "cbData", $iLen)
    DllStructSetData($tDataIn, "pbData", DllStructGetPtr($tData))

    [/autoit] [autoit][/autoit] [autoit]

    Return $tDataIn
    EndFunc ;==>_DataToBlob

    [/autoit]

    Dateien

    CryptProtect.zip 3,7 kB – 885 Downloads
  • Offline IP zu MAC und Hersteller Konverter

    • funkey
    • 24. Juli 2014 um 10:56

    Hallo,
    hab mal wieder ein kleines Projekt, für eine Anwendung, die ich öfters benötige. Ip2Mac&Vendor ermittelt aus der eingegebenen IP-Adresse die dazugehörige MAC-Adresse (SendARP) und daraus wird über eine Text-Datenbank der Herrsteller herausgesucht. Wer dazu noch eine passendes RegExp hat, bitte gerne melden.

    Hier der Code als Demo ohne ganze Datenbank und im Anhang das volle Skript..
    Viel Spaß!

    Spoiler anzeigen
    [autoit]

    ;;funkey 2014.07.24
    ;;OUI – Organizationally Unique Identifier
    Global Const $sTitle = "IP2MAC&Vendor Offline demo"

    [/autoit] [autoit][/autoit] [autoit]

    Global $sIpDefault = @IPAddress1

    [/autoit] [autoit][/autoit] [autoit]

    Global $sIP = InputBox($sTitle, "Please enter IP address to fetch information about device", $sIpDefault)
    If @error Or $sIP = "" Then
    Exit
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Global $sMAC = _SendARP($sIP)
    If @error Then
    MsgBox(16, $sTitle, "Error fetching MAC address from IP address '" & $sIP & "'" & @LF & $sMAC)
    Exit
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Global $sOUI = _oui()
    Global $sMacSearchPart = " " & StringLeft($sMAC, 8)

    [/autoit] [autoit][/autoit] [autoit]

    Global $iVendorPos = StringInStr($sOUI, $sMacSearchPart)
    If $iVendorPos = 0 Then
    MsgBox(16, $sTitle, "Error fetching information from MAC address '" & $sMAC & "'." & @LF & "No entry in database.")
    Exit
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Global $sVendor = StringMid($sOUI, $iVendorPos, 512)
    $sVendor = StringTrimLeft($sVendor, StringInStr($sVendor, @CRLF) + 25)
    $sVendor = StringLeft($sVendor, StringInStr($sVendor, @CRLF & @CRLF))
    $sVendor = StringReplace($sVendor, @TAB, "")
    $sVendor = StringReplace($sVendor, " ", "")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    MsgBox(64, $sTitle, "Info about IP: " & $sIP & @LF & @LF & _
    "MAC-Address: " & $sMAC & @LF & @LF & _
    $sVendor)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _inet_addr($sIP)
    Local $aRet = DllCall("ws2_32.dll", "ULONG", "inet_addr", "str", $sIP)
    Return $aRet[0]
    EndFunc ;==>_inet_addr

    [/autoit] [autoit][/autoit] [autoit]

    Func _SendARP($DestIP)
    Local $DestAddress = _inet_addr($DestIP)
    If $DestAddress = 0xFFFFFFFF Then Return SetError(1, 0, "INVALID_IP_ADDRESS")
    Local $tMacAddr = DllStructCreate("BYTE[8]")
    Local $aRet = DllCall("Iphlpapi.dll", "DWORD", "SendARP", "ULONG", $DestAddress, "ULONG", 0, "struct*", $tMacAddr, "ULONG*", 8)
    Local $sMAC = ""
    Switch $aRet[0]
    Case 0
    For $i = 1 To $aRet[4] - 1
    $sMAC &= Hex(DllStructGetData($tMacAddr, 1, $i), 2) & "-"
    Next
    $sMAC &= Hex(DllStructGetData($tMacAddr, 1, $i), 2)
    Return $sMAC
    Case 31
    Return SetError(2, $aRet[0], "ERROR_GEN_FAILURE")
    Case 87
    Return SetError(3, $aRet[0], "ERROR_INVALID_PARAMETER")
    Case 1784
    Return SetError(4, $aRet[0], "ERROR_INVALID_USER_BUFFER")
    Case 67
    Return SetError(5, $aRet[0], "ERROR_BAD_NET_NAME")
    Case 1168
    Return SetError(6, $aRet[0], "ERROR_NOT_FOUND")
    EndSwitch
    EndFunc ;==>_SendARP
    #cs
    https://standards.ieee.org/develop/regauth/oui/oui.txt
    #ce

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _oui()
    Local $o = " Generated: Wed, 23 Jul 2014 05:00:03 -0400" & @CRLF & _
    "" & @CRLF & _
    " OUI/MA-L Organization" & @CRLF & _
    " company_id Organization" & @CRLF & _
    " Address" & @CRLF & _
    " " & @CRLF & _
    " " & @CRLF & _
    " 00-00-00 (hex) XEROX CORPORATION" & @CRLF & _
    " 000000 (base 16) XEROX CORPORATION" & @CRLF & _
    " M/S 105-50C" & @CRLF & _
    " 800 PHILLIPS ROAD" & @CRLF & _
    " WEBSTER NY 14580" & @CRLF & _
    " UNITED STATES" & @CRLF & _
    "" & @CRLF & _
    " 00-00-01 (hex) XEROX CORPORATION" & @CRLF & _
    " 000001 (base 16) XEROX CORPORATION" & @CRLF & _
    " ZEROX SYSTEMS INSTITUTE" & @CRLF & _
    " M/S 105-50C 800 PHILLIPS ROAD" & @CRLF & _
    " WEBSTER NY 14580" & @CRLF & _
    " UNITED STATES" & @CRLF & _
    "" & @CRLF
    Return $o
    EndFunc ;==>_oui

    [/autoit]

    Dateien

    IP2Mac&Vendor.7z 1,43 MB – 919 Downloads
  • Funktion aufrufen wenn Combofeld verlassen wird

    • funkey
    • 20. April 2014 um 17:31
    Spoiler anzeigen
    [autoit]

    #include <ComboConstants.au3>
    #include <GUIConstantsEx.au3>
    Dim $form_main = GUICreate("Beispiel Formular",250,250)
    Dim $combo_1 = GUICtrlCreateCombo("",10,50,100,20,$CBS_DROPDOWNLIST)
    GUICtrlSetData(-1,"Entry 1|Entry 2|Entry 3","Entry 1")
    Dim $bttn_exit = GUICtrlCreateButton("Exit",180,200,60,30)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nmsg = GUIGetMsg()
    Switch $nmsg

    [/autoit] [autoit][/autoit] [autoit]

    Case $combo_1
    _Funktion()
    ;hier soll geprüft werden ob sich der Wert vom Combofeld verändert hat, und anschliessend soll eine Funktion aufgerufen werden....

    [/autoit] [autoit][/autoit] [autoit]

    Case -3, $bttn_exit
    Exit
    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _Funktion()
    ConsoleWrite("Combo-Control geändert!" & @LF)
    EndFunc

    [/autoit]
  • Admin-Geburtstag

    • funkey
    • 20. April 2014 um 15:46

    Hey! Nachträglich auch von mir noch alles Gute!! :D:party:

  • RegExp: String ausschließen

    • funkey
    • 15. März 2014 um 19:53

    Not StringInStr ?

  • Happy Birthday GDI+ Meister

    • funkey
    • 2. März 2014 um 19:34

    Alles Gute!! :party:

  • Gruß aus der Ferne.

    • funkey
    • 12. Januar 2014 um 20:50

    Viel Spaß in New York! Ich war auch schon mal dort, es ist eine sehr coole Stadt.

  • LED - Laufschrift

    • funkey
    • 14. Dezember 2013 um 12:29

    Mal diesen Thread ausgraben ;)
    Kann es sein, dass unter Win7 die LED-Schrift nicht angezeigt wird? Also die Gui schwarz bleibt? Oder ist das nur bei mir so?

  • Happy Birthday Pee und funkey

    • funkey
    • 4. Dezember 2013 um 12:00

    Vielen Dank! Und auch alles Gute zum Geburtstag, Glück und Gesundheit für pee! :party::party:

  • Weihnachtsmützen für euer Avatar !

    • funkey
    • 3. Dezember 2013 um 22:26

    Bin auch wieder dabei ;)

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™