1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
package NET.worlds.console;
import NET.worlds.core.RegKey;
import NET.worlds.core.RegKeyNotFoundException;
import java.io.IOException;
public class IClassFactory extends IUnknown {
private static final String IID_IClassFactory = "{00000001-0000-0000-C000-000000000046}";
private long _registerID;
public IClassFactory() throws IOException {
}
public IClassFactory(String svrID) throws IOException {
super(svrID, "{00000001-0000-0000-C000-000000000046}");
}
public IClassFactory(IUnknown pIUnknown) throws IOException, OLEInvalidObjectException {
super(pIUnknown, "{00000001-0000-0000-C000-000000000046}");
}
public synchronized void activate(String CLSID) throws IOException {
assert this._registerID == 0L;
assert Main.isMainThread();
if ((ActiveX.getDebugLevel() & 8) > 0) {
System.out.println(this + ": activating server as " + CLSID);
}
this._registerID = this.nActivate(CLSID);
if ((ActiveX.getDebugLevel() & 8) > 0) {
System.out.println(this + ": successful");
}
}
public synchronized void deactivate() throws IOException {
assert this._registerID != 0L;
assert Main.isMainThread();
if ((ActiveX.getDebugLevel() & 8) > 0) {
System.out.println(this + ": deactivating server");
}
this.nDeactivate(this._registerID);
}
@Override
public synchronized void Release() throws OLEInvalidObjectException {
if (this._refs == 1 && this._registerID != 0L) {
if ((ActiveX.getDebugLevel() & 4) > 0) {
System.out.println(this + ": deactivating before Release");
}
try {
this.deactivate();
} catch (IOException var2) {
System.out.println("DEBUG: " + this);
var2.printStackTrace(System.out);
assert false;
}
this._registerID = 0L;
}
super.Release();
}
@Override
public String internalData() {
return "_registerID = " + this._registerID + ", " + super.internalData();
}
@Override
public String toString() {
return "IClassFactory(" + this.internalData() + ")";
}
public void register(String friendlyName, String CLSID, String VerIndProgID, String ProgID) {
try {
RegKey root = RegKey.getRootKey(0);
RegKey gammaKey = new RegKey(root, "world\\shell\\open\\command", 0);
String gammaPath = gammaKey.getStringValue("");
int argIndx = gammaPath.indexOf(" \"%1\"");
gammaPath = gammaPath.substring(0, argIndx);
RegKey classKey = new RegKey(root, "CLSID\\" + CLSID, 2);
classKey.setStringValue("", friendlyName, false);
RegKey subKey = new RegKey(classKey, "LocalServer32", 2);
subKey.setStringValue("", gammaPath, false);
subKey.close();
subKey = new RegKey(classKey, "ProgID", 2);
subKey.setStringValue("", ProgID, false);
subKey.close();
subKey = new RegKey(classKey, "VersionIndependentProgID", 2);
subKey.setStringValue("", VerIndProgID, false);
subKey.close();
classKey.close();
RegKey verIndKey = new RegKey(root, VerIndProgID, 2);
verIndKey.setStringValue("", friendlyName, false);
subKey = new RegKey(verIndKey, "CLSID", 2);
subKey.setStringValue("", CLSID, false);
subKey.close();
subKey = new RegKey(verIndKey, "CurVer", 2);
subKey.setStringValue("", ProgID, false);
subKey.close();
verIndKey.close();
RegKey progKey = new RegKey(root, ProgID, 2);
progKey.setStringValue("", friendlyName, false);
subKey = new RegKey(progKey, "CLSID", 2);
subKey.setStringValue("", CLSID, false);
subKey.close();
progKey.close();
} catch (RegKeyNotFoundException var13) {
System.out.println("Warning: System Registry not configured properly by Worlds.");
}
}
private native long nActivate(String var1) throws IOException;
private native void nDeactivate(long var1) throws IOException;
}
|