Web Images Maps Groups Scholar Blogs Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion XcvData broken on Vista
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Carey Gregory  
View profile  
 More options Jul 7 2008, 5:42 pm
Newsgroups: microsoft.public.development.device.drivers, microsoft.public.win32.programmer.gdi
From: Carey Gregory <tiredofspam...@comcast.net>
Date: Mon, 07 Jul 2008 11:42:15 -0400
Local: Mon, Jul 7 2008 5:42 pm
Subject: Re: XcvData broken on Vista
Never mind.   It's an astonishingly subtle bug in Vista involving the
OpenPrinter function.  For the next victim who encounters this bug, here's
how you fix it:

Vista apparently caches printer handles, and does a less than stellar job
of it.  The solution is the OpenPrinter2 function (new to Vista) and the
PRINTER_OPTION_NO_CACHE option (also new).  For example, this fixes the
problem:

      PRINTER_OPTIONSW  po;
      po.cbSize = sizeof(po);
      po.dwFlags = PRINTER_OPTION_NO_CACHE;
      OpenPrinter2(L"\\\\myServer\\,XvcPort myPort", &hServer, 0, &po);

Note that OpenPrinter2 is found only on Vista, so you'll have to
dynamically load it at runtime if you need to support XP, etc.

I presume what's happening is that on Vista, OpenPrinter is making the
mistake of thinking it can use a cached handle to the printer itself
instead of opening a new handle to the port monitor.  But the semantics of
including the "XvcPort" string in the call to OpenPrinter demands a call
to XvcOpenPort.  Vista is not doing that, which of course causes XcvData
to fail mysteriously.  That requirement is clearly spelled out in the
documentation, so this is definitely a bug.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google