ianis24
Messages postés87Date d'inscriptiondimanche 20 août 2006StatutMembreDernière intervention13 janvier 2011
-
1 avril 2009 à 22:07
ianis24
Messages postés87Date d'inscriptiondimanche 20 août 2006StatutMembreDernière intervention13 janvier 2011
-
12 avril 2009 à 17:30
Bonjour je souhaiterai avoir une traduction la plus complète possible de ce code vb.net ver le visual basic 6.
je bloque pour appeler la fonction ainsi que pour charger la librairie "Steam.dll" externe au dossier d'éxecution.
<DllImport("Steam.dll", CallingConvention:=CallingConvention.Cdecl)> _
Public Function SteamDecryptDataForThisMachine(ByVal encryptedData As String, _
ByVal encryptedDataSize As Integer, _
ByVal decryptedBuffer As StringBuilder, _
ByVal decryptedBufferSize As Integer, _
ByRef decryptedDataSize As Integer) As Integer
End Function
Sub Main(ByVal args() As String)
Dim encpwd As String = "91C6109CBA72D1AF587E74E860AB2348DFEBCE61EFC11C80205ECD4E18CDC2FAF200008284B7D6EC411631A03F02" 'string encpwd Dim decryptedDataSize As Integer 0
Dim pwd As New StringBuilder
pwd.Length = encpwd.Length / 2
If SteamDecryptDataForThisMachine(encpwd, encpwd.Length, pwd, pwd.Length, _
decryptedDataSize) = 0 Then
Console.WriteLine(Constants.vbLf & " Password: " & pwd.ToString())
Else
Console.WriteLine("Error decrypting the Steam Password.")
End If
Console.ReadLine()
End Sub
End Module
Renfield
Messages postés17287Date d'inscriptionmercredi 2 janvier 2002StatutModérateurDernière intervention27 septembre 202174 2 avril 2009 à 11:18
Public Function SteamDecryptDataForThisMachine Lib "Steam.dll" (ByVal encryptedData As String, ByVal encryptedDataSize As Long, Byval decryptedBuffer As String, ByVal decryptedBufferSize As Long, ByRef decryptedDataSize As Long) As Long
ianis24
Messages postés87Date d'inscriptiondimanche 20 août 2006StatutMembreDernière intervention13 janvier 2011 2 avril 2009 à 19:56
j'ai déjà essayer cette méthode mais la DLL en question est dans un autre dossier.
J'ai donc besoin de charger la library.
Pa = loadlibrary ("C:\Data\123.dll")
Et la fonction d'entête n'est donc plus utilisable.
ianis24
Messages postés87Date d'inscriptiondimanche 20 août 2006StatutMembreDernière intervention13 janvier 2011 3 avril 2009 à 18:21
La Dll en question peut être dans un dossier variable un disque variable...
je récupère ce dossier via une fonction
Private Function GetSteamDLL() As String
Set WshShell = CreateObject("WScript.Shell")
GetSteamDLL = WshShell.RegRead("HKEY_CURRENT_USER\Software\Valve\Steam\SteamPath")
GetSteamDLL = GetSteamDLL & "/" & "Steam.dll"
End Function
Je ne peut donc pas la déclarer comme sur ton message précédent.
Vous n’avez pas trouvé la réponse que vous recherchez ?
ianis24
Messages postés87Date d'inscriptiondimanche 20 août 2006StatutMembreDernière intervention13 janvier 2011 4 avril 2009 à 00:12
Voici ou en est mon code, j'ai une erreur avec le class module ( run-time error )
Comment dois-je récupérer les variables de sortie ?
je suis complètement perdu, ça fait 2 semaine que je boss sur ce projet et je me vois obliger de me remettre a vous. Votre aide me sera très utile.
Si quelqu'un peut complètement traduire le code Vb.net ver Vb6 ce serait formidable.
Excusez moi je j'ai absolument besoin de comprendre le fonctionnement de cette DLL il n'existe aucun code public vb6 fonctionnelle pour cette procédure.
Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) As Long
Private MyFunction As New CDelegate
Private Function GetSteamDLL() As String
Set WshShell = CreateObject("WScript.Shell")
GetSteamDLL = WshShell.RegRead("HKEY_CURRENT_USER\Software\Valve\Steam\SteamPath")
GetSteamDLL = GetSteamDLL & "/" & "Steam.dll"
End Function
Sub Main()
Dim lb As Long, pa As Long
lb = LoadLibrary(GetSteamDLL)
pa = GetProcAddress(lb, "SteamDecryptDataForThisMachine")
'a = "encryptedData As String, ByVal encryptedDataSize As Long, Byval decryptedBuffer As String, ByVal decryptedBufferSize As Long, ByRef decryptedDataSize As Long"
dll = LoadLibrary("STEAM.DLL");
if(!dll){
printf("\nError: the file STEAM.DLL has not been found\n");
exit(1);
}
SteamDecryptDataForThisMachine =(void*)GetProcAddress(dll, "SteamDecryptDataForThisMachine");
if(!SteamDecryptDataForThisMachine){
printf("\nError: the function SteamDecryptDataForThisMachine has not been found\n");
exit(1);
}
Renfield
Messages postés17287Date d'inscriptionmercredi 2 janvier 2002StatutModérateurDernière intervention27 septembre 202174 4 avril 2009 à 07:44
GetSteamDLL = GetSteamDLL & "/" & "Steam.dll"
sur windows, on utilises le backslash...
GetSteamDLL = GetSteamDLL & "" & "Steam.dll"
tu ne peux pas faire:
Voici ou en est mon code, j'ai une erreur avec le class module ( run-time error )
Comment dois-je récupérer les variables de sortie ?
je suis complètement perdu, ça fait 2 semaine que je boss sur ce projet et je me vois obliger de me remettre a vous. Votre aide me sera très utile.
Si quelqu'un peut complètement traduire le code Vb.net ver Vb6 ce serait formidable.
Excusez moi je j'ai absolument besoin de comprendre le fonctionnement de cette DLL il n'existe aucun code public vb6 fonctionnelle pour cette procédure.
Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) As Long
Private MyFunction As New CDelegate
Private Function GetSteamDLL() As String
Set WshShell = CreateObject("WScript.Shell")
GetSteamDLL = WshShell.RegRead("HKEY_CURRENT_USER\Software\Valve\Steam\SteamPath")
GetSteamDLL = GetSteamDLL & "/" & "Steam.dll"
End Function
Sub Main()
Dim lb As Long, pa As Long
lb = LoadLibrary(GetSteamDLL)
pa = GetProcAddress(lb, "SteamDecryptDataForThisMachine")
Voici ou en est mon code, j'ai une erreur avec le class module ( run-time error )
Comment dois-je récupérer les variables de sortie ?
je suis complètement perdu, ça fait 2 semaine que je boss sur ce projet et je me vois obliger de me remettre a vous. Votre aide me sera très utile.
Si quelqu'un peut complètement traduire le code Vb.net ver Vb6 ce serait formidable.
Excusez moi je j'ai absolument besoin de comprendre le fonctionnement de cette DLL il n'existe aucun code public vb6 fonctionnelle pour cette procédure.
Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) As Long
Private MyFunction As New CDelegate
Private Function GetSteamDLL() As String
Set WshShell = CreateObject("WScript.Shell")
GetSteamDLL = WshShell.RegRead("HKEY_CURRENT_USER\Software\Valve\Steam\SteamPath")
GetSteamDLL = GetSteamDLL & "/" & "Steam.dll"
End Function
Sub Main()
Dim lb As Long, pa As Long
lb = LoadLibrary(GetSteamDLL)
pa = GetProcAddress(lb, "SteamDecryptDataForThisMachine")
Voici ou en est mon code, j'ai une erreur avec le class module ( run-time error )
Comment dois-je récupérer les variables de sortie ?
je suis complètement perdu, ça fait 2 semaine que je boss sur ce projet et je me vois obliger de me remettre a vous. Votre aide me sera très utile.
Si quelqu'un peut complètement traduire le code Vb.net ver Vb6 ce serait formidable.
Excusez moi je j'ai absolument besoin de comprendre le fonctionnement de cette DLL il n'existe aucun code public vb6 fonctionnelle pour cette procédure.
Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) As Long
Private MyFunction As New CDelegate
Private Function GetSteamDLL() As String
Set WshShell = CreateObject("WScript.Shell")
GetSteamDLL = WshShell.RegRead("HKEY_CURRENT_USER\Software\Valve\Steam\SteamPath")
GetSteamDLL = GetSteamDLL & "/" & "Steam.dll"
End Function
Sub Main()
Dim lb As Long, pa As Long
lb = LoadLibrary(GetSteamDLL)
pa = GetProcAddress(lb, "SteamDecryptDataForThisMachine")
MyFunction.Create "Steam.dll::SteamDecryptDataForThisMachine", vbLong, vbLong, vbString, vbString, vbLong
puisque steam.dll n'est pas accessible directement...
tu as récupéré son hLib, juste au dessus... utilises le.
les types passés lors de la création du delegué, tu n'utilises pas les même types que dans la declaration d'API...
d'autre part, tu ne fait finallement pas appel a la fonction... (pas de MyFunction.Default.Invoke)
Sub Main()
Dim lb As Long, pa As Long
lb = LoadLibrary(GetSteamDLL)
pa = GetProcAddress(lb, "SteamDecryptDataForThisMachine")
ianis24
Messages postés87Date d'inscriptiondimanche 20 août 2006StatutMembreDernière intervention13 janvier 2011 4 avril 2009 à 13:25
Donc a partir d'ici comment puis je utiliser ce code pour décrypter une chaine ?
(Le classe module ne m'est pas tout a fait claire)
Comment définir le nom des variables de la fonction crée ?
Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, ByVal lpProcName As String) As Long
Private MyFunction As New CDelegate
Private Function GetSteamDLL() As String
Set WshShell = CreateObject("WScript.Shell")
GetSteamDLL = WshShell.RegRead("HKEY_CURRENT_USER\Software\Valve\Steam\SteamPath")
GetSteamDLL = GetSteamDLL & "" & "Steam.dll"
End Function
Sub Main()
Dim lb As Long, pa As Long
lb = LoadLibrary(GetSteamDLL)
pa = GetProcAddress(lb, "SteamDecryptDataForThisMachine")