adrian, this is very likely a bug caused by martin, because he simply removed
the utime support under windows when he reworked it. [please be more careful wrt
windows, martin!]
here is some code out of my mule workspace that should fix it.  i can't exactly
generate a clean patch because everything has changed a lot, so i've appended a
partial a patch.  [sorry, it's somewhat untested] in addition you'll have to add
this line to nt.h:
int mswindows_utime (Lisp_Object path, struct utimbuf *times);
and this code to nt.c:
static void
convert_from_time_t (time_t time, FILETIME * pft)
{
  long double tmp;
  if (!init)
    {
      /* Determine the delta between 1-Jan-1601 and 1-Jan-1970. */
      SYSTEMTIME st;
      st.wYear = 1970;
      st.wMonth = 1;
      st.wDay = 1;
      st.wHour = 0;
      st.wMinute = 0;
      st.wSecond = 0;
      st.wMilliseconds = 0;
      SystemTimeToFileTime (&st, &utc_base_ft);
      utc_base = (long double) utc_base_ft.dwHighDateTime
	* 4096 * 1024 * 1024 + utc_base_ft.dwLowDateTime;
      init = 1;
    }
  /* time in 100ns units since 1-Jan-1601 */
  tmp = (long double) time * 1e7 + utc_base;
  pft->dwHighDateTime = (DWORD) (tmp / (4096.0 * 1024 * 1024));
  pft->dwLowDateTime = (DWORD) (tmp - (4096.0 * 1024 * 1024) *
pft->dwHighDateTime);
}
int
mswindows_utime (Lisp_Object path, struct utimbuf *times)
{
  struct utimbuf deftime;
  HANDLE fh;
  FILETIME mtime;
  FILETIME atime;
  Extbyte *filename;
  if (times == NULL)
    {
      deftime.modtime = deftime.actime = time (NULL);
      times = &deftime;
    }
  LISP_STRING_TO_EXTERNAL (path, filename, Qmswindows_tstr);
  /* Need write access to set times.  */
  fh = CreateFile (filename, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
		   0, OPEN_EXISTING, 0, NULL);
  if (fh)
    {
      convert_from_time_t (times->actime, &atime);
      convert_from_time_t (times->modtime, &mtime);
      if (!SetFileTime (fh, NULL, &atime, &mtime))
	{
	  CloseHandle (fh);
	  errno = EACCES;
	  return -1;
	}
      CloseHandle (fh);
    }
  else
    {
      errno = EINVAL;
      return -1;
    }
  return 0;
}
Adrian Aichner wrote:
 
 >>>>> "APA" == Adrian Aichner <Adrian.Aichner(a)t-online.de>
writes:
 
     APA> Torgny has located the problem.
 
     APA> Thanks, Torgny!
 
     APA> What is the right approach to fix this?
 
 Martin,
 
 you've worked on this last.
 
 The current code in 21.1.14 does work on Windows 2000 while the code
 in 21.2-b46 does not!
 
 I'm willing to test any suggestions you have.
 
 Best regards,
 
 Adrian
 
     APA> Best regards,
 
     APA> Adrian
 
     APA> From: Torgny Nyblom <torgny(a)linux.nu>
     APA> Subject: Re: XEmacs 21.1-b46 pop3.el?
     APA> Newsgroups: comp.emacs.xemacs
     APA> Date: 03 Apr 2001 17:00:07 +0200
     APA> Organization: Telenordia
     APA> Message-ID: <elvaowp4.fsf(a)nyblom.org>
     APA> References: <u24gt9fi.fsf(a)nyblom.org>
<ulmpshzyx.fsf(a)rapier.ecf.teradyne.com>
     APA> Xref: 
news.t-online.com comp.emacs.xemacs:52365
 
     APA> Adrian Aichner <adrian(a)xemacs.org> writes:
 
     >> FWIW, I have seen this problem also in 21.2-b46 build on native
     >> Windows 2000.
     Torgny> know if the problem exists in others) pop3.el. The problem
     Torgny> is that when I try to use 'pop3-leave-mail-on-server t' I
     Torgny> get this error message:
 
     APA> [...]
 
     APA> After some time away I found what the problem is. In the function
     APA> 'pop3-save-uidls' in pop3.el 'copy-file' is called with
KEEP-TIME to 't' this
     APA> breaks Win2000. If I remove this 't' everything workes fine.
 
     APA> --
     APA> Torgny Nyblom | torgny(a)linux.nu
     APA> ===============================
     APA> My keyboard has an F1 key. Where is the NASCAR key?
     APA> ===============================
     APA> ----------
 
     APA> --
     APA>   Adrian Aichner              Teradyne GmbH, European Design Center
     APA>   Integra Test Division       Telephone +49/89/41861(0)-208
     APA>   Dingolfinger Strasse 2      Fax       +49/89/41861-115
     APA>   D-81673 MUENCHEN            E-mail    adrian.aichner(a)teradyne.com
 
 --
 Adrian Aichner
  mailto:adrian@xemacs.org
  
http://www.xemacs.org/ 
-- 
ben
I'm sometimes slow in getting around to reading my mail, so if you
want to reach me faster, call 520-661-6661.
See 
http://www.666.com/ben/chronic-pain/ for the hell I've been
through.
Index: src/fileio.c
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/src/fileio.c,v
retrieving revision 1.51.2.34.6.2
diff -u -r1.51.2.34.6.2 fileio.c
--- src/fileio.c	2001/02/27 17:21:21	1.51.2.34.6.2
+++ src/fileio.c	2001/04/05 05:15:23
@@ -54,6 +54,7 @@
 #endif /* HPUX */
 
 #ifdef WIN32_NATIVE
+#include "nt.h"
 #define IS_DRIVE(x) isalpha (x)
 /* Need to lower-case the drive letter, or else expanded
    filenames will sometimes compare inequal, because
@@ -1676,16 +1667,6 @@
   return;
 }
 
-/* A slightly higher-level interface than `set_file_times' */
-static int
-lisp_string_set_file_times (Lisp_Object filename,
-			    EMACS_TIME atime, EMACS_TIME mtime)
-{
-  char *ext_filename;
-  LISP_STRING_TO_EXTERNAL (filename, ext_filename, Qfile_name);
-  return set_file_times (ext_filename, atime, mtime);
-}
-
 DEFUN ("copy-file", Fcopy_file, 2, 4,
        "fCopy file: \nFCopy %s to file: \np\nP", /*
 Copy FILENAME to NEWNAME.  Both args must be strings.
@@ -1823,7 +1804,7 @@
 	    EMACS_TIME atime, mtime;
 	    EMACS_SET_SECS_USECS (atime, st.st_atime, 0);
 	    EMACS_SET_SECS_USECS (mtime, st.st_mtime, 0);
-	    if (lisp_string_set_file_times (newname, atime, mtime))
+	    if (set_file_times (newname, atime, mtime))
 	      report_file_error ("I/O error", list1 (newname));
 	  }
 	chmod ((const char *) XSTRING_DATA (newname),
Index: src/sysdep.c
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/src/sysdep.c,v
retrieving revision 1.32.2.44.4.2
diff -u -r1.32.2.44.4.2 sysdep.c
--- src/sysdep.c	2001/03/14 16:16:22	1.32.2.44.4.2
+++ src/sysdep.c	2001/04/05 05:15:57
@@ -3342,17 +3289,26 @@
    access to those functions goes through the following. */
 
 int
-set_file_times (char *filename, EMACS_TIME atime, EMACS_TIME mtime)
+set_file_times (Lisp_Object path, EMACS_TIME atime, EMACS_TIME mtime)
 {
-#if defined (HAVE_UTIME)
+#if defined (WIN32_NATIVE)
+  struct utimbuf utb;
+  utb.actime = EMACS_SECS (atime);
+  utb.modtime = EMACS_SECS (mtime);
+  return mswindows_utime (path, &utb);
+#elif defined (HAVE_UTIME)
   struct utimbuf utb;
+  Extbyte *filename;
   utb.actime = EMACS_SECS (atime);
   utb.modtime = EMACS_SECS (mtime);
+  LISP_STRING_TO_EXTERNAL (path, filename, Qfile_name);
   return utime (filename, &utb);
 #elif defined (HAVE_UTIMES)
   struct timeval tv[2];
+  Extbyte *filename;
   tv[0] = atime;
   tv[1] = mtime;
+  LISP_STRING_TO_EXTERNAL (path, filename, Qfile_name);
   return utimes (filename, tv);
 #else
   /* No file times setting function available. */
Index: src/systime.h
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/src/systime.h,v
retrieving revision 1.8.2.6.6.1
diff -u -r1.8.2.6.6.1 systime.h
--- src/systime.h	2001/02/20 12:22:01	1.8.2.6.6.1
+++ src/systime.h	2001/04/05 05:15:57
@@ -63,10 +63,16 @@
 
 #endif /* WIN32_NATIVE */
 
+/* struct utimbuf */
+
 #ifdef HAVE_UTIME
 # include <utime.h>
 #endif
 
+#ifdef WIN32_NATIVE
+# include <sys/utime.h>
+#endif
+
 #if defined(HAVE_TZNAME) && !defined(WIN32_NATIVE) && !defined(CYGWIN)
 #ifndef tzname		/* For SGI.  */
 extern char *tzname[];	/* RS6000 and others want it this way.  */
@@ -228,7 +234,7 @@
 #define EMACS_SET_SECS_USECS(time, secs, usecs) 		\
   (EMACS_SET_SECS (time, secs), EMACS_SET_USECS (time, usecs))
 
-int set_file_times (char *filename, EMACS_TIME atime, EMACS_TIME mtime);
+int set_file_times (Lisp_Object path, EMACS_TIME atime, EMACS_TIME mtime);
 
 void get_process_times (double *user_time, double *system_time,
 			double *real_time);