Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Ethereal-dev: Re: [Ethereal-dev] BUG: printing in windows needs access-rights to root director

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "Ph. Marek" <philipp.marek@xxxxxxxxxx>
Date: Fri, 29 Jul 2005 10:31:13 +0200
On Friday 29 July 2005 10:05, Ulf Lamping wrote:
> Ph. Marek wrote:
> >Trying to print in windows results an error, as I'm working as a user and
> > the root-directory is not writable for me.
>
> As you are writing to the developer mailing list I assume you are a
> developer yourself. 
diff -u print_dlg.c.orig print_dlg.c
--- print_dlg.c.orig    2005-07-29 10:26:17.363031600 +0200
+++ print_dlg.c 2005-07-29 10:30:14.314310680 +0200
@@ -855,7 +855,11 @@
     win_printer = TRUE;
     /*XXX should use temp file stuff in util routines */
     g_free(args->file);
-    args->file = g_strdup(tmpnam(NULL));
+    args->file = gstrdup_printf("%s\\ethereal_print_%s.tmp",
+                          getenv("TMP") ? getenv("TMP") :
+                          getenv("TEMP") ? getenv("TEMP") :
+                          "c:\\temp",
+                          tmpnam(NULL));
     args->to_file = TRUE;
 #else
     g_free(args->cmd);

> In this case you should know that's not a good idea 
> to only provide an interpretation of an error message, but provide the
> exact error message itself.
>
> You should also explain the exact steps to reproduce your problem. There
> is more than one printing function, so we have to guess which one you
> tried.
Using the "official" 0.10.12 ethereal build, capture some packets.
Choose File->Print, option don't matter, as long as you don't print into a 
file :-)
On clicking OK I get a messagebox 
	Ethereal
	You don't have permission to create or write to the file "\s1bg.".

This is with TEMP and TMP set to a writeable path (below profiles).

And in all cases in windows ./gtk/print_dlg.c:862 (the tmpnam()-call you 
mentioned) is used, so it didn't seem necessary to me to specify any 
particular options I used.


> >I couldn't find an option for setting the path; please use %TEMP% or
> > %TMP%.
> The function tmpnam() is used to get the output path/filename for
> printing on windows. The function description is a bit hard to
> understand, but I think it will use %TMP%, so there seems something
> wrong with your environment.
I don't think so - on both accounts (it doesn't, and there isn't ;-).

> >(BTW: could I have a 0.10.12 with that changed, please ? :-)
> No. We won't ship two different versions with the same 0.10.12 version
> number. That's simply a very bad idea.
How about a 0.10.12b, then ? :-)

> Regards, ULFL
Regards,

Phil