Microsoft Windows Vista Community Forums - Vistaheads
Recommended Download



Welcome to the Microsoft Windows Vista Community Forums - Vistaheads, YOUR Largest Resource for Windows Vista related information.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so , join our community today!

If you have any problems with the registration process or your account login, please contact us.

Driver Scanner

PaperSize not available when Run as Admin

microsoft.public.windows.vista.print fax scan






Speedup My PC
Reply
  #1 (permalink)  
Old 05-22-2009
robkeithd
 

Posts: n/a
PaperSize not available when Run as Admin

I've got a Windows app written in C# that errors out when it is Run as
Admin. I've boiled it down to setting the PaperSize on the printer.
I've got a test app consisting of single form with two textboxes and in
the Shown event I have the following code:

PrinterSettings ps = new PrinterSettings();
ps.PrinterName = "Microsoft XPS Document Writer";
textBox1.Text = ps.PrinterName;
textBox2.Text = ps.PaperSizes.Count.ToString();

When I run the app with a double click on the desktop icon I get the
expected 106 for the count. If I right click the icon and select Run as
Admin, the printer name is correct but the count is zero.

Part of my full app relies on reading the PaperSizes so the issue of
not finding any when running as admin is causing some problems. This
only seems to be an issue on 64 bit Vista. Have reproduced it on two 64
bit boxes but don't have the problem on a 32 bit Vista or XP 32 or XP
64.

Any help on this would be greatly appreciated

Thanks


--
robkeithd
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-28-2009
Alan Morris [MSFT]
 

Posts: n/a
Re: PaperSize not available when Run as Admin
is this a 32bit application?

--
Alan Morris
Windows Printing Team
Search the Microsoft Knowledge Base here:
http://support.microsoft.com/search/?adv=1

This posting is provided "AS IS" with no warranties, and confers no rights.

"robkeithd" <guest@unknown-email.com> wrote in message
news:e3a413d48d7036ec60340f977026c0f9@nntp-gateway.com...
>
> I've got a Windows app written in C# that errors out when it is Run as
> Admin. I've boiled it down to setting the PaperSize on the printer.
> I've got a test app consisting of single form with two textboxes and in
> the Shown event I have the following code:
>
> PrinterSettings ps = new PrinterSettings();
> ps.PrinterName = "Microsoft XPS Document Writer";
> textBox1.Text = ps.PrinterName;
> textBox2.Text = ps.PaperSizes.Count.ToString();
>
> When I run the app with a double click on the desktop icon I get the
> expected 106 for the count. If I right click the icon and select Run as
> Admin, the printer name is correct but the count is zero.
>
> Part of my full app relies on reading the PaperSizes so the issue of
> not finding any when running as admin is causing some problems. This
> only seems to be an issue on 64 bit Vista. Have reproduced it on two 64
> bit boxes but don't have the problem on a 32 bit Vista or XP 32 or XP
> 64.
>
> Any help on this would be greatly appreciated
>
> Thanks
>
>
> --
> robkeithd



Reply With Quote
  #3 (permalink)  
Old 05-28-2009
robkeithd
 

Posts: n/a
Re: PaperSize not available when Run as Admin

Hi Alan,

Thanks for the reply

Our "real" app is 32 bit. I built the test app as both 32 and 64. We
have been done a little more discovery. This seems to have something to
do with splwow64.exe. If I run the test "as is" and then it again "as
admin" I have the problem. If I bring up Task Manager and kill splwow64
(or wait long enough for it go away on its own) in between then the test
runs fine. If I run "as admin" the first time then I don't seem to have
the problem - i.e. I can turn right around and run the app as is or as
admin with no problem.

So now I'm at the point where I know I need to make sure I can read the
printer properties before proceeeding with the print job so my program
won't just flat out die but I don't really know what to do if it turns
out that I can't read the properites.

If there is some trick or tip out there it would be greatly
appreiciated.


--
robkeithd
Reply With Quote
  #4 (permalink)  
Old 05-28-2009
Alan Morris [MSFT]
 

Posts: n/a
Re: PaperSize not available when Run as Admin
You can change the timeout value on the splwow64.exe for termination after 1
minute. If the print driver keeps a reference to the process this does not
work.


http://support.microsoft.com/kb/923357

You cannot use the RUNAS command to print from a 32-bit program in different
user accounts in a single session on a computer that is running a 64-bit
version of Microsoft Windows



--
Alan Morris
Windows Printing Team
Search the Microsoft Knowledge Base here:
http://support.microsoft.com/search/?adv=1

This posting is provided "AS IS" with no warranties, and confers no rights.

"robkeithd" <guest@unknown-email.com> wrote in message
news:a8458961c8ecb3fba3f53d0e83dea48c@nntp-gateway.com...
>
> Hi Alan,
>
> Thanks for the reply
>
> Our "real" app is 32 bit. I built the test app as both 32 and 64. We
> have been done a little more discovery. This seems to have something to
> do with splwow64.exe. If I run the test "as is" and then it again "as
> admin" I have the problem. If I bring up Task Manager and kill splwow64
> (or wait long enough for it go away on its own) in between then the test
> runs fine. If I run "as admin" the first time then I don't seem to have
> the problem - i.e. I can turn right around and run the app as is or as
> admin with no problem.
>
> So now I'm at the point where I know I need to make sure I can read the
> printer properties before proceeeding with the print job so my program
> won't just flat out die but I don't really know what to do if it turns
> out that I can't read the properites.
>
> If there is some trick or tip out there it would be greatly
> appreiciated.
>
>
> --
> robkeithd



Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
ATTN: For those of you who have disabled UAC while using user/admin,you don't have full admin rights -- <VBG>! Paul Montgumdrop microsoft.public.windows.vista.general 20 10-02-2008 20:14
Beyond a normal Admin issue. Admin account is acting as a guest ac Juggernautalis microsoft.public.windows.vista.administration accounts passwords 2 07-08-2008 05:59
Admin access to Vista Registry Remote & locally in Admin Approval Gayle microsoft.public.windows.vista.security 0 10-24-2007 15:26
Add domain admin to local admin group BigHaig microsoft.public.windows.vista.general 2 07-07-2007 17:16
What is the differences between default admin and limited admin =?Utf-8?B?5oKp44KB44KL5a2Q576K?= microsoft.public.windows.vista.administration accounts passwords 3 02-28-2007 14:10




All times are GMT +1. The time now is 17:18.




Driver Scanner - Free Scan Now

Vistaheads.com is part of the Heads Network. See also XPHeads.com , Win7Heads.com and Win8Heads.com.


Design by Vjacheslav Trushkin for phpBBStyles.com.
Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.6.0 RC 2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120