Jump to content
  • 0

Problem Code Method Getprotectiondomain


Question

Posted

helpme code in java base l2f

 

import l2f.gameserver.utils.VgConfig;
import l2f.commons.util.Base64;
import l2f.commons.crypt.NewCrypt;
import java.io.*;
import java.net.URL;
import java.net.URLConnection;
import java.security.CodeSource;
import java.security.ProtectionDomain;
import java.util.Enumeration;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;

 

 

public Class forName(String className)
    {
        String classFile;
        ZipFile z;
        Enumeration list;
        if(VgConfig.NPROTECT_KEY == -1)
            throw new Exception();
        classFile = className.replace(".", "/");
        z = new ZipFile(VLoaderKey.getProtectionDomain().getCodeSource().getLocation().toURI());
        list = z.entries();
        byte data[];
        ZipEntry ze;
        do
        {
            if(!list.hasMoreElements())
            ze = (ZipEntry)list.nextElement();
        } while(!ze.getName().startsWith(classFile));
        InputStream is = z.getInputStream(ze);
        data = new byte[(int)ze.getSize()];
        is.read(data);
        is.close();
        if(data[0] != -54 || data[1] != -2)
        {
            NewCrypt nc = new NewCrypt(String.format("%X", new Object[] {
                Integer.valueOf(VgConfig.NPROTECT_KEY)
            }));
            data = nc.decrypt(data);
        }
        try
        {
            Class result = defineClass(className, data, 0, data.length);
            z.close();
            return result;
        }
        catch(ClassFormatError e)
        {
            System.out.println(" - Fxn 64 Protect: Unable to load protection components");
        }
        z.close();
        System.exit(0);
        return null;
        throw new Exception();
        Exception e;
        
        System.out.println("WARNING: Unable to load protection components");
        System.exit(0);
        return null;
    }

 

 

erro compile

 

compile:
    [javac] \java\l2f\gameserver\utils\VLoaderKey.java:91: error: cannot find symbol
    [javac]         z = new ZipFile(VLoaderKey.getProtectionDomain().getCodeSource().getLocation().toURI());
    [javac]                                   ^
    [javac]   symbol:   method getProtectionDomain()
    [javac]   location: class VLoaderKey

 

    [javac] \java\l2f\gameserver\utils\VLoaderRev.java:112: error: cannot find symbol
    [javac]             Class result = defineClass(className, data, 0, data.length);
    [javac]                            ^
    [javac]   symbol:   method defineClass(String,byte[],int,int)
    [javac]   location: class VLoaderRev

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...