Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 03:46

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Dllcall problem @error = 1

Discussion on Dllcall problem @error = 1 within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
FacePalmMan's Avatar
 
elite*gold: 0
Join Date: Jan 2013
Posts: 426
Received Thanks: 129
Dllcall problem @error = 1

Da ich einen Videostream in AutoIt möglich machen will in dem man nicht einzelne Frames verschickt, sondern echtes Video, habe ich sehr lange nach einer Methode gesucht einen Videostream zu erstellen. Als ich aber die Methode gefunden habe einen Videostream zu erstellen und ihn beim Schließen zu speichern, dachte ich mir: Wieso nicht einfach zwischenspeichern und die hinzugekommenen/geänderten Bytes zum Empfänger senden?
Tja. Ich bin nicht so der DllCall Experte da ich nicht so der C++ Profi bin, und in C# auch erst recht neu bin, habe ich etwas gebraucht bis ich den DllCall erstmal mit den richtigen Parametern & Datentypen vollständig hatte.
Aber da die AVI Datei nicht zwischendurch gespeichert wurde habe ich eine MsgBox ans Ende der Funktion gepackt, damit ich sehen kann was zurückgegeben wird.
Resultat: @error = 1, der Rest 0
Die AutoIt Hilfe sagt natürlich: @error 1 = unable to use the DLL file
Aber das Problem ist: Die DllCalls rufen ALLE die selbe DLL auf. D.h sowohl die Funktion die ich einfügen will, als auch die um den Stream zu erstellen und zu schließen.

Also was denkt ihr ist da falsch?

Downloadlink zu den Dateien (Problematische Funktion: AVISave):
FacePalmMan is offline  
Old 05/19/2015, 14:46   #2
 
elite*gold: 0
Join Date: Apr 2011
Posts: 363
Received Thanks: 166
Hi, there have u tried turning it off and on?.
So the other functions of the dll are working fine?, then are u sure u have to use stdcall method instead of cdecl.
I'm sorry don't speak german :c. I'm also afraid that i looked at your code and looks complicated, keep it up you will solve it soon!
elmarcia is offline  
Old 05/19/2015, 15:46   #3
 
FacePalmMan's Avatar
 
elite*gold: 0
Join Date: Jan 2013
Posts: 426
Received Thanks: 129
Quote:
Originally Posted by elmarcia View Post
Hi, there have u tried turning it off and on?.
So the other functions of the dll are working fine?, then are u sure u have to use stdcall method instead of cdecl.
I'm sorry don't speak german :c. I'm also afraid that i looked at your code and looks complicated, keep it up you will solve it soon!
I tried it too, but the @error is still 1
FacePalmMan is offline  
Old 05/20/2015, 02:12   #4
 
elite*gold: 0
Join Date: Apr 2011
Posts: 363
Received Thanks: 166
Mmm, maybe its a problem with the dll, if its a x64 dll then u can't run it with scite, you should first compile the script x64 then run it, that worked for me with a test i made...
elmarcia is offline  
Old 05/20/2015, 19:49   #5
 
FacePalmMan's Avatar
 
elite*gold: 0
Join Date: Jan 2013
Posts: 426
Received Thanks: 129
Quote:
Originally Posted by elmarcia View Post
Mmm, maybe its a problem with the dll, if its a x64 dll then u can't run it with scite, you should first compile the script x64 then run it, that worked for me with a test i made...
Its a x86 dll, and my OS runs on 32 bit.
FacePalmMan is offline  
Old 05/21/2015, 15:45   #6
 
elite*gold: 0
Join Date: Apr 2011
Posts: 363
Received Thanks: 166
Alright, u should:
1º-> Have u checked with pe explorer or something if your dll is exporting AVISave, maybe u missed it in your def file.
2º-> Check that every parameter that u are using is the equivalent to autoit.
3º-> Use a debugger to find out what it is happening with those parameters, (ollydbg should work) setting a breakpoint in AVISave call.
4º-> if still don't get it. Is autoit the best language for your project?. Translating those functions to C++ won't be so hard.
(if olly isn't working try using some plugins since autoit will check for debuggers)

Good Luck and Have fun doing your research!
elmarcia is offline  
Old 05/21/2015, 16:35   #7
 
FacePalmMan's Avatar
 
elite*gold: 0
Join Date: Jan 2013
Posts: 426
Received Thanks: 129
Quote:
Originally Posted by elmarcia View Post
Alright, u should:
1º-> Have u checked with pe explorer or something if your dll is exporting AVISave, maybe u missed it in your def file.
2º-> Check that every parameter that u are using is the equivalent to autoit.
3º-> Use a debugger to find out what it is happening with those parameters, (ollydbg should work) setting a breakpoint in AVISave call.
4º-> if still don't get it. Is autoit the best language for your project?. Translating those functions to C++ won't be so hard.
(if olly isn't working try using some plugins since autoit will check for debuggers)

Good Luck and Have fun doing your research!
The thing is that I want to show the world that you can do videostreaming using autoit.
To your other arguments: @error 1 means that the file can't be used. That means: the parameters don't have anything to do with it. Only the ":cdecl" could also cause this error, but it isn't because I tried it too.
FacePalmMan is offline  
Old 05/21/2015, 21:56   #8
 
elite*gold: 0
Join Date: Apr 2011
Posts: 363
Received Thanks: 166
Find the solution i think looking again at your code->
Code:
$ret = DllCall($Avi32_Dll, "long", "AVISave", "str", $sFilename, "none", 0, "ptr", DllCallbackGetPtr($Emptycallback), "int", 1, "ptr", $Avi_Handle[1], "ptr", DllStructGetPtr($asi))
-none no value (only valid for return type - equivalent to void in C)
Why the hell u put none there :c
elmarcia is offline  
Old 05/22/2015, 05:37   #9
 
YatoDev's Avatar
 
elite*gold: 50
Join Date: Sep 2012
Posts: 3,841
Received Thanks: 1,462
hatte das problem auch mal in autoit das eine dll mit den autoit funktionen nicht ansprechbar war.
Meine lösung:
PHP Code:
;Example of using DllCallAddress
Func _CallFunction
($pointer$returntype)
    
Local $hResult DllCallAddress($returntype$pointer"int",0,"int",0,"int",@DesktopWidth,"int",@DesktopHeight,"str",@DesktopDir "\imgsrc.bmp")
    If 
Not IsArray($hResultThen Return False
    
Return $hResult[0]
EndFunc

;Gets the address of the fucntionparam1 module handle param2 "Function"
Func _GetFunctionPointer($hDll$name)
    
Local $hOpen DllOpen("kernel32.dll")
    
$hResult DllCall($hOpen"DWORD""GetProcAddress""HANDLE"$hDll"STR"$name)
    
DllClose($hOpen)
    If 
$hResult[0] = null Then Return False
    
Return $hResult[0]
EndFunc

;Returns the module handle
Func _LoadLibrary
($path)
    
Local $hOpen DllOpen("Kernel32.dll")
    
$hResult DllCall($hOpen"HANDLE","LoadLibrary""STR"$path)
    
DllClose($hOpen)
    If 
$hResult[0] = Null Then Return False
    
Return $hResult[0]
EndFunc

;closes the module
Func _FreeLibrary
($hModule)
    
Local $hOpen DllOpen("Kernel32.dll")
    
$hResult DllCall($hOpen"BOOL","FreeLibrary""HANDLE"$hModule)
    
DllClose($hResult)
    If 
$hResult[0] = 0 Then Return False
    
Return True
EndFunc 
#Edit:
Für DllCallAddress gibts auch api funktionen falls autoit nicht will
#Edit2:
Bei dem beispiel funktionsaufruf handelte es sich um eine von mir geschriebene IMG search dll die leider doch keinen geschwindigkeitsvorteil brachte dank autoshit^^
Edit3:
Wohl zu früh am morgen...
Die mühe mit den return hab ich mir gemacht um autoshit beizubringen True als sting auszugeben und keine 1. Ich hasse den autoit variant
YatoDev is offline  
Reply


Similar Threads Similar Threads
DllCall Expert, please an help
07/29/2014 - AutoIt - 11 Replies
Guten Morgen :D I need you guys and only this forum can help me. I want to convert another language to autoit, is a couple of lines: hxxps://github.com/Drugoy/Autohotkey-scripts-.ahk /blob/master/hyde/test%20hyde.ahk This is my attempt, i think only the first DllCall is correct: OnAutoItExitRegister("_Exit") Global $hMod, $hHook
Dllcall auf eigener dll?
05/12/2012 - AutoIt - 5 Replies
Servus, hab mir eben ne kleine .dll in C++ geschrieben. Die führt eine einfache Main funktion aus, die den typen int besitzt. Also, sobald die dll in einen Process attached wird, wird die Main Funktion ausgeführt und eine MessageBox wird geöffnet. Diese befindet sich ebenfalls in der Main Funktion. Nun meine Frage. Kann ich diese Funktion mithilfe von Autoit aufrufen wie z.B mit dem dllcall ?
[DllCall] FRAPS mit Autoit ansteuern
06/03/2011 - AutoIt - 0 Replies
Hallo erstmal :) Folgendes FRAPS ist ja ein Benchmark-, Screencapture- und Echtzeitvideoaufnahmeprogramm für DirectX- und OpenGL-Anwendungen. --> mich interessieren allerdings nur die Frame Benchmark Funktionen. http://www.fraps.com/images/33fps.png
[Frage] DllCall, EndScence, Hook, LUA Injection
04/24/2011 - General Coding - 10 Replies
Hallihallo, ich bin mir nicht ganz sicher, ob da hier richtig ist, da es sich auf WoW bezieht. Ich möchte via AutoIt ein kleines Tool schreiben, mit dem ich z.B. den 'Charakter erstellen' Button drücken kann, ohne das WoW Fenster maximiert zu haben (ControlClick, Mouseclick plus funktionieren bei WoW nicht). Dazu hab ich mich natürlich schon schlau gemacht und bin auf einige Begriffe wie Endscene, Hook, LUA Injection und die Funktion WowLuaDoString gestoßen. Jetzt meine Frage: Besteht...
DLL injection und AutoIT DLLCall
11/30/2010 - AutoIt - 4 Replies
Hallo, ich hab ein Problem was mit seit ein paar Stunden den Kopf zerbricht, vllt ist es auch einfach der falsche Ansatz. Ich hab mir eine DLL zum injizieren mit C++ geschrieben, durch Winject wird diese auch injiziert und die main Funktion durch die WINAPI DLLMain aufgerufen (einfach nur eine MsgBox). Jetzt besteht meine Frage / Problem darin, kann ich mit AutoIt die restlichen Funktionen auch aufrufen (durch DLLCall) oder soll man dass auch lieber mit C++ realisieren. (andere...



All times are GMT +2. The time now is 03:46.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.