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

Bug 344591

Summary: potential crash in Printer
Product: [Eclipse Project] Platform Reporter: Grant Gayed <grant_gayed>
Component: SWTAssignee: Carolyn MacLeod <carolynmacleod4>
Status: RESOLVED FIXED QA Contact: Carolyn MacLeod <carolynmacleod4>
Severity: normal    
Priority: P3 CC: gheorghe, mc5686, pwebster, Silenio_Quarti
Version: 3.7Flags: Silenio_Quarti: review+
Target Milestone: 3.7 RC1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
patch
none
Error description none

Description Grant Gayed CLA 2011-05-03 10:52:20 EDT
A post on the Eclipse forum ( http://www.eclipse.org/forums/index.php?t=msg&th=208526 ) got me looking at Printer.create() on Windows.  It appears that a crash can occur at line:

OS.MoveMemory(devmode, lpInitData, DEVMODE.sizeof);

because lpInitData can validly be 0 when this line is executed.  I suspect that this is the problem being seen in the forum post.  What should be happening in this case?
Comment 1 Carolyn MacLeod CLA 2011-05-03 12:05:44 EDT
In order for lpInitData to be 0 when the MoveMemory occurs, either HeapAlloc has to fail (by which time, we are running out of memory) or the call to PrintDlg with PD_RETURNDEFAULT set did not set hDevMode for some reason: either there is no default printer, or maybe the code to find a default printer failed somehow.

Looking at our code to find the default printer, I see that it is ancient. It is still using GetProfileString, which originally worked by looking in the win.ini file for the default printer. This code still worked all these years because newer versions of GetProfileString mapped registry keys to the old win.ini format. However there is newer Windows API (GetDefaultPrinter) that we should be using (we can still use GetProfileString for pre-2000 versions of the OS).

In the case of the Eclipse Forum post, I can't tell if the user does not have a default printer, or if there is somehow an old bogus win.ini file present, or if the registry is somehow messed up for the default printer, or if maybe the newest version of Windows does not honor the old mapping from registry keys to win.ini. I suspect the latter case is most likely.

I will create a patch that uses GetDefaultPrinter to find the default printer, but it would be nice to know how the developer on the Forum post created his/her Printer, i.e. was it using new Printer() or maybe new Printer(printerData)? If it was done using printerData, then how was that created?
Comment 2 Mauro Condarelli CLA 2011-05-05 08:22:13 EDT
(In reply to comment #1)
> I will create a patch that uses GetDefaultPrinter to find the default printer,
> but it would be nice to know how the developer on the Forum post created
> his/her Printer, i.e. was it using new Printer() or maybe new
> Printer(printerData)? If it was done using printerData, then how was that
> created?

Hi,
I'm the original poster.
The single statement causing the crash is:

  printer = new Printer();

The system, if it matters, is a fairly up-to-date Windows Seven computer.
I had a previous version of the program not hanging (so I suppose this the OS is not the culprit).
Changes between two version were several, but two stand to attention:

1) I added an SWT_AWT panel to show a preview of what I was about to print.
2) I detached my PC from my home net, so the Default Printer is not reachable.

I am currently out for a job trip, but I am willing to do some testing during next weekend. Please advise about what would be useful.

I have *NO* problems sending over my whole project, if deemed useful. Just ask.
It uses pdf-renderer to render the page (via PagePanel). I don't know if this may be relevant.

Regards
Mauro
Comment 3 Carolyn MacLeod CLA 2011-05-05 11:36:56 EDT
Hi, Mauro - thanks for the reply - it is useful.
So the problem is # 2) that your default printer is not reachable.
Since you are using the Printer() constructor, which constructs a new printer representing the default printer, there should be some kind of failure.

My bug is that I am crashing in this situation - I will fix that.
I should throw ERROR_NO_HANDLES instead.

I see that the javadoc for ERROR_NO_HANDLES is wrong - it should say:
"ERROR_NO_HANDLES - if there is no default printer or the default printer is not available".

I will let you know when these changes are in HEAD.
Comment 4 Carolyn MacLeod CLA 2011-05-05 13:36:55 EDT
Created attachment 194856 [details]
patch

This patch protects the line of code that (I believe) is crashing. I tried replicating the crash by unplugging my network cable, however my printing system recovers gracefully and does not crash. I also tried using a Win 7 machine that had no printers installed, however it still has a "default printer" which is to print to PDF. I don't want to delete the PDF, fax, and XPS subsystems that come with the OS, so I am stuck not being able to test this fix. However, I am pretty sure that this will fix it for you. If possible, could you please test it using tomorrow's Integration build?
Comment 5 Carolyn MacLeod CLA 2011-05-05 13:41:46 EDT
SSQ, please review patch and +1 for tomorrow's I-build.
I now throw an error if the OS.PrintDlg call returns 0,
and I changed the Printer() constructor javadoc to say:
"ERROR_NO_HANDLES - if there is no valid default printer"
because that seems to describe the case that is failing.
Comment 6 Carolyn MacLeod CLA 2011-05-05 14:17:04 EDT
Fixed > 20110505 in HEAD.

BG, please confirm when swt is tagged for the I20110506 build, so that Mauro knows that the fix is in and can be tested when the build is ready. Thanks!
Comment 7 Mauro Condarelli CLA 2011-05-06 03:55:36 EDT
(In reply to comment #6)
> Fixed > 20110505 in HEAD.
> 
> BG, please confirm when swt is tagged for the I20110506 build, so that Mauro
> knows that the fix is in and can be tested when the build is ready. Thanks!

Thanks.
I can confirm my program (unchanged) works when connected back to my home network where it can see my default printer.

In either case (connected or unconnected) the following snippets works:

   private Combo              cmbPrinter;


      PrinterData[] printerlist = Printer.getPrinterList();
      if (printerlist.length > 0) {
         PrinterData defPrinter = Printer.getDefaultPrinterData();
         for (PrinterData pd : printerlist) {
            String name = pd.name;
            cmbPrinter.add(name);
            cmbPrinter.setData(name, pd);
            if (name.equals(defPrinter.name))
               cmbPrinter.select(cmbPrinter.getItemCount() - 1);
         }
      }

The combo always points to my default net printer, regardless of availability.
Is there some way I can (nondestructively!) test for availability of a specific printer.
This way I could remove unavailable printers from the list and rewire the default printer to an available one. This would be useful regardless of the crash, of course.

Any hint when and how this fix will be available to the public (me)?
Will I have to wait till Indigo?

Thanks a lot
Mauro
Comment 8 Bogdan Gheorghe CLA 2011-05-06 11:19:37 EDT
We are all tagged and ready to go. Next I build is at noon.
Comment 9 Carolyn MacLeod CLA 2011-05-06 11:28:24 EDT
> Any hint when and how this fix will be available to the public (me)?
> Will I have to wait till Indigo?

You don't have to wait for this fix. It will be available later today.
Today's Eclipse build starts at noon (EST). They usually take about 3 hours.

When the build is ready, you will be able to get it as follows:
- go to this page: http://download.eclipse.org/eclipse/downloads/
- click on the link to the right of: "3.7 Stream Integration Build"
  (most likely the link will look like this: "I20110506-1200" or similar)
- click on the download link to the right of your platform (Windows)
Comment 10 Carolyn MacLeod CLA 2011-05-06 11:56:21 EDT
> Is there some way I can (nondestructively!) test for availability
> of a specific printer.

Yes. When you get the new code, you should be able to catch ERROR_NO_HANDLES and then use another printer from the list using new Printer(printerData) or remove the error printer from the list - similar to the code you have in comment 7.

> rewire the default printer to an available one.

We don't have API to set the default printer (only to get it). If you like, you can open a feature request to have that API added (but note that we are past API freeze for 3.7). I don't think you need it, though.

Note that if you use the PrintDialog, then your users can set the default printer in the dialog (right-click on printer to get context menu, then set as default).
Comment 11 Carolyn MacLeod CLA 2011-05-19 11:22:36 EDT
Mauro, did you get a chance to try this? The fix is in all current builds, including 3.7RC1, which you can download from here: http://download.eclipse.org/eclipse/downloads/
We are very close to shipping Eclipse 3.7, and it would be nice to know if this works before we ship.
Comment 12 Mauro Condarelli CLA 2011-05-19 17:40:08 EDT
Created attachment 196173 [details]
Error description
Comment 13 Mauro Condarelli CLA 2011-05-19 17:54:42 EDT
Sorry.
No good.

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x1919de5a, pid=6072, tid=4232
#
# JRE version: 6.0_24-b07
# Java VM: Java HotSpot(TM) Client VM (19.1-b02 mixed mode windows-x86 )
# Problematic frame:
# C  [swt-win32-3659.dll+0x2de5a]
#
# An error report file with more information is saved as:
# C:\Users\Mauro\Documents\WriterWS\pdfprint\hs_err_pid6072.log
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

I attach the whole hs_err_pid6072.log

I just now downloaded Version: 3.7.0 Build id: I20110512-2000 (RC1-amd64) and the latest Sun JDK (6.25).

I can confirm it crashes only if printers are not reachable;
They are all net printers and I am connected to the "wrong" net.

The "culprit" routine is:

   public void getPrinters() {
      PrinterData[] printerlist = Printer.getPrinterList();
      if (printerlist.length > 0) {
         PrinterData defPrinter = Printer.getDefaultPrinterData();
         for (PrinterData pd : printerlist) {
            try {
               Printer p = new Printer(pd);   <<-- it crashes HERE
               String name = pd.name;
               cmbPrinter.add(name);
               cmbPrinter.setData(name, pd);
               if (name.equals(defPrinter.name)) {
                  cmbPrinter.select(cmbPrinter.getItemCount() - 1);
                  printer = p;
               }
            } catch (SWTError e) {
               if (e.code != SWT.ERROR_NO_HANDLES)
                  throw e; // something went really wrong
            }
         }
      }
      if (cmbPrinter.getItemCount() > 0) {
         if (printer == null) {
            PrinterData pd = (PrinterData) cmbPrinter.getData(cmbPrinter.getItem(0));
            try {
               printer = new Printer(pd);
            } catch (SWTError e) {
               printer = null;
               cmbPrinter.setEnabled(false);
               if (!e.equals(SWT.ERROR_NO_HANDLES))
                  throw e; // something went really wrong
            }
         }
      } else {
         printer = null;
         cmbPrinter.setEnabled(false);
      }
   }

If useful I can post my whole project.

Regards
Mauro
Comment 14 Grant Gayed CLA 2011-05-20 10:01:02 EDT
Library swt-win32-3659 indicates that you're using 3.6.2, which does not have the fix.  Please try with the latest 3.7RC2 build from http://download.eclipse.org/eclipse/downloads/drops/I20110519-1138/index.php .
Comment 15 Grant Gayed CLA 2011-05-20 10:05:25 EDT
To follow up, I see that you say you've already downloaded 3.7RC1, which should have the fix.  However the trace you attached is definitely using swt 3.6.2, not 3.7.  Did you attach an old trace?  Or are you somehow still pointing at swt 3.6.2 from your 3.7RC1 environment?
Comment 16 Mauro Condarelli CLA 2011-05-20 11:50:48 EDT
(In reply to comment #15)
> To follow up, I see that you say you've already downloaded 3.7RC1, which should
> have the fix.  However the trace you attached is definitely using swt 3.6.2,
> not 3.7.  Did you attach an old trace?  Or are you somehow still pointing at
> swt 3.6.2 from your 3.7RC1 environment?

I don't really know.

I downloaded the new 3.7.RC1
I unpacked it to a different location.
I downloaded latest Sun Java RTK (previous one was 32-bit)
I launched the new Indigo (I am sure I lauched that because I saw "Indigo" and the string "Version: 3.7.0 Build id: I20110512-2000" was taken from "Help->About Eclipse SDK").
I pointed to my *old* workspace
I waited patiently for eclipse to recompile all my workspace (without changing anything).
I started my App and it crashed (not the trace I sent You).
I restarted my app in debug mode, stopped just before the "Printer p = new Printer(pd);" line.
I did a "step" and the program happily crashed after several seconds producing the trace I sent.

I did nothing else. Did I forget something?
I repeated right now *after* erasing the runtime directories with identical results:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x191dde5a, pid=5528, tid=2692
#
# JRE version: 6.0_24-b07
# Java VM: Java HotSpot(TM) Client VM (19.1-b02 mixed mode windows-x86 )
# Problematic frame:
# C  [swt-win32-3659.dll+0x2de5a]
#
# An error report file with more information is saved as:
# C:\Users\Mauro\Documents\WriterWS\pdfprint\hs_err_pid5528.log
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

Unfortunately I will not be available anymore till monday morning.
Please tell me if I need to do something else.

Here follows the contents of C:\Users\Mauro\Documents\WriterWS\pdfprint\hs_err_pid5528.log:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x191dde5a, pid=5528, tid=2692
#
# JRE version: 6.0_24-b07
# Java VM: Java HotSpot(TM) Client VM (19.1-b02 mixed mode windows-x86 )
# Problematic frame:
# C  [swt-win32-3659.dll+0x2de5a]
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

---------------  T H R E A D  ---------------

Current thread (0x01be9800):  JavaThread "main" [_thread_in_native, id=2692, stack(0x003b0000,0x00400000)]

siginfo: ExceptionCode=0xc0000005, reading address 0x00000000

Registers:
EAX=0x000000dc, EBX=0x01be9918, ECX=0x00000037, EDX=0x00000000
ESP=0x003ffa00, EBP=0x003ffa08, ESI=0x00000000, EDI=0x003ffa28
EIP=0x191dde5a, EFLAGS=0x00010212

Register to memory mapping:

EAX=0x000000dc
0x000000dc is pointing to unknown location

EBX=0x01be9918
0x01be9918 is pointing to unknown location

ECX=0x00000037
0x00000037 is pointing to unknown location

EDX=0x00000000
0x00000000 is pointing to unknown location

ESP=0x003ffa00
0x003ffa00 is pointing into the stack for thread: 0x01be9800
"main" prio=6 tid=0x01be9800 nid=0xa84 runnable [0x003ff000]
   java.lang.Thread.State: RUNNABLE

EBP=0x003ffa08
0x003ffa08 is pointing into the stack for thread: 0x01be9800
"main" prio=6 tid=0x01be9800 nid=0xa84 runnable [0x003ff000]
   java.lang.Thread.State: RUNNABLE

ESI=0x00000000
0x00000000 is pointing to unknown location

EDI=0x003ffa28
0x003ffa28 is pointing into the stack for thread: 0x01be9800
"main" prio=6 tid=0x01be9800 nid=0xa84 runnable [0x003ff000]
   java.lang.Thread.State: RUNNABLE


Top of Stack: (sp=0x003ffa00)
0x003ffa00:   003ffb68 003ffa28 003ffb08 191ba8d7
0x003ffa10:   003ffa28 00000000 000000dc 01be9800
0x003ffa20:   148ed430 148ed430 00000063 00000100
0x003ffa30:   6d874b00 0000000b 00000050 775cf9c9
0x003ffa40:   7651014d 00000078 00000000 003ffa64
0x003ffa50:   6d9d46f2 00000078 6d7f2a4e 00000000
0x003ffa60:   01be1000 003ffa78 6d7f2c68 18f78e70
0x003ffa70:   01be9bc8 00000000 003ffaac 6d7f2ce8 

Instructions: (pc=0x191dde5a)
0x191dde4a:   00 00 00 75 15 c1 e9 02 83 e2 03 83 f9 08 72 2a
0x191dde5a:   f3 a5 ff 24 95 74 df 1d 19 90 8b c7 ba 03 00 00 


Stack: [0x003b0000,0x00400000],  sp=0x003ffa00,  free space=318k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [swt-win32-3659.dll+0x2de5a]
C  [swt-win32-3659.dll+0xa8d7]
j  org.eclipse.swt.internal.win32.OS.MoveMemory(Lorg/eclipse/swt/internal/win32/DEVMODEW;II)V+0
j  org.eclipse.swt.internal.win32.OS.MoveMemory(Lorg/eclipse/swt/internal/win32/DEVMODE;II)V+12
j  org.eclipse.swt.printing.Printer.create(Lorg/eclipse/swt/graphics/DeviceData;)V+239
j  org.eclipse.swt.graphics.Device.<init>(Lorg/eclipse/swt/graphics/DeviceData;)V+125
j  org.eclipse.swt.printing.Printer.<init>(Lorg/eclipse/swt/printing/PrinterData;)V+5
j  it.condarelli.pdfprint.PDFPrint.getPrinters()V+37
j  it.condarelli.pdfprint.PDFPrint.open([Ljava/lang/String;)V+9
j  it.condarelli.pdfprint.PDFPrint.main([Ljava/lang/String;)V+10
v  ~StubRoutines::call_stub
V  [jvm.dll+0xf0ab9]
V  [jvm.dll+0x1837d1]
V  [jvm.dll+0xf0b3d]
V  [jvm.dll+0xfa0d6]
V  [jvm.dll+0x101cde]
C  [javaw.exe+0x2155]
C  [javaw.exe+0x8614]
C  [kernel32.dll+0x133ca]
C  [ntdll.dll+0x39ed2]
C  [ntdll.dll+0x39ea5]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.eclipse.swt.internal.win32.OS.MoveMemory(Lorg/eclipse/swt/internal/win32/DEVMODEW;II)V+0
j  org.eclipse.swt.internal.win32.OS.MoveMemory(Lorg/eclipse/swt/internal/win32/DEVMODE;II)V+12
j  org.eclipse.swt.printing.Printer.create(Lorg/eclipse/swt/graphics/DeviceData;)V+239
j  org.eclipse.swt.graphics.Device.<init>(Lorg/eclipse/swt/graphics/DeviceData;)V+125
j  org.eclipse.swt.printing.Printer.<init>(Lorg/eclipse/swt/printing/PrinterData;)V+5
j  it.condarelli.pdfprint.PDFPrint.getPrinters()V+37
j  it.condarelli.pdfprint.PDFPrint.open([Ljava/lang/String;)V+9
j  it.condarelli.pdfprint.PDFPrint.main([Ljava/lang/String;)V+10
v  ~StubRoutines::call_stub

---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )
  0x18fff400 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=5048, stack(0x1aaa0000,0x1aaf0000)]
  0x18fd4400 JavaThread "AWT-Windows" daemon [_thread_in_native, id=1684, stack(0x1aa10000,0x1aa60000)]
  0x18fd3c00 JavaThread "AWT-Shutdown" [_thread_blocked, id=2144, stack(0x1a9c0000,0x1aa10000)]
  0x18fd3800 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=3376, stack(0x19320000,0x19370000)]
  0x024d1800 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=1796, stack(0x18ed0000,0x18f20000)]
  0x024bf400 JavaThread "CompilerThread0" daemon [_thread_blocked, id=4196, stack(0x18e00000,0x18e50000)]
  0x024ac000 JavaThread "JDWP Command Reader" daemon [_thread_in_native, id=2764, stack(0x18d20000,0x18d70000)]
  0x024ab000 JavaThread "JDWP Event Helper Thread" daemon [_thread_blocked, id=2696, stack(0x18c50000,0x18ca0000)]
  0x024a8800 JavaThread "JDWP Transport Listener: dt_socket" daemon [_thread_blocked, id=4852, stack(0x18a20000,0x18a70000)]
  0x0249cc00 JavaThread "Attach Listener" daemon [_thread_blocked, id=4596, stack(0x188a0000,0x188f0000)]
  0x02499800 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=5584, stack(0x18810000,0x18860000)]
  0x02470000 JavaThread "Finalizer" daemon [_thread_blocked, id=4116, stack(0x18780000,0x187d0000)]
  0x0246b400 JavaThread "Reference Handler" daemon [_thread_blocked, id=4264, stack(0x186f0000,0x18740000)]
=>0x01be9800 JavaThread "main" [_thread_in_native, id=2692, stack(0x003b0000,0x00400000)]

Other Threads:
  0x02467400 VMThread [stack: 0x18660000,0x186b0000] [id=600]
  0x18f28c00 WatcherThread [stack: 0x19160000,0x191b0000] [id=1776]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap
 def new generation   total 4928K, used 3961K [0x044e0000, 0x04a30000, 0x09a30000)
  eden space 4416K,  87% used [0x044e0000, 0x048a14d8, 0x04930000)
  from space 512K,  22% used [0x04930000, 0x0494cf40, 0x049b0000)
  to   space 512K,   0% used [0x049b0000, 0x049b0000, 0x04a30000)
 tenured generation   total 10944K, used 796K [0x09a30000, 0x0a4e0000, 0x144e0000)
   the space 10944K,   7% used [0x09a30000, 0x09af7118, 0x09af7200, 0x0a4e0000)
 compacting perm gen  total 12288K, used 7794K [0x144e0000, 0x150e0000, 0x184e0000)
   the space 12288K,  63% used [0x144e0000, 0x14c7c838, 0x14c7ca00, 0x150e0000)
No shared spaces configured.

Dynamic libraries:
0x00400000 - 0x00424000 	C:\Program Files (x86)\Java\jre6\bin\javaw.exe
0x775b0000 - 0x77730000 	C:\Windows\SysWOW64\ntdll.dll
0x755c0000 - 0x756d0000 	C:\Windows\syswow64\kernel32.dll
0x76500000 - 0x76546000 	C:\Windows\syswow64\KERNELBASE.dll
0x76550000 - 0x765f0000 	C:\Windows\syswow64\ADVAPI32.dll
0x75040000 - 0x750ec000 	C:\Windows\syswow64\msvcrt.dll
0x751a0000 - 0x751b9000 	C:\Windows\SysWOW64\sechost.dll
0x74f50000 - 0x75040000 	C:\Windows\syswow64\RPCRT4.dll
0x74ca0000 - 0x74d00000 	C:\Windows\syswow64\SspiCli.dll
0x74c90000 - 0x74c9c000 	C:\Windows\syswow64\CRYPTBASE.dll
0x75440000 - 0x75540000 	C:\Windows\syswow64\USER32.dll
0x75250000 - 0x752e0000 	C:\Windows\syswow64\GDI32.dll
0x764e0000 - 0x764ea000 	C:\Windows\syswow64\LPK.dll
0x750f0000 - 0x7518d000 	C:\Windows\syswow64\USP10.dll
0x765f0000 - 0x76650000 	C:\Windows\system32\IMM32.DLL
0x767f0000 - 0x768bc000 	C:\Windows\syswow64\MSCTF.dll
0x7c340000 - 0x7c396000 	C:\Program Files (x86)\Java\jre6\bin\msvcr71.dll
0x6d7f0000 - 0x6da96000 	C:\Program Files (x86)\Java\jre6\bin\client\jvm.dll
0x74790000 - 0x747c2000 	C:\Windows\system32\WINMM.dll
0x72660000 - 0x726ac000 	C:\Windows\system32\apphelp.dll
0x6d7a0000 - 0x6d7ac000 	C:\Program Files (x86)\Java\jre6\bin\verify.dll
0x6d320000 - 0x6d33f000 	C:\Program Files (x86)\Java\jre6\bin\java.dll
0x6d280000 - 0x6d288000 	C:\Program Files (x86)\Java\jre6\bin\hpi.dll
0x77580000 - 0x77585000 	C:\Windows\syswow64\PSAPI.DLL
0x6d370000 - 0x6d399000 	C:\Program Files (x86)\Java\jre6\bin\jdwp.dll
0x6d690000 - 0x6d696000 	C:\Program Files (x86)\Java\jre6\bin\npt.dll
0x6d7e0000 - 0x6d7ef000 	C:\Program Files (x86)\Java\jre6\bin\zip.dll
0x6d200000 - 0x6d207000 	C:\Program Files (x86)\Java\jre6\bin\dt_socket.dll
0x764a0000 - 0x764d5000 	C:\Windows\syswow64\WS2_32.dll
0x74d00000 - 0x74d06000 	C:\Windows\syswow64\NSI.dll
0x74650000 - 0x74660000 	C:\Windows\system32\NLAapi.dll
0x741f0000 - 0x74200000 	C:\Windows\system32\napinsp.dll
0x741d0000 - 0x741e2000 	C:\Windows\system32\pnrpnsp.dll
0x741c0000 - 0x741cd000 	C:\Windows\system32\wshbth.dll
0x74190000 - 0x741b7000 	C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live\WLIDNSP.DLL
0x76320000 - 0x76377000 	C:\Windows\syswow64\SHLWAPI.dll
0x74880000 - 0x748bc000 	C:\Windows\System32\mswsock.dll
0x72570000 - 0x725b4000 	C:\Windows\system32\DNSAPI.dll
0x74180000 - 0x74188000 	C:\Windows\System32\winrnr.dll
0x74800000 - 0x7481c000 	C:\Windows\system32\IPHLPAPI.DLL
0x747f0000 - 0x747f7000 	C:\Windows\system32\WINNSI.DLL
0x735b0000 - 0x735e8000 	C:\Windows\System32\fwpuclnt.dll
0x74200000 - 0x74206000 	C:\Windows\system32\rasadhlp.dll
0x74670000 - 0x74675000 	C:\Windows\System32\wshtcpip.dll
0x191b0000 - 0x19213000 	C:\Users\Mauro\AppData\Local\Temp\swtlib-32\swt-win32-3659.dll
0x752e0000 - 0x7543c000 	C:\Windows\syswow64\ole32.dll
0x74e30000 - 0x74ebf000 	C:\Windows\syswow64\OLEAUT32.dll
0x76c40000 - 0x76cbb000 	C:\Windows\syswow64\comdlg32.dll
0x72980000 - 0x72b1e000 	C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.17514_none_41e6975e2bd6f2b2\COMCTL32.dll
0x756d0000 - 0x7631a000 	C:\Windows\syswow64\SHELL32.dll
0x74d10000 - 0x74e2a000 	C:\Windows\syswow64\WININET.dll
0x75190000 - 0x75193000 	C:\Windows\syswow64\Normaliz.dll
0x76a30000 - 0x76be6000 	C:\Windows\syswow64\iertutil.dll
0x76920000 - 0x76a30000 	C:\Windows\syswow64\urlmon.dll
0x72b50000 - 0x72bd0000 	C:\Windows\system32\uxtheme.dll
0x72760000 - 0x727b8000 	C:\Program Files (x86)\Common Files\microsoft shared\ink\tiptsf.dll
0x72620000 - 0x72629000 	C:\Windows\system32\version.dll
0x72b30000 - 0x72b43000 	C:\Windows\system32\dwmapi.dll
0x6d000000 - 0x6d14a000 	C:\Program Files (x86)\Java\jre6\bin\awt.dll
0x74b70000 - 0x74bc1000 	C:\Windows\system32\WINSPOOL.DRV
0x6d230000 - 0x6d27f000 	C:\Program Files (x86)\Java\jre6\bin\fontmanager.dll

VM Arguments:
jvm_args: -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:53072 -Dfile.encoding=Cp1252 
java_command: it.condarelli.pdfprint.PDFPrint
Launcher Type: SUN_STANDARD

Environment Variables:
CLASSPATH=C:\Program Files (x86)\Novosoft\C2J\Bin\c2jruntime.zip;
PATH=C:\opt\Ruby192\bin;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\msys\1.0\bin;C:\mingw\bin;C:\Program Files (x86)\MiKTeX 2.8\miktex\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jre6\bin;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\WIDCOMM\Bluetooth Software\syswow64;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Graphviz2.26.3\bin;C:\Program Files (x86)\Ruby192\bin;C:\Program Files (x86)\Novosoft\C2J\Bin;;C:\Program Files (x86)\OpenVPN\bin
USERNAME=Mauro
OS=Windows_NT
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 23 Stepping 10, GenuineIntel



---------------  S Y S T E M  ---------------

OS: Windows 7 Build 7601 Service Pack 1

CPU:total 2 (2 cores per cpu, 1 threads per core) family 6 model 23 stepping 10, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3

Memory: 4k page, physical 4094884k(1021536k free), swap 8187920k(4975792k free)

vm_info: Java HotSpot(TM) Client VM (19.1-b02) for windows-x86 JRE (1.6.0_24-b07), built on Feb  2 2011 17:44:41 by "java_re" with MS VC++ 7.1 (VS2003)

time: Fri May 20 17:46:25 2011
elapsed time: 32 seconds
Comment 17 Carolyn MacLeod CLA 2011-05-20 13:27:07 EDT
Aha - you must have the older SWT in your workspace. Either you imported it or loaded it from CVS or maybe you are pointing to an old SWT jar.

Whatever you did when you got SWT before - you need to go do that same thing again to get SWT for Eclipse 3.7. (Either re-import, or re-load, or point to the newer jar).
Comment 18 Mauro Condarelli CLA 2011-05-23 04:35:04 EDT
(In reply to comment #17)
> Aha - you must have the older SWT in your workspace. Either you imported it or
> loaded it from CVS or maybe you are pointing to an old SWT jar.
> 
> Whatever you did when you got SWT before - you need to go do that same thing
> again to get SWT for Eclipse 3.7. (Either re-import, or re-load, or point to
> the newer jar).

Ok.
It seems to work.

Only complaint is the (prevoiousluy fatal) instruction:
  Printer p = new Printer(pd);
takes about 20 seconds to fail, but I assume that is because some timeouts in the system itself.
Having a few printers this loop takes a Loooooooong time.

I had to re-wire manually SWT library in my project properties AND completely uninstall all old Java runtimes (32bit) because otherwise launching my program from Indigo (64bit) would use the 32bit environment and fail miserably.

What is the "Right Way" to specify a project in order to have upgrades to work smoothly?
Comment 19 Carolyn MacLeod CLA 2011-05-24 13:27:22 EDT
> It seems to work.
Great! Thanks very much for your perseverance - it is truly appreciated.

> Only complaint is the (prevoiousluy fatal) instruction:
>   Printer p = new Printer(pd);
> takes about 20 seconds to fail, but I assume that is because some timeouts in
> the system itself.
I doubt I can do anything about that. (Definitely can't do anything in the 3.7 time frame).

Just curious - if you use the PrintDialog, how quickly (or slowly) does the dialog open? What about if you print from some other application (Notepad or whatever).

> I had to re-wire manually SWT library in my project properties AND completely
> uninstall all old Java runtimes (32bit) because otherwise launching my program
> from Indigo (64bit) would use the 32bit environment and fail miserably.
I think you don't need to uninstall old JREs - try selecting an alternate JRE to run your code: Run -> Run configurations... and select the configuration that you usually run, then select the JRE tab and choose an alternate JRE.

> What is the "Right Way" to specify a project in order to have upgrades to work
> smoothly?
If you are starting from scratch, the easiest way is to use the New Project wizard to create a "Plug-in Project" (instead of just a plain Java Project). You might get some extra stuff you don't need (i.e. org.eclipse.ui), but this method gives you all of the SWT connections (jar, dll, source) for free, and they are updated for free when you update your Eclipse IDE.
Here's how:
File -> New -> Project...
Plug-in project
Next >
type the project name
Next >
Finish

If you are starting with a pre-existing Java Project, and if you update your Eclipse host to the same path, then the following should work:
Select your project
context menu -> Properties
Java Build Path
Libraries tab
Add Variable...
ECLIPSE_HOME
Extend...
Expand plugins
Scroll down and select 3 org.eclipse.swt* jars
OK
OK
You may have to repeat these steps if you upgrade your host to a new directory, but at least you will get a warning because nothing will compile.

(I always work with SWT from CVS, and I update my workspace content frequently, so I am almost never precisely in sync with the Eclipse build I am using to host the code.)