Bug 35583 - [OLE] Support for licensed COM
Summary: [OLE] Support for licensed COM
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact: Felipe Heidrich CLA
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2003-03-24 12:16 EST by Stephen Goldbaum CLA
Modified: 2017-08-03 12:31 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephen Goldbaum CLA 2003-03-24 12:16:28 EST
I'd like to request support for licensed COM controls (those that support
the IClassFactory2 interface) in SWT.  This would require adding a method 
to swtole.c that would take a license string and call 
IClassFactory2::CreateInstanceLic.  In addition, modifications would need 
to made to COM and OleClientSite to call the the licensed method instead of
CoCreateInstance when supplied with a license.

-Stephen
Comment 1 Veronika Irvine CLA 2003-03-25 13:45:44 EST
Support for licensed ActiveX controls is already in place (see 
OleControlSite).  What exactly do you mean?  COM is quite big.  We only 
support containers for ActiveX and Ole Documents.

We currently use OleCreate not CoCreateInstance for Ole Documents.  OleCreate 
does a large amount of work, much more than just calling CoCreateInstance.
Comment 2 Stephen Goldbaum CLA 2003-03-25 15:13:06 EST
I am attempting to pass in a license key from the Java side at runtime (the 
control is licensed by developer seat with unlimited deployment).  I looked 
through the OleControlSite and associated code.  I see a String member variable 
named licenseInfo that is never used.  So, it looks you need to override 
getLicenseInfo(GUID) in to allocate the memory for your license string and 
return its address for use by IClassFactory2.CreateInstanceLic.  Is this 
correct or is there a simpler approach?  It would be great if there were a 
constructor that took a license string that did this for you.
Comment 3 Veronika Irvine CLA 2003-03-25 17:35:47 EST
I am not sure what version of the code you are looking at, but there is no 
licenseInfo string member variable in Eclipse 2.1.
OleControlSite uses a BSTR which it extracts from the LICINFO struct obtained 
from the IClassFactory2 interface.

I think perhaps your control is not installed correctly.  It should have 
a .LIC file with all the licensing info contained in the file.  You should not 
be passing in a licensing string.

See:
http://msdn.microsoft.com/library/default.asp?
url=/workshop/components/activex/licensing.aspus/vccore/html/_core_activex_cont
rols.3a_.licensing_an_activex_control.asp
Comment 4 Stephen Goldbaum CLA 2003-03-26 13:15:12 EST
ActiveX licensing is a three step procedure.  The first two steps (involving 
IClassFactory2::GetLicInfo and IClassFactory2::RequestLicKey) occur only at 
development time.  On the developer's machine, license info can be stored 
either in a .LIC file or in the 
\\HKEY_LOCAL_MACHINE\\SOFTWARE\\Classes\\Licenses path of the registry.  Either 
way, these values are accessed by IClassFactory2::GetLicInfo and 
IClassFactory2::RequestLicKey from the IDE , which embeds the resulting key 
into the application.

At application runtime, the application calls IClassFactory2::CreateInstanceLic 
using the key that was embedded by the IDE.  The deployed application does not 
call IClassFactory2::GetLicInfo or IClassFactory2::RequestLicKey.  If it did, 
it would require that the developer's license be installed in the registry of 
the deployment machines, which most likely violates the licensing agreement.

Currently SWT performs all three steps at application runtime.  Thus, it mimics 
the IDE container in calling IClassFactory2::GetLicInfo or 
IClassFactory2::RequestLicKey.  As such , this only works on the machine with 
the developer's license.

A more appropriate approach to deploying a licensed ActiveX control with a SWT 
application would be to hardcode the license string into the application and 
return the address for that string from OleControlSite.getLicenseInfo (the 
license string can be pulled from the .LIC file or registry by the developer).  
Thus, the request for adding a contructor to take the license key as a 
parameter.
Comment 5 Stephen Goldbaum CLA 2003-03-26 14:57:34 EST
All that needs to be added is the following lines to OleControlSite:

  private char[] licInfo;
  public OleControlSite(Composite parent, int style, String progID, String key) 
  {
    this(parent, style, programID);

    if(key != null) {
      this.licInfo = key.toCharArray();
    }
  }
		
  protected int getLicenseInfo(GUID clsid) {
    if(this.licInfo != null) {
      int ptr = COM.SysAllocString(this.licInfo);
      if(ptr != 0) {
        return ptr;
      }
    }
			
    //... Do the rest of getLicenseInfo
  }


Since getLicenseInfo() is called by the constructor, OleControlSite can't be 
extended to do this.  Thanks for all of the COM utilities.  It really makes it 
easy.

-Stephen
Comment 6 Felipe Heidrich CLA 2009-08-12 12:12:17 EDT
Your bug has been moved to triage, visit http://www.eclipse.org/swt/triage.php for more info.
Comment 7 Leo Ufimtsev CLA 2017-08-03 12:31:51 EDT
This is a one-off bulk update. (The last one in the triage migration).

Moving bugs from swt-triaged@eclipse to platform-swt-inbox@eclipse.org and adding "triaged" keyword as per new triage process:
https://wiki.eclipse.org/SWT/Devel/Triage

See Bug 518478 for details.

Tag for notification/mail filters:
@TriageBulkUpdate