[UT99 Native] Check if DLL is installed

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

So(u)rcerer

New Member
Mar 7, 2005
6
0
0
Hamburg / Germany
www.kitana.org
Hi,

I'm writing a UT99 mod which requires some native code on the clients. The mod runs fine on both server and client as long as the client has already installed my DLL. But ... if the client hasn't yet installed the DLL (because it has to download it from the server first) it crashes with an ugly exception:

Can't bind to native class MyNativePackage.MyNativeClass

History: UClass:: Bind <- (Class MyNativePackage.MyNativeClass) <- ULinkerLoader::CreateExport ...


So my questions is:
How can I check if the client has installed my DLL?

If it has then I can call my native code. Otherwise I have ask the user if he trusts my mod ( :D ) and allows the loader (a normal UnrealScript class) to install the DLL so I can execute it after rebooting UT.
 

Mychaeel

New Member
I must have missed the part where he needed to check whether the DLL is present in UnrealScript... gah.

I suppose using DynamicLoadObject won't work either, though. As I understand it, the game crashes as soon as a class is loaded which needs to bind to the DLL if the DLL is not present -- regardless of how the class is loaded.
 

So(u)rcerer

New Member
Mar 7, 2005
6
0
0
Hamburg / Germany
www.kitana.org
Thanx for the quick replies.

I will try if these functions do the job. I know it must be possible because it works for QValidate. When connecting to a QValidate server a message window opens that tells you that the DLL has been installed and that you have to reboot UT now. On the next time you can connect to the server and the DLL is active.
 

So(u)rcerer

New Member
Mar 7, 2005
6
0
0
Hamburg / Germany
www.kitana.org
Oh yes, I really like to have a look at the code. But ... too bad ... Professor Q has removed his source code from the package (for security reasons).

But it seems that he's using DynamicLoadObject, too (as I can see at the binary file of the package).
 

Shambler[sixpack]

New Member
May 3, 2001
564
0
0
Ireland
Visit site
Yes that's right you can't use DynamicLoadObject to check if a .dll exists (in fact it's impossible through UScript AFAIK in UT1), what you SHOULD do Sourcerer is first of all load a package on the client that is not natively bound and then use that package to test if the client has the native package installed. (by trying to dynamicly load one of its native classes)

If it doesn't exist then the client needs to install it, as long as you do NOT make the natively bound package a ServerPackage (i.e. as long as the client can NEVER possess only the .u file, but must install both the .u and .dll at the same time) you should be ok.

If it doesn't exist just get the client to install it, you should do this manually. (i.e. link the client to a download address on a website using the "Start http://etc." console-command)
For the sake of security there is ONLY that manual way :p (*cough* this is a note to anyone thinking of posting)
 

So(u)rcerer

New Member
Mar 7, 2005
6
0
0
Hamburg / Germany
www.kitana.org
Ok, I've tested DynamicLoadObject and you're right - it doesn't solve the problem.

Now I have 2 packages: The 1st consists of pure UnrealScript classes while the 2nd contains the native class. Both packages have been declared as server packages so the client is downloading both. So far this is working well. The client can run an actor from the pure UnrealScript class but as soon as this actor is calling DynamicLoadObject with a class of the native package UT is crashing. Too bad ...

So I need a different way to check if the DLL is present. I've searched the Wiki for objects/actors/functions that "touch" files. Someone said that UTPure is using WebResponse.IncludeBinaryFile to read random files from the UT folder. But it sounds quite difficult since you have to implement a HTTP server and client for this.

Now I'm testing CheckSumCommandlet. When running this Commandlet at the DOS prompt it returns with exitcode 0 for any existing file but returns 1 if the file does not exist. That's all I need. And CheckSumCommandlet's parameter doesn't have to be a valid Unreal package - you can specify any file.

But how can I use a (this) Commandlet in my actor? Since Commandlet is not an actor but an object I've created the Commandlet object with:

local Commandlet cc;
cc=New class'CheckSumCommandlet';
result=cc.Main(Filename);


But this causes UT to crash with the following error message:

Critical: Failed to find function Main in CheckSumCommandlet CTF-Face.CheckFileExists0.CheckSumCommandlet0
 

Shambler[sixpack]

New Member
May 3, 2001
564
0
0
Ireland
Visit site
Hmm...How do you intend on getting the client to install the .dll in the first place?

It would make a lot more sense (and require a lot less pain) if the client had to install both the .u and .dll at the same time.