1 /* -*- mode: C; c-file-style: "gnu" -*- */
2 /* dbus-sysdeps-util.c Would be in dbus-sysdeps.c, but not used in libdbus
4 * Copyright (C) 2002, 2003, 2004, 2005 Red Hat, Inc.
5 * Copyright (C) 2003 CodeFactory AB
7 * Licensed under the Academic Free License version 2.1
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #define STRSAFE_NO_DEPRECATE
29 #include "dbus-sysdeps.h"
30 #include "dbus-internals.h"
31 #include "dbus-protocol.h"
32 #include "dbus-string.h"
33 #include "dbus-sysdeps.h"
34 #include "dbus-sysdeps-win.h"
35 #include "dbus-memory.h"
46 #if defined __MINGW32__ || (defined _MSC_VER && _MSC_VER <= 1310)
47 /* save string functions version
48 using DBusString needs to much time because of uncommon api
52 errno_t strcat_s(char *dest, size_t size, char *src)
54 _dbus_assert(strlen(dest) + strlen(src) +1 <= size);
59 errno_t strcpy_s(char *dest, size_t size, char *src)
61 _dbus_assert(strlen(src) +1 <= size);
68 * Does the chdir, fork, setsid, etc. to become a daemon process.
70 * @param pidfile #NULL, or pidfile to create
71 * @param print_pid_fd file descriptor to print daemon's pid to, or -1 for none
72 * @param error return location for errors
73 * @returns #FALSE on failure
76 _dbus_become_daemon (const DBusString *pidfile,
77 DBusPipe *print_pid_pipe,
84 * Creates a file containing the process ID.
86 * @param filename the filename to write to
87 * @param pid our process ID
88 * @param error return location for errors
89 * @returns #FALSE on failure
92 _dbus_write_pid_file (const DBusString *filename,
96 const char *cfilename;
100 cfilename = _dbus_string_get_const_data (filename);
102 if (!_dbus_file_open(&file, cfilename, O_WRONLY|O_CREAT|O_EXCL|O_BINARY, 0644))
104 dbus_set_error (error, _dbus_error_from_errno (errno),
105 "Failed to open \"%s\": %s", cfilename,
106 _dbus_strerror (errno));
110 if ((f = fdopen (file.FDATA, "w")) == NULL)
112 dbus_set_error (error, _dbus_error_from_errno (errno),
113 "Failed to fdopen fd %d: %s", file.FDATA, _dbus_strerror (errno));
114 _dbus_file_close (&file, NULL);
118 if (fprintf (f, "%lu\n", pid) < 0)
120 dbus_set_error (error, _dbus_error_from_errno (errno),
121 "Failed to write to \"%s\": %s", cfilename,
122 _dbus_strerror (errno));
128 if (fclose (f) == EOF)
130 dbus_set_error (error, _dbus_error_from_errno (errno),
131 "Failed to close \"%s\": %s", cfilename,
132 _dbus_strerror (errno));
140 * Verify that after the fork we can successfully change to this user.
142 * @param user the username given in the daemon configuration
143 * @returns #TRUE if username is valid
146 _dbus_verify_daemon_user (const char *user)
152 * Changes the user and group the bus is running as.
154 * @param user the user to become
155 * @param error return location for errors
156 * @returns #FALSE on failure
159 _dbus_change_to_daemon_user (const char *user,
166 * Changes the user and group the bus is running as.
168 * @param uid the new user ID
169 * @param gid the new group ID
170 * @param error return location for errors
171 * @returns #FALSE on failure
174 _dbus_change_identity (dbus_uid_t uid,
181 /** Checks if user is at the console
183 * @param username user to check
184 * @param error return location for errors
185 * @returns #TRUE is the user is at the consolei and there are no errors
188 _dbus_user_at_console(const char *username,
194 dbus_bool_t retval = FALSE;
197 PSID user_sid, console_user_sid;
200 wusername = _dbus_win_utf8_to_utf16 (username, error);
205 if (!_dbus_win_account_to_sid (wusername, &user_sid, error))
208 /* Now we have the SID for username. Get the SID of the
209 * user at the "console" (window station WinSta0)
211 if (!(winsta = OpenWindowStation ("WinSta0", FALSE, READ_CONTROL)))
213 _dbus_win_set_error_from_win_error (error, GetLastError ());
218 GetUserObjectInformation (winsta, UOI_USER_SID,
219 NULL, 0, &sid_length);
222 /* Nobody is logged on */
226 if (sid_length < 0 || sid_length > 1000)
228 dbus_set_error_const (error, DBUS_ERROR_FAILED, "Invalid SID length");
232 console_user_sid = dbus_malloc (sid_length);
233 if (!console_user_sid)
235 _DBUS_SET_OOM (error);
239 if (!GetUserObjectInformation (winsta, UOI_USER_SID,
240 console_user_sid, sid_length, &sid_length))
242 _dbus_win_set_error_from_win_error (error, GetLastError ());
246 if (!IsValidSid (console_user_sid))
248 dbus_set_error_const (error, DBUS_ERROR_FAILED, "Invalid SID");
252 retval = EqualSid (user_sid, console_user_sid);
255 dbus_free (console_user_sid);
257 CloseWindowStation (winsta);
259 dbus_free (user_sid);
261 dbus_free (wusername);
268 * Removes a directory; Directory must be empty
270 * @param filename directory filename
271 * @param error initialized error object
272 * @returns #TRUE on success
275 _dbus_delete_directory (const DBusString *filename,
278 const char *filename_c;
280 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
282 filename_c = _dbus_string_get_const_data (filename);
284 if (rmdir (filename_c) != 0)
286 dbus_set_error (error, DBUS_ERROR_FAILED,
287 "Failed to remove directory %s: %s\n",
288 filename_c, _dbus_strerror (errno));
295 /** Installs a signal handler
297 * @param sig the signal to handle
298 * @param handler the handler
301 _dbus_set_signal_handler (int sig,
302 DBusSignalHandler handler)
304 _dbus_verbose ("_dbus_set_signal_handler() has to be implemented\n");
307 /** Checks if a file exists
309 * @param file full path to the file
310 * @returns #TRUE if file exists
313 _dbus_file_exists (const char *file)
315 HANDLE h = CreateFile(
316 file, /* LPCTSTR lpFileName*/
317 0, /* DWORD dwDesiredAccess */
318 0, /* DWORD dwShareMode*/
319 NULL, /* LPSECURITY_ATTRIBUTES lpSecurityAttributes */
320 OPEN_EXISTING, /* DWORD dwCreationDisposition */
321 FILE_ATTRIBUTE_NORMAL, /* DWORD dwFlagsAndAttributes */
322 NULL /* HANDLE hTemplateFile */
325 /* file not found, use local copy of session.conf */
326 if (h != INVALID_HANDLE_VALUE && GetLastError() != ERROR_PATH_NOT_FOUND)
338 * @param filename the filename to stat
339 * @param statbuf the stat info to fill in
340 * @param error return location for error
341 * @returns #FALSE if error was set
344 _dbus_stat(const DBusString *filename,
352 const char *filename_c;
353 #if !defined(DBUS_WIN) && !defined(DBUS_WINCE)
358 WIN32_FILE_ATTRIBUTE_DATA wfad;
361 PSID owner_sid, group_sid;
362 PSECURITY_DESCRIPTOR sd;
365 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
367 filename_c = _dbus_string_get_const_data (filename);
369 if (!GetFileAttributesEx (filename_c, GetFileExInfoStandard, &wfad))
371 _dbus_win_set_error_from_win_error (error, GetLastError ());
375 if (wfad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
376 statbuf->mode = _S_IFDIR;
378 statbuf->mode = _S_IFREG;
380 statbuf->mode |= _S_IREAD;
381 if (wfad.dwFileAttributes & FILE_ATTRIBUTE_READONLY)
382 statbuf->mode |= _S_IWRITE;
384 lastdot = strrchr (filename_c, '.');
385 if (lastdot && stricmp (lastdot, ".exe") == 0)
386 statbuf->mode |= _S_IEXEC;
388 statbuf->mode |= (statbuf->mode & 0700) >> 3;
389 statbuf->mode |= (statbuf->mode & 0700) >> 6;
394 rc = GetNamedSecurityInfo ((char *) filename_c, SE_FILE_OBJECT,
395 OWNER_SECURITY_INFORMATION |
396 GROUP_SECURITY_INFORMATION,
397 &owner_sid, &group_sid,
400 if (rc != ERROR_SUCCESS)
402 _dbus_win_set_error_from_win_error (error, rc);
408 #ifdef ENABLE_UID_TO_SID
410 statbuf->uid = _dbus_win_sid_to_uid_t (owner_sid);
411 statbuf->gid = _dbus_win_sid_to_uid_t (group_sid);
416 statbuf->size = ((dbus_int64_t) wfad.nFileSizeHigh << 32) + wfad.nFileSizeLow;
419 (((dbus_int64_t) wfad.ftLastAccessTime.dwHighDateTime << 32) +
420 wfad.ftLastAccessTime.dwLowDateTime) / 10000000 - DBUS_INT64_CONSTANT (116444736000000000);
423 (((dbus_int64_t) wfad.ftLastWriteTime.dwHighDateTime << 32) +
424 wfad.ftLastWriteTime.dwLowDateTime) / 10000000 - DBUS_INT64_CONSTANT (116444736000000000);
427 (((dbus_int64_t) wfad.ftCreationTime.dwHighDateTime << 32) +
428 wfad.ftCreationTime.dwLowDateTime) / 10000000 - DBUS_INT64_CONSTANT (116444736000000000);
437 // mingw ships with dirent.h
439 #define _dbus_opendir opendir
440 #define _dbus_readdir readdir
441 #define _dbus_closedir closedir
446 #include <io.h> // win32 file functions
449 #include <sys/types.h>
452 /* This file is part of the KDE project
453 Copyright (C) 2000 Werner Almesberger
455 libc/sys/linux/sys/dirent.h - Directory entry as returned by readdir
457 This program is free software; you can redistribute it and/or
458 modify it under the terms of the GNU Library General Public
459 License as published by the Free Software Foundation; either
460 version 2 of the License, or (at your option) any later version.
462 This program is distributed in the hope that it will be useful,
463 but WITHOUT ANY WARRANTY; without even the implied warranty of
464 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
465 Library General Public License for more details.
467 You should have received a copy of the GNU Library General Public License
468 along with this program; see the file COPYING. If not, write to
469 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
470 Boston, MA 02110-1301, USA.
472 #define HAVE_NO_D_NAMLEN /* no struct dirent->d_namlen */
473 #define HAVE_DD_LOCK /* have locking mechanism */
475 #define MAXNAMLEN 255 /* sizeof(struct dirent.d_name)-1 */
477 #define __dirfd(dir) (dir)->dd_fd
479 /* struct dirent - same as Unix */
482 long d_ino; /* inode (always 1 in WIN32) */
483 off_t d_off; /* offset to this dirent */
484 unsigned short d_reclen; /* length of d_name */
485 char d_name[_MAX_FNAME+1]; /* filename (null terminated) */
488 /* typedef DIR - not the same as Unix */
491 long handle; /* _findfirst/_findnext handle */
492 short offset; /* offset into directory */
493 short finished; /* 1 if there are not more files */
494 struct _finddata_t fileinfo; /* from _findfirst/_findnext */
495 char *dir; /* the dir we are reading */
496 struct dirent dent; /* the dirent to return */
500 /**********************************************************************
501 * Implement dirent-style opendir/readdir/closedir on Window 95/NT
503 * Functions defined are opendir(), readdir() and closedir() with the
504 * same prototypes as the normal dirent.h implementation.
506 * Does not implement telldir(), seekdir(), rewinddir() or scandir().
507 * The dirent struct is compatible with Unix, except that d_ino is
508 * always 1 and d_off is made up as we go along.
510 * The DIR typedef is not compatible with Unix.
511 **********************************************************************/
513 DIR * _dbus_opendir(const char *dir)
520 filespec = malloc(strlen(dir) + 2 + 1);
521 strcpy(filespec, dir);
522 index = strlen(filespec) - 1;
523 if (index >= 0 && (filespec[index] == '/' || filespec[index] == '\\'))
524 filespec[index] = '\0';
525 strcat(filespec, "\\*");
527 dp = (DIR *)malloc(sizeof(DIR));
530 dp->dir = strdup(dir);
532 if ((handle = _findfirst(filespec, &(dp->fileinfo))) < 0)
546 struct dirent * _dbus_readdir(DIR *dp)
548 if (!dp || dp->finished)
553 if (_findnext(dp->handle, &(dp->fileinfo)) < 0)
562 strncpy(dp->dent.d_name, dp->fileinfo.name, _MAX_FNAME);
564 dp->dent.d_reclen = strlen(dp->dent.d_name);
565 dp->dent.d_off = dp->offset;
571 int _dbus_closedir(DIR *dp)
575 _findclose(dp->handle);
584 #endif //#ifdef HAVE_DIRENT_H
587 * Internals of directory iterator
591 DIR *d; /**< The DIR* from opendir() */
596 * Open a directory to iterate over.
598 * @param filename the directory name
599 * @param error exception return object or #NULL
600 * @returns new iterator, or #NULL on error
603 _dbus_directory_open (const DBusString *filename,
608 const char *filename_c;
610 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
612 filename_c = _dbus_string_get_const_data (filename);
614 d = _dbus_opendir (filename_c);
617 dbus_set_error (error, _dbus_error_from_errno (errno),
618 "Failed to read directory \"%s\": %s",
620 _dbus_strerror (errno));
623 iter = dbus_new0 (DBusDirIter, 1);
627 dbus_set_error (error, DBUS_ERROR_NO_MEMORY,
628 "Could not allocate memory for directory iterator");
638 * Get next file in the directory. Will not return "." or ".." on
639 * UNIX. If an error occurs, the contents of "filename" are
640 * undefined. The error is never set if the function succeeds.
642 * @todo for thread safety, I think we have to use
643 * readdir_r(). (GLib has the same issue, should file a bug.)
645 * @param iter the iterator
646 * @param filename string to be set to the next file in the dir
647 * @param error return location for error
648 * @returns #TRUE if filename was filled in with a new filename
651 _dbus_directory_get_next_file (DBusDirIter *iter,
652 DBusString *filename,
657 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
661 ent = _dbus_readdir (iter->d);
665 dbus_set_error (error,
666 _dbus_error_from_errno (errno),
667 "%s", _dbus_strerror (errno));
670 else if (ent->d_name[0] == '.' &&
671 (ent->d_name[1] == '\0' ||
672 (ent->d_name[1] == '.' && ent->d_name[2] == '\0')))
676 _dbus_string_set_length (filename, 0);
677 if (!_dbus_string_append (filename, ent->d_name))
679 dbus_set_error (error, DBUS_ERROR_NO_MEMORY,
680 "No memory to read directory entry");
689 * Closes a directory iteration.
692 _dbus_directory_close (DBusDirIter *iter)
694 _dbus_closedir (iter->d);
699 * Checks whether the filename is an absolute path
701 * @param filename the filename
702 * @returns #TRUE if an absolute path
705 _dbus_path_is_absolute (const DBusString *filename)
707 if (_dbus_string_get_length (filename) > 0)
708 return _dbus_string_get_byte (filename, 1) == ':'
709 || _dbus_string_get_byte (filename, 0) == '\\'
710 || _dbus_string_get_byte (filename, 0) == '/';
715 /** @} */ /* End of DBusInternalsUtils functions */
718 * @addtogroup DBusString
723 * Get the directory name from a complete filename
724 * @param filename the filename
725 * @param dirname string to append directory name to
726 * @returns #FALSE if no memory
729 _dbus_string_get_dirname(const DBusString *filename,
734 _dbus_assert (filename != dirname);
735 _dbus_assert (filename != NULL);
736 _dbus_assert (dirname != NULL);
738 /* Ignore any separators on the end */
739 sep = _dbus_string_get_length (filename);
741 return _dbus_string_append (dirname, "."); /* empty string passed in */
744 (_dbus_string_get_byte (filename, sep - 1) == '/' ||
745 _dbus_string_get_byte (filename, sep - 1) == '\\'))
748 _dbus_assert (sep >= 0);
752 _dbus_string_get_byte (filename, 1) == ':' &&
753 isalpha (_dbus_string_get_byte (filename, 0))))
754 return _dbus_string_copy_len (filename, 0, sep + 1,
755 dirname, _dbus_string_get_length (dirname));
759 _dbus_string_find_byte_backward (filename, sep, '/', &sep1);
760 _dbus_string_find_byte_backward (filename, sep, '\\', &sep2);
762 sep = MAX (sep1, sep2);
765 return _dbus_string_append (dirname, ".");
768 (_dbus_string_get_byte (filename, sep - 1) == '/' ||
769 _dbus_string_get_byte (filename, sep - 1) == '\\'))
772 _dbus_assert (sep >= 0);
776 _dbus_string_get_byte (filename, 1) == ':' &&
777 isalpha (_dbus_string_get_byte (filename, 0))))
779 (_dbus_string_get_byte (filename, sep) == '/' ||
780 _dbus_string_get_byte (filename, sep) == '\\'))
781 return _dbus_string_copy_len (filename, 0, sep + 1,
782 dirname, _dbus_string_get_length (dirname));
784 return _dbus_string_copy_len (filename, 0, sep - 0,
785 dirname, _dbus_string_get_length (dirname));
790 * Checks to see if the UNIX user ID matches the UID of
791 * the process. Should always return #FALSE on Windows.
793 * @param uid the UNIX user ID
794 * @returns #TRUE if this uid owns the process.
797 _dbus_unix_user_is_process_owner (dbus_uid_t uid)
802 /*=====================================================================
803 unix emulation functions - should be removed sometime in the future
804 =====================================================================*/
807 * Checks to see if the UNIX user ID is at the console.
808 * Should always fail on Windows (set the error to
809 * #DBUS_ERROR_NOT_SUPPORTED).
811 * @param uid UID of person to check
812 * @param error return location for errors
813 * @returns #TRUE if the UID is the same as the console user and there are no errors
816 _dbus_unix_user_is_at_console (dbus_uid_t uid,
824 * Parse a UNIX group from the bus config file. On Windows, this should
825 * simply always fail (just return #FALSE).
827 * @param groupname the groupname text
828 * @param gid_p place to return the gid
829 * @returns #TRUE on success
832 _dbus_parse_unix_group_from_config (const DBusString *groupname,
839 * Parse a UNIX user from the bus config file. On Windows, this should
840 * simply always fail (just return #FALSE).
842 * @param username the username text
843 * @param uid_p place to return the uid
844 * @returns #TRUE on success
847 _dbus_parse_unix_user_from_config (const DBusString *username,
855 * Gets all groups corresponding to the given UNIX user ID. On UNIX,
856 * just calls _dbus_groups_from_uid(). On Windows, should always
857 * fail since we don't know any UNIX groups.
860 * @param group_ids return location for array of group IDs
861 * @param n_group_ids return location for length of returned array
862 * @returns #TRUE if the UID existed and we got some credentials
865 _dbus_unix_groups_from_uid (dbus_uid_t uid,
866 dbus_gid_t **group_ids,
874 /** @} */ /* DBusString stuff */
876 /************************************************************************
880 ************************************************************************/
884 * Assigns an error name and message corresponding to a Win32 error
885 * code to a DBusError. Does nothing if error is #NULL.
887 * @param error the error.
888 * @param code the Win32 error code
891 _dbus_win_set_error_from_win_error (DBusError *error,
896 /* As we want the English message, use the A API */
897 FormatMessageA (FORMAT_MESSAGE_ALLOCATE_BUFFER |
898 FORMAT_MESSAGE_IGNORE_INSERTS |
899 FORMAT_MESSAGE_FROM_SYSTEM,
900 NULL, code, MAKELANGID (LANG_ENGLISH, SUBLANG_ENGLISH_US),
901 (LPTSTR) &msg, 0, NULL);
906 msg_copy = dbus_malloc (strlen (msg));
907 strcpy (msg_copy, msg);
910 dbus_set_error (error, "win32.error", "%s", msg_copy);
913 dbus_set_error (error, "win32.error", "Unknown error code %d or FormatMessage failed", code);
917 _dbus_win_warn_win_error (const char *message,
922 dbus_error_init (&error);
923 _dbus_win_set_error_from_win_error (&error, code);
924 _dbus_warn ("%s: %s\n", message, error.message);
925 dbus_error_free (&error);
929 * A wrapper around strerror() because some platforms
930 * may be lame and not have strerror().
932 * @param error_number errno.
933 * @returns error description.
936 _dbus_strerror (int error_number)
944 switch (error_number)
947 return "Interrupted function call";
949 return "Permission denied";
951 return "Bad address";
953 return "Invalid argument";
955 return "Too many open files";
957 return "Resource temporarily unavailable";
959 return "Operation now in progress";
961 return "Operation already in progress";
963 return "Socket operation on nonsocket";
964 case WSAEDESTADDRREQ:
965 return "Destination address required";
967 return "Message too long";
969 return "Protocol wrong type for socket";
971 return "Bad protocol option";
972 case WSAEPROTONOSUPPORT:
973 return "Protocol not supported";
974 case WSAESOCKTNOSUPPORT:
975 return "Socket type not supported";
977 return "Operation not supported";
978 case WSAEPFNOSUPPORT:
979 return "Protocol family not supported";
980 case WSAEAFNOSUPPORT:
981 return "Address family not supported by protocol family";
983 return "Address already in use";
984 case WSAEADDRNOTAVAIL:
985 return "Cannot assign requested address";
987 return "Network is down";
989 return "Network is unreachable";
991 return "Network dropped connection on reset";
992 case WSAECONNABORTED:
993 return "Software caused connection abort";
995 return "Connection reset by peer";
997 return "No buffer space available";
999 return "Socket is already connected";
1001 return "Socket is not connected";
1003 return "Cannot send after socket shutdown";
1005 return "Connection timed out";
1006 case WSAECONNREFUSED:
1007 return "Connection refused";
1009 return "Host is down";
1010 case WSAEHOSTUNREACH:
1011 return "No route to host";
1013 return "Too many processes";
1015 return "Graceful shutdown in progress";
1016 case WSATYPE_NOT_FOUND:
1017 return "Class type not found";
1018 case WSAHOST_NOT_FOUND:
1019 return "Host not found";
1021 return "Nonauthoritative host not found";
1022 case WSANO_RECOVERY:
1023 return "This is a nonrecoverable error";
1025 return "Valid name, no data record of requested type";
1026 case WSA_INVALID_HANDLE:
1027 return "Specified event object handle is invalid";
1028 case WSA_INVALID_PARAMETER:
1029 return "One or more parameters are invalid";
1030 case WSA_IO_INCOMPLETE:
1031 return "Overlapped I/O event object not in signaled state";
1032 case WSA_IO_PENDING:
1033 return "Overlapped operations will complete later";
1034 case WSA_NOT_ENOUGH_MEMORY:
1035 return "Insufficient memory available";
1036 case WSA_OPERATION_ABORTED:
1037 return "Overlapped operation aborted";
1038 #ifdef WSAINVALIDPROCTABLE
1040 case WSAINVALIDPROCTABLE:
1041 return "Invalid procedure table from service provider";
1043 #ifdef WSAINVALIDPROVIDER
1045 case WSAINVALIDPROVIDER:
1046 return "Invalid service provider version number";
1048 #ifdef WSAPROVIDERFAILEDINIT
1050 case WSAPROVIDERFAILEDINIT:
1051 return "Unable to initialize a service provider";
1054 case WSASYSCALLFAILURE:
1055 return "System call failure";
1057 msg = strerror (error_number);
1067 /* lan manager error codes */
1069 _dbus_lm_strerror(int error_number)
1076 switch (error_number)
1078 case NERR_NetNotStarted:
1079 return "The workstation driver is not installed.";
1080 case NERR_UnknownServer:
1081 return "The server could not be located.";
1083 return "An internal error occurred. The network cannot access a shared memory segment.";
1084 case NERR_NoNetworkResource:
1085 return "A network resource shortage occurred.";
1086 case NERR_RemoteOnly:
1087 return "This operation is not supported on workstations.";
1088 case NERR_DevNotRedirected:
1089 return "The device is not connected.";
1090 case NERR_ServerNotStarted:
1091 return "The Server service is not started.";
1092 case NERR_ItemNotFound:
1093 return "The queue is empty.";
1094 case NERR_UnknownDevDir:
1095 return "The device or directory does not exist.";
1096 case NERR_RedirectedPath:
1097 return "The operation is invalid on a redirected resource.";
1098 case NERR_DuplicateShare:
1099 return "The name has already been shared.";
1101 return "The server is currently out of the requested resource.";
1102 case NERR_TooManyItems:
1103 return "Requested addition of items exceeds the maximum allowed.";
1104 case NERR_InvalidMaxUsers:
1105 return "The Peer service supports only two simultaneous users.";
1106 case NERR_BufTooSmall:
1107 return "The API return buffer is too small.";
1108 case NERR_RemoteErr:
1109 return "A remote API error occurred.";
1110 case NERR_LanmanIniError:
1111 return "An error occurred when opening or reading the configuration file.";
1112 case NERR_NetworkError:
1113 return "A general network error occurred.";
1114 case NERR_WkstaInconsistentState:
1115 return "The Workstation service is in an inconsistent state. Restart the computer before restarting the Workstation service.";
1116 case NERR_WkstaNotStarted:
1117 return "The Workstation service has not been started.";
1118 case NERR_BrowserNotStarted:
1119 return "The requested information is not available.";
1120 case NERR_InternalError:
1121 return "An internal error occurred.";
1122 case NERR_BadTransactConfig:
1123 return "The server is not configured for transactions.";
1124 case NERR_InvalidAPI:
1125 return "The requested API is not supported on the remote server.";
1126 case NERR_BadEventName:
1127 return "The event name is invalid.";
1128 case NERR_DupNameReboot:
1129 return "The computer name already exists on the network. Change it and restart the computer.";
1130 case NERR_CfgCompNotFound:
1131 return "The specified component could not be found in the configuration information.";
1132 case NERR_CfgParamNotFound:
1133 return "The specified parameter could not be found in the configuration information.";
1134 case NERR_LineTooLong:
1135 return "A line in the configuration file is too long.";
1136 case NERR_QNotFound:
1137 return "The printer does not exist.";
1138 case NERR_JobNotFound:
1139 return "The print job does not exist.";
1140 case NERR_DestNotFound:
1141 return "The printer destination cannot be found.";
1142 case NERR_DestExists:
1143 return "The printer destination already exists.";
1145 return "The printer queue already exists.";
1147 return "No more printers can be added.";
1148 case NERR_JobNoRoom:
1149 return "No more print jobs can be added.";
1150 case NERR_DestNoRoom:
1151 return "No more printer destinations can be added.";
1153 return "This printer destination is idle and cannot accept control operations.";
1154 case NERR_DestInvalidOp:
1155 return "This printer destination request contains an invalid control function.";
1156 case NERR_ProcNoRespond:
1157 return "The print processor is not responding.";
1158 case NERR_SpoolerNotLoaded:
1159 return "The spooler is not running.";
1160 case NERR_DestInvalidState:
1161 return "This operation cannot be performed on the print destination in its current state.";
1162 case NERR_QInvalidState:
1163 return "This operation cannot be performed on the printer queue in its current state.";
1164 case NERR_JobInvalidState:
1165 return "This operation cannot be performed on the print job in its current state.";
1166 case NERR_SpoolNoMemory:
1167 return "A spooler memory allocation failure occurred.";
1168 case NERR_DriverNotFound:
1169 return "The device driver does not exist.";
1170 case NERR_DataTypeInvalid:
1171 return "The data type is not supported by the print processor.";
1172 case NERR_ProcNotFound:
1173 return "The print processor is not installed.";
1174 case NERR_ServiceTableLocked:
1175 return "The service database is locked.";
1176 case NERR_ServiceTableFull:
1177 return "The service table is full.";
1178 case NERR_ServiceInstalled:
1179 return "The requested service has already been started.";
1180 case NERR_ServiceEntryLocked:
1181 return "The service does not respond to control actions.";
1182 case NERR_ServiceNotInstalled:
1183 return "The service has not been started.";
1184 case NERR_BadServiceName:
1185 return "The service name is invalid.";
1186 case NERR_ServiceCtlTimeout:
1187 return "The service is not responding to the control function.";
1188 case NERR_ServiceCtlBusy:
1189 return "The service control is busy.";
1190 case NERR_BadServiceProgName:
1191 return "The configuration file contains an invalid service program name.";
1192 case NERR_ServiceNotCtrl:
1193 return "The service could not be controlled in its present state.";
1194 case NERR_ServiceKillProc:
1195 return "The service ended abnormally.";
1196 case NERR_ServiceCtlNotValid:
1197 return "The requested pause or stop is not valid for this service.";
1198 case NERR_NotInDispatchTbl:
1199 return "The service control dispatcher could not find the service name in the dispatch table.";
1200 case NERR_BadControlRecv:
1201 return "The service control dispatcher pipe read failed.";
1202 case NERR_ServiceNotStarting:
1203 return "A thread for the new service could not be created.";
1204 case NERR_AlreadyLoggedOn:
1205 return "This workstation is already logged on to the local-area network.";
1206 case NERR_NotLoggedOn:
1207 return "The workstation is not logged on to the local-area network.";
1208 case NERR_BadUsername:
1209 return "The user name or group name parameter is invalid.";
1210 case NERR_BadPassword:
1211 return "The password parameter is invalid.";
1212 case NERR_UnableToAddName_W:
1213 return "@W The logon processor did not add the message alias.";
1214 case NERR_UnableToAddName_F:
1215 return "The logon processor did not add the message alias.";
1216 case NERR_UnableToDelName_W:
1217 return "@W The logoff processor did not delete the message alias.";
1218 case NERR_UnableToDelName_F:
1219 return "The logoff processor did not delete the message alias.";
1220 case NERR_LogonsPaused:
1221 return "Network logons are paused.";
1222 case NERR_LogonServerConflict:
1223 return "A centralized logon-server conflict occurred.";
1224 case NERR_LogonNoUserPath:
1225 return "The server is configured without a valid user path.";
1226 case NERR_LogonScriptError:
1227 return "An error occurred while loading or running the logon script.";
1228 case NERR_StandaloneLogon:
1229 return "The logon server was not specified. Your computer will be logged on as STANDALONE.";
1230 case NERR_LogonServerNotFound:
1231 return "The logon server could not be found.";
1232 case NERR_LogonDomainExists:
1233 return "There is already a logon domain for this computer.";
1234 case NERR_NonValidatedLogon:
1235 return "The logon server could not validate the logon.";
1236 case NERR_ACFNotFound:
1237 return "The security database could not be found.";
1238 case NERR_GroupNotFound:
1239 return "The group name could not be found.";
1240 case NERR_UserNotFound:
1241 return "The user name could not be found.";
1242 case NERR_ResourceNotFound:
1243 return "The resource name could not be found.";
1244 case NERR_GroupExists:
1245 return "The group already exists.";
1246 case NERR_UserExists:
1247 return "The user account already exists.";
1248 case NERR_ResourceExists:
1249 return "The resource permission list already exists.";
1250 case NERR_NotPrimary:
1251 return "This operation is only allowed on the primary domain controller of the domain.";
1252 case NERR_ACFNotLoaded:
1253 return "The security database has not been started.";
1254 case NERR_ACFNoRoom:
1255 return "There are too many names in the user accounts database.";
1256 case NERR_ACFFileIOFail:
1257 return "A disk I/O failure occurred.";
1258 case NERR_ACFTooManyLists:
1259 return "The limit of 64 entries per resource was exceeded.";
1260 case NERR_UserLogon:
1261 return "Deleting a user with a session is not allowed.";
1262 case NERR_ACFNoParent:
1263 return "The parent directory could not be located.";
1264 case NERR_CanNotGrowSegment:
1265 return "Unable to add to the security database session cache segment.";
1266 case NERR_SpeGroupOp:
1267 return "This operation is not allowed on this special group.";
1268 case NERR_NotInCache:
1269 return "This user is not cached in user accounts database session cache.";
1270 case NERR_UserInGroup:
1271 return "The user already belongs to this group.";
1272 case NERR_UserNotInGroup:
1273 return "The user does not belong to this group.";
1274 case NERR_AccountUndefined:
1275 return "This user account is undefined.";
1276 case NERR_AccountExpired:
1277 return "This user account has expired.";
1278 case NERR_InvalidWorkstation:
1279 return "The user is not allowed to log on from this workstation.";
1280 case NERR_InvalidLogonHours:
1281 return "The user is not allowed to log on at this time.";
1282 case NERR_PasswordExpired:
1283 return "The password of this user has expired.";
1284 case NERR_PasswordCantChange:
1285 return "The password of this user cannot change.";
1286 case NERR_PasswordHistConflict:
1287 return "This password cannot be used now.";
1288 case NERR_PasswordTooShort:
1289 return "The password does not meet the password policy requirements. Check the minimum password length, password complexity and password history requirements.";
1290 case NERR_PasswordTooRecent:
1291 return "The password of this user is too recent to change.";
1292 case NERR_InvalidDatabase:
1293 return "The security database is corrupted.";
1294 case NERR_DatabaseUpToDate:
1295 return "No updates are necessary to this replicant network/local security database.";
1296 case NERR_SyncRequired:
1297 return "This replicant database is outdated; synchronization is required.";
1298 case NERR_UseNotFound:
1299 return "The network connection could not be found.";
1300 case NERR_BadAsgType:
1301 return "This asg_type is invalid.";
1302 case NERR_DeviceIsShared:
1303 return "This device is currently being shared.";
1304 case NERR_NoComputerName:
1305 return "The computer name could not be added as a message alias. The name may already exist on the network.";
1306 case NERR_MsgAlreadyStarted:
1307 return "The Messenger service is already started.";
1308 case NERR_MsgInitFailed:
1309 return "The Messenger service failed to start.";
1310 case NERR_NameNotFound:
1311 return "The message alias could not be found on the network.";
1312 case NERR_AlreadyForwarded:
1313 return "This message alias has already been forwarded.";
1314 case NERR_AddForwarded:
1315 return "This message alias has been added but is still forwarded.";
1316 case NERR_AlreadyExists:
1317 return "This message alias already exists locally.";
1318 case NERR_TooManyNames:
1319 return "The maximum number of added message aliases has been exceeded.";
1320 case NERR_DelComputerName:
1321 return "The computer name could not be deleted.";
1322 case NERR_LocalForward:
1323 return "Messages cannot be forwarded back to the same workstation.";
1324 case NERR_GrpMsgProcessor:
1325 return "An error occurred in the domain message processor.";
1326 case NERR_PausedRemote:
1327 return "The message was sent, but the recipient has paused the Messenger service.";
1328 case NERR_BadReceive:
1329 return "The message was sent but not received.";
1330 case NERR_NameInUse:
1331 return "The message alias is currently in use. Try again later.";
1332 case NERR_MsgNotStarted:
1333 return "The Messenger service has not been started.";
1334 case NERR_NotLocalName:
1335 return "The name is not on the local computer.";
1336 case NERR_NoForwardName:
1337 return "The forwarded message alias could not be found on the network.";
1338 case NERR_RemoteFull:
1339 return "The message alias table on the remote station is full.";
1340 case NERR_NameNotForwarded:
1341 return "Messages for this alias are not currently being forwarded.";
1342 case NERR_TruncatedBroadcast:
1343 return "The broadcast message was truncated.";
1344 case NERR_InvalidDevice:
1345 return "This is an invalid device name.";
1346 case NERR_WriteFault:
1347 return "A write fault occurred.";
1348 case NERR_DuplicateName:
1349 return "A duplicate message alias exists on the network.";
1350 case NERR_DeleteLater:
1351 return "@W This message alias will be deleted later.";
1352 case NERR_IncompleteDel:
1353 return "The message alias was not successfully deleted from all networks.";
1354 case NERR_MultipleNets:
1355 return "This operation is not supported on computers with multiple networks.";
1356 case NERR_NetNameNotFound:
1357 return "This shared resource does not exist.";
1358 case NERR_DeviceNotShared:
1359 return "This device is not shared.";
1360 case NERR_ClientNameNotFound:
1361 return "A session does not exist with that computer name.";
1362 case NERR_FileIdNotFound:
1363 return "There is not an open file with that identification number.";
1364 case NERR_ExecFailure:
1365 return "A failure occurred when executing a remote administration command.";
1367 return "A failure occurred when opening a remote temporary file.";
1368 case NERR_TooMuchData:
1369 return "The data returned from a remote administration command has been truncated to 64K.";
1370 case NERR_DeviceShareConflict:
1371 return "This device cannot be shared as both a spooled and a non-spooled resource.";
1372 case NERR_BrowserTableIncomplete:
1373 return "The information in the list of servers may be incorrect.";
1374 case NERR_NotLocalDomain:
1375 return "The computer is not active in this domain.";
1376 #ifdef NERR_IsDfsShare
1378 case NERR_IsDfsShare:
1379 return "The share must be removed from the Distributed File System before it can be deleted.";
1382 case NERR_DevInvalidOpCode:
1383 return "The operation is invalid for this device.";
1384 case NERR_DevNotFound:
1385 return "This device cannot be shared.";
1386 case NERR_DevNotOpen:
1387 return "This device was not open.";
1388 case NERR_BadQueueDevString:
1389 return "This device name list is invalid.";
1390 case NERR_BadQueuePriority:
1391 return "The queue priority is invalid.";
1392 case NERR_NoCommDevs:
1393 return "There are no shared communication devices.";
1394 case NERR_QueueNotFound:
1395 return "The queue you specified does not exist.";
1396 case NERR_BadDevString:
1397 return "This list of devices is invalid.";
1399 return "The requested device is invalid.";
1400 case NERR_InUseBySpooler:
1401 return "This device is already in use by the spooler.";
1402 case NERR_CommDevInUse:
1403 return "This device is already in use as a communication device.";
1404 case NERR_InvalidComputer:
1405 return "This computer name is invalid.";
1406 case NERR_MaxLenExceeded:
1407 return "The string and prefix specified are too long.";
1408 case NERR_BadComponent:
1409 return "This path component is invalid.";
1411 return "Could not determine the type of input.";
1412 case NERR_TooManyEntries:
1413 return "The buffer for types is not big enough.";
1414 case NERR_ProfileFileTooBig:
1415 return "Profile files cannot exceed 64K.";
1416 case NERR_ProfileOffset:
1417 return "The start offset is out of range.";
1418 case NERR_ProfileCleanup:
1419 return "The system cannot delete current connections to network resources.";
1420 case NERR_ProfileUnknownCmd:
1421 return "The system was unable to parse the command line in this file.";
1422 case NERR_ProfileLoadErr:
1423 return "An error occurred while loading the profile file.";
1424 case NERR_ProfileSaveErr:
1425 return "@W Errors occurred while saving the profile file. The profile was partially saved.";
1426 case NERR_LogOverflow:
1427 return "Log file %1 is full.";
1428 case NERR_LogFileChanged:
1429 return "This log file has changed between reads.";
1430 case NERR_LogFileCorrupt:
1431 return "Log file %1 is corrupt.";
1432 case NERR_SourceIsDir:
1433 return "The source path cannot be a directory.";
1434 case NERR_BadSource:
1435 return "The source path is illegal.";
1437 return "The destination path is illegal.";
1438 case NERR_DifferentServers:
1439 return "The source and destination paths are on different servers.";
1440 case NERR_RunSrvPaused:
1441 return "The Run server you requested is paused.";
1442 case NERR_ErrCommRunSrv:
1443 return "An error occurred when communicating with a Run server.";
1444 case NERR_ErrorExecingGhost:
1445 return "An error occurred when starting a background process.";
1446 case NERR_ShareNotFound:
1447 return "The shared resource you are connected to could not be found.";
1448 case NERR_InvalidLana:
1449 return "The LAN adapter number is invalid.";
1450 case NERR_OpenFiles:
1451 return "There are open files on the connection.";
1452 case NERR_ActiveConns:
1453 return "Active connections still exist.";
1454 case NERR_BadPasswordCore:
1455 return "This share name or password is invalid.";
1457 return "The device is being accessed by an active process.";
1458 case NERR_LocalDrive:
1459 return "The drive letter is in use locally.";
1460 case NERR_AlertExists:
1461 return "The specified client is already registered for the specified event.";
1462 case NERR_TooManyAlerts:
1463 return "The alert table is full.";
1464 case NERR_NoSuchAlert:
1465 return "An invalid or nonexistent alert name was raised.";
1466 case NERR_BadRecipient:
1467 return "The alert recipient is invalid.";
1468 case NERR_AcctLimitExceeded:
1469 return "A user's session with this server has been deleted.";
1470 case NERR_InvalidLogSeek:
1471 return "The log file does not contain the requested record number.";
1472 case NERR_BadUasConfig:
1473 return "The user accounts database is not configured correctly.";
1474 case NERR_InvalidUASOp:
1475 return "This operation is not permitted when the Netlogon service is running.";
1476 case NERR_LastAdmin:
1477 return "This operation is not allowed on the last administrative account.";
1478 case NERR_DCNotFound:
1479 return "Could not find domain controller for this domain.";
1480 case NERR_LogonTrackingError:
1481 return "Could not set logon information for this user.";
1482 case NERR_NetlogonNotStarted:
1483 return "The Netlogon service has not been started.";
1484 case NERR_CanNotGrowUASFile:
1485 return "Unable to add to the user accounts database.";
1486 case NERR_TimeDiffAtDC:
1487 return "This server's clock is not synchronized with the primary domain controller's clock.";
1488 case NERR_PasswordMismatch:
1489 return "A password mismatch has been detected.";
1490 case NERR_NoSuchServer:
1491 return "The server identification does not specify a valid server.";
1492 case NERR_NoSuchSession:
1493 return "The session identification does not specify a valid session.";
1494 case NERR_NoSuchConnection:
1495 return "The connection identification does not specify a valid connection.";
1496 case NERR_TooManyServers:
1497 return "There is no space for another entry in the table of available servers.";
1498 case NERR_TooManySessions:
1499 return "The server has reached the maximum number of sessions it supports.";
1500 case NERR_TooManyConnections:
1501 return "The server has reached the maximum number of connections it supports.";
1502 case NERR_TooManyFiles:
1503 return "The server cannot open more files because it has reached its maximum number.";
1504 case NERR_NoAlternateServers:
1505 return "There are no alternate servers registered on this server.";
1506 case NERR_TryDownLevel:
1507 return "Try down-level (remote admin protocol) version of API instead.";
1508 case NERR_UPSDriverNotStarted:
1509 return "The UPS driver could not be accessed by the UPS service.";
1510 case NERR_UPSInvalidConfig:
1511 return "The UPS service is not configured correctly.";
1512 case NERR_UPSInvalidCommPort:
1513 return "The UPS service could not access the specified Comm Port.";
1514 case NERR_UPSSignalAsserted:
1515 return "The UPS indicated a line fail or low battery situation. Service not started.";
1516 case NERR_UPSShutdownFailed:
1517 return "The UPS service failed to perform a system shut down.";
1518 case NERR_BadDosRetCode:
1519 return "The program below returned an MS-DOS error code:";
1520 case NERR_ProgNeedsExtraMem:
1521 return "The program below needs more memory:";
1522 case NERR_BadDosFunction:
1523 return "The program below called an unsupported MS-DOS function:";
1524 case NERR_RemoteBootFailed:
1525 return "The workstation failed to boot.";
1526 case NERR_BadFileCheckSum:
1527 return "The file below is corrupt.";
1528 case NERR_NoRplBootSystem:
1529 return "No loader is specified in the boot-block definition file.";
1530 case NERR_RplLoadrNetBiosErr:
1531 return "NetBIOS returned an error: The NCB and SMB are dumped above.";
1532 case NERR_RplLoadrDiskErr:
1533 return "A disk I/O error occurred.";
1534 case NERR_ImageParamErr:
1535 return "Image parameter substitution failed.";
1536 case NERR_TooManyImageParams:
1537 return "Too many image parameters cross disk sector boundaries.";
1538 case NERR_NonDosFloppyUsed:
1539 return "The image was not generated from an MS-DOS diskette formatted with /S.";
1540 case NERR_RplBootRestart:
1541 return "Remote boot will be restarted later.";
1542 case NERR_RplSrvrCallFailed:
1543 return "The call to the Remoteboot server failed.";
1544 case NERR_CantConnectRplSrvr:
1545 return "Cannot connect to the Remoteboot server.";
1546 case NERR_CantOpenImageFile:
1547 return "Cannot open image file on the Remoteboot server.";
1548 case NERR_CallingRplSrvr:
1549 return "Connecting to the Remoteboot server...";
1550 case NERR_StartingRplBoot:
1551 return "Connecting to the Remoteboot server...";
1552 case NERR_RplBootServiceTerm:
1553 return "Remote boot service was stopped; check the error log for the cause of the problem.";
1554 case NERR_RplBootStartFailed:
1555 return "Remote boot startup failed; check the error log for the cause of the problem.";
1556 case NERR_RPL_CONNECTED:
1557 return "A second connection to a Remoteboot resource is not allowed.";
1558 case NERR_BrowserConfiguredToNotRun:
1559 return "The browser service was configured with MaintainServerList=No.";
1560 case NERR_RplNoAdaptersStarted:
1561 return "Service failed to start since none of the network adapters started with this service.";
1562 case NERR_RplBadRegistry:
1563 return "Service failed to start due to bad startup information in the registry.";
1564 case NERR_RplBadDatabase:
1565 return "Service failed to start because its database is absent or corrupt.";
1566 case NERR_RplRplfilesShare:
1567 return "Service failed to start because RPLFILES share is absent.";
1568 case NERR_RplNotRplServer:
1569 return "Service failed to start because RPLUSER group is absent.";
1570 case NERR_RplCannotEnum:
1571 return "Cannot enumerate service records.";
1572 case NERR_RplWkstaInfoCorrupted:
1573 return "Workstation record information has been corrupted.";
1574 case NERR_RplWkstaNotFound:
1575 return "Workstation record was not found.";
1576 case NERR_RplWkstaNameUnavailable:
1577 return "Workstation name is in use by some other workstation.";
1578 case NERR_RplProfileInfoCorrupted:
1579 return "Profile record information has been corrupted.";
1580 case NERR_RplProfileNotFound:
1581 return "Profile record was not found.";
1582 case NERR_RplProfileNameUnavailable:
1583 return "Profile name is in use by some other profile.";
1584 case NERR_RplProfileNotEmpty:
1585 return "There are workstations using this profile.";
1586 case NERR_RplConfigInfoCorrupted:
1587 return "Configuration record information has been corrupted.";
1588 case NERR_RplConfigNotFound:
1589 return "Configuration record was not found.";
1590 case NERR_RplAdapterInfoCorrupted:
1591 return "Adapter ID record information has been corrupted.";
1592 case NERR_RplInternal:
1593 return "An internal service error has occurred.";
1594 case NERR_RplVendorInfoCorrupted:
1595 return "Vendor ID record information has been corrupted.";
1596 case NERR_RplBootInfoCorrupted:
1597 return "Boot block record information has been corrupted.";
1598 case NERR_RplWkstaNeedsUserAcct:
1599 return "The user account for this workstation record is missing.";
1600 case NERR_RplNeedsRPLUSERAcct:
1601 return "The RPLUSER local group could not be found.";
1602 case NERR_RplBootNotFound:
1603 return "Boot block record was not found.";
1604 case NERR_RplIncompatibleProfile:
1605 return "Chosen profile is incompatible with this workstation.";
1606 case NERR_RplAdapterNameUnavailable:
1607 return "Chosen network adapter ID is in use by some other workstation.";
1608 case NERR_RplConfigNotEmpty:
1609 return "There are profiles using this configuration.";
1610 case NERR_RplBootInUse:
1611 return "There are workstations, profiles, or configurations using this boot block.";
1612 case NERR_RplBackupDatabase:
1613 return "Service failed to backup Remoteboot database.";
1614 case NERR_RplAdapterNotFound:
1615 return "Adapter record was not found.";
1616 case NERR_RplVendorNotFound:
1617 return "Vendor record was not found.";
1618 case NERR_RplVendorNameUnavailable:
1619 return "Vendor name is in use by some other vendor record.";
1620 case NERR_RplBootNameUnavailable:
1621 return "(boot name, vendor ID) is in use by some other boot block record.";
1622 case NERR_RplConfigNameUnavailable:
1623 return "Configuration name is in use by some other configuration.";
1624 case NERR_DfsInternalCorruption:
1625 return "The internal database maintained by the Dfs service is corrupt.";
1626 case NERR_DfsVolumeDataCorrupt:
1627 return "One of the records in the internal Dfs database is corrupt.";
1628 case NERR_DfsNoSuchVolume:
1629 return "There is no DFS name whose entry path matches the input Entry Path.";
1630 case NERR_DfsVolumeAlreadyExists:
1631 return "A root or link with the given name already exists.";
1632 case NERR_DfsAlreadyShared:
1633 return "The server share specified is already shared in the Dfs.";
1634 case NERR_DfsNoSuchShare:
1635 return "The indicated server share does not support the indicated DFS namespace.";
1636 case NERR_DfsNotALeafVolume:
1637 return "The operation is not valid on this portion of the namespace.";
1638 case NERR_DfsLeafVolume:
1639 return "The operation is not valid on this portion of the namespace.";
1640 case NERR_DfsVolumeHasMultipleServers:
1641 return "The operation is ambiguous because the link has multiple servers.";
1642 case NERR_DfsCantCreateJunctionPoint:
1643 return "Unable to create a link.";
1644 case NERR_DfsServerNotDfsAware:
1645 return "The server is not Dfs Aware.";
1646 case NERR_DfsBadRenamePath:
1647 return "The specified rename target path is invalid.";
1648 case NERR_DfsVolumeIsOffline:
1649 return "The specified DFS link is offline.";
1650 case NERR_DfsNoSuchServer:
1651 return "The specified server is not a server for this link.";
1652 case NERR_DfsCyclicalName:
1653 return "A cycle in the Dfs name was detected.";
1654 case NERR_DfsNotSupportedInServerDfs:
1655 return "The operation is not supported on a server-based Dfs.";
1656 case NERR_DfsDuplicateService:
1657 return "This link is already supported by the specified server-share.";
1658 case NERR_DfsCantRemoveLastServerShare:
1659 return "Can't remove the last server-share supporting this root or link.";
1660 case NERR_DfsVolumeIsInterDfs:
1661 return "The operation is not supported for an Inter-DFS link.";
1662 case NERR_DfsInconsistent:
1663 return "The internal state of the Dfs Service has become inconsistent.";
1664 case NERR_DfsServerUpgraded:
1665 return "The Dfs Service has been installed on the specified server.";
1666 case NERR_DfsDataIsIdentical:
1667 return "The Dfs data being reconciled is identical.";
1668 case NERR_DfsCantRemoveDfsRoot:
1669 return "The DFS root cannot be deleted. Uninstall DFS if required.";
1670 case NERR_DfsChildOrParentInDfs:
1671 return "A child or parent directory of the share is already in a Dfs.";
1672 case NERR_DfsInternalError:
1673 return "Dfs internal error.";
1674 /* the following are not defined in mingw */
1677 case NERR_SetupAlreadyJoined:
1678 return "This machine is already joined to a domain.";
1679 case NERR_SetupNotJoined:
1680 return "This machine is not currently joined to a domain.";
1681 case NERR_SetupDomainController:
1682 return "This machine is a domain controller and cannot be unjoined from a domain.";
1683 case NERR_DefaultJoinRequired:
1684 return "The destination domain controller does not support creating machine accounts in OUs.";
1685 case NERR_InvalidWorkgroupName:
1686 return "The specified workgroup name is invalid.";
1687 case NERR_NameUsesIncompatibleCodePage:
1688 return "The specified computer name is incompatible with the default language used on the domain controller.";
1689 case NERR_ComputerAccountNotFound:
1690 return "The specified computer account could not be found.";
1691 case NERR_PersonalSku:
1692 return "This version of Windows cannot be joined to a domain.";
1693 case NERR_PasswordMustChange:
1694 return "The password must change at the next logon.";
1695 case NERR_AccountLockedOut:
1696 return "The account is locked out.";
1697 case NERR_PasswordTooLong:
1698 return "The password is too long.";
1699 case NERR_PasswordNotComplexEnough:
1700 return "The password does not meet the complexity policy.";
1701 case NERR_PasswordFilterError:
1702 return "The password does not meet the requirements of the password filter DLLs.";
1706 msg = strerror (error_number);