How can I create a dll in PB that works only for PB?

Just starting out? Need help? Post your questions and find answers here.
roblos
User
User
Posts: 20
Joined: Wed Apr 19, 2006 2:20 pm

How can I create a dll in PB that works only for PB?

Post by roblos »

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
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

No. But if people don't know the parameters to the dll's functions they can't use it.
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

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?]
roblos
User
User
Posts: 20
Joined: Wed Apr 19, 2006 2:20 pm

...

Post by roblos »

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.
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

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. :wink:
roblos
User
User
Posts: 20
Joined: Wed Apr 19, 2006 2:20 pm

...

Post by roblos »

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. :wink:
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.

I hope I'm right now and well yes, if there is no other way to follow, I'll follow your suggestions. Thanks,
Roberto
roblos
User
User
Posts: 20
Joined: Wed Apr 19, 2006 2:20 pm

...

Post by roblos »

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?]
Hi thefool,

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
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post by El_Choni »

You can distribute a PB lib with the DLL has to be included in the exe that calls the dll. Only one function.

Code: Select all

IdentifyAsPBExe()
And it creates a mutex, or a signature in global memory, dunno, just a (fast) idea.
El_Choni
Lyon
User
User
Posts: 59
Joined: Tue Mar 28, 2006 9:26 pm

Post by Lyon »

If you just wanted to make it for PB users, you wouldn't even need a DLL, you could use tailbite and make it a userlib just for PBers.
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

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.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

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
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

except for the fact anyone can grap the dll and use it..
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

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... )
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

just distribute the source, people need then purebasic to use it
Good idea!
BERESHEIT
josku_x
Addict
Addict
Posts: 997
Joined: Sat Sep 24, 2005 2:08 pm

Post by josku_x »

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:

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
Post Reply