Index: /trunk/src/lib/nt/nthlpcore.c
===================================================================
--- /trunk/src/lib/nt/nthlpcore.c	(revision 2702)
+++ /trunk/src/lib/nt/nthlpcore.c	(revision 2703)
@@ -34,5 +34,5 @@
 #include <errno.h>
 #include "nthlp.h"
-#if 1
+#ifndef NDEBUG
 # include <stdio.h>
 #endif
@@ -223,4 +223,6 @@
             return EEXIST;
         /* EXDEV            = 18 */
+        case STATUS_NOT_SAME_DEVICE:
+            return EXDEV;
         /* ENODEV           = 19 */
         /* ENOTDIR          = 20 */
@@ -344,5 +346,5 @@
     }
 
-#if 1
+#ifndef NDEBUG
     __debugbreak();
     fprintf(stderr, "rcNt=%#x (%d)\n", rcNt, rcNt);
@@ -410,4 +412,8 @@
         case ERROR_TOO_MANY_LINKS:          errno = EMLINK; break;
 #endif
+
+        case ERROR_SHARING_VIOLATION:
+            errno = ETXTBSY;
+            break;
     }
 
Index: /trunk/src/lib/nt/nthlpfs.c
===================================================================
--- /trunk/src/lib/nt/nthlpfs.c	(revision 2702)
+++ /trunk/src/lib/nt/nthlpfs.c	(revision 2703)
@@ -168,5 +168,7 @@
         case FILE_OVERWRITE_IF:     fW32Disp = CREATE_ALWAYS; break;
         default:
+# ifndef NDEBUG
             __debugbreak();
+# endif
             return INVALID_HANDLE_VALUE;
     }
@@ -195,5 +197,6 @@
     birdSetErrnoFromWin32(dwErr);
 
-#else
+#else  /* !BIRD_USE_WIN32 */
+
     /*
      * Call the NT API directly.
@@ -230,5 +233,5 @@
     }
 
-#endif
+#endif /* !BIRD_USE_WIN32 */
     return INVALID_HANDLE_VALUE;
 }
Index: /trunk/src/lib/nt/ntstat.c
===================================================================
--- /trunk/src/lib/nt/ntstat.c	(revision 2702)
+++ /trunk/src/lib/nt/ntstat.c	(revision 2703)
@@ -358,5 +358,5 @@
 
         /* On things like pagefile.sys we may get sharing violation. */
-        if (GetLastError() == ERROR_SHARING_VIOLATION)
+        if (errno == ETXTBSY)
         {
             /** @todo Fall back on the parent directory enum if we run into a sharing
@@ -365,9 +365,4 @@
         rc = -1;
     }
-
-#if 1
-    if (strchr(pszPath, ';'))
-        __debugbreak();
-#endif
 
     return rc;
