D-Bus  1.4.18
dbus-sysdeps-util-win.c
00001 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
00002 /* dbus-sysdeps-util.c Would be in dbus-sysdeps.c, but not used in libdbus
00003  * 
00004  * Copyright (C) 2002, 2003, 2004, 2005  Red Hat, Inc.
00005  * Copyright (C) 2003 CodeFactory AB
00006  *
00007  * Licensed under the Academic Free License version 2.1
00008  * 
00009  * This program is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  * 
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00022  *
00023  */
00024 
00025 #include <config.h>
00026 
00027 #define STRSAFE_NO_DEPRECATE
00028 
00029 #include "dbus-sysdeps.h"
00030 #include "dbus-internals.h"
00031 #include "dbus-protocol.h"
00032 #include "dbus-string.h"
00033 #include "dbus-sysdeps.h"
00034 #include "dbus-sysdeps-win.h"
00035 #include "dbus-sockets-win.h"
00036 #include "dbus-memory.h"
00037 #include "dbus-pipe.h"
00038 
00039 #include <stdio.h>
00040 #include <stdlib.h>
00041 #if HAVE_ERRNO_H
00042 #include <errno.h>
00043 #endif
00044 #include <winsock2.h>   // WSA error codes
00045 
00046 #ifndef DBUS_WINCE
00047 #include <io.h>
00048 #include <lm.h>
00049 #include <sys/stat.h>
00050 #endif
00051 
00052 
00062 dbus_bool_t
00063 _dbus_become_daemon (const DBusString *pidfile,
00064                      DBusPipe         *print_pid_pipe,
00065                      DBusError        *error,
00066                      dbus_bool_t       keep_umask)
00067 {
00068   return TRUE;
00069 }
00070 
00079 static dbus_bool_t
00080 _dbus_write_pid_file (const DBusString *filename,
00081                       unsigned long     pid,
00082                       DBusError        *error)
00083 {
00084   const char *cfilename;
00085   HANDLE hnd;
00086   char pidstr[20];
00087   int total;
00088   int bytes_to_write;
00089 
00090   _DBUS_ASSERT_ERROR_IS_CLEAR (error);
00091 
00092   cfilename = _dbus_string_get_const_data (filename);
00093 
00094   hnd = CreateFileA (cfilename, GENERIC_WRITE,
00095                      FILE_SHARE_READ | FILE_SHARE_WRITE,
00096                      NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL,
00097                      INVALID_HANDLE_VALUE);
00098   if (hnd == INVALID_HANDLE_VALUE)
00099     {
00100       char *emsg = _dbus_win_error_string (GetLastError ());
00101       dbus_set_error (error, _dbus_win_error_from_last_error (),
00102                       "Could not create PID file %s: %s",
00103                       cfilename, emsg);
00104       _dbus_win_free_error_string (emsg);
00105       return FALSE;
00106     }
00107 
00108   if (snprintf (pidstr, sizeof (pidstr), "%lu\n", pid) < 0)
00109     {
00110       dbus_set_error (error, _dbus_error_from_system_errno (),
00111                       "Failed to format PID for \"%s\": %s", cfilename,
00112                       _dbus_strerror_from_errno ());
00113       CloseHandle (hnd);
00114       return FALSE;
00115     }
00116 
00117   total = 0;
00118   bytes_to_write = strlen (pidstr);;
00119 
00120   while (total < bytes_to_write)
00121     {
00122       DWORD bytes_written;
00123       BOOL res;
00124 
00125       res = WriteFile (hnd, pidstr + total, bytes_to_write - total,
00126                        &bytes_written, NULL);
00127 
00128       if (res == 0 || bytes_written <= 0)
00129         {
00130           char *emsg = _dbus_win_error_string (GetLastError ());
00131           dbus_set_error (error, _dbus_win_error_from_last_error (),
00132                            "Could not write to %s: %s", cfilename, emsg);
00133           _dbus_win_free_error_string (emsg);
00134           CloseHandle (hnd);
00135           return FALSE;
00136         }
00137 
00138       total += bytes_written;
00139     }
00140 
00141   if (CloseHandle (hnd) == 0)
00142     {
00143       char *emsg = _dbus_win_error_string (GetLastError ());
00144       dbus_set_error (error, _dbus_win_error_from_last_error (),
00145                        "Could not close file %s: %s",
00146                       cfilename, emsg);
00147       _dbus_win_free_error_string (emsg);
00148 
00149       return FALSE;
00150     }
00151 
00152   return TRUE;
00153 }
00154 
00166 dbus_bool_t
00167 _dbus_write_pid_to_file_and_pipe (const DBusString *pidfile,
00168                                   DBusPipe         *print_pid_pipe,
00169                                   dbus_pid_t        pid_to_write,
00170                                   DBusError        *error)
00171 {
00172   if (pidfile)
00173     {
00174       _dbus_verbose ("writing pid file %s\n", _dbus_string_get_const_data (pidfile));
00175       if (!_dbus_write_pid_file (pidfile,
00176                                  pid_to_write,
00177                                  error))
00178         {
00179           _dbus_verbose ("pid file write failed\n");
00180           _DBUS_ASSERT_ERROR_IS_SET(error);
00181           return FALSE;
00182         }
00183     }
00184   else
00185     {
00186       _dbus_verbose ("No pid file requested\n");
00187     }
00188 
00189   if (print_pid_pipe != NULL && _dbus_pipe_is_valid (print_pid_pipe))
00190     {
00191       DBusString pid;
00192       int bytes;
00193 
00194       _dbus_verbose ("writing our pid to pipe %d\n", print_pid_pipe->fd_or_handle);
00195 
00196       if (!_dbus_string_init (&pid))
00197         {
00198           _DBUS_SET_OOM (error);
00199           return FALSE;
00200         }
00201 
00202       if (!_dbus_string_append_int (&pid, pid_to_write) ||
00203           !_dbus_string_append (&pid, "\n"))
00204         {
00205           _dbus_string_free (&pid);
00206           _DBUS_SET_OOM (error);
00207           return FALSE;
00208         }
00209 
00210       bytes = _dbus_string_get_length (&pid);
00211       if (_dbus_pipe_write (print_pid_pipe, &pid, 0, bytes, error) != bytes)
00212         {
00213           /* _dbus_pipe_write sets error only on failure, not short write */
00214           if (error != NULL && !dbus_error_is_set(error))
00215             {
00216               dbus_set_error (error, DBUS_ERROR_FAILED,
00217                               "Printing message bus PID: did not write enough bytes\n");
00218             }
00219           _dbus_string_free (&pid);
00220           return FALSE;
00221         }
00222 
00223       _dbus_string_free (&pid);
00224     }
00225   else
00226     {
00227       _dbus_verbose ("No pid pipe to write to\n");
00228     }
00229 
00230   return TRUE;
00231 }
00232 
00239 dbus_bool_t
00240 _dbus_verify_daemon_user (const char *user)
00241 {
00242   return TRUE;
00243 }
00244 
00252 dbus_bool_t
00253 _dbus_change_to_daemon_user  (const char    *user,
00254                               DBusError     *error)
00255 {
00256   return TRUE;
00257 }
00258 
00259 static void
00260 fd_limit_not_supported (DBusError *error)
00261 {
00262   dbus_set_error (error, DBUS_ERROR_NOT_SUPPORTED,
00263                   "cannot change fd limit on this platform");
00264 }
00265 
00266 DBusRLimit *
00267 _dbus_rlimit_save_fd_limit (DBusError *error)
00268 {
00269   fd_limit_not_supported (error);
00270   return NULL;
00271 }
00272 
00273 dbus_bool_t
00274 _dbus_rlimit_raise_fd_limit_if_privileged (unsigned int  desired,
00275                                            DBusError    *error)
00276 {
00277   fd_limit_not_supported (error);
00278   return FALSE;
00279 }
00280 
00281 dbus_bool_t
00282 _dbus_rlimit_restore_fd_limit (DBusRLimit *saved,
00283                                DBusError  *error)
00284 {
00285   fd_limit_not_supported (error);
00286   return FALSE;
00287 }
00288 
00289 void
00290 _dbus_rlimit_free (DBusRLimit *lim)
00291 {
00292   /* _dbus_rlimit_save_fd_limit() cannot return non-NULL on Windows
00293    * so there cannot be anything to free */
00294   _dbus_assert (lim == NULL);
00295 }
00296 
00297 void
00298 _dbus_init_system_log (void)
00299 {
00300   /* OutputDebugStringA doesn't need any special initialization, do nothing */
00301 }
00302 
00311 void
00312 _dbus_system_log (DBusSystemLogSeverity severity, const char *msg, ...)
00313 {
00314   va_list args;
00315 
00316   va_start (args, msg);
00317 
00318   _dbus_system_logv (severity, msg, args);
00319 
00320   va_end (args);
00321 }
00322 
00333 void
00334 _dbus_system_logv (DBusSystemLogSeverity severity, const char *msg, va_list args)
00335 {
00336   char *s = "";
00337   char buf[1024];
00338   
00339   switch(severity) 
00340    {
00341      case DBUS_SYSTEM_LOG_INFO: s = "info"; break;
00342      case DBUS_SYSTEM_LOG_SECURITY: s = "security"; break;
00343      case DBUS_SYSTEM_LOG_FATAL: s = "fatal"; break;
00344    }
00345    
00346   sprintf(buf,"%s%s",s,msg);
00347   vsprintf(buf,buf,args);
00348   OutputDebugStringA(buf);
00349   
00350   if (severity == DBUS_SYSTEM_LOG_FATAL)
00351     exit (1);
00352 }
00353 
00359 void
00360 _dbus_set_signal_handler (int               sig,
00361                           DBusSignalHandler handler)
00362 {
00363   _dbus_verbose ("_dbus_set_signal_handler() has to be implemented\n");
00364 }
00365 
00374 dbus_bool_t
00375 _dbus_stat(const DBusString *filename,
00376            DBusStat         *statbuf,
00377            DBusError        *error)
00378 {
00379   const char *filename_c;
00380   WIN32_FILE_ATTRIBUTE_DATA wfad;
00381   char *lastdot;
00382   DWORD rc;
00383 
00384   _DBUS_ASSERT_ERROR_IS_CLEAR (error);
00385 
00386   filename_c = _dbus_string_get_const_data (filename);
00387 
00388   if (!GetFileAttributesExA (filename_c, GetFileExInfoStandard, &wfad))
00389     {
00390       _dbus_win_set_error_from_win_error (error, GetLastError ());
00391       return FALSE;
00392     }
00393 
00394   if (wfad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
00395     statbuf->mode = _S_IFDIR;
00396   else
00397     statbuf->mode = _S_IFREG;
00398 
00399   statbuf->mode |= _S_IREAD;
00400   if (wfad.dwFileAttributes & FILE_ATTRIBUTE_READONLY)
00401     statbuf->mode |= _S_IWRITE;
00402 
00403   lastdot = strrchr (filename_c, '.');
00404   if (lastdot && stricmp (lastdot, ".exe") == 0)
00405     statbuf->mode |= _S_IEXEC;
00406 
00407   statbuf->mode |= (statbuf->mode & 0700) >> 3;
00408   statbuf->mode |= (statbuf->mode & 0700) >> 6;
00409 
00410   statbuf->nlink = 1;
00411 
00412 #ifdef ENABLE_UID_TO_SID
00413   {
00414     PSID owner_sid, group_sid;
00415     PSECURITY_DESCRIPTOR sd;
00416 
00417     sd = NULL;
00418     rc = GetNamedSecurityInfo ((char *) filename_c, SE_FILE_OBJECT,
00419                                OWNER_SECURITY_INFORMATION |
00420                                GROUP_SECURITY_INFORMATION,
00421                                &owner_sid, &group_sid,
00422                                NULL, NULL,
00423                                &sd);
00424     if (rc != ERROR_SUCCESS)
00425       {
00426         _dbus_win_set_error_from_win_error (error, rc);
00427         if (sd != NULL)
00428           LocalFree (sd);
00429         return FALSE;
00430       }
00431     
00432     /* FIXME */
00433     statbuf->uid = _dbus_win_sid_to_uid_t (owner_sid);
00434     statbuf->gid = _dbus_win_sid_to_uid_t (group_sid);
00435 
00436     LocalFree (sd);
00437   }
00438 #else
00439   statbuf->uid = DBUS_UID_UNSET;
00440   statbuf->gid = DBUS_GID_UNSET;
00441 #endif
00442 
00443   statbuf->size = ((dbus_int64_t) wfad.nFileSizeHigh << 32) + wfad.nFileSizeLow;
00444 
00445   statbuf->atime =
00446     (((dbus_int64_t) wfad.ftLastAccessTime.dwHighDateTime << 32) +
00447      wfad.ftLastAccessTime.dwLowDateTime) / 10000000 - DBUS_INT64_CONSTANT (116444736000000000);
00448 
00449   statbuf->mtime =
00450     (((dbus_int64_t) wfad.ftLastWriteTime.dwHighDateTime << 32) +
00451      wfad.ftLastWriteTime.dwLowDateTime) / 10000000 - DBUS_INT64_CONSTANT (116444736000000000);
00452 
00453   statbuf->ctime =
00454     (((dbus_int64_t) wfad.ftCreationTime.dwHighDateTime << 32) +
00455      wfad.ftCreationTime.dwLowDateTime) / 10000000 - DBUS_INT64_CONSTANT (116444736000000000);
00456 
00457   return TRUE;
00458 }
00459 
00460 
00461 /* This file is part of the KDE project
00462 Copyright (C) 2000 Werner Almesberger
00463 
00464 libc/sys/linux/sys/dirent.h - Directory entry as returned by readdir
00465 
00466 This program is free software; you can redistribute it and/or
00467 modify it under the terms of the GNU Library General Public
00468 License as published by the Free Software Foundation; either
00469 version 2 of the License, or (at your option) any later version.
00470 
00471 This program is distributed in the hope that it will be useful,
00472 but WITHOUT ANY WARRANTY; without even the implied warranty of
00473 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00474 Library General Public License for more details.
00475 
00476 You should have received a copy of the GNU Library General Public License
00477 along with this program; see the file COPYING.  If not, write to
00478 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00479 Boston, MA 02110-1301, USA.
00480 */
00481 #define HAVE_NO_D_NAMLEN        /* no struct dirent->d_namlen */
00482 #define HAVE_DD_LOCK            /* have locking mechanism */
00483 
00484 #define MAXNAMLEN 255           /* sizeof(struct dirent.d_name)-1 */
00485 
00486 #define __dirfd(dir) (dir)->dd_fd
00487 
00488 /* struct dirent - same as Unix */
00489 struct dirent
00490   {
00491     long d_ino;                    /* inode (always 1 in WIN32) */
00492     off_t d_off;                /* offset to this dirent */
00493     unsigned short d_reclen;    /* length of d_name */
00494     char d_name[_MAX_FNAME+1];    /* filename (null terminated) */
00495   };
00496 
00497 /* typedef DIR - not the same as Unix */
00498 typedef struct
00499   {
00500     HANDLE handle;              /* FindFirst/FindNext handle */
00501     short offset;               /* offset into directory */
00502     short finished;             /* 1 if there are not more files */
00503     WIN32_FIND_DATAA fileinfo;  /* from FindFirst/FindNext */
00504     char *dir;                  /* the dir we are reading */
00505     struct dirent dent;         /* the dirent to return */
00506   }
00507 DIR;
00508 
00509 /**********************************************************************
00510 * Implement dirent-style opendir/readdir/closedir on Window 95/NT
00511 *
00512 * Functions defined are opendir(), readdir() and closedir() with the
00513 * same prototypes as the normal dirent.h implementation.
00514 *
00515 * Does not implement telldir(), seekdir(), rewinddir() or scandir().
00516 * The dirent struct is compatible with Unix, except that d_ino is
00517 * always 1 and d_off is made up as we go along.
00518 *
00519 * Error codes are not available with errno but GetLastError.
00520 *
00521 * The DIR typedef is not compatible with Unix.
00522 **********************************************************************/
00523 
00524 static DIR * _dbus_opendir(const char *dir)
00525 {
00526   DIR *dp;
00527   char *filespec;
00528   HANDLE handle;
00529   int index;
00530 
00531   filespec = malloc(strlen(dir) + 2 + 1);
00532   strcpy(filespec, dir);
00533   index = strlen(filespec) - 1;
00534   if (index >= 0 && (filespec[index] == '/' || filespec[index] == '\\'))
00535     filespec[index] = '\0';
00536   strcat(filespec, "\\*");
00537 
00538   dp = (DIR *)malloc(sizeof(DIR));
00539   dp->offset = 0;
00540   dp->finished = 0;
00541   dp->dir = strdup(dir);
00542 
00543   handle = FindFirstFileA(filespec, &(dp->fileinfo));
00544   if (handle == INVALID_HANDLE_VALUE)
00545     {
00546       if (GetLastError() == ERROR_NO_MORE_FILES)
00547         dp->finished = 1;
00548       else
00549         return NULL;
00550     }
00551 
00552   dp->handle = handle;
00553   free(filespec);
00554 
00555   return dp;
00556 }
00557 
00558 static struct dirent * _dbus_readdir(DIR *dp)
00559 {
00560   int saved_err = GetLastError();
00561 
00562   if (!dp || dp->finished)
00563     return NULL;
00564 
00565   if (dp->offset != 0)
00566     {
00567       if (FindNextFileA(dp->handle, &(dp->fileinfo)) == 0)
00568         {
00569           if (GetLastError() == ERROR_NO_MORE_FILES)
00570             {
00571               SetLastError(saved_err);
00572               dp->finished = 1;
00573             }
00574           return NULL;
00575         }
00576     }
00577   dp->offset++;
00578   
00579   strncpy(dp->dent.d_name, dp->fileinfo.cFileName, _MAX_FNAME);
00580   dp->dent.d_ino = 1;
00581   dp->dent.d_reclen = strlen(dp->dent.d_name);
00582   dp->dent.d_off = dp->offset;
00583   
00584   return &(dp->dent);
00585 }
00586 
00587 
00588 static int _dbus_closedir(DIR *dp)
00589 {
00590   if (!dp)
00591     return 0;
00592   FindClose(dp->handle);
00593   if (dp->dir)
00594     free(dp->dir);
00595   if (dp)
00596     free(dp);
00597 
00598   return 0;
00599 }
00600 
00601 
00605 struct DBusDirIter
00606   {
00607     DIR *d; 
00609   };
00610 
00618 DBusDirIter*
00619 _dbus_directory_open (const DBusString *filename,
00620                       DBusError        *error)
00621 {
00622   DIR *d;
00623   DBusDirIter *iter;
00624   const char *filename_c;
00625 
00626   _DBUS_ASSERT_ERROR_IS_CLEAR (error);
00627 
00628   filename_c = _dbus_string_get_const_data (filename);
00629 
00630   d = _dbus_opendir (filename_c);
00631   if (d == NULL)
00632     {
00633       char *emsg = _dbus_win_error_string (GetLastError ());
00634       dbus_set_error (error, _dbus_win_error_from_last_error (),
00635                       "Failed to read directory \"%s\": %s",
00636                       filename_c, emsg);
00637       _dbus_win_free_error_string (emsg);
00638       return NULL;
00639     }
00640   iter = dbus_new0 (DBusDirIter, 1);
00641   if (iter == NULL)
00642     {
00643       _dbus_closedir (d);
00644       dbus_set_error (error, DBUS_ERROR_NO_MEMORY,
00645                       "Could not allocate memory for directory iterator");
00646       return NULL;
00647     }
00648 
00649   iter->d = d;
00650 
00651   return iter;
00652 }
00653 
00667 dbus_bool_t
00668 _dbus_directory_get_next_file (DBusDirIter      *iter,
00669                                DBusString       *filename,
00670                                DBusError        *error)
00671 {
00672   struct dirent *ent;
00673 
00674   _DBUS_ASSERT_ERROR_IS_CLEAR (error);
00675 
00676 again:
00677   SetLastError (0);
00678   ent = _dbus_readdir (iter->d);
00679   if (ent == NULL)
00680     {
00681       if (GetLastError() != 0)
00682         {
00683           char *emsg = _dbus_win_error_string (GetLastError ());
00684           dbus_set_error (error, _dbus_win_error_from_last_error (),
00685                           "Failed to get next in directory: %s", emsg);
00686           _dbus_win_free_error_string (emsg);
00687         }
00688       return FALSE;
00689     }
00690   else if (ent->d_name[0] == '.' &&
00691            (ent->d_name[1] == '\0' ||
00692             (ent->d_name[1] == '.' && ent->d_name[2] == '\0')))
00693     goto again;
00694   else
00695     {
00696       _dbus_string_set_length (filename, 0);
00697       if (!_dbus_string_append (filename, ent->d_name))
00698         {
00699           dbus_set_error (error, DBUS_ERROR_NO_MEMORY,
00700                           "No memory to read directory entry");
00701           return FALSE;
00702         }
00703       else
00704         return TRUE;
00705     }
00706 }
00707 
00711 void
00712 _dbus_directory_close (DBusDirIter *iter)
00713 {
00714   _dbus_closedir (iter->d);
00715   dbus_free (iter);
00716 }
00717  /* End of DBusInternalsUtils functions */
00719 
00731 dbus_bool_t
00732 _dbus_string_get_dirname(const DBusString *filename,
00733                          DBusString       *dirname)
00734 {
00735   int sep;
00736 
00737   _dbus_assert (filename != dirname);
00738   _dbus_assert (filename != NULL);
00739   _dbus_assert (dirname != NULL);
00740 
00741   /* Ignore any separators on the end */
00742   sep = _dbus_string_get_length (filename);
00743   if (sep == 0)
00744     return _dbus_string_append (dirname, "."); /* empty string passed in */
00745 
00746   while (sep > 0 &&
00747          (_dbus_string_get_byte (filename, sep - 1) == '/' ||
00748           _dbus_string_get_byte (filename, sep - 1) == '\\'))
00749     --sep;
00750 
00751   _dbus_assert (sep >= 0);
00752 
00753   if (sep == 0 ||
00754       (sep == 2 &&
00755        _dbus_string_get_byte (filename, 1) == ':' &&
00756        isalpha (_dbus_string_get_byte (filename, 0))))
00757     return _dbus_string_copy_len (filename, 0, sep + 1,
00758                                   dirname, _dbus_string_get_length (dirname));
00759 
00760   {
00761     int sep1, sep2;
00762     _dbus_string_find_byte_backward (filename, sep, '/', &sep1);
00763     _dbus_string_find_byte_backward (filename, sep, '\\', &sep2);
00764 
00765     sep = MAX (sep1, sep2);
00766   }
00767   if (sep < 0)
00768     return _dbus_string_append (dirname, ".");
00769 
00770   while (sep > 0 &&
00771          (_dbus_string_get_byte (filename, sep - 1) == '/' ||
00772           _dbus_string_get_byte (filename, sep - 1) == '\\'))
00773     --sep;
00774 
00775   _dbus_assert (sep >= 0);
00776 
00777   if ((sep == 0 ||
00778        (sep == 2 &&
00779         _dbus_string_get_byte (filename, 1) == ':' &&
00780         isalpha (_dbus_string_get_byte (filename, 0))))
00781       &&
00782       (_dbus_string_get_byte (filename, sep) == '/' ||
00783        _dbus_string_get_byte (filename, sep) == '\\'))
00784     return _dbus_string_copy_len (filename, 0, sep + 1,
00785                                   dirname, _dbus_string_get_length (dirname));
00786   else
00787     return _dbus_string_copy_len (filename, 0, sep - 0,
00788                                   dirname, _dbus_string_get_length (dirname));
00789 }
00790 
00791 
00799 dbus_bool_t
00800 _dbus_unix_user_is_process_owner (dbus_uid_t uid)
00801 {
00802   return FALSE;
00803 }
00804 
00805 dbus_bool_t _dbus_windows_user_is_process_owner (const char *windows_sid)
00806 {
00807   return TRUE;
00808 }
00809 
00810 /*=====================================================================
00811   unix emulation functions - should be removed sometime in the future
00812  =====================================================================*/
00813 
00823 dbus_bool_t
00824 _dbus_unix_user_is_at_console (dbus_uid_t         uid,
00825                                DBusError         *error)
00826 {
00827   dbus_set_error (error, DBUS_ERROR_NOT_SUPPORTED,
00828                   "UNIX user IDs not supported on Windows\n");
00829   return FALSE;
00830 }
00831 
00832 
00841 dbus_bool_t
00842 _dbus_parse_unix_group_from_config (const DBusString  *groupname,
00843                                     dbus_gid_t        *gid_p)
00844 {
00845   return FALSE;
00846 }
00847 
00856 dbus_bool_t
00857 _dbus_parse_unix_user_from_config (const DBusString  *username,
00858                                    dbus_uid_t        *uid_p)
00859 {
00860   return FALSE;
00861 }
00862 
00863 
00874 dbus_bool_t
00875 _dbus_unix_groups_from_uid (dbus_uid_t            uid,
00876                             dbus_gid_t          **group_ids,
00877                             int                  *n_group_ids)
00878 {
00879   return FALSE;
00880 }
00881 
00882 
00883  /* DBusString stuff */
00885 
00886 /************************************************************************
00887  
00888  error handling
00889  
00890  ************************************************************************/
00891 
00892 
00893 
00894 
00895 
00896 /* lan manager error codes */
00897 const char*
00898 _dbus_lm_strerror(int error_number)
00899 {
00900 #ifdef DBUS_WINCE
00901   // TODO
00902   return "unknown";
00903 #else
00904   const char *msg;
00905   switch (error_number)
00906     {
00907     case NERR_NetNotStarted:
00908       return "The workstation driver is not installed.";
00909     case NERR_UnknownServer:
00910       return "The server could not be located.";
00911     case NERR_ShareMem:
00912       return "An internal error occurred. The network cannot access a shared memory segment.";
00913     case NERR_NoNetworkResource:
00914       return "A network resource shortage occurred.";
00915     case NERR_RemoteOnly:
00916       return "This operation is not supported on workstations.";
00917     case NERR_DevNotRedirected:
00918       return "The device is not connected.";
00919     case NERR_ServerNotStarted:
00920       return "The Server service is not started.";
00921     case NERR_ItemNotFound:
00922       return "The queue is empty.";
00923     case NERR_UnknownDevDir:
00924       return "The device or directory does not exist.";
00925     case NERR_RedirectedPath:
00926       return "The operation is invalid on a redirected resource.";
00927     case NERR_DuplicateShare:
00928       return "The name has already been shared.";
00929     case NERR_NoRoom:
00930       return "The server is currently out of the requested resource.";
00931     case NERR_TooManyItems:
00932       return "Requested addition of items exceeds the maximum allowed.";
00933     case NERR_InvalidMaxUsers:
00934       return "The Peer service supports only two simultaneous users.";
00935     case NERR_BufTooSmall:
00936       return "The API return buffer is too small.";
00937     case NERR_RemoteErr:
00938       return "A remote API error occurred.";
00939     case NERR_LanmanIniError:
00940       return "An error occurred when opening or reading the configuration file.";
00941     case NERR_NetworkError:
00942       return "A general network error occurred.";
00943     case NERR_WkstaInconsistentState:
00944       return "The Workstation service is in an inconsistent state. Restart the computer before restarting the Workstation service.";
00945     case NERR_WkstaNotStarted:
00946       return "The Workstation service has not been started.";
00947     case NERR_BrowserNotStarted:
00948       return "The requested information is not available.";
00949     case NERR_InternalError:
00950       return "An internal error occurred.";
00951     case NERR_BadTransactConfig:
00952       return "The server is not configured for transactions.";
00953     case NERR_InvalidAPI:
00954       return "The requested API is not supported on the remote server.";
00955     case NERR_BadEventName:
00956       return "The event name is invalid.";
00957     case NERR_DupNameReboot:
00958       return "The computer name already exists on the network. Change it and restart the computer.";
00959     case NERR_CfgCompNotFound:
00960       return "The specified component could not be found in the configuration information.";
00961     case NERR_CfgParamNotFound:
00962       return "The specified parameter could not be found in the configuration information.";
00963     case NERR_LineTooLong:
00964       return "A line in the configuration file is too long.";
00965     case NERR_QNotFound:
00966       return "The printer does not exist.";
00967     case NERR_JobNotFound:
00968       return "The print job does not exist.";
00969     case NERR_DestNotFound:
00970       return "The printer destination cannot be found.";
00971     case NERR_DestExists:
00972       return "The printer destination already exists.";
00973     case NERR_QExists:
00974       return "The printer queue already exists.";
00975     case NERR_QNoRoom:
00976       return "No more printers can be added.";
00977     case NERR_JobNoRoom:
00978       return "No more print jobs can be added.";
00979     case NERR_DestNoRoom:
00980       return "No more printer destinations can be added.";
00981     case NERR_DestIdle:
00982       return "This printer destination is idle and cannot accept control operations.";
00983     case NERR_DestInvalidOp:
00984       return "This printer destination request contains an invalid control function.";
00985     case NERR_ProcNoRespond:
00986       return "The print processor is not responding.";
00987     case NERR_SpoolerNotLoaded:
00988       return "The spooler is not running.";
00989     case NERR_DestInvalidState:
00990       return "This operation cannot be performed on the print destination in its current state.";
00991     case NERR_QInvalidState:
00992       return "This operation cannot be performed on the printer queue in its current state.";
00993     case NERR_JobInvalidState:
00994       return "This operation cannot be performed on the print job in its current state.";
00995     case NERR_SpoolNoMemory:
00996       return "A spooler memory allocation failure occurred.";
00997     case NERR_DriverNotFound:
00998       return "The device driver does not exist.";
00999     case NERR_DataTypeInvalid:
01000       return "The data type is not supported by the print processor.";
01001     case NERR_ProcNotFound:
01002       return "The print processor is not installed.";
01003     case NERR_ServiceTableLocked:
01004       return "The service database is locked.";
01005     case NERR_ServiceTableFull:
01006       return "The service table is full.";
01007     case NERR_ServiceInstalled:
01008       return "The requested service has already been started.";
01009     case NERR_ServiceEntryLocked:
01010       return "The service does not respond to control actions.";
01011     case NERR_ServiceNotInstalled:
01012       return "The service has not been started.";
01013     case NERR_BadServiceName:
01014       return "The service name is invalid.";
01015     case NERR_ServiceCtlTimeout:
01016       return "The service is not responding to the control function.";
01017     case NERR_ServiceCtlBusy:
01018       return "The service control is busy.";
01019     case NERR_BadServiceProgName:
01020       return "The configuration file contains an invalid service program name.";
01021     case NERR_ServiceNotCtrl:
01022       return "The service could not be controlled in its present state.";
01023     case NERR_ServiceKillProc:
01024       return "The service ended abnormally.";
01025     case NERR_ServiceCtlNotValid:
01026       return "The requested pause or stop is not valid for this service.";
01027     case NERR_NotInDispatchTbl:
01028       return "The service control dispatcher could not find the service name in the dispatch table.";
01029     case NERR_BadControlRecv:
01030       return "The service control dispatcher pipe read failed.";
01031     case NERR_ServiceNotStarting:
01032       return "A thread for the new service could not be created.";
01033     case NERR_AlreadyLoggedOn:
01034       return "This workstation is already logged on to the local-area network.";
01035     case NERR_NotLoggedOn:
01036       return "The workstation is not logged on to the local-area network.";
01037     case NERR_BadUsername:
01038       return "The user name or group name parameter is invalid.";
01039     case NERR_BadPassword:
01040       return "The password parameter is invalid.";
01041     case NERR_UnableToAddName_W:
01042       return "@W The logon processor did not add the message alias.";
01043     case NERR_UnableToAddName_F:
01044       return "The logon processor did not add the message alias.";
01045     case NERR_UnableToDelName_W:
01046       return "@W The logoff processor did not delete the message alias.";
01047     case NERR_UnableToDelName_F:
01048       return "The logoff processor did not delete the message alias.";
01049     case NERR_LogonsPaused:
01050       return "Network logons are paused.";
01051     case NERR_LogonServerConflict:
01052       return "A centralized logon-server conflict occurred.";
01053     case NERR_LogonNoUserPath:
01054       return "The server is configured without a valid user path.";
01055     case NERR_LogonScriptError:
01056       return "An error occurred while loading or running the logon script.";
01057     case NERR_StandaloneLogon:
01058       return "The logon server was not specified. Your computer will be logged on as STANDALONE.";
01059     case NERR_LogonServerNotFound:
01060       return "The logon server could not be found.";
01061     case NERR_LogonDomainExists:
01062       return "There is already a logon domain for this computer.";
01063     case NERR_NonValidatedLogon:
01064       return "The logon server could not validate the logon.";
01065     case NERR_ACFNotFound:
01066       return "The security database could not be found.";
01067     case NERR_GroupNotFound:
01068       return "The group name could not be found.";
01069     case NERR_UserNotFound:
01070       return "The user name could not be found.";
01071     case NERR_ResourceNotFound:
01072       return "The resource name could not be found.";
01073     case NERR_GroupExists:
01074       return "The group already exists.";
01075     case NERR_UserExists:
01076       return "The user account already exists.";
01077     case NERR_ResourceExists:
01078       return "The resource permission list already exists.";
01079     case NERR_NotPrimary:
01080       return "This operation is only allowed on the primary domain controller of the domain.";
01081     case NERR_ACFNotLoaded:
01082       return "The security database has not been started.";
01083     case NERR_ACFNoRoom:
01084       return "There are too many names in the user accounts database.";
01085     case NERR_ACFFileIOFail:
01086       return "A disk I/O failure occurred.";
01087     case NERR_ACFTooManyLists:
01088       return "The limit of 64 entries per resource was exceeded.";
01089     case NERR_UserLogon:
01090       return "Deleting a user with a session is not allowed.";
01091     case NERR_ACFNoParent:
01092       return "The parent directory could not be located.";
01093     case NERR_CanNotGrowSegment:
01094       return "Unable to add to the security database session cache segment.";
01095     case NERR_SpeGroupOp:
01096       return "This operation is not allowed on this special group.";
01097     case NERR_NotInCache:
01098       return "This user is not cached in user accounts database session cache.";
01099     case NERR_UserInGroup:
01100       return "The user already belongs to this group.";
01101     case NERR_UserNotInGroup:
01102       return "The user does not belong to this group.";
01103     case NERR_AccountUndefined:
01104       return "This user account is undefined.";
01105     case NERR_AccountExpired:
01106       return "This user account has expired.";
01107     case NERR_InvalidWorkstation:
01108       return "The user is not allowed to log on from this workstation.";
01109     case NERR_InvalidLogonHours:
01110       return "The user is not allowed to log on at this time.";
01111     case NERR_PasswordExpired:
01112       return "The password of this user has expired.";
01113     case NERR_PasswordCantChange:
01114       return "The password of this user cannot change.";
01115     case NERR_PasswordHistConflict:
01116       return "This password cannot be used now.";
01117     case NERR_PasswordTooShort:
01118       return "The password does not meet the password policy requirements. Check the minimum password length, password complexity and password history requirements.";
01119     case NERR_PasswordTooRecent:
01120       return "The password of this user is too recent to change.";
01121     case NERR_InvalidDatabase:
01122       return "The security database is corrupted.";
01123     case NERR_DatabaseUpToDate:
01124       return "No updates are necessary to this replicant network/local security database.";
01125     case NERR_SyncRequired:
01126       return "This replicant database is outdated; synchronization is required.";
01127     case NERR_UseNotFound:
01128       return "The network connection could not be found.";
01129     case NERR_BadAsgType:
01130       return "This asg_type is invalid.";
01131     case NERR_DeviceIsShared:
01132       return "This device is currently being shared.";
01133     case NERR_NoComputerName:
01134       return "The computer name could not be added as a message alias. The name may already exist on the network.";
01135     case NERR_MsgAlreadyStarted:
01136       return "The Messenger service is already started.";
01137     case NERR_MsgInitFailed:
01138       return "The Messenger service failed to start.";
01139     case NERR_NameNotFound:
01140       return "The message alias could not be found on the network.";
01141     case NERR_AlreadyForwarded:
01142       return "This message alias has already been forwarded.";
01143     case NERR_AddForwarded:
01144       return "This message alias has been added but is still forwarded.";
01145     case NERR_AlreadyExists:
01146       return "This message alias already exists locally.";
01147     case NERR_TooManyNames:
01148       return "The maximum number of added message aliases has been exceeded.";
01149     case NERR_DelComputerName:
01150       return "The computer name could not be deleted.";
01151     case NERR_LocalForward:
01152       return "Messages cannot be forwarded back to the same workstation.";
01153     case NERR_GrpMsgProcessor:
01154       return "An error occurred in the domain message processor.";
01155     case NERR_PausedRemote:
01156       return "The message was sent, but the recipient has paused the Messenger service.";
01157     case NERR_BadReceive:
01158       return "The message was sent but not received.";
01159     case NERR_NameInUse:
01160       return "The message alias is currently in use. Try again later.";
01161     case NERR_MsgNotStarted:
01162       return "The Messenger service has not been started.";
01163     case NERR_NotLocalName:
01164       return "The name is not on the local computer.";
01165     case NERR_NoForwardName:
01166       return "The forwarded message alias could not be found on the network.";
01167     case NERR_RemoteFull:
01168       return "The message alias table on the remote station is full.";
01169     case NERR_NameNotForwarded:
01170       return "Messages for this alias are not currently being forwarded.";
01171     case NERR_TruncatedBroadcast:
01172       return "The broadcast message was truncated.";
01173     case NERR_InvalidDevice:
01174       return "This is an invalid device name.";
01175     case NERR_WriteFault:
01176       return "A write fault occurred.";
01177     case NERR_DuplicateName:
01178       return "A duplicate message alias exists on the network.";
01179     case NERR_DeleteLater:
01180       return "@W This message alias will be deleted later.";
01181     case NERR_IncompleteDel:
01182       return "The message alias was not successfully deleted from all networks.";
01183     case NERR_MultipleNets:
01184       return "This operation is not supported on computers with multiple networks.";
01185     case NERR_NetNameNotFound:
01186       return "This shared resource does not exist.";
01187     case NERR_DeviceNotShared:
01188       return "This device is not shared.";
01189     case NERR_ClientNameNotFound:
01190       return "A session does not exist with that computer name.";
01191     case NERR_FileIdNotFound:
01192       return "There is not an open file with that identification number.";
01193     case NERR_ExecFailure:
01194       return "A failure occurred when executing a remote administration command.";
01195     case NERR_TmpFile:
01196       return "A failure occurred when opening a remote temporary file.";
01197     case NERR_TooMuchData:
01198       return "The data returned from a remote administration command has been truncated to 64K.";
01199     case NERR_DeviceShareConflict:
01200       return "This device cannot be shared as both a spooled and a non-spooled resource.";
01201     case NERR_BrowserTableIncomplete:
01202       return "The information in the list of servers may be incorrect.";
01203     case NERR_NotLocalDomain:
01204       return "The computer is not active in this domain.";
01205 #ifdef NERR_IsDfsShare
01206 
01207     case NERR_IsDfsShare:
01208       return "The share must be removed from the Distributed File System before it can be deleted.";
01209 #endif
01210 
01211     case NERR_DevInvalidOpCode:
01212       return "The operation is invalid for this device.";
01213     case NERR_DevNotFound:
01214       return "This device cannot be shared.";
01215     case NERR_DevNotOpen:
01216       return "This device was not open.";
01217     case NERR_BadQueueDevString:
01218       return "This device name list is invalid.";
01219     case NERR_BadQueuePriority:
01220       return "The queue priority is invalid.";
01221     case NERR_NoCommDevs:
01222       return "There are no shared communication devices.";
01223     case NERR_QueueNotFound:
01224       return "The queue you specified does not exist.";
01225     case NERR_BadDevString:
01226       return "This list of devices is invalid.";
01227     case NERR_BadDev:
01228       return "The requested device is invalid.";
01229     case NERR_InUseBySpooler:
01230       return "This device is already in use by the spooler.";
01231     case NERR_CommDevInUse:
01232       return "This device is already in use as a communication device.";
01233     case NERR_InvalidComputer:
01234       return "This computer name is invalid.";
01235     case NERR_MaxLenExceeded:
01236       return "The string and prefix specified are too long.";
01237     case NERR_BadComponent:
01238       return "This path component is invalid.";
01239     case NERR_CantType:
01240       return "Could not determine the type of input.";
01241     case NERR_TooManyEntries:
01242       return "The buffer for types is not big enough.";
01243     case NERR_ProfileFileTooBig:
01244       return "Profile files cannot exceed 64K.";
01245     case NERR_ProfileOffset:
01246       return "The start offset is out of range.";
01247     case NERR_ProfileCleanup:
01248       return "The system cannot delete current connections to network resources.";
01249     case NERR_ProfileUnknownCmd:
01250       return "The system was unable to parse the command line in this file.";
01251     case NERR_ProfileLoadErr:
01252       return "An error occurred while loading the profile file.";
01253     case NERR_ProfileSaveErr:
01254       return "@W Errors occurred while saving the profile file. The profile was partially saved.";
01255     case NERR_LogOverflow:
01256       return "Log file %1 is full.";
01257     case NERR_LogFileChanged:
01258       return "This log file has changed between reads.";
01259     case NERR_LogFileCorrupt:
01260       return "Log file %1 is corrupt.";
01261     case NERR_SourceIsDir:
01262       return "The source path cannot be a directory.";
01263     case NERR_BadSource:
01264       return "The source path is illegal.";
01265     case NERR_BadDest:
01266       return "The destination path is illegal.";
01267     case NERR_DifferentServers:
01268       return "The source and destination paths are on different servers.";
01269     case NERR_RunSrvPaused:
01270       return "The Run server you requested is paused.";
01271     case NERR_ErrCommRunSrv:
01272       return "An error occurred when communicating with a Run server.";
01273     case NERR_ErrorExecingGhost:
01274       return "An error occurred when starting a background process.";
01275     case NERR_ShareNotFound:
01276       return "The shared resource you are connected to could not be found.";
01277     case NERR_InvalidLana:
01278       return "The LAN adapter number is invalid.";
01279     case NERR_OpenFiles:
01280       return "There are open files on the connection.";
01281     case NERR_ActiveConns:
01282       return "Active connections still exist.";
01283     case NERR_BadPasswordCore:
01284       return "This share name or password is invalid.";
01285     case NERR_DevInUse:
01286       return "The device is being accessed by an active process.";
01287     case NERR_LocalDrive:
01288       return "The drive letter is in use locally.";
01289     case NERR_AlertExists:
01290       return "The specified client is already registered for the specified event.";
01291     case NERR_TooManyAlerts:
01292       return "The alert table is full.";
01293     case NERR_NoSuchAlert:
01294       return "An invalid or nonexistent alert name was raised.";
01295     case NERR_BadRecipient:
01296       return "The alert recipient is invalid.";
01297     case NERR_AcctLimitExceeded:
01298       return "A user's session with this server has been deleted.";
01299     case NERR_InvalidLogSeek:
01300       return "The log file does not contain the requested record number.";
01301     case NERR_BadUasConfig:
01302       return "The user accounts database is not configured correctly.";
01303     case NERR_InvalidUASOp:
01304       return "This operation is not permitted when the Netlogon service is running.";
01305     case NERR_LastAdmin:
01306       return "This operation is not allowed on the last administrative account.";
01307     case NERR_DCNotFound:
01308       return "Could not find domain controller for this domain.";
01309     case NERR_LogonTrackingError:
01310       return "Could not set logon information for this user.";
01311     case NERR_NetlogonNotStarted:
01312       return "The Netlogon service has not been started.";
01313     case NERR_CanNotGrowUASFile:
01314       return "Unable to add to the user accounts database.";
01315     case NERR_TimeDiffAtDC:
01316       return "This server's clock is not synchronized with the primary domain controller's clock.";
01317     case NERR_PasswordMismatch:
01318       return "A password mismatch has been detected.";
01319     case NERR_NoSuchServer:
01320       return "The server identification does not specify a valid server.";
01321     case NERR_NoSuchSession:
01322       return "The session identification does not specify a valid session.";
01323     case NERR_NoSuchConnection:
01324       return "The connection identification does not specify a valid connection.";
01325     case NERR_TooManyServers:
01326       return "There is no space for another entry in the table of available servers.";
01327     case NERR_TooManySessions:
01328       return "The server has reached the maximum number of sessions it supports.";
01329     case NERR_TooManyConnections:
01330       return "The server has reached the maximum number of connections it supports.";
01331     case NERR_TooManyFiles:
01332       return "The server cannot open more files because it has reached its maximum number.";
01333     case NERR_NoAlternateServers:
01334       return "There are no alternate servers registered on this server.";
01335     case NERR_TryDownLevel:
01336       return "Try down-level (remote admin protocol) version of API instead.";
01337     case NERR_UPSDriverNotStarted:
01338       return "The UPS driver could not be accessed by the UPS service.";
01339     case NERR_UPSInvalidConfig:
01340       return "The UPS service is not configured correctly.";
01341     case NERR_UPSInvalidCommPort:
01342       return "The UPS service could not access the specified Comm Port.";
01343     case NERR_UPSSignalAsserted:
01344       return "The UPS indicated a line fail or low battery situation. Service not started.";
01345     case NERR_UPSShutdownFailed:
01346       return "The UPS service failed to perform a system shut down.";
01347     case NERR_BadDosRetCode:
01348       return "The program below returned an MS-DOS error code:";
01349     case NERR_ProgNeedsExtraMem:
01350       return "The program below needs more memory:";
01351     case NERR_BadDosFunction:
01352       return "The program below called an unsupported MS-DOS function:";
01353     case NERR_RemoteBootFailed:
01354       return "The workstation failed to boot.";
01355     case NERR_BadFileCheckSum:
01356       return "The file below is corrupt.";
01357     case NERR_NoRplBootSystem:
01358       return "No loader is specified in the boot-block definition file.";
01359     case NERR_RplLoadrNetBiosErr:
01360       return "NetBIOS returned an error:      The NCB and SMB are dumped above.";
01361     case NERR_RplLoadrDiskErr:
01362       return "A disk I/O error occurred.";
01363     case NERR_ImageParamErr:
01364       return "Image parameter substitution failed.";
01365     case NERR_TooManyImageParams:
01366       return "Too many image parameters cross disk sector boundaries.";
01367     case NERR_NonDosFloppyUsed:
01368       return "The image was not generated from an MS-DOS diskette formatted with /S.";
01369     case NERR_RplBootRestart:
01370       return "Remote boot will be restarted later.";
01371     case NERR_RplSrvrCallFailed:
01372       return "The call to the Remoteboot server failed.";
01373     case NERR_CantConnectRplSrvr:
01374       return "Cannot connect to the Remoteboot server.";
01375     case NERR_CantOpenImageFile:
01376       return "Cannot open image file on the Remoteboot server.";
01377     case NERR_CallingRplSrvr:
01378       return "Connecting to the Remoteboot server...";
01379     case NERR_StartingRplBoot:
01380       return "Connecting to the Remoteboot server...";
01381     case NERR_RplBootServiceTerm:
01382       return "Remote boot service was stopped; check the error log for the cause of the problem.";
01383     case NERR_RplBootStartFailed:
01384       return "Remote boot startup failed; check the error log for the cause of the problem.";
01385     case NERR_RPL_CONNECTED:
01386       return "A second connection to a Remoteboot resource is not allowed.";
01387     case NERR_BrowserConfiguredToNotRun:
01388       return "The browser service was configured with MaintainServerList=No.";
01389     case NERR_RplNoAdaptersStarted:
01390       return "Service failed to start since none of the network adapters started with this service.";
01391     case NERR_RplBadRegistry:
01392       return "Service failed to start due to bad startup information in the registry.";
01393     case NERR_RplBadDatabase:
01394       return "Service failed to start because its database is absent or corrupt.";
01395     case NERR_RplRplfilesShare:
01396       return "Service failed to start because RPLFILES share is absent.";
01397     case NERR_RplNotRplServer:
01398       return "Service failed to start because RPLUSER group is absent.";
01399     case NERR_RplCannotEnum:
01400       return "Cannot enumerate service records.";
01401     case NERR_RplWkstaInfoCorrupted:
01402       return "Workstation record information has been corrupted.";
01403     case NERR_RplWkstaNotFound:
01404       return "Workstation record was not found.";
01405     case NERR_RplWkstaNameUnavailable:
01406       return "Workstation name is in use by some other workstation.";
01407     case NERR_RplProfileInfoCorrupted:
01408       return "Profile record information has been corrupted.";
01409     case NERR_RplProfileNotFound:
01410       return "Profile record was not found.";
01411     case NERR_RplProfileNameUnavailable:
01412       return "Profile name is in use by some other profile.";
01413     case NERR_RplProfileNotEmpty:
01414       return "There are workstations using this profile.";
01415     case NERR_RplConfigInfoCorrupted:
01416       return "Configuration record information has been corrupted.";
01417     case NERR_RplConfigNotFound:
01418       return "Configuration record was not found.";
01419     case NERR_RplAdapterInfoCorrupted:
01420       return "Adapter ID record information has been corrupted.";
01421     case NERR_RplInternal:
01422       return "An internal service error has occurred.";
01423     case NERR_RplVendorInfoCorrupted:
01424       return "Vendor ID record information has been corrupted.";
01425     case NERR_RplBootInfoCorrupted:
01426       return "Boot block record information has been corrupted.";
01427     case NERR_RplWkstaNeedsUserAcct:
01428       return "The user account for this workstation record is missing.";
01429     case NERR_RplNeedsRPLUSERAcct:
01430       return "The RPLUSER local group could not be found.";
01431     case NERR_RplBootNotFound:
01432       return "Boot block record was not found.";
01433     case NERR_RplIncompatibleProfile:
01434       return "Chosen profile is incompatible with this workstation.";
01435     case NERR_RplAdapterNameUnavailable:
01436       return "Chosen network adapter ID is in use by some other workstation.";
01437     case NERR_RplConfigNotEmpty:
01438       return "There are profiles using this configuration.";
01439     case NERR_RplBootInUse:
01440       return "There are workstations, profiles, or configurations using this boot block.";
01441     case NERR_RplBackupDatabase:
01442       return "Service failed to backup Remoteboot database.";
01443     case NERR_RplAdapterNotFound:
01444       return "Adapter record was not found.";
01445     case NERR_RplVendorNotFound:
01446       return "Vendor record was not found.";
01447     case NERR_RplVendorNameUnavailable:
01448       return "Vendor name is in use by some other vendor record.";
01449     case NERR_RplBootNameUnavailable:
01450       return "(boot name, vendor ID) is in use by some other boot block record.";
01451     case NERR_RplConfigNameUnavailable:
01452       return "Configuration name is in use by some other configuration.";
01453     case NERR_DfsInternalCorruption:
01454       return "The internal database maintained by the Dfs service is corrupt.";
01455     case NERR_DfsVolumeDataCorrupt:
01456       return "One of the records in the internal Dfs database is corrupt.";
01457     case NERR_DfsNoSuchVolume:
01458       return "There is no DFS name whose entry path matches the input Entry Path.";
01459     case NERR_DfsVolumeAlreadyExists:
01460       return "A root or link with the given name already exists.";
01461     case NERR_DfsAlreadyShared:
01462       return "The server share specified is already shared in the Dfs.";
01463     case NERR_DfsNoSuchShare:
01464       return "The indicated server share does not support the indicated DFS namespace.";
01465     case NERR_DfsNotALeafVolume:
01466       return "The operation is not valid on this portion of the namespace.";
01467     case NERR_DfsLeafVolume:
01468       return "The operation is not valid on this portion of the namespace.";
01469     case NERR_DfsVolumeHasMultipleServers:
01470       return "The operation is ambiguous because the link has multiple servers.";
01471     case NERR_DfsCantCreateJunctionPoint:
01472       return "Unable to create a link.";
01473     case NERR_DfsServerNotDfsAware:
01474       return "The server is not Dfs Aware.";
01475     case NERR_DfsBadRenamePath:
01476       return "The specified rename target path is invalid.";
01477     case NERR_DfsVolumeIsOffline:
01478       return "The specified DFS link is offline.";
01479     case NERR_DfsNoSuchServer:
01480       return "The specified server is not a server for this link.";
01481     case NERR_DfsCyclicalName:
01482       return "A cycle in the Dfs name was detected.";
01483     case NERR_DfsNotSupportedInServerDfs:
01484       return "The operation is not supported on a server-based Dfs.";
01485     case NERR_DfsDuplicateService:
01486       return "This link is already supported by the specified server-share.";
01487     case NERR_DfsCantRemoveLastServerShare:
01488       return "Can't remove the last server-share supporting this root or link.";
01489     case NERR_DfsVolumeIsInterDfs:
01490       return "The operation is not supported for an Inter-DFS link.";
01491     case NERR_DfsInconsistent:
01492       return "The internal state of the Dfs Service has become inconsistent.";
01493     case NERR_DfsServerUpgraded:
01494       return "The Dfs Service has been installed on the specified server.";
01495     case NERR_DfsDataIsIdentical:
01496       return "The Dfs data being reconciled is identical.";
01497     case NERR_DfsCantRemoveDfsRoot:
01498       return "The DFS root cannot be deleted. Uninstall DFS if required.";
01499     case NERR_DfsChildOrParentInDfs:
01500       return "A child or parent directory of the share is already in a Dfs.";
01501     case NERR_DfsInternalError:
01502       return "Dfs internal error.";
01503       /* the following are not defined in mingw */
01504 #if 0
01505 
01506     case NERR_SetupAlreadyJoined:
01507       return "This machine is already joined to a domain.";
01508     case NERR_SetupNotJoined:
01509       return "This machine is not currently joined to a domain.";
01510     case NERR_SetupDomainController:
01511       return "This machine is a domain controller and cannot be unjoined from a domain.";
01512     case NERR_DefaultJoinRequired:
01513       return "The destination domain controller does not support creating machine accounts in OUs.";
01514     case NERR_InvalidWorkgroupName:
01515       return "The specified workgroup name is invalid.";
01516     case NERR_NameUsesIncompatibleCodePage:
01517       return "The specified computer name is incompatible with the default language used on the domain controller.";
01518     case NERR_ComputerAccountNotFound:
01519       return "The specified computer account could not be found.";
01520     case NERR_PersonalSku:
01521       return "This version of Windows cannot be joined to a domain.";
01522     case NERR_PasswordMustChange:
01523       return "The password must change at the next logon.";
01524     case NERR_AccountLockedOut:
01525       return "The account is locked out.";
01526     case NERR_PasswordTooLong:
01527       return "The password is too long.";
01528     case NERR_PasswordNotComplexEnough:
01529       return "The password does not meet the complexity policy.";
01530     case NERR_PasswordFilterError:
01531       return "The password does not meet the requirements of the password filter DLLs.";
01532 #endif
01533 
01534     }
01535   msg = strerror (error_number);
01536   if (msg == NULL)
01537     msg = "unknown";
01538 
01539   return msg;
01540 #endif //DBUS_WINCE
01541 }
01542 
01557 dbus_bool_t
01558 _dbus_command_for_pid (unsigned long  pid,
01559                        DBusString    *str,
01560                        int            max_len,
01561                        DBusError     *error)
01562 {
01563   // FIXME
01564   return FALSE;
01565 }