Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > C/C++
You last visited: Today at 21:44

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

Advertisement



von autoit zu c++

Discussion on von autoit zu c++ within the C/C++ forum part of the Coders Den category.

Reply
 
Old   #1
 
Terrat's Avatar
 
elite*gold: 130
Join Date: Apr 2012
Posts: 1,173
Received Thanks: 670
von autoit zu c++

Hallo ich versuche derzeit den autoit code:
Code:
Func _SkinGUI($SkincrafterDll, $SkincrafterSkin, $Handle)
   $Dll = DllOpen($SkincrafterDll)
   DllCall($Dll, "int:cdecl", "InitLicenKeys", "wstr", "SKINCRAFTER", "wstr", "SKINCRAFTER.COM", "wstr", "", "wstr", "DEMOSKINCRAFTERLICENCE")
   DllCall($Dll, "int:cdecl", "InitDecoration", "int", 1)
   DllCall($Dll, "int:cdecl", "LoadSkinFromFile", "wstr", $SkincrafterSkin)
   DllCall($Dll, "int:cdecl", "DecorateAs", "int", $Handle, "int", 25)
   DllCall($Dll, "int:cdecl", "ApplySkin")
EndFunc
in c++ zu übersetzen.
Vortschritte:
#update 1 void
#update 2 Loadlibrary
Code:
void _SkinGUI(char *SkincrafterDll, char *SkincrafterSkin, DWORD Handle)
{
    HINSTANCE SkinDLL;
    SkinDLL = LoadLibrary(TEXT("Skin.dll"));
}
Terrat is offline  
Old 03/07/2014, 13:40   #2
 
Tyrar's Avatar
 
elite*gold: 0
Join Date: Oct 2008
Posts: 1,637
Received Thanks: 1,119
Als nächstes müsstest du via GetProcAddress an die Adressen der einzelnen Funktionen kommen und den Returnwert in einen Funktionspointer casten, diesen dann callen.
Ich verstehe aber nicht, warum du der Funktion überhaupt Parameter gibst die hinterher wohl eh nicht mehr verwendet werden?
Tyrar is offline  
Thanks
1 User
Old 03/07/2014, 15:52   #3
 
Terrat's Avatar
 
elite*gold: 130
Join Date: Apr 2012
Posts: 1,173
Received Thanks: 670
da ich die funktion mehfrach benutzen möchte

Quote:
Originally Posted by Tyrar View Post
Als nächstes müsstest du via GetProcAddress an die Adressen der einzelnen Funktionen kommen und den Returnwert in einen Funktionspointer casten, diesen dann callen.
Ich verstehe aber nicht, warum du der Funktion überhaupt Parameter gibst die hinterher wohl eh nicht mehr verwendet werden?
so oder wie ?
Code:
   PGNSI pGNSI;
   SYSTEM_INFO si;

   ZeroMemory(&si, sizeof(SYSTEM_INFO));
   
   pGNSI = (PGNSI) GetProcAddress(
       SkinDLL, 
      "InitLicenKeys");
Terrat is offline  
Old 03/07/2014, 17:24   #4


 
elite*gold: 1091
Join Date: Jun 2007
Posts: 19,836
Received Thanks: 7,180
Quote:
Originally Posted by Dreamsläps View Post
da ich die funktion mehfrach benutzen möchte



so oder wie ?
Code:
   PGNSI pGNSI;
   SYSTEM_INFO si;

   ZeroMemory(&si, sizeof(SYSTEM_INFO));
   
   pGNSI = (PGNSI) GetProcAddress(
       SkinDLL, 
      "InitLicenKeys");
Code:
#include <functional>
std::function<int(int)> InitDecoration = reinterpret_cast<int(*)(int)>(GetProcAddress(hModule, "InitDecoration"));
Das war mit Funktionspointer gemeint. Was auch immer du da gemacht hast, kann ich nicht nachvollziehen.
Mostey is offline  
Thanks
1 User
Old 03/07/2014, 18:00   #5
 
elite*gold: 46
Join Date: Oct 2010
Posts: 782
Received Thanks: 525
Er wird sowas gemacht haben:
Code:
typedef rückgabewert(__stdcall *name)
		(param1_type, param2_type);
Je nachdem wie die Funktion halt aussieht. Danach halt das:
Code:
name Funktion = (name)
		GetProcAddress(GetModuleHandle("dll"),
		"Funktion");
Für mich ist das ein Funktions pointer ^^ Funktioniert auch so. Frage mich nur was das System_Info und ZeroMemory da drinnen zu suchen hat. Deins geht aber natürlich auch.
th0rex is offline  
Thanks
1 User
Old 03/07/2014, 18:05   #6
 
Terrat's Avatar
 
elite*gold: 130
Join Date: Apr 2012
Posts: 1,173
Received Thanks: 670
hab da jetzt bisher das stehen:
Code:
   hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
      CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);

	HINSTANCE SkinDLL;
    SkinDLL = LoadLibrary(TEXT("Skin.dll"));
	std::function<int(int)> InitLicenKeys = reinterpret_cast<int(*)(int)>(GetProcAddress(SkinDLL, "InitLicenKeys"));
	std::function<int(int)> InitDecoration = reinterpret_cast<int(*)(int)>(GetProcAddress(SkinDLL, "InitDecoration"));
	std::function<int(int)> LoadSkinFromFile= reinterpret_cast<int(*)(int)>(GetProcAddress(SkinDLL, "LoadSkinFromFile"));
	std::function<int(int)> DecorateAs = reinterpret_cast<int(*)(int)>(GetProcAddress(SkinDLL, "DecorateAs"));
	std::function<int(int)> ApplySkin = reinterpret_cast<int(*)(int)>(GetProcAddress(SkinDLL, "ApplySkin"));
Wie rufe ich diese jetzt auf ?
Terrat is offline  
Old 03/07/2014, 18:08   #7
 
elite*gold: 46
Join Date: Oct 2010
Posts: 782
Received Thanks: 525
z.b. InitLicenKeys(param1, param2, param3 usw....);
ABER das std::function<int(int)> ist nicht richtig. das erste int ist der rückgabe wert und das 2. der wert des 1. parameters glaube ich. Benutze immer nur das was ich gepostet habe so wie du es anscheinend auch gemacht hast. Wenn du dann das std::function<...> änderst musst du natürlich auch reinterpret_cast anpassen. Musst das halt auf die Funktion anpassen. Ich nutze aber lieber meine Version. Wahrscheinlich aber nur weil ich da weiß wo welcher typ für den 1. parameter hin muss, was ich bei std::function nicht sicher weiß.
th0rex is offline  
Thanks
1 User
Old 03/07/2014, 18:12   #8
 
Terrat's Avatar
 
elite*gold: 130
Join Date: Apr 2012
Posts: 1,173
Received Thanks: 670
warum crasht es wen ich die funktion aufrufe mit ?
InitDecoration(1);
ps projekt rangehängt
Attached Files
File Type: rar Win32Project2.rar (1.65 MB, 9 views)
Terrat is offline  
Old 03/07/2014, 18:36   #9
 
elite*gold: 46
Join Date: Oct 2010
Posts: 782
Received Thanks: 525
Sicher das der return typ von InitDecoration ein Int ist ?
th0rex is offline  
Old 03/07/2014, 20:30   #10
 
Padmak's Avatar
 
elite*gold: 58
Join Date: Jun 2008
Posts: 2,311
Received Thanks: 8,420
BITTE lern erst was du hier machst, das ist ja katastrophal.

Padmak
Padmak is offline  
Thanks
3 Users
Old 03/07/2014, 21:13   #11
 
Terrat's Avatar
 
elite*gold: 130
Join Date: Apr 2012
Posts: 1,173
Received Thanks: 670
Quote:
Originally Posted by Padmak View Post
BITTE lern erst was du hier machst, das ist ja katastrophal.

Padmak
:/ ? srysly
ich lerne doch steht hier irgend wo "das ich c++ behersche"
Terrat is offline  
Old 03/07/2014, 21:13   #12
 
YatoDev's Avatar
 
elite*gold: 50
Join Date: Sep 2012
Posts: 3,841
Received Thanks: 1,462
wo ist der sinn das zu übersetzen ?
YatoDev is offline  
Old 03/07/2014, 22:30   #13

 
Delinquenz's Avatar
 
elite*gold: 0
Join Date: Jan 2009
Posts: 1,160
Received Thanks: 232
Quote:
ich lerne doch steht hier irgend wo "das ich c++ behersche"
Dann übersteigt das anscheinend deine Kompetenzen. C&P bringt dich nicht weiter.
Delinquenz is offline  
Old 03/07/2014, 22:37   #14


 
elite*gold: 1091
Join Date: Jun 2007
Posts: 19,836
Received Thanks: 7,180
Quote:
Originally Posted by omitma View Post
Er wird sowas gemacht haben:
Code:
typedef rückgabewert(__stdcall *name)
		(param1_type, param2_type);
Je nachdem wie die Funktion halt aussieht. Danach halt das:
Code:
name Funktion = (name)
		GetProcAddress(GetModuleHandle("dll"),
		"Funktion");
Für mich ist das ein Funktions pointer ^^ Funktioniert auch so. Frage mich nur was das System_Info und ZeroMemory da drinnen zu suchen hat. Deins geht aber natürlich auch.
Oh, das kann natürlich sein - erschließt sich mir aus dem gegebenen Kontext allerdings nicht. der TE postet irgendwie immer nur die Hälfte der Suppe.


Quote:
Originally Posted by omitma View Post
Wahrscheinlich aber nur weil ich da weiß wo welcher typ für den 1. parameter hin muss, was ich bei std::function nicht sicher weiß.
Wie meinst du das? Wenn du anschließend die Funktion aufrufst, bekommst du die Parameter (und deren Datentypen) auch angezeigt, sie haben eben nur keine Bezeichner.

Quote:
Originally Posted by omitma View Post
ABER das std::function<int(int)> ist nicht richtig. das erste int ist der rückgabe wert und das 2. der wert des 1. parameters glaube ich
Ja, haste schon richtig erkannt.
Mostey is offline  
Old 03/07/2014, 23:08   #15
 
Master674b's Avatar
 
elite*gold: 0
Join Date: Dec 2012
Posts: 255
Received Thanks: 110
Quote:
Originally Posted by omitma View Post
Sicher das der return typ von InitDecoration ein Int ist ?
Der Rückgabewert einer Funktion kann niemals einen Crash verursachen wenn dieser nicht verwendet wird.
Also ist der Rückgabetyp egal, sofern er diesen nicht verwendet. Das Problem wird vielmehr die Funktionssignatur sein bzw. die verwendete Aufrufkonvention.

Btw: std::function macht hier wenig Sinn, da schleichen sich nur unnötige Fehler ein, da man dann die Aufrufkonvention nicht mehr direkt sehen kann. Da wäre soetwas schon besser:

Code:
typedef int (__cdecl *tInitDecoration) (int);
tInitDecoration pInitDecoration = reinterpret_cast<tInitDecoration>(
        GetProcAddress(skincrafterHandle, "InitDecoration"));
pInitDecoration(1);
Master674b is offline  
Reply




All times are GMT +1. The time now is 21:44.


Powered by vBulletin®
Copyright ©2000 - 2026, 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 ©2026 elitepvpers All Rights Reserved.