summaryrefslogtreecommitdiff
path: root/NET/worlds/console/IClassFactory.java
blob: 408d4c45aac4e362eb4e0c16ad694b7cd98f8ba9 (plain) (blame)
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
/*     */ package NET.worlds.console;
/*     */ 
/*     */ import NET.worlds.core.RegKey;
/*     */ import NET.worlds.core.RegKeyNotFoundException;
/*     */ import java.io.IOException;
/*     */ import java.io.PrintStream;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 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
/*     */   {
/*  32 */     super(svrID, "{00000001-0000-0000-C000-000000000046}");
/*     */   }
/*     */   
/*     */   public IClassFactory(IUnknown pIUnknown) throws IOException, OLEInvalidObjectException
/*     */   {
/*  37 */     super(pIUnknown, "{00000001-0000-0000-C000-000000000046}");
/*     */   }
/*     */   
/*     */   public synchronized void activate(String CLSID) throws IOException {
/*  41 */     assert (this._registerID == 0L);
/*     */     
/*  43 */     assert (Main.isMainThread());
/*     */     
/*  45 */     if ((ActiveX.getDebugLevel() & 0x8) > 0) {
/*  46 */       System.out.println(this + ": activating server as " + CLSID);
/*     */     }
/*  48 */     this._registerID = nActivate(CLSID);
/*     */     
/*  50 */     if ((ActiveX.getDebugLevel() & 0x8) > 0) {
/*  51 */       System.out.println(this + ": successful");
/*     */     }
/*     */   }
/*     */   
/*     */   public synchronized void deactivate() throws IOException {
/*  56 */     assert (this._registerID != 0L);
/*  57 */     assert (Main.isMainThread());
/*     */     
/*  59 */     if ((ActiveX.getDebugLevel() & 0x8) > 0) {
/*  60 */       System.out.println(this + ": deactivating server");
/*     */     }
/*  62 */     nDeactivate(this._registerID);
/*     */   }
/*     */   
/*     */   public synchronized void Release()
/*     */     throws OLEInvalidObjectException
/*     */   {
/*  68 */     if (this._refs == 1)
/*     */     {
/*     */ 
/*  71 */       if (this._registerID != 0L)
/*     */       {
/*     */ 
/*     */ 
/*  75 */         if ((ActiveX.getDebugLevel() & 0x4) > 0) {
/*  76 */           System.out.println(this + 
/*  77 */             ": deactivating before Release");
/*     */         }
/*     */         try {
/*  80 */           deactivate();
/*     */ 
/*     */         }
/*     */         catch (IOException e)
/*     */         {
/*  85 */           System.out.println("DEBUG: " + this);
/*  86 */           e.printStackTrace(System.out);
/*  87 */           if (!$assertionsDisabled) throw new AssertionError();
/*     */         }
/*  89 */         this._registerID = 0L;
/*     */       }
/*     */     }
/*  92 */     super.Release();
/*     */   }
/*     */   
/*     */   public String internalData()
/*     */   {
/*  97 */     return "_registerID = " + this._registerID + ", " + super.internalData();
/*     */   }
/*     */   
/*     */   public String toString()
/*     */   {
/* 102 */     return "IClassFactory(" + internalData() + ")";
/*     */   }
/*     */   
/*     */   public void register(String friendlyName, String CLSID, String VerIndProgID, String ProgID)
/*     */   {
/*     */     try {
/* 108 */       RegKey root = RegKey.getRootKey(0);
/*     */       
/*     */ 
/*     */ 
/* 112 */       RegKey gammaKey = new RegKey(root, "world\\shell\\open\\command", 
/* 113 */         0);
/* 114 */       String gammaPath = gammaKey.getStringValue("");
/* 115 */       int argIndx = gammaPath.indexOf(" \"%1\"");
/* 116 */       gammaPath = gammaPath.substring(0, argIndx);
/*     */       
/*     */ 
/* 119 */       RegKey classKey = new RegKey(root, "CLSID\\" + CLSID, 
/* 120 */         2);
/* 121 */       classKey.setStringValue("", friendlyName, false);
/*     */       
/*     */ 
/* 124 */       RegKey subKey = new RegKey(classKey, "LocalServer32", 
/* 125 */         2);
/* 126 */       subKey.setStringValue("", gammaPath, false);
/* 127 */       subKey.close();
/*     */       
/*     */ 
/* 130 */       subKey = new RegKey(classKey, "ProgID", 2);
/* 131 */       subKey.setStringValue("", ProgID, false);
/* 132 */       subKey.close();
/*     */       
/*     */ 
/* 135 */       subKey = new RegKey(classKey, "VersionIndependentProgID", 
/* 136 */         2);
/* 137 */       subKey.setStringValue("", VerIndProgID, false);
/* 138 */       subKey.close();
/*     */       
/* 140 */       classKey.close();
/*     */       
/*     */ 
/*     */ 
/* 144 */       RegKey verIndKey = new RegKey(root, VerIndProgID, 
/* 145 */         2);
/* 146 */       verIndKey.setStringValue("", friendlyName, false);
/* 147 */       subKey = new RegKey(verIndKey, "CLSID", 2);
/* 148 */       subKey.setStringValue("", CLSID, false);
/* 149 */       subKey.close();
/* 150 */       subKey = new RegKey(verIndKey, "CurVer", 2);
/* 151 */       subKey.setStringValue("", ProgID, false);
/* 152 */       subKey.close();
/* 153 */       verIndKey.close();
/*     */       
/* 155 */       RegKey progKey = new RegKey(root, ProgID, 2);
/* 156 */       progKey.setStringValue("", friendlyName, false);
/* 157 */       subKey = new RegKey(progKey, "CLSID", 2);
/* 158 */       subKey.setStringValue("", CLSID, false);
/* 159 */       subKey.close();
/* 160 */       progKey.close();
/*     */     }
/*     */     catch (RegKeyNotFoundException e) {
/* 163 */       System.out.println("Warning: System Registry not configured properly by Worlds.");
/*     */     }
/*     */   }
/*     */   
/*     */   private native long nActivate(String paramString)
/*     */     throws IOException;
/*     */   
/*     */   private native void nDeactivate(long paramLong)
/*     */     throws IOException;
/*     */ }


/* Location:              C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\IClassFactory.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */