Hallo an alle! Schöne Weihnachten!!!
Beiträge von funkey
-
-
Es gibt auch DLL's, die z.B. über eine Registrierungsfunktion verfügen, wo man also eine Seriennummer übergeben muss (könnte ich mir auch bei dieser DLL vorstellen). Damit das funktioniert, muss immer die DLL zuerst geöffnet werden, und dann mit dem Handle weitergearbeitet werden. Das ist also immer die sicherere Variante.
-
https://www.ravensburger.de/shop/tiptoi/bu…2904/index.html
Damit kann jeder in die englische Sprache einsteigen
-
DBX und DBF sind ja glaube ich fast kompatibel. Du könntest mal meine DBF-UDF probieren, aber leider sind alle meine Links in AutoIt.de nicht mehr da . Vielleicht finde ich die UDF noch irgendwo in meinem Chaos.
Weiß jemand, ob man die Links in den Beiträgen bzw. alle Uploads wieder herstellen kann?
Gruß funkey
-
Ich kann das leider nicht testen, aber so hätte ich das versucht:
AutoIt
Alles anzeigenGlobal Const $tagDHCPDS_SERVER = "DWORD Version;ptr ServerName;DWORD ServerAddress;DWORD Flags;DWORD State;ptr DsLocation;DWORD DsLocType;" Global Const $tagDHCPDS_SERVERS = "DWORD Flags;DWORD NumElements;ptr Servers;" Func _DhcpEnumServers() Local $aRet = DllCall("Dhcpsapi.dll", "DWORD", "DhcpEnumServers", "DWORD", 0, "ptr", 0, "ptr*", 0, "ptr", 0, "ptr", 0) If $aRet[0] <> 0 Then Return SetError(1, $aRet[0]) EndIf Local $iNum = DllStructCreate("DWORD NumElements", $aRet[3] + 4) Local $tagDHCP_Temp = $tagDHCPDS_SERVERS For $i = 1 To $iNum $tagDHCP_Temp &= $tagDHCPDS_SERVER Next Local $tDHCP_Servers = DllStructCreate($tagDHCP_Temp, $aRet[3]) Local $aData[$iNum][4] For $i = 0 To $iNum - 1 $aData[$i][0] = DllStructCreate("wchar[256]", DllStructGetData($tDHCP_Servers, 4 + $i * 7)) $aData[$i][0] = DllStructGetData($aData[$i][0], 1) $aData[$i][1] = DllStructGetData($tDHCP_Servers, 5 + $i * 7) $aData[$i][1] = _inet_ntoa($aData[$i][1]) $aData[$i][2] = DllStructGetData($tDHCP_Servers, 6 + $i * 7) $aData[$i][3] = DllStructCreate("wchar[256]", DllStructGetData($tDHCP_Servers, 8 + $i * 7)) $aData[$i][3] = DllStructGetData($aData[$i][3], 1) Next ;DllCall("Dhcpsapi.dll", "none", "DhcpRpcFreeMemory", "ptr", $aRet[3]) Return $aData EndFunc ;==>_DhcpEnumServers Func _inet_ntoa($pIn_Addr) ;only IPv4 (deprecated) --> use _inet_ntop() instead Local $aRet = DllCall("ws2_32.dll", "str", "inet_ntoa", "ptr", $pIn_Addr) Return $aRet[0] EndFunc ;==>_inet_ntoa #include <Array.au3> Global $aDHCPServerInfo = _DhcpEnumServers() If @error Then MsgBox(16, "Error", "Error: " & @extended) Else _ArrayDisplay($aDHCPServerInfo, "Arraydisplay", "", 0, Default, "ServerName|ServerAddress|Flags|DsLocation") EndIf
-
Etwas davon ist hier schon vorhanden: http://www.autoitscript.com/forum/topic/74…ntinfo-wrapper/
Vielleicht hilft dir das schon.
-
Da kann nicht mal ein Obfuscator mithalten, aber ich werde versuchen mich da morgen durchzuwühlen.
Edit: Der Fehler muss aber von 'LogAitDave_V3.0.exe' kommen und das ist keine AutoIt Datei und auch der Quellcode davon ist nicht dabei!?
-
LibNodave kenn ich
Aber das Include-File und die Funktionen die du aufrufst habe ich noch nie gesehen. Ohne diese Datei(en) wird dir keiner hier helfen können. -
Hab mal die UDF überarbeitet. Die Funktionen brauchten noch die 'cdecl' Aufrufkonvention. Wahrscheinlich hatte ich damals zum testen eine andere DLL oder so. Das Beispiel sollte nun funktionieren.
BTW: Ich kann keine rar-files mehr anhängen, sondern nur noch zip. Ist kein Problem, wollte es nur anmerken.
-
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.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. -
In deinem Fall geht das so:
Spoiler anzeigen
[autoit]#include <WinAPI.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <WinAPIRes.au3>
#include <APIResConstants.au3>Global $hModul = _WinAPI_LoadLibraryEx("Resourcen_neu.dll", $LOAD_LIBRARY_AS_DATAFILE)
[/autoit] [autoit][/autoit] [autoit]Global $hRes1 = _WinAPI_FindResource($hModul, $RT_RCDATA, "DATEN_1")
[/autoit] [autoit][/autoit] [autoit]
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)Global $hRes2 = _WinAPI_FindResource($hModul, $RT_RCDATA, "DATEN_2")
[/autoit] [autoit][/autoit] [autoit]
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)_WinAPI_FreeLibrary($hModul)
[/autoit] [autoit][/autoit] [autoit][/autoit] -
Schau dir mal das Komandozeilen-Tool ExifTool an. Das müsste das können und kann über AutoIt angesteuert werden.
-
Spoiler anzeigen
[autoit]
[/autoit] [autoit][/autoit] [autoit]
Global Const $WM_POWERBROADCAST = 0x0218
Global Const $PBT_POWERSETTINGCHANGE = 0x8013Global Const $WM_SYSCOMMAND = 0x0112
[/autoit] [autoit][/autoit] [autoit]
Global Const $SC_MONITORPOWER = 0xF170
Global Const $MONITOR_ON = -1
Global Const $MONITOR_OFF = 2
Global Const $MONITOR_STANDBY = 1Global Const $tagGUID = "struct; ulong Data1;ushort Data2;ushort Data3;byte Data4[8]; endstruct"
[/autoit] [autoit][/autoit] [autoit]
Global Const $tagPOWERBROADCAST_SETTING = $tagGUID & ";DWORD DataLength;DWORD Data;"Global Const $DEVICE_NOTIFY_WINDOW_HANDLE = 0
[/autoit] [autoit][/autoit] [autoit]
Global Const $DEVICE_NOTIFY_SERVICE_HANDLE = 1Global Const $GUID_CONSOLE_DISPLAY_STATE = "{6fe69556-704a-47a0-8f24-c28d936fda47}" ; Win8
[/autoit] [autoit][/autoit] [autoit]
Global Const $GUID_MONITOR_POWER_ON = "{02731015-4510-4526-99e6-e5a17ebd1aea}" ; Vista and Win7Global $hGui = GUICreate("Gui for registering Windows Message", 600, 200)
[/autoit] [autoit][/autoit] [autoit]
GUIRegisterMsg($WM_POWERBROADCAST, "_PowerSettingNotification")
Global $nBtnSleep = GUICtrlCreateButton("Hey monitors, please sleep!", 50, 50, 500, 100)
GUICtrlSetFont(-1, 25)Global $hNotify
[/autoit] [autoit][/autoit] [autoit]If @OSBuild < 9000 Then
[/autoit] [autoit][/autoit] [autoit]
$hNotify = _RegisterPowerSettingNotification($hGui, $GUID_MONITOR_POWER_ON)
Else
$hNotify = _RegisterPowerSettingNotification($hGui, $GUID_CONSOLE_DISPLAY_STATE)
EndIfGUISetState()
[/autoit] [autoit][/autoit] [autoit]Global $iMsg
[/autoit] [autoit][/autoit] [autoit]
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_UnregisterPowerSettingNotification($hNotify)
[/autoit] [autoit][/autoit] [autoit]Func _PowerSettingNotification($hWndGUI, $MsgID, $wParam, $lParam)
[/autoit] [autoit][/autoit] [autoit]
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
EndFuncFunc _RegisterPowerSettingNotification($hGui, $GUID)
[/autoit] [autoit][/autoit] [autoit]
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]
EndFuncFunc _UnregisterPowerSettingNotification($hNotify)
[/autoit] [autoit][/autoit] [autoit][/autoit]
Local $aRet = DllCall("user32.dll", "BOOL", "UnregisterPowerSettingNotification", "handle", $hNotify)
If @error Or $aRet[0] = 0 Then Return SetError(1, @error, 0)
Return $aRet[0]
EndFuncEdit: Beispiel verschönert
-
Schau dir mal das von ProgAndy an: http://www.autoitscript.com/forum/topic/78…ct/#entry564395
-
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.
-
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]
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
Global $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc")Global $oKissSoft = ObjCreate("KISSsoftCOM.KISSsoft")
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
If @error Then
MsgBox(0 + 48, "ERROR", "Failed to open KISSsoft!")
Exit
EndIf;$oKissSoft.SetSilentMode( True )
[/autoit] [autoit][/autoit] [autoit]
$oKissSoft.GetModule("Z012", True)Global $sIni = $oKissSoft.GetININame()
[/autoit] [autoit][/autoit] [autoit]
ConsoleWrite("> GetININame: " & $sIni & @CRLF)Global $sVar = $oKissSoft.GetVar("var")
[/autoit] [autoit][/autoit] [autoit]
ConsoleWrite("> Var: " & $sVar & @CRLF)$oKissSoft.ReleaseModule
[/autoit] [autoit][/autoit] [autoit]; User's COM error function. Will be called if COM error occurs
[/autoit]
Func _ErrFunc($oError)
; Do anything here.
ConsoleWrite("err.number is: " & @TAB & "0x" & Hex($oError.number, & @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
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üssenSpoiler anzeigen
Code
Alles anzeigen' 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
-
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. -
Versuchs mal mit SysAllocString.
Hier die Funktionen in AutoIt gewrappt: http://www.autoitscript.com/forum/topic/13…od/#entry955338 -
Hab eine UDF daraus gemacht und im ersten Post angehängt!
-
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).aspxViel 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.
[/autoit] [autoit][/autoit] [autoit]
;Any user on the computer on which CryptProtectData is called can use CryptUnprotectData to decrypt the data.
Global Const $CRYPTPROTECT_LOCAL_MACHINE = 0x4;This flag is used for remote situations where presenting a user interface (UI) is not an option. When this flag is set
[/autoit] [autoit][/autoit] [autoit]
;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;This flag generates an audit on protect and unprotect operations.
[/autoit] [autoit][/autoit] [autoit]
Global Const $CRYPTPROTECT_LOCAL_AUDIT = 0x10Global Const $CRYPTPROTECT_VERIFY_PROTECTION = 0x40
[/autoit] [autoit][/autoit] [autoit];This flag is used to provide the prompt for the protect phase.
[/autoit] [autoit][/autoit] [autoit]
Global Const $CRYPTPROTECT_PROMPT_ON_PROTECT = 0x2;This flag can be combined with CRYPTPROTECT_PROMPT_ON_PROTECT to enforce the UI (user interface) policy of the caller.
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
;When CryptUnprotectData is called, the dwPromptFlags specified in the CryptProtectData call are enforced.
Global Const $CRYPTPROTECT_PROMPT_ON_UNPROTECT = 0x1Global Const $ERROR_INVALID_DATA = 13
[/autoit] [autoit][/autoit] [autoit]Global Const $tagDATA_BLOB = "DWORD cbData;ptr pbData;"
[/autoit] [autoit][/autoit] [autoit]
Global Const $tagCRYPTPROTECT_PROMPTSTRUCT = "DWORD cbSize;DWORD dwPromptFlags;HWND hwndApp;ptr szPrompt;"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")
[/autoit] [autoit][/autoit] [autoit]
ConsoleWrite("Error protecting: " & @error & " - " & @extended & @LF)
ConsoleWrite("Protected data: " & $bData & @LF)$sData = _CryptUnprotectData($bData, $sDesc)
[/autoit] [autoit][/autoit] [autoit]
ConsoleWrite("Error unprotecting: " & @error & " - " & @extended & @LF)
ConsoleWrite("Unprotected string: " & $sData & @LF)
ConsoleWrite("Unprotected description: " & $sDesc & @LF)ConsoleWrite(@LF & @LF)
[/autoit] [autoit][/autoit] [autoit]$bData = _CryptProtectData($sString2Hide, "Some other information", "pass")
[/autoit] [autoit][/autoit] [autoit]
ConsoleWrite("Error protecting: " & @error & " - " & @extended & @LF)
ConsoleWrite("Protected data: " & $bData & @LF)$sData = _CryptUnprotectData($bData, $sDesc, "")
[/autoit] [autoit][/autoit] [autoit]
ConsoleWrite("Error unprotecting: " & @error & " - " & @extended & @LF)
ConsoleWrite("Unprotected string: " & $sData & @LF)
ConsoleWrite("Unprotected description: " & $sDesc & @LF)ConsoleWrite(@LF & @LF)
[/autoit] [autoit][/autoit] [autoit]$bData = _CryptProtectData($sString2Hide, "Some other information", "pwd")
[/autoit] [autoit][/autoit] [autoit]
ConsoleWrite("Error protecting: " & @error & " - " & @extended & @LF)
ConsoleWrite("Protected data: " & $bData & @LF)$sData = _CryptUnprotectData($bData, $sDesc, "pwd")
[/autoit] [autoit][/autoit] [autoit]
ConsoleWrite("Error unprotecting: " & @error & " - " & @extended & @LF)
ConsoleWrite("Unprotected string: " & $sData & @LF)
ConsoleWrite("Unprotected description: " & $sDesc & @LF)ConsoleWrite(@LF & @LF)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]Global $sPromptString = "Data protection will be done"
[/autoit] [autoit][/autoit] [autoit]
Global $tPromptString = DllStructCreate("wchar szPrompt[256]")
DllStructSetData($tPromptString, "szPrompt", $sPromptString)Global $tPrompt = DllStructCreate($tagCRYPTPROTECT_PROMPTSTRUCT)
[/autoit] [autoit][/autoit] [autoit]
DllStructSetData($tPrompt, "cbSize", DllStructGetSize($tPrompt))
DllStructSetData($tPrompt, "dwPromptFlags", BitOR($CRYPTPROTECT_PROMPT_ON_PROTECT, $CRYPTPROTECT_PROMPT_ON_UNPROTECT))
DllStructSetData($tPrompt, "szPrompt", DllStructGetPtr($tPromptString))$bData = _CryptProtectData($sString2Hide, "Protection example with Gui", "pwd", 0, DllStructGetPtr($tPrompt))
[/autoit] [autoit][/autoit] [autoit]
ConsoleWrite("Error protecting: " & @error & " - " & @extended & @LF)
ConsoleWrite("Protected data: " & $bData & @LF)$sPromptString = "Data unprotection will be done"
[/autoit] [autoit][/autoit] [autoit]
DllStructSetData($tPromptString, "szPrompt", $sPromptString)$sData = _CryptUnprotectData($bData, $sDesc, "pwd", 0, DllStructGetPtr($tPrompt))
[/autoit] [autoit][/autoit] [autoit]
ConsoleWrite("Error unprotecting: " & @error & " - " & @extended & @LF)
ConsoleWrite("Unprotected string: " & $sData & @LF)
ConsoleWrite("Unprotected description: " & $sDesc & @LF)DllClose($hDLL_CryptProtect)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit];http://msdn.microsoft.com/en-us/library/…1(v=vs.85).aspx
[/autoit] [autoit][/autoit] [autoit]
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)
EndIfIf $sDesc <> "" Then
[/autoit] [autoit][/autoit] [autoit]
$tDesc = DllStructCreate("wchar desc[" & StringLen($sDesc) + 1 & "]")
DllStructSetData($tDesc, "desc", $sDesc)
$pDesc = DllStructGetPtr($tDesc)
EndIfLocal $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)
[/autoit] [autoit][/autoit] [autoit]
$iError = @error_WinAPI_LocalFree(DllStructGetData($tDataIn, "pbData"))
[/autoit] [autoit][/autoit] [autoit]If $sPwd <> "" Then _WinAPI_LocalFree(DllStructGetData($tEntropy, "pbData"))
[/autoit] [autoit][/autoit] [autoit]
If $iError Then Return SetError(1, 0, "")
If $aRet[0] = 0 Then Return SetError(2, _WinAPI_GetLastError(), "")Local $tDataOut = DllStructCreate("byte data[" & DllStructGetData($tDataBuf, "cbData") & "]", DllStructGetData($tDataBuf, "pbData"))
[/autoit] [autoit][/autoit] [autoit]
Local $bData = DllStructGetData($tDataOut, "data")_WinAPI_LocalFree(DllStructGetData($tDataBuf, "pbData"))
[/autoit] [autoit][/autoit] [autoit]Return $bData
[/autoit] [autoit][/autoit] [autoit]
EndFunc ;==>_CryptProtectData;http://msdn.microsoft.com/en-us/library/…2(v=vs.85).aspx
[/autoit] [autoit][/autoit] [autoit]
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 = ""If $sPwd <> "" Then
[/autoit] [autoit][/autoit] [autoit]
$tEntropy = _DataToBlob($sPwd)
$pEntropy = DllStructGetPtr($tEntropy)
EndIfLocal $tDataBuf = DllStructCreate($tagDATA_BLOB)
[/autoit] [autoit][/autoit] [autoit]
Local $tDesc = DllStructCreate("ptr desc")
Local $pDesc = DllStructGetPtr($tDesc)$aRet = DllCall($hDLL_CryptProtect, "BOOL", "CryptUnprotectData", "struct*", $tDataIn, "ptr*", $pDesc, "ptr", $pEntropy, "ptr", 0, "ptr", $pPrompt, "DWORD", $iFlag, "struct*", $tDataBuf)
[/autoit] [autoit][/autoit] [autoit]
$iError = @error_WinAPI_LocalFree(DllStructGetData($tDataIn, "pbData"))
[/autoit] [autoit][/autoit] [autoit]If $sPwd <> "" Then _WinAPI_LocalFree(DllStructGetData($tEntropy, "pbData"))
[/autoit] [autoit][/autoit] [autoit]
If $iError Then Return SetError(1, 0, "")
If $aRet[0] = 0 Then Return SetError(2, _WinAPI_GetLastError(), "")Local $tDataOut = DllStructCreate("char data[" & DllStructGetData($tDataBuf, "cbData") & "]", DllStructGetData($tDataBuf, "pbData"))
[/autoit] [autoit][/autoit] [autoit]
Local $sData = DllStructGetData($tDataOut, "data")Local $aLen = DllCall("msvcrt.dll", "UINT:cdecl", "wcslen", "ptr", $aRet[2])
[/autoit] [autoit][/autoit] [autoit]
Local $tDesc = DllStructCreate("wchar desc[" & $aLen[0] + 1 & "]", $aRet[2])
$sDesc = DllStructGetData($tDesc, "desc")_WinAPI_LocalFree($aRet[2])
[/autoit] [autoit][/autoit] [autoit]
_WinAPI_LocalFree(DllStructGetData($tDataBuf, "pbData"))Return $sData
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
EndFunc ;==>_CryptUnprotectData;Creates a DATA_BLOB structure where the function stores the decrypted data.
[/autoit] [autoit][/autoit] [autoit]
;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$tDataIn = DllStructCreate($tagDATA_BLOB)
[/autoit] [autoit][/autoit] [autoit]
$aMem = DllCall("Kernel32.dll", "handle", "LocalAlloc", "UINT", $LMEM_ZEROINIT, "UINT", $iLen)
$tData = DllStructCreate("byte[" & $iLen & "]", $aMem[0])DllStructSetData($tData, 1, $data)
[/autoit] [autoit][/autoit] [autoit]
DllStructSetData($tDataIn, "cbData", $iLen)
DllStructSetData($tDataIn, "pbData", DllStructGetPtr($tData))Return $tDataIn
[/autoit]
EndFunc ;==>_DataToBlob