Class Ole32FFM


public final class Ole32FFM extends WindowsForeignFunctions
FFM bindings for OLE32.dll COM initialization and object creation functions.
  • Field Details

  • Method Details

    • CoInitializeEx

      public static OptionalInt CoInitializeEx(int coInit)
      Initializes the COM library for use by the calling thread.
      Parameters:
      coInit - the concurrency model and initialization options (COINIT_*)
      Returns:
      HRESULT: S_OK if successful, S_FALSE if already initialized, or error code
    • CoUninitialize

      public static void CoUninitialize()
      Closes the COM library on the current thread.
    • CoInitializeSecurity

      public static OptionalInt CoInitializeSecurity(int authnLevel, int impLevel, int capabilities)
      Registers security and sets the default security values for the process.
      Parameters:
      authnLevel - the default authentication level
      impLevel - the default impersonation level
      capabilities - additional capabilities (EOAC_*)
      Returns:
      HRESULT: S_OK if successful, RPC_E_TOO_LATE if already called, or error code
    • CoCreateInstance

      public static MemorySegment CoCreateInstance(Arena arena, MemorySegment clsid, int clsctx, MemorySegment iid)
      Creates a single uninitialized object of the class associated with a specified CLSID.
      Parameters:
      arena - the arena for memory allocation
      clsid - the CLSID of the object to create
      clsctx - the context in which the code that manages the object will run (CLSCTX_*)
      iid - the IID of the interface to obtain
      Returns:
      the interface pointer, or NULL if failed
    • CoSetProxyBlanket

      public static OptionalInt CoSetProxyBlanket(MemorySegment pProxy, int authnSvc, int authzSvc, int authnLevel, int impLevel, int capabilities)
      Sets the authentication information for a proxy.
      Parameters:
      pProxy - the proxy to set authentication on
      authnSvc - the authentication service (use -1 for default)
      authzSvc - the authorization service (use -1 for default)
      authnLevel - the authentication level
      impLevel - the impersonation level
      capabilities - additional capabilities
      Returns:
      HRESULT
    • succeeded

      public static boolean succeeded(int hr)
      Checks if an HRESULT indicates success (non-negative value).
      Parameters:
      hr - the HRESULT value
      Returns:
      true if successful
    • failed

      public static boolean failed(int hr)
      Checks if an HRESULT indicates failure (negative value).
      Parameters:
      hr - the HRESULT value
      Returns:
      true if failed