Exemplo n.º 1
0
  /* QueryInterface([in] riid, [out] ppvObject)
   * Ownership of ppvObject transfers from callee to caller so reference count on ppvObject
   * must be incremented before returning.  Caller is responsible for releasing ppvObject.
   */
  private int QueryInterface(long /*int*/ riid, long /*int*/ ppvObject) {
    if (riid == 0 || ppvObject == 0) return COM.E_INVALIDARG;
    GUID guid = new GUID();
    COM.MoveMemory(guid, riid, GUID.sizeof);

    if (COM.IsEqualGUID(guid, COM.IIDIUnknown) || COM.IsEqualGUID(guid, COM.IIDIDropSource)) {
      OS.MoveMemory(ppvObject, new long /*int*/[] {iDropSource.getAddress()}, OS.PTR_SIZEOF);
      AddRef();
      return COM.S_OK;
    }

    if (COM.IsEqualGUID(guid, COM.IIDIDataObject)) {
      OS.MoveMemory(ppvObject, new long /*int*/[] {iDataObject.getAddress()}, OS.PTR_SIZEOF);
      AddRef();
      return COM.S_OK;
    }

    OS.MoveMemory(ppvObject, new long /*int*/[] {0}, OS.PTR_SIZEOF);
    return COM.E_NOINTERFACE;
  }