How can I create a dll in PB that works only for PB?
How can I create a dll in PB that works only for PB?
Hi everybody,
I have a question I can't answer by myself so I ask your help.
I'd like to create a tool in PureBasic, for example something like a Visual Designer.
My tool will be in the following form: MyTool.exe + MyTool.dll and I would like MyTool.dll to be available for PureBasic owners.
Now what I ask is:
is it possible to create a dll in PureBasic and make the dll work only with PureBasic code? In other words, is there a way to be sure my dll won't be used in other languages but PureBasic only?
Thanks,
Roberto
I have a question I can't answer by myself so I ask your help.
I'd like to create a tool in PureBasic, for example something like a Visual Designer.
My tool will be in the following form: MyTool.exe + MyTool.dll and I would like MyTool.dll to be available for PureBasic owners.
Now what I ask is:
is it possible to create a dll in PureBasic and make the dll work only with PureBasic code? In other words, is there a way to be sure my dll won't be used in other languages but PureBasic only?
Thanks,
Roberto
...
Well, I guess that's the problem. If I provide a PB source code to use my dll, for example to load a game level, I guess everyone could use the dll in another programming language. Am I right?
Trond wrote:No. But if people don't know the parameters to the dll's functions they can't use it.
...
Well my main concern is that I'm not allowed to create PB dlls that use high level PB commands for other languages so I wanted a way to keep it legal. As there is no technical way to create a dll that works only for PB owners, my task is to advise users NOT to use the dll in other languages, because that would be illegal, or at least not to use the dll in other languages if you do not own PB, too.Trond wrote:Yes, you're right. Of course you can license it only for PureBasic owners, all other use is illegal. This won't stop everyone, but at least you'll make them feel bad.
I hope I'm right now and well yes, if there is no other way to follow, I'll follow your suggestions. Thanks,
Roberto
...
Hi thefool,thefool wrote:Of course its possible. You can make the pb user call a specific command and then go read that memory area around the command, and if it equals exactly to the pb command then you got a call from purebasic. [of course it's possible to crack around it but who wants to do that?]
I did not read your comment, before posting my reply to Trond.
Your idea looks interesting if I can limit my dll to PB only. That would be 200% perfect for my purpose. Sorry for my limited knowledge of PB at the moment, but am I asking you too much if you can provide me a sample source that illustrates your idea?
Thanks again,
Roberto
You can distribute a PB lib with the DLL has to be included in the exe that calls the dll. Only one function.
And it creates a mutex, or a signature in global memory, dunno, just a (fast) idea.
Code: Select all
IdentifyAsPBExe()
El_Choni
el choni's idea seems interesting. Im not at my pc atm so cant provide an example, but ill get to it later. Basically i just want to take the size of a specific PB command and send that size to the dll (or eventually the code, wich you peek from the memory).
just a quick idea i got
but the easiest way would be to make an userlib.
just a quick idea i got

but the easiest way would be to make an userlib.
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
I've considered this problem before and I believe it has one very simple, very elegant solution. A solution that also takes into consideration the fact that anyone who owns a PureBasic license should be able to use the dll too and call it from any language. My idea? Fred creates a webspace in the PureBasic.com server downloads section that people can use to up/download dlls. You have to provide your PB user/pass to get into the downloads section, right? It would not have to be very large and it would give the exact same security to dll producers that PureBasic itself has. Done. And it solves quite a few headaches for fred too.
BERESHEIT
just distribute the source, people need then purebasic to use it 

( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
- netmaestro
- PureBasic Bullfrog
- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
There is a DOWN side:
If you publish the PB source, some users in this forum could just make a DLL of it by replacing all Procedure to ProcedureDLL.
But, I have somehow an idea, for example, here in the forum many users announced tools for the PB IDE. Many of them has some code to check if PureBasic is opened/present. You could make a dll, add some checking before doing anything in the Procedures.
like this:
If you publish the PB source, some users in this forum could just make a DLL of it by replacing all Procedure to ProcedureDLL.
But, I have somehow an idea, for example, here in the forum many users announced tools for the PB IDE. Many of them has some code to check if PureBasic is opened/present. You could make a dll, add some checking before doing anything in the Procedures.
like this:
Code: Select all
Procedure MyTool_CreateWindow(ID, x, y, Width, Height)
; Check that PB is present
If PureBasicIsPresent()
; Do your actual procedure stuff here
EndIf
EndProcedure