Seite 1 von 1
Ausgabe direkt von einem AttachProcess [Gelöst]
Verfasst: 02.06.2008 11:41
von kwai chang caine
Hallo an alle
Ich möchte wissen, ob es möglich ist, zu testen, eine Voraussetzung für die Frage einer DLL, und wenn sie nicht gut zu verlassen, ohne die Upgrade-Funktion aufrufen.
Dies auch, um den Test zu jeder Funktion, ohne daß man jedes Mal
Code des DLL
Code: Alles auswählen
ProcedureDLL AttachProcess(Instance)
Buffer.s = Space(1024)
Bufsize.l = 1024
GetComputerName_(@Buffer, @Bufsize)
NamePc.s = Buffer
If NamePc <> "ComputerName"
MessageRequester("Test", "The name of the PC is no good", 0)
EndIf
EndProcedure
ProcedureDLL Message()
MessageRequester("Test", "Hello is good", 0)
EndProcedure
Code des Programms
Code: Alles auswählen
OpenLibrary(0, "PureBasic.dll")
CallFunction(0, "Message")
CloseLibrary(0)
Ich danke Ihnen
Guten Tag
Verfasst: 02.06.2008 16:34
von nicolaus
Hello,
sorry but google have translate your text so crasy that i don´t understand what you want to know.
Verfasst: 02.06.2008 18:45
von kwai chang caine

And in deutch i walk in the complet dark
I have asked the question, in the two forums, because it's a very hard question, same SROD which is a very good programer was not the answer
Well, I called the master
Freak and he gave me the answer to ASM
I post the link, if a friend of this forum is interested:
http://www.purebasic.fr/english/viewtop ... highlight=
Thanks a lot for your interest

Verfasst: 03.06.2008 13:06
von kwai chang caine
I have a new problem, the code of FREAK works fine for exit a DLL, without execute the rest of DLL.
Directly of the AttachProcess function
It's really useful, for test if a program have the autorisation to use the DLL
It works fine when the DLL called by a PB program, else when the DLL called with VB6, i have an error 48
"File no found : PureBasic.dll"
Somebody know why VB call don't works ?
What is the difference of the DLL management between PB and VB6 ?
Code: Alles auswählen
ProcedureDLL AttachProcess(Instance)
Global AppPath.s
AppPath = Space(200)
GetCurrentDirectory_(200, @AppPath)
AppPath = Trim(AppPath)
If Right(AppPath,1) <> "\"
AppPath + "\"
EndIf
Global NomExecutable.s
Application.s = Space(255)
GetModuleFileName_(0, @Application, 255)
NomExecutable = GetFilePart(Application)
Application = ""
Global AutorisationAppli = #False
ReadFile(1, AppPath + "Autorisation")
Repeat
Donnee$ = ReadString(1)
NomAppliFichier.s = StringField(UCase(Trim(Donnee$)), 1, "=")
If FindString(UCase(Trim(NomExecutable)), NomAppliFichier, 1)
AutorisationAppli = #True
Break
EndIf
Until Eof(1) <> 0
CloseFile(1)
If AutorisationAppli = #False
MessageRequester(NomDLL, Space(8) + "Le logiciel " + NomExecutable + " n'est pas autorisé à utiliser " + NomDll + "," + Chr(13) + "veuillez contacter le développeur pour obtenir une autorisation.")
!ADD esp, 8 ; remove Instance variable and return address from stack
!MOV eax, 0 ; set returnvalue to 0
!RET 12 ; return from DllEntryPoint
Else
ProcedureReturn ; return normally
EndIf
EndProcedure
Verfasst: 03.06.2008 13:31
von edel
"File no found : PureBasic.dll"
dll in apppath ?
Verfasst: 03.06.2008 13:54
von kwai chang caine
Yes, and i declare her like this :
Code: Alles auswählen
Private Declare Function Kcc Lib "PureBasic.dll" (ByVal Session As String) As Long
If i remove the code of FREAK, the DLL works fine in VB and in pb
Verfasst: 03.06.2008 16:15
von freak
Then "File not found" is probably a generic error that VB displays when the dll cannot be loaded.
This is what you want, isn't it ? If you prevent the dll from loading, VB has to display some kind of error.
Verfasst: 03.06.2008 16:36
von kwai chang caine
Hello FREAK, thanks to help me
It's a normal comportement of VB for you !!!
But it's a more big mule that me, because the DLL is here, she just no be loaded.
This mule said "no DLL", if he said "The DLL can not be loaded" that is a good error message, but he said "no DLL". what a mule....
Perhaps, i must manage this error in VB ???
This VB, more i programing PB, more i hate him

Verfasst: 03.06.2008 17:34
von kwai chang caine
I read the VB doc, and see :
VB can not manage error DLL
I search again
Verfasst: 04.06.2008 10:25
von kwai chang caine
I have some news about VB and the library, thank RENFIELD a VB programer
He said me, to use the API "LoadLibrary" before call the function in the DLL
And that's right, it's works
I give in this forum this information, if a crazy like me use a day this fonction
Thanks you very much at all
