ich habe derzeit folgenden abgekürzten C# Code:
Code: Alles auswählen
[DllImport("PxCrypto.dll", CharSet = CharSet.Ansi,
EntryPoint = "_MakeHash@8")]
private static extern int MakeHash(string password, ref object Hash);
...
object var_CryptoPass = "";
MakeHash("", ref var_CryptoPass);
Code: Alles auswählen
hllDll = ctypes.WinDLL (r"PxCrypto.dll")
hllApiProto = ctypes.WINFUNCTYPE (
ctypes.c_int, # Return type.
ctypes.c_void_p, # string password
ctypes.c_void_p) # object Hash
hllApiParams = (1, "p1", 0), (1, "p2", 0),
hllApi = hllApiProto (("_MakeHash@8", hllDll), hllApiParams)
p1 = ctypes.c_char
p2 = ctypes.c_char_p
a = hllApi (ctypes.byref (p1), p2)
print(a)
Ich bin jetzt was C# und generell DLLs anbelangt nicht wirklich gut und komme hier nicht weiter.
Ich verstehe noch nicht, wie ich die p1, p2 Parameter richtig setzen muss, ob c_char das Richtige ist?
Derzeit bekomme ich den Fehler in python:
Code: Alles auswählen
Traceback (most recent call last):
File "C:\Users\mwagner\AppData\Local\Programs\Python\Python310-32\lib\code.py", line 90, in runcode
exec(code, self.locals)
File "<input>", line 11, in <module>
TypeError: byref() argument must be a ctypes instance, not '_ctypes.PyCSimpleType'
Weiß jemand, was ich falsch mache und würde es mir erklären?