Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 327560

Summary: Failed to create Citrix Client v12
Product: [Eclipse Project] Platform Reporter: Gilles Darondeau <gdarondeau>
Component: SWTAssignee: Silenio Quarti <Silenio_Quarti>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: eclipse.felipe, Silenio_Quarti
Version: 4.1Flags: eclipse.felipe: review+
Target Milestone: 3.6.2   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Citrix Inc sample
none
fix
none
swt plugin based on 3.6.x branch none

Description Gilles Darondeau CLA 2010-10-12 10:23:59 EDT
Build Identifier: eclipse SDK 3.4

SWT crashes when creating an OLE object of the Citrix client v12.
Yet the same code works with previous version of the Citrix client.
I also tried to create this OLE object with Microsoft C++ and it works.
This defect is probably 50% on the Citrix side but I'd appreciate if an expert could have a look.
Rather to get a fix I would be satisfied if you could give me a workaround.


Reproducible: Always

Steps to Reproduce:
1. download Citrix online plugin at: http://www.citrix.com/English/ss/downloads/details.asp?downloadId=2301299&productId=186&c1=sot2755
2.install the client
3.try this
	public static void main(String[] args) {
		try {
			Shell ret = new Shell(new Display(), SWT.SHELL_TRIM);
			ret.setVisible(true);
			ret.setLayout(new GridLayout(1, true));

			OleFrame frame = new OleFrame(ret, SWT.NO_BACKGROUND);
			OleControlSite controlSite = new OleControlSite(
					frame,
					SWT.NO_MERGE_PAINTS,
			"{238F6F83-B8B4-11CF-8771-00A024541EE3}");

			Thread.sleep(5000);

		} catch (Exception e) {
			System.out.println(e.getMessage());
		}
	}
Comment 1 Gilles Darondeau CLA 2010-10-18 08:17:01 EDT
Becomming urgent...

This code is better but doesn't change the problem
	public static void main(String[] args) {
		try {
		    final Display display = new Display();
		    Shell shell = new Shell(display);
		    shell.setSize(600, 400);
		    shell.setLayout(new FillLayout());

		    OleFrame oleFrame = new OleFrame(shell, SWT.NONE);
		    OleControlSite oleControlSite = new OleControlSite(
		    		oleFrame,
					SWT.NO_MERGE_PAINTS,
					"{238F6F83-B8B4-11CF-8771-00A024541EE3}");
		    
		    oleControlSite.doVerb(OLE.OLEIVERB_INPLACEACTIVATE);
		    shell.open();

		    while (!shell.isDisposed()) {
		      if (!display.readAndDispatch())
		        display.sleep();
		    }
		    display.dispose();

		} catch (Exception e) {
			System.out.println(e.getMessage());
		}
	}
Comment 2 Silenio Quarti CLA 2010-10-21 11:39:41 EDT
It looks like a bug on the Citrix client, but we should investigate to see if it is possible to workaround it.  The problem is that we do not have access to a Citrix server. Is there a machine we can use?

Also, please attach the crash log.
Comment 3 Gilles Darondeau CLA 2010-10-21 11:55:27 EDT
I agree, it's probably a Citrix client bug but I imagine that a workaround is possible because the creation of this ole object works with a C++ sample.

I tried to debug a little and I have been able to see that the failure comes from the OleControlSite constructor (line #140). The value returned by COM.OleCreate is not equal to COM.S_OK.

The result is that an exception is caught on the oleControlSite = new OleControlSite() call.

You should be able to reproduce without an access to a Citrix server.

Thanks,
Gilles
Comment 4 Gilles Darondeau CLA 2010-11-04 10:24:40 EDT
Hi,
did you have any chance to progress on this?
Regards,
Gilles
Comment 5 Felipe Heidrich CLA 2010-11-04 11:10:56 EDT
silenio, did you ever get the chance to install the client ?
Comment 6 Silenio Quarti CLA 2010-11-04 11:23:54 EDT
(In reply to comment #5)
> silenio, did you ever get the chance to install the client ?

No.

Gilles, the link for the download is broken. Please could you update it?
Comment 7 Gilles Darondeau CLA 2010-11-04 11:29:26 EDT
Here is the link
http://www.citrix.com/English/ss/downloads/results.asp?productID=186&c1=sot2755
and then please download online plugin 12.1
Comment 8 Silenio Quarti CLA 2010-11-04 12:01:27 EDT
I downloaded the client and reproduced the problem. OleCreate() is returning 1 instead of S_OK. I am not sure what 1 means. GetLastError() has no further info.

Gilles, could you attach your C++ sample?
Comment 9 Gilles Darondeau CLA 2010-11-05 09:55:39 EDT
Created attachment 182471 [details]
Citrix Inc sample

attached...
Comment 10 Felipe Heidrich CLA 2010-11-05 10:54:47 EDT
(In reply to comment #9)
> Created an attachment (id=182471) [details]
> Citrix Inc sample
> attached...

I was search your sample looking for OleCreate and I found no hits.
I scan over the code quickly I didn't find where the ole object was being created. Can you please point to us which file and method the Citrix client ole object is created in ? Thank you.
Comment 11 Gilles Darondeau CLA 2010-11-05 12:35:05 EDT
This sample is done thanks to the visual C++ UI builder, so calls like OleCreate() are not directly visible. But I think that you could find it if you compile and run the sample.
I am re-installing visual C++ and when I have more information I let you know.
Thanks,
Gilles
Comment 12 Gilles Darondeau CLA 2010-11-10 08:00:59 EST
I built the sample Citrix project and I checked that it runs with the client v12. Then I generate an output of the preprocessed C++ code but I didn't see a call to oleCreate(). It seems that visual C++ uses another way to load the activX.

When I set breakpoints in OleControlSite class I can notice that there are more callbacks with client v12 than with older client.
Did you notice the same behaviour ?

Regards,
Gilles
Comment 13 Felipe Heidrich CLA 2010-11-10 10:01:27 EST
(In reply to comment #12)

> When I set breakpoints in OleControlSite class I can notice that there are more
> callbacks with client v12 than with older client.
> Did you notice the same behaviour ?

No I did not. What callbacks did you see ?
Comment 14 Gilles Darondeau CLA 2010-11-10 10:30:04 EST
(In reply to comment #13)
> (In reply to comment #12)
> > When I set breakpoints in OleControlSite class I can notice that there are more
> > callbacks with client v12 than with older client.
> > Did you notice the same behaviour ?
> No I did not. What callbacks did you see ?


I was refering to the call sequence of COMObject.callback?()
(where ? means '1' to '9')
You should be able to notice that a couple of calls more with client v12.
But unfortunately I ignore if it's a useful indication.
Comment 15 Silenio Quarti CLA 2010-11-10 11:24:22 EST
Created attachment 182833 [details]
fix

Please try this patch out. Some how ICA Client 2.7 is failing when the OleClientSite object is passed to OleCreate().  This workaround stops passing a client site to OleCreate() for all versions of ICAClient.  We need to see if it does not break older versions of the client.
Comment 16 Gilles Darondeau CLA 2010-11-15 12:22:40 EST
I have been able to create an Ole Citrix client object with the patch for both a v12 and v11.
I am going to test more to see how the patch behaves.
This is an encouraging result but I wonder if there is a way to get this workaround without a swt .jar update.
Comment 17 Gilles Darondeau CLA 2010-11-19 10:55:54 EST
I seeked a way to integrate the fix in my code but like the exception is raised in the class constructor there is no workaround. I also tried to write my own version of the OleControlSite class in copying the original code but some calls refer to "package" method.
So I think that the only solution is to make the fix in the SWT jar.
I would like to test it from my product and with different version of the Citrix client. Could you please provide me a SWT jar file which would contain the fix ?

Regards,
Gilles
Comment 18 Silenio Quarti CLA 2010-11-19 11:46:47 EST
Sure. Do want it based on which SWT version? HEAD?
Comment 19 Gilles Darondeau CLA 2010-11-19 11:58:57 EST
I am using a 3.6.0.
Thanks
Comment 20 Silenio Quarti CLA 2010-11-19 12:28:15 EST
Created attachment 183487 [details]
swt plugin based on 3.6.x branch

Here is the SWT plugin based on the 3.6.x branch. Note that I added a println to the patch to make sure the fix is running. If the fix is running you should see "BUG327560 isICAClient" in the console.
Comment 21 Gilles Darondeau CLA 2010-11-24 09:20:14 EST
Well done!
I ran a complete suite of tests with several versions of the Citrix client (9.2, 10.2, 12.1).
The patch fixes the bug for the version 12.1 and contains no regressions.
I wondered about adding a statement for a specific component but I saw that it has already been necessary for some others dll. So if this fix suits you it's fine by me as well.
Could you please add the fix in both 3.6 branch and HEAD ?

Thanks a lot,
Gilles
Comment 22 Silenio Quarti CLA 2010-11-25 10:11:46 EST
Felipe, please review for 3.6.2
Comment 23 Silenio Quarti CLA 2010-11-25 11:16:16 EST
Fixed in R3_6_maintenance and HEAD.