summaryrefslogtreecommitdiff
path: root/NET/worlds/console/IUnknown.java
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-02-12 22:33:32 -0800
committerFuwn <[email protected]>2026-02-12 22:33:32 -0800
commitc7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9 (patch)
treedf9f48bf128a6c0186a8e91857d6ff30fe0e9f18 /NET/worlds/console/IUnknown.java
downloadworldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.tar.xz
worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.zip
Initial commit
Diffstat (limited to 'NET/worlds/console/IUnknown.java')
-rw-r--r--NET/worlds/console/IUnknown.java166
1 files changed, 166 insertions, 0 deletions
diff --git a/NET/worlds/console/IUnknown.java b/NET/worlds/console/IUnknown.java
new file mode 100644
index 0000000..3a80b20
--- /dev/null
+++ b/NET/worlds/console/IUnknown.java
@@ -0,0 +1,166 @@
+package NET.worlds.console;
+
+import java.io.IOException;
+
+public class IUnknown {
+ protected int _pInterface = 0;
+ protected int _refs = 0;
+ private static final String IID_IUnknown = "{00000000-0000-0000-c000-000000000046}";
+
+ public IUnknown() throws IOException {
+ }
+
+ protected synchronized void init(int pInterface) throws IOException {
+ assert pInterface != 0;
+
+ ActiveX.init(this);
+ this._pInterface = pInterface;
+ this._refs = 1;
+ }
+
+ public IUnknown(String svrID) throws IOException {
+ if ((ActiveX.getDebugLevel() & 2) > 0) {
+ System.out.println(this + ": constructor: svrID = " + svrID);
+ }
+
+ ActiveX.init(this);
+
+ try {
+ try {
+ this._pInterface = ActiveX.getClassFClsID(svrID, "{00000000-0000-0000-c000-000000000046}");
+ this._refs++;
+ } catch (IOException var3) {
+ this._pInterface = ActiveX.getClassFProgID(svrID, "{00000000-0000-0000-c000-000000000046}");
+ this._refs++;
+ }
+ } catch (IOException var4) {
+ ActiveX.uninit(this);
+ throw var4;
+ }
+
+ if ((ActiveX.getDebugLevel() & 2) > 0) {
+ System.out.println("IUnknown: constructed " + this);
+ }
+ }
+
+ public IUnknown(String svrID, String intfID) throws IOException {
+ if ((ActiveX.getDebugLevel() & 2) > 0) {
+ System.out.println(this + ": constructor: svrID = " + svrID + ", intfID = " + intfID);
+ }
+
+ this.init(svrID, intfID);
+ if ((ActiveX.getDebugLevel() & 2) > 0) {
+ System.out.println("IUnknown: constructed " + this);
+ }
+ }
+
+ protected synchronized void init(String svrID, String intfID) throws IOException {
+ ActiveX.init(this);
+
+ try {
+ try {
+ this._pInterface = ActiveX.getClassFClsID(svrID, intfID);
+ this._refs++;
+ } catch (IOException var4) {
+ this._pInterface = ActiveX.getClassFProgID(svrID, intfID);
+ this._refs++;
+ }
+ } catch (IOException var5) {
+ ActiveX.uninit(this);
+ throw var5;
+ }
+ }
+
+ public IUnknown(IUnknown parent, String intfID) throws IOException, OLEInvalidObjectException {
+ if ((ActiveX.getDebugLevel() & 2) > 0) {
+ System.out.println(this + ": constructor: parent = " + parent + ", intfID = " + intfID);
+ }
+
+ this.init(parent, intfID);
+ if ((ActiveX.getDebugLevel() & 2) > 0) {
+ System.out.println("IUnknown: constructed " + this);
+ }
+ }
+
+ protected synchronized void init(IUnknown parent, String intfID) throws IOException, OLEInvalidObjectException {
+ assert parent != null;
+
+ ActiveX.init(this);
+
+ try {
+ this._pInterface = parent.QueryInterface(intfID);
+ this._refs = 1;
+ } catch (IOException var4) {
+ ActiveX.uninit(this);
+ throw var4;
+ } catch (OLEInvalidObjectException var5) {
+ ActiveX.uninit(this);
+ throw var5;
+ }
+ }
+
+ public synchronized void Release() throws OLEInvalidObjectException {
+ if ((ActiveX.getDebugLevel() & 4) > 0) {
+ System.out.println(this + ": Releasing");
+ }
+
+ if (this._pInterface == 0) {
+ throw new OLEInvalidObjectException();
+ } else {
+ if (this._pInterface != 0 && this._refs > 0) {
+ this.true_Release();
+ }
+
+ this._refs--;
+ if (this._refs == 0) {
+ this._pInterface = 0;
+ ActiveX.uninit(this);
+ }
+ }
+ }
+
+ @Override
+ public void finalize() {
+ if (this._pInterface != 0) {
+ while (this._refs > 0) {
+ try {
+ this.Release();
+ } catch (OLEInvalidObjectException var2) {
+ System.out.println("DEBUG: " + this);
+
+ assert false;
+ }
+ }
+ }
+ }
+
+ public synchronized void AddRef() throws OLEInvalidObjectException {
+ if ((ActiveX.getDebugLevel() & 4) > 0) {
+ System.out.println(this + ": AddingRef");
+ }
+
+ if (this._pInterface == 0) {
+ throw new OLEInvalidObjectException();
+ } else {
+ this._refs++;
+ this.true_AddRef();
+ }
+ }
+
+ public native void true_AddRef();
+
+ public native int QueryInterface(String var1) throws IOException, OLEInvalidObjectException;
+
+ public native void true_Release() throws OLEInvalidObjectException;
+
+ protected native int getPtr() throws OLEInvalidObjectException;
+
+ public String internalData() {
+ return "_pInterface=" + this._pInterface + ", _refs=" + this._refs;
+ }
+
+ @Override
+ public String toString() {
+ return "IUnknown(" + this.internalData() + ")";
+ }
+}