Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-15-2004, 10:20 AM
Junior Member
 
Join Date: Mar 2004
Posts: 3
Default Protecting swf, serial nos

Hi, we have swf files that are supplied on CD to customers.
We want to protect the swfs somehow so that the swf will only run on one PC. Will swfkit allow us to do this?
Reply With Quote
  #2 (permalink)  
Old 03-16-2004, 01:29 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Protecting swf, serial nos

Sure, SWFKit can do this. In SWFKit 1.1, there are some hidden methods for you.


1. Application.setBasePath

Syntax
Application.setBasePath("movies");
Application.setBasePath("attachments");
Application.setBasePath({path-name});

Description
Set the base of the Flash Player to load movies.
Eg, you have added a movie "demo.swf" to the addtional file list "myswfs"
You can load the movie more easily in the main SWF like this,
a. in the main movie, load the movie by the action script loadMovieNum("myswfs\\demo.swf", 1);
in FFish script, you need to call Application.setBasePath("attachments");

b. in the main movie, load the movie directly without any folder name: loadMovieNum("demo.swf", 1);
in FFish Script, you need to set base to the folder that the demo.swf has been put in:
var name = getAddtionalFile("myswfs\\demo.swf");
Application.setBasePath((new File(name)).parentPath);

2. Application.Expiry.bEnable

Syntax
var enable = Application.Expiry.bEnable;

Description
Determine if the "Expiry" option is enabled in the "Expiry" setting dialog
Read-only.

3. Application.Expiry.expireOn

Syntax
var date = new Date(Application.Expiry.expireOn);

Description
Returns the date when the program will expire. Read-only.
only valid when "Application.Expiry.bEnable" returns true
In SWFKit 1.05, it will return a wrong value in preview mode

4. Application.Expiry.leftDays

Syntax
var leftdaynumber = Application.Expiry.leftDays;

Description
returns the left days of the program. Read-only.

Eg. if (Application.Expiry.leftDays < 0) trace("Expired!");
In SWFKit 1.05, it will return a wrong value in preview mode

5. Application.Expiry.bEnableUnlock

Syntax
var enable = Application.Expiry.bEnableUnlock;

Description
Determine if the "Enable unlock" option is enabled in the "Expiry" setting dialog. Read-only.
If the property returns false, and you don't handle the Application.Expiry.onExpired event,
when the program is expired, it can't run anymore. However, if you handle the Application.Expiry.onExpired
event, you still can let users register your program by the Application.Expiry.register method
and check if they have registered the program by Application.Expiry.isRegistered property.

6. Application.Expiry.showRegisterDlg

Syntax
var registerd = Application.Expiry.showRegisterDlg();

Description
Shows the register dialog. returns true if the registration is successful.

7. Application.Expiry.isExpired

Syntax
var expired = Application.Expiry.isExpired;
Description
returns true when the program is expired.

8. Application.Expiry.isRegistered

Syntax
var expired = Application.Expiry.isRegistered;
Description
returns true when the program is registered.

9. Application.Expiry.register

Syntax
var registered = Application.Expiry.register(username, sn, password);

Description

register the program. Eg. Application.Expiry.register("zqzxf", "0000000000", "LYCRYVUBKQDG8WW9");
Notice: the password is "LYCR-YVUB-KQDG-8WW9", you must remove the "-" when you pass it to the method

10. Application.Expiry.onExpired

Syntax
var Application.Expiry.onExpired = function (donnot_call_the_default_handler)
{
donnot_call_the_default_handler.value = true;
}

Descrption

When the program is fired, the event will be fired just after the main window is appeared on the screen.
The event will be only fired once.

When you set the donnot_call_the_default_handler.value to true, the SWFKit won't call the default handler
any more, you must do all the things in this function by your self, such as show a dialog to alert the expiry,
let the user register the program, etc.

If you set the donnot_call_the_default_handler.value to true, and do nothing in the handler function,
the program will continue to run as if without expiry supporting. You can use this way to bypass the default
handler, and check if the parogram is expired later by using the "Application.Expiry.isExpired" property.

By default, SWFKit gives users chance to input the register codes only if the "Enable unlock" option is checked,
or the program will stop to run after it shows a expiry alert dialog. If you set the donnot_call_the_default_handler.value
to true, you still can let users input their reg codes even if the "Enable unlock" option is diabled.

You can provide your own unlock system by unchecking the "Enable unlock" option,
setting the donnot_call_the_default_handler.value to true,
and writing your own reister and verify functions. Eg.

registered = false;
function myRegister(username, sn, pass)
{
if (sn != 'guest' || pass != 'guest')
{
registered = false;
}
else registered = true;

return registered;
}

function myIsRegistered()
{
return registered;
}

var Application.Expiry.onExpired = function (donnot_call_the_default_handler)
{
if (Application.Expiry.isExpired && !myIsRegistered())
{
trace("Expired, you must register");

//get the user name, pass, and sn
//...

if (!myRegister(username, sn, pass))
{
trace("wrong pass or sn, you won't get full function");
}
}

donnot_call_the_default_handler.value = true;
}

11. Encryption.blowfishEncode(key, string);
12. Encryption.blowfishDecode(key, string);

blowfish encode and decode
Eg.
var x = Encryption.blowfishEncode("mykey", "text");
var y = Encryption.blowfishDecode("mykey", x);
trace(y == "text");

13. Encryption.md5(string);

Eg. trace(Encryption.md5("text"));

14. Encryption.md5File(File);

Eg. trace(Encryption.md5File("c:\\1.txt"));

15. Encryption.desEncode(key, string);
16. Encryption.desDecode(key, string);

DES encode and decode
Eg.
var x = Encryption.desEncode("mykey", "text");
var y = Encryption.desDecode("mykey", x);
trace(y == "text");

17. DiskInfo Object

Get the hardware information of the HardDisks. The serial number of the hard disk is unqie and won't be changed,
you can use the serial number as your encrypt key.

Syntax

var di = new DiskInfo(i); i = 0, 1, 2, 3
0 - The master disk of the primary controller
1 - The slave disk of the primary controller
2 - The master disk of the secondary controller
3 - The slave disk of the secondary controller

if the specified disk doesn't exist, it returns null

Eg.

for (i = 0; i < 4; i++)
{
var di = new DiskInfo(i);
if (di != null)
{
trace(di.modelNumber);
trace(di.serialNumber);
trace(di.revisionNumber);
trace(di.driveType);
trace(di.bufferSize);
trace(di.cylinders);
trace(di.heads);
trace(di.sectors);
}
}



How to protect your movies?

1. make a Flash componenet by the following action acript

#initclip

function AFlashGuardCD() {
Stage.showMenu = false;
this._visible = false;
fscommand("trapallkeys", true);
fscommand("showmenu", false);
var tm = this._parent;
tm.stop();
fscommand("FFish_Eval", "onGaurd(" + tm.toString() + ")");
}

AFlashGuardCD.prototype = new MovieClip();

Object.registerClass("FlashGuardCD", AFlashGuardCD);

#endinitclip

2. Add the component to your movie
3. When the movie runs, the component makes the movie invisible
4. Define a function in the "initialize" script in SWFKit

function onGuard(parent)
{
//Check if the movie can be visible
//...

//make the movie visible
FlashPlayer.tagretSetProperty(parent, 7, "1");
}
Reply With Quote
  #3 (permalink)  
Old 03-16-2004, 01:32 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Protecting swf, serial nos

The DiskInfo object can help you to get the serial number of the hard disk, which is unique for every PC
Reply With Quote
  #4 (permalink)  
Old 03-31-2004, 02:37 PM
Junior Member
 
Join Date: Mar 2004
Posts: 3
Default Re:Protecting swf, serial nos

Thanks for that, I have put the component in Flash but it doesn't make it invisible, any hints?
Reply With Quote
  #5 (permalink)  
Old 03-31-2004, 02:50 PM
Junior Member
 
Join Date: Mar 2004
Posts: 3
Default Re:Protecting swf, serial nos

I also get this error in SWFKit

FSCommand("FFish_Eval", "onGaurd([object Object])")
error: line 0: syntax error: missing ] after element list
Reply With Quote
Reply

Was this information helpful?    Yes No



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 05:55 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.