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-sockets-win.h"
36#include "dbus-memory.h"
69 "Cannot daemonize on Windows");
82_dbus_write_pid_file (
const DBusString *filename,
86 const char *cfilename;
92 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
94 cfilename = _dbus_string_get_const_data (filename);
96 hnd = CreateFileA (cfilename, GENERIC_WRITE,
97 FILE_SHARE_READ | FILE_SHARE_WRITE,
98 NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL,
99 INVALID_HANDLE_VALUE);
100 if (hnd == INVALID_HANDLE_VALUE)
102 char *emsg = _dbus_win_error_string (GetLastError ());
104 "Could not create PID file %s: %s",
106 _dbus_win_free_error_string (emsg);
110 if (snprintf (pidstr,
sizeof (pidstr),
"%lu\n", pid) < 0)
113 "Failed to format PID for \"%s\": %s", cfilename,
120 bytes_to_write = strlen (pidstr);;
122 while (total < bytes_to_write)
127 res = WriteFile (hnd, pidstr + total, bytes_to_write - total,
128 &bytes_written,
NULL);
130 if (res == 0 || bytes_written <= 0)
132 char *emsg = _dbus_win_error_string (GetLastError ());
134 "Could not write to %s: %s", cfilename, emsg);
135 _dbus_win_free_error_string (emsg);
140 total += bytes_written;
143 if (CloseHandle (hnd) == 0)
145 char *emsg = _dbus_win_error_string (GetLastError ());
147 "Could not close file %s: %s",
149 _dbus_win_free_error_string (emsg);
176 _dbus_verbose (
"writing pid file %s\n", _dbus_string_get_const_data (pidfile));
177 if (!_dbus_write_pid_file (pidfile,
181 _dbus_verbose (
"pid file write failed\n");
182 _DBUS_ASSERT_ERROR_IS_SET(error);
188 _dbus_verbose (
"No pid file requested\n");
191 if (print_pid_pipe !=
NULL && _dbus_pipe_is_valid (print_pid_pipe))
196 _dbus_verbose (
"writing our pid to pipe %d\n", print_pid_pipe->fd);
200 _DBUS_SET_OOM (error);
208 _DBUS_SET_OOM (error);
212 bytes = _dbus_string_get_length (&pid);
213 if (_dbus_pipe_write (print_pid_pipe, &pid, 0, bytes, error) != bytes)
219 "Printing message bus PID: did not write enough bytes\n");
229 _dbus_verbose (
"No pid pipe to write to\n");
265 "cannot change fd limit on this platform");
269_dbus_rlimit_save_fd_limit (
DBusError *error)
271 fd_limit_not_supported (error);
276_dbus_rlimit_raise_fd_limit (
DBusError *error)
278 fd_limit_not_supported (error);
283_dbus_rlimit_restore_fd_limit (DBusRLimit *saved,
286 fd_limit_not_supported (error);
291_dbus_rlimit_free (DBusRLimit *lim)
311 const char *filename_c;
312 WIN32_FILE_ATTRIBUTE_DATA wfad;
315 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
317 filename_c = _dbus_string_get_const_data (filename);
319 if (!GetFileAttributesExA (filename_c, GetFileExInfoStandard, &wfad))
321 _dbus_win_set_error_from_win_error (error, GetLastError ());
325 if (wfad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
326 statbuf->
mode = _S_IFDIR;
328 statbuf->
mode = _S_IFREG;
330 statbuf->
mode |= _S_IREAD;
331 if (wfad.dwFileAttributes & FILE_ATTRIBUTE_READONLY)
332 statbuf->
mode |= _S_IWRITE;
334 lastdot = strrchr (filename_c,
'.');
335 if (lastdot && stricmp (lastdot,
".exe") == 0)
336 statbuf->
mode |= _S_IEXEC;
338 statbuf->
mode |= (statbuf->
mode & 0700) >> 3;
339 statbuf->
mode |= (statbuf->
mode & 0700) >> 6;
343#ifdef ENABLE_UID_TO_SID
345 PSID owner_sid, group_sid;
346 PSECURITY_DESCRIPTOR sd;
349 rc = GetNamedSecurityInfo ((
char *) filename_c, SE_FILE_OBJECT,
350 OWNER_SECURITY_INFORMATION |
351 GROUP_SECURITY_INFORMATION,
352 &owner_sid, &group_sid,
355 if (rc != ERROR_SUCCESS)
357 _dbus_win_set_error_from_win_error (error, rc);
364 statbuf->
uid = _dbus_win_sid_to_uid_t (owner_sid);
365 statbuf->
gid = _dbus_win_sid_to_uid_t (group_sid);
374 statbuf->
size = ((dbus_int64_t) wfad.nFileSizeHigh << 32) + wfad.nFileSizeLow;
377 (((dbus_int64_t) wfad.ftLastAccessTime.dwHighDateTime << 32) +
378 wfad.ftLastAccessTime.dwLowDateTime) / 10000000 - DBUS_INT64_CONSTANT (116444736000000000);
381 (((dbus_int64_t) wfad.ftLastWriteTime.dwHighDateTime << 32) +
382 wfad.ftLastWriteTime.dwLowDateTime) / 10000000 - DBUS_INT64_CONSTANT (116444736000000000);
385 (((dbus_int64_t) wfad.ftCreationTime.dwHighDateTime << 32) +
386 wfad.ftCreationTime.dwLowDateTime) / 10000000 - DBUS_INT64_CONSTANT (116444736000000000);
397 WIN32_FIND_DATAA fileinfo;
416 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
421 "Could not allocate memory for directory filename copy");
431 "Could not append filename wildcard");
441 "Could not append filename wildcard 2");
451 "Could not allocate memory for directory iterator");
455 iter->finished =
FALSE;
457 iter->handle = FindFirstFileA (_dbus_string_get_const_data (&filespec), &(iter->fileinfo));
458 if (iter->handle == INVALID_HANDLE_VALUE)
460 if (GetLastError () == ERROR_NO_MORE_FILES)
461 iter->finished =
TRUE;
464 char *emsg = _dbus_win_error_string (GetLastError ());
466 "Failed to read directory \"%s\": %s",
467 _dbus_string_get_const_data (filename), emsg);
468 _dbus_win_free_error_string (emsg);
493 int saved_err = GetLastError();
495 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
500 if (!iter || iter->finished)
503 if (iter->offset > 0)
505 if (FindNextFileA (iter->handle, &(iter->fileinfo)) == 0)
507 if (GetLastError() == ERROR_NO_MORE_FILES)
509 SetLastError(saved_err);
514 char *emsg = _dbus_win_error_string (GetLastError ());
516 "Failed to get next in directory: %s", emsg);
517 _dbus_win_free_error_string (emsg);
528 if (iter->fileinfo.cFileName[0] ==
'.' &&
529 (iter->fileinfo.cFileName[1] ==
'\0' ||
530 (iter->fileinfo.cFileName[1] ==
'.' && iter->fileinfo.cFileName[2] ==
'\0')))
537 "No memory to read directory entry");
552 FindClose(iter->handle);
580 sep = _dbus_string_get_length (filename);
585 (_dbus_string_get_byte (filename, sep - 1) ==
'/' ||
586 _dbus_string_get_byte (filename, sep - 1) ==
'\\'))
593 _dbus_string_get_byte (filename, 1) ==
':' &&
594 isalpha (_dbus_string_get_byte (filename, 0))))
596 dirname, _dbus_string_get_length (dirname));
603 sep = MAX (sep1, sep2);
609 (_dbus_string_get_byte (filename, sep - 1) ==
'/' ||
610 _dbus_string_get_byte (filename, sep - 1) ==
'\\'))
617 _dbus_string_get_byte (filename, 1) ==
':' &&
618 isalpha (_dbus_string_get_byte (filename, 0))))
620 (_dbus_string_get_byte (filename, sep) ==
'/' ||
621 _dbus_string_get_byte (filename, sep) ==
'\\'))
623 dirname, _dbus_string_get_length (dirname));
626 dirname, _dbus_string_get_length (dirname));
666 "UNIX user IDs not supported on Windows\n");
736_dbus_lm_strerror(
int error_number)
743 switch (error_number)
745 case NERR_NetNotStarted:
746 return "The workstation driver is not installed.";
747 case NERR_UnknownServer:
748 return "The server could not be located.";
750 return "An internal error occurred. The network cannot access a shared memory segment.";
751 case NERR_NoNetworkResource:
752 return "A network resource shortage occurred.";
753 case NERR_RemoteOnly:
754 return "This operation is not supported on workstations.";
755 case NERR_DevNotRedirected:
756 return "The device is not connected.";
757 case NERR_ServerNotStarted:
758 return "The Server service is not started.";
759 case NERR_ItemNotFound:
760 return "The queue is empty.";
761 case NERR_UnknownDevDir:
762 return "The device or directory does not exist.";
763 case NERR_RedirectedPath:
764 return "The operation is invalid on a redirected resource.";
765 case NERR_DuplicateShare:
766 return "The name has already been shared.";
768 return "The server is currently out of the requested resource.";
769 case NERR_TooManyItems:
770 return "Requested addition of items exceeds the maximum allowed.";
771 case NERR_InvalidMaxUsers:
772 return "The Peer service supports only two simultaneous users.";
773 case NERR_BufTooSmall:
774 return "The API return buffer is too small.";
776 return "A remote API error occurred.";
777 case NERR_LanmanIniError:
778 return "An error occurred when opening or reading the configuration file.";
779 case NERR_NetworkError:
780 return "A general network error occurred.";
781 case NERR_WkstaInconsistentState:
782 return "The Workstation service is in an inconsistent state. Restart the computer before restarting the Workstation service.";
783 case NERR_WkstaNotStarted:
784 return "The Workstation service has not been started.";
785 case NERR_BrowserNotStarted:
786 return "The requested information is not available.";
787 case NERR_InternalError:
788 return "An internal error occurred.";
789 case NERR_BadTransactConfig:
790 return "The server is not configured for transactions.";
791 case NERR_InvalidAPI:
792 return "The requested API is not supported on the remote server.";
793 case NERR_BadEventName:
794 return "The event name is invalid.";
795 case NERR_DupNameReboot:
796 return "The computer name already exists on the network. Change it and restart the computer.";
797 case NERR_CfgCompNotFound:
798 return "The specified component could not be found in the configuration information.";
799 case NERR_CfgParamNotFound:
800 return "The specified parameter could not be found in the configuration information.";
801 case NERR_LineTooLong:
802 return "A line in the configuration file is too long.";
804 return "The printer does not exist.";
805 case NERR_JobNotFound:
806 return "The print job does not exist.";
807 case NERR_DestNotFound:
808 return "The printer destination cannot be found.";
809 case NERR_DestExists:
810 return "The printer destination already exists.";
812 return "The printer queue already exists.";
814 return "No more printers can be added.";
816 return "No more print jobs can be added.";
817 case NERR_DestNoRoom:
818 return "No more printer destinations can be added.";
820 return "This printer destination is idle and cannot accept control operations.";
821 case NERR_DestInvalidOp:
822 return "This printer destination request contains an invalid control function.";
823 case NERR_ProcNoRespond:
824 return "The print processor is not responding.";
825 case NERR_SpoolerNotLoaded:
826 return "The spooler is not running.";
827 case NERR_DestInvalidState:
828 return "This operation cannot be performed on the print destination in its current state.";
829 case NERR_QInvalidState:
830 return "This operation cannot be performed on the printer queue in its current state.";
831 case NERR_JobInvalidState:
832 return "This operation cannot be performed on the print job in its current state.";
833 case NERR_SpoolNoMemory:
834 return "A spooler memory allocation failure occurred.";
835 case NERR_DriverNotFound:
836 return "The device driver does not exist.";
837 case NERR_DataTypeInvalid:
838 return "The data type is not supported by the print processor.";
839 case NERR_ProcNotFound:
840 return "The print processor is not installed.";
841 case NERR_ServiceTableLocked:
842 return "The service database is locked.";
843 case NERR_ServiceTableFull:
844 return "The service table is full.";
845 case NERR_ServiceInstalled:
846 return "The requested service has already been started.";
847 case NERR_ServiceEntryLocked:
848 return "The service does not respond to control actions.";
849 case NERR_ServiceNotInstalled:
850 return "The service has not been started.";
851 case NERR_BadServiceName:
852 return "The service name is invalid.";
853 case NERR_ServiceCtlTimeout:
854 return "The service is not responding to the control function.";
855 case NERR_ServiceCtlBusy:
856 return "The service control is busy.";
857 case NERR_BadServiceProgName:
858 return "The configuration file contains an invalid service program name.";
859 case NERR_ServiceNotCtrl:
860 return "The service could not be controlled in its present state.";
861 case NERR_ServiceKillProc:
862 return "The service ended abnormally.";
863 case NERR_ServiceCtlNotValid:
864 return "The requested pause or stop is not valid for this service.";
865 case NERR_NotInDispatchTbl:
866 return "The service control dispatcher could not find the service name in the dispatch table.";
867 case NERR_BadControlRecv:
868 return "The service control dispatcher pipe read failed.";
869 case NERR_ServiceNotStarting:
870 return "A thread for the new service could not be created.";
871 case NERR_AlreadyLoggedOn:
872 return "This workstation is already logged on to the local-area network.";
873 case NERR_NotLoggedOn:
874 return "The workstation is not logged on to the local-area network.";
875 case NERR_BadUsername:
876 return "The user name or group name parameter is invalid.";
877 case NERR_BadPassword:
878 return "The password parameter is invalid.";
879 case NERR_UnableToAddName_W:
880 return "@W The logon processor did not add the message alias.";
881 case NERR_UnableToAddName_F:
882 return "The logon processor did not add the message alias.";
883 case NERR_UnableToDelName_W:
884 return "@W The logoff processor did not delete the message alias.";
885 case NERR_UnableToDelName_F:
886 return "The logoff processor did not delete the message alias.";
887 case NERR_LogonsPaused:
888 return "Network logons are paused.";
889 case NERR_LogonServerConflict:
890 return "A centralized logon-server conflict occurred.";
891 case NERR_LogonNoUserPath:
892 return "The server is configured without a valid user path.";
893 case NERR_LogonScriptError:
894 return "An error occurred while loading or running the logon script.";
895 case NERR_StandaloneLogon:
896 return "The logon server was not specified. Your computer will be logged on as STANDALONE.";
897 case NERR_LogonServerNotFound:
898 return "The logon server could not be found.";
899 case NERR_LogonDomainExists:
900 return "There is already a logon domain for this computer.";
901 case NERR_NonValidatedLogon:
902 return "The logon server could not validate the logon.";
903 case NERR_ACFNotFound:
904 return "The security database could not be found.";
905 case NERR_GroupNotFound:
906 return "The group name could not be found.";
907 case NERR_UserNotFound:
908 return "The user name could not be found.";
909 case NERR_ResourceNotFound:
910 return "The resource name could not be found.";
911 case NERR_GroupExists:
912 return "The group already exists.";
913 case NERR_UserExists:
914 return "The user account already exists.";
915 case NERR_ResourceExists:
916 return "The resource permission list already exists.";
917 case NERR_NotPrimary:
918 return "This operation is only allowed on the primary domain controller of the domain.";
919 case NERR_ACFNotLoaded:
920 return "The security database has not been started.";
922 return "There are too many names in the user accounts database.";
923 case NERR_ACFFileIOFail:
924 return "A disk I/O failure occurred.";
925 case NERR_ACFTooManyLists:
926 return "The limit of 64 entries per resource was exceeded.";
928 return "Deleting a user with a session is not allowed.";
929 case NERR_ACFNoParent:
930 return "The parent directory could not be located.";
931 case NERR_CanNotGrowSegment:
932 return "Unable to add to the security database session cache segment.";
933 case NERR_SpeGroupOp:
934 return "This operation is not allowed on this special group.";
935 case NERR_NotInCache:
936 return "This user is not cached in user accounts database session cache.";
937 case NERR_UserInGroup:
938 return "The user already belongs to this group.";
939 case NERR_UserNotInGroup:
940 return "The user does not belong to this group.";
941 case NERR_AccountUndefined:
942 return "This user account is undefined.";
943 case NERR_AccountExpired:
944 return "This user account has expired.";
945 case NERR_InvalidWorkstation:
946 return "The user is not allowed to log on from this workstation.";
947 case NERR_InvalidLogonHours:
948 return "The user is not allowed to log on at this time.";
949 case NERR_PasswordExpired:
950 return "The password of this user has expired.";
951 case NERR_PasswordCantChange:
952 return "The password of this user cannot change.";
953 case NERR_PasswordHistConflict:
954 return "This password cannot be used now.";
955 case NERR_PasswordTooShort:
956 return "The password does not meet the password policy requirements. Check the minimum password length, password complexity and password history requirements.";
957 case NERR_PasswordTooRecent:
958 return "The password of this user is too recent to change.";
959 case NERR_InvalidDatabase:
960 return "The security database is corrupted.";
961 case NERR_DatabaseUpToDate:
962 return "No updates are necessary to this replicant network/local security database.";
963 case NERR_SyncRequired:
964 return "This replicant database is outdated; synchronization is required.";
965 case NERR_UseNotFound:
966 return "The network connection could not be found.";
967 case NERR_BadAsgType:
968 return "This asg_type is invalid.";
969 case NERR_DeviceIsShared:
970 return "This device is currently being shared.";
971 case NERR_NoComputerName:
972 return "The computer name could not be added as a message alias. The name may already exist on the network.";
973 case NERR_MsgAlreadyStarted:
974 return "The Messenger service is already started.";
975 case NERR_MsgInitFailed:
976 return "The Messenger service failed to start.";
977 case NERR_NameNotFound:
978 return "The message alias could not be found on the network.";
979 case NERR_AlreadyForwarded:
980 return "This message alias has already been forwarded.";
981 case NERR_AddForwarded:
982 return "This message alias has been added but is still forwarded.";
983 case NERR_AlreadyExists:
984 return "This message alias already exists locally.";
985 case NERR_TooManyNames:
986 return "The maximum number of added message aliases has been exceeded.";
987 case NERR_DelComputerName:
988 return "The computer name could not be deleted.";
989 case NERR_LocalForward:
990 return "Messages cannot be forwarded back to the same workstation.";
991 case NERR_GrpMsgProcessor:
992 return "An error occurred in the domain message processor.";
993 case NERR_PausedRemote:
994 return "The message was sent, but the recipient has paused the Messenger service.";
995 case NERR_BadReceive:
996 return "The message was sent but not received.";
998 return "The message alias is currently in use. Try again later.";
999 case NERR_MsgNotStarted:
1000 return "The Messenger service has not been started.";
1001 case NERR_NotLocalName:
1002 return "The name is not on the local computer.";
1003 case NERR_NoForwardName:
1004 return "The forwarded message alias could not be found on the network.";
1005 case NERR_RemoteFull:
1006 return "The message alias table on the remote station is full.";
1007 case NERR_NameNotForwarded:
1008 return "Messages for this alias are not currently being forwarded.";
1009 case NERR_TruncatedBroadcast:
1010 return "The broadcast message was truncated.";
1011 case NERR_InvalidDevice:
1012 return "This is an invalid device name.";
1013 case NERR_WriteFault:
1014 return "A write fault occurred.";
1015 case NERR_DuplicateName:
1016 return "A duplicate message alias exists on the network.";
1017 case NERR_DeleteLater:
1018 return "@W This message alias will be deleted later.";
1019 case NERR_IncompleteDel:
1020 return "The message alias was not successfully deleted from all networks.";
1021 case NERR_MultipleNets:
1022 return "This operation is not supported on computers with multiple networks.";
1023 case NERR_NetNameNotFound:
1024 return "This shared resource does not exist.";
1025 case NERR_DeviceNotShared:
1026 return "This device is not shared.";
1027 case NERR_ClientNameNotFound:
1028 return "A session does not exist with that computer name.";
1029 case NERR_FileIdNotFound:
1030 return "There is not an open file with that identification number.";
1031 case NERR_ExecFailure:
1032 return "A failure occurred when executing a remote administration command.";
1034 return "A failure occurred when opening a remote temporary file.";
1035 case NERR_TooMuchData:
1036 return "The data returned from a remote administration command has been truncated to 64K.";
1037 case NERR_DeviceShareConflict:
1038 return "This device cannot be shared as both a spooled and a non-spooled resource.";
1039 case NERR_BrowserTableIncomplete:
1040 return "The information in the list of servers may be incorrect.";
1041 case NERR_NotLocalDomain:
1042 return "The computer is not active in this domain.";
1043#ifdef NERR_IsDfsShare
1045 case NERR_IsDfsShare:
1046 return "The share must be removed from the Distributed File System before it can be deleted.";
1049 case NERR_DevInvalidOpCode:
1050 return "The operation is invalid for this device.";
1051 case NERR_DevNotFound:
1052 return "This device cannot be shared.";
1053 case NERR_DevNotOpen:
1054 return "This device was not open.";
1055 case NERR_BadQueueDevString:
1056 return "This device name list is invalid.";
1057 case NERR_BadQueuePriority:
1058 return "The queue priority is invalid.";
1059 case NERR_NoCommDevs:
1060 return "There are no shared communication devices.";
1061 case NERR_QueueNotFound:
1062 return "The queue you specified does not exist.";
1063 case NERR_BadDevString:
1064 return "This list of devices is invalid.";
1066 return "The requested device is invalid.";
1067 case NERR_InUseBySpooler:
1068 return "This device is already in use by the spooler.";
1069 case NERR_CommDevInUse:
1070 return "This device is already in use as a communication device.";
1071 case NERR_InvalidComputer:
1072 return "This computer name is invalid.";
1073 case NERR_MaxLenExceeded:
1074 return "The string and prefix specified are too long.";
1075 case NERR_BadComponent:
1076 return "This path component is invalid.";
1078 return "Could not determine the type of input.";
1079 case NERR_TooManyEntries:
1080 return "The buffer for types is not big enough.";
1081 case NERR_ProfileFileTooBig:
1082 return "Profile files cannot exceed 64K.";
1083 case NERR_ProfileOffset:
1084 return "The start offset is out of range.";
1085 case NERR_ProfileCleanup:
1086 return "The system cannot delete current connections to network resources.";
1087 case NERR_ProfileUnknownCmd:
1088 return "The system was unable to parse the command line in this file.";
1089 case NERR_ProfileLoadErr:
1090 return "An error occurred while loading the profile file.";
1091 case NERR_ProfileSaveErr:
1092 return "@W Errors occurred while saving the profile file. The profile was partially saved.";
1093 case NERR_LogOverflow:
1094 return "Log file %1 is full.";
1095 case NERR_LogFileChanged:
1096 return "This log file has changed between reads.";
1097 case NERR_LogFileCorrupt:
1098 return "Log file %1 is corrupt.";
1099 case NERR_SourceIsDir:
1100 return "The source path cannot be a directory.";
1101 case NERR_BadSource:
1102 return "The source path is illegal.";
1104 return "The destination path is illegal.";
1105 case NERR_DifferentServers:
1106 return "The source and destination paths are on different servers.";
1107 case NERR_RunSrvPaused:
1108 return "The Run server you requested is paused.";
1109 case NERR_ErrCommRunSrv:
1110 return "An error occurred when communicating with a Run server.";
1111 case NERR_ErrorExecingGhost:
1112 return "An error occurred when starting a background process.";
1113 case NERR_ShareNotFound:
1114 return "The shared resource you are connected to could not be found.";
1115 case NERR_InvalidLana:
1116 return "The LAN adapter number is invalid.";
1117 case NERR_OpenFiles:
1118 return "There are open files on the connection.";
1119 case NERR_ActiveConns:
1120 return "Active connections still exist.";
1121 case NERR_BadPasswordCore:
1122 return "This share name or password is invalid.";
1124 return "The device is being accessed by an active process.";
1125 case NERR_LocalDrive:
1126 return "The drive letter is in use locally.";
1127 case NERR_AlertExists:
1128 return "The specified client is already registered for the specified event.";
1129 case NERR_TooManyAlerts:
1130 return "The alert table is full.";
1131 case NERR_NoSuchAlert:
1132 return "An invalid or nonexistent alert name was raised.";
1133 case NERR_BadRecipient:
1134 return "The alert recipient is invalid.";
1135 case NERR_AcctLimitExceeded:
1136 return "A user's session with this server has been deleted.";
1137 case NERR_InvalidLogSeek:
1138 return "The log file does not contain the requested record number.";
1139 case NERR_BadUasConfig:
1140 return "The user accounts database is not configured correctly.";
1141 case NERR_InvalidUASOp:
1142 return "This operation is not permitted when the Netlogon service is running.";
1143 case NERR_LastAdmin:
1144 return "This operation is not allowed on the last administrative account.";
1145 case NERR_DCNotFound:
1146 return "Could not find domain controller for this domain.";
1147 case NERR_LogonTrackingError:
1148 return "Could not set logon information for this user.";
1149 case NERR_NetlogonNotStarted:
1150 return "The Netlogon service has not been started.";
1151 case NERR_CanNotGrowUASFile:
1152 return "Unable to add to the user accounts database.";
1153 case NERR_TimeDiffAtDC:
1154 return "This server's clock is not synchronized with the primary domain controller's clock.";
1155 case NERR_PasswordMismatch:
1156 return "A password mismatch has been detected.";
1157 case NERR_NoSuchServer:
1158 return "The server identification does not specify a valid server.";
1159 case NERR_NoSuchSession:
1160 return "The session identification does not specify a valid session.";
1161 case NERR_NoSuchConnection:
1162 return "The connection identification does not specify a valid connection.";
1163 case NERR_TooManyServers:
1164 return "There is no space for another entry in the table of available servers.";
1165 case NERR_TooManySessions:
1166 return "The server has reached the maximum number of sessions it supports.";
1167 case NERR_TooManyConnections:
1168 return "The server has reached the maximum number of connections it supports.";
1169 case NERR_TooManyFiles:
1170 return "The server cannot open more files because it has reached its maximum number.";
1171 case NERR_NoAlternateServers:
1172 return "There are no alternate servers registered on this server.";
1173 case NERR_TryDownLevel:
1174 return "Try down-level (remote admin protocol) version of API instead.";
1175 case NERR_UPSDriverNotStarted:
1176 return "The UPS driver could not be accessed by the UPS service.";
1177 case NERR_UPSInvalidConfig:
1178 return "The UPS service is not configured correctly.";
1179 case NERR_UPSInvalidCommPort:
1180 return "The UPS service could not access the specified Comm Port.";
1181 case NERR_UPSSignalAsserted:
1182 return "The UPS indicated a line fail or low battery situation. Service not started.";
1183 case NERR_UPSShutdownFailed:
1184 return "The UPS service failed to perform a system shut down.";
1185 case NERR_BadDosRetCode:
1186 return "The program below returned an MS-DOS error code:";
1187 case NERR_ProgNeedsExtraMem:
1188 return "The program below needs more memory:";
1189 case NERR_BadDosFunction:
1190 return "The program below called an unsupported MS-DOS function:";
1191 case NERR_RemoteBootFailed:
1192 return "The workstation failed to boot.";
1193 case NERR_BadFileCheckSum:
1194 return "The file below is corrupt.";
1195 case NERR_NoRplBootSystem:
1196 return "No loader is specified in the boot-block definition file.";
1197 case NERR_RplLoadrNetBiosErr:
1198 return "NetBIOS returned an error: The NCB and SMB are dumped above.";
1199 case NERR_RplLoadrDiskErr:
1200 return "A disk I/O error occurred.";
1201 case NERR_ImageParamErr:
1202 return "Image parameter substitution failed.";
1203 case NERR_TooManyImageParams:
1204 return "Too many image parameters cross disk sector boundaries.";
1205 case NERR_NonDosFloppyUsed:
1206 return "The image was not generated from an MS-DOS diskette formatted with /S.";
1207 case NERR_RplBootRestart:
1208 return "Remote boot will be restarted later.";
1209 case NERR_RplSrvrCallFailed:
1210 return "The call to the Remoteboot server failed.";
1211 case NERR_CantConnectRplSrvr:
1212 return "Cannot connect to the Remoteboot server.";
1213 case NERR_CantOpenImageFile:
1214 return "Cannot open image file on the Remoteboot server.";
1215 case NERR_CallingRplSrvr:
1216 return "Connecting to the Remoteboot server...";
1217 case NERR_StartingRplBoot:
1218 return "Connecting to the Remoteboot server...";
1219 case NERR_RplBootServiceTerm:
1220 return "Remote boot service was stopped; check the error log for the cause of the problem.";
1221 case NERR_RplBootStartFailed:
1222 return "Remote boot startup failed; check the error log for the cause of the problem.";
1223 case NERR_RPL_CONNECTED:
1224 return "A second connection to a Remoteboot resource is not allowed.";
1225 case NERR_BrowserConfiguredToNotRun:
1226 return "The browser service was configured with MaintainServerList=No.";
1227 case NERR_RplNoAdaptersStarted:
1228 return "Service failed to start since none of the network adapters started with this service.";
1229 case NERR_RplBadRegistry:
1230 return "Service failed to start due to bad startup information in the registry.";
1231 case NERR_RplBadDatabase:
1232 return "Service failed to start because its database is absent or corrupt.";
1233 case NERR_RplRplfilesShare:
1234 return "Service failed to start because RPLFILES share is absent.";
1235 case NERR_RplNotRplServer:
1236 return "Service failed to start because RPLUSER group is absent.";
1237 case NERR_RplCannotEnum:
1238 return "Cannot enumerate service records.";
1239 case NERR_RplWkstaInfoCorrupted:
1240 return "Workstation record information has been corrupted.";
1241 case NERR_RplWkstaNotFound:
1242 return "Workstation record was not found.";
1243 case NERR_RplWkstaNameUnavailable:
1244 return "Workstation name is in use by some other workstation.";
1245 case NERR_RplProfileInfoCorrupted:
1246 return "Profile record information has been corrupted.";
1247 case NERR_RplProfileNotFound:
1248 return "Profile record was not found.";
1249 case NERR_RplProfileNameUnavailable:
1250 return "Profile name is in use by some other profile.";
1251 case NERR_RplProfileNotEmpty:
1252 return "There are workstations using this profile.";
1253 case NERR_RplConfigInfoCorrupted:
1254 return "Configuration record information has been corrupted.";
1255 case NERR_RplConfigNotFound:
1256 return "Configuration record was not found.";
1257 case NERR_RplAdapterInfoCorrupted:
1258 return "Adapter ID record information has been corrupted.";
1259 case NERR_RplInternal:
1260 return "An internal service error has occurred.";
1261 case NERR_RplVendorInfoCorrupted:
1262 return "Vendor ID record information has been corrupted.";
1263 case NERR_RplBootInfoCorrupted:
1264 return "Boot block record information has been corrupted.";
1265 case NERR_RplWkstaNeedsUserAcct:
1266 return "The user account for this workstation record is missing.";
1267 case NERR_RplNeedsRPLUSERAcct:
1268 return "The RPLUSER local group could not be found.";
1269 case NERR_RplBootNotFound:
1270 return "Boot block record was not found.";
1271 case NERR_RplIncompatibleProfile:
1272 return "Chosen profile is incompatible with this workstation.";
1273 case NERR_RplAdapterNameUnavailable:
1274 return "Chosen network adapter ID is in use by some other workstation.";
1275 case NERR_RplConfigNotEmpty:
1276 return "There are profiles using this configuration.";
1277 case NERR_RplBootInUse:
1278 return "There are workstations, profiles, or configurations using this boot block.";
1279 case NERR_RplBackupDatabase:
1280 return "Service failed to backup Remoteboot database.";
1281 case NERR_RplAdapterNotFound:
1282 return "Adapter record was not found.";
1283 case NERR_RplVendorNotFound:
1284 return "Vendor record was not found.";
1285 case NERR_RplVendorNameUnavailable:
1286 return "Vendor name is in use by some other vendor record.";
1287 case NERR_RplBootNameUnavailable:
1288 return "(boot name, vendor ID) is in use by some other boot block record.";
1289 case NERR_RplConfigNameUnavailable:
1290 return "Configuration name is in use by some other configuration.";
1291 case NERR_DfsInternalCorruption:
1292 return "The internal database maintained by the Dfs service is corrupt.";
1293 case NERR_DfsVolumeDataCorrupt:
1294 return "One of the records in the internal Dfs database is corrupt.";
1295 case NERR_DfsNoSuchVolume:
1296 return "There is no DFS name whose entry path matches the input Entry Path.";
1297 case NERR_DfsVolumeAlreadyExists:
1298 return "A root or link with the given name already exists.";
1299 case NERR_DfsAlreadyShared:
1300 return "The server share specified is already shared in the Dfs.";
1301 case NERR_DfsNoSuchShare:
1302 return "The indicated server share does not support the indicated DFS namespace.";
1303 case NERR_DfsNotALeafVolume:
1304 return "The operation is not valid on this portion of the namespace.";
1305 case NERR_DfsLeafVolume:
1306 return "The operation is not valid on this portion of the namespace.";
1307 case NERR_DfsVolumeHasMultipleServers:
1308 return "The operation is ambiguous because the link has multiple servers.";
1309 case NERR_DfsCantCreateJunctionPoint:
1310 return "Unable to create a link.";
1311 case NERR_DfsServerNotDfsAware:
1312 return "The server is not Dfs Aware.";
1313 case NERR_DfsBadRenamePath:
1314 return "The specified rename target path is invalid.";
1315 case NERR_DfsVolumeIsOffline:
1316 return "The specified DFS link is offline.";
1317 case NERR_DfsNoSuchServer:
1318 return "The specified server is not a server for this link.";
1319 case NERR_DfsCyclicalName:
1320 return "A cycle in the Dfs name was detected.";
1321 case NERR_DfsNotSupportedInServerDfs:
1322 return "The operation is not supported on a server-based Dfs.";
1323 case NERR_DfsDuplicateService:
1324 return "This link is already supported by the specified server-share.";
1325 case NERR_DfsCantRemoveLastServerShare:
1326 return "Can't remove the last server-share supporting this root or link.";
1327 case NERR_DfsVolumeIsInterDfs:
1328 return "The operation is not supported for an Inter-DFS link.";
1329 case NERR_DfsInconsistent:
1330 return "The internal state of the Dfs Service has become inconsistent.";
1331 case NERR_DfsServerUpgraded:
1332 return "The Dfs Service has been installed on the specified server.";
1333 case NERR_DfsDataIsIdentical:
1334 return "The Dfs data being reconciled is identical.";
1335 case NERR_DfsCantRemoveDfsRoot:
1336 return "The DFS root cannot be deleted. Uninstall DFS if required.";
1337 case NERR_DfsChildOrParentInDfs:
1338 return "A child or parent directory of the share is already in a Dfs.";
1339 case NERR_DfsInternalError:
1340 return "Dfs internal error.";
1344 case NERR_SetupAlreadyJoined:
1345 return "This machine is already joined to a domain.";
1346 case NERR_SetupNotJoined:
1347 return "This machine is not currently joined to a domain.";
1348 case NERR_SetupDomainController:
1349 return "This machine is a domain controller and cannot be unjoined from a domain.";
1350 case NERR_DefaultJoinRequired:
1351 return "The destination domain controller does not support creating machine accounts in OUs.";
1352 case NERR_InvalidWorkgroupName:
1353 return "The specified workgroup name is invalid.";
1354 case NERR_NameUsesIncompatibleCodePage:
1355 return "The specified computer name is incompatible with the default language used on the domain controller.";
1356 case NERR_ComputerAccountNotFound:
1357 return "The specified computer account could not be found.";
1358 case NERR_PersonalSku:
1359 return "This version of Windows cannot be joined to a domain.";
1360 case NERR_PasswordMustChange:
1361 return "The password must change at the next logon.";
1362 case NERR_AccountLockedOut:
1363 return "The account is locked out.";
1364 case NERR_PasswordTooLong:
1365 return "The password is too long.";
1366 case NERR_PasswordNotComplexEnough:
1367 return "The password does not meet the complexity policy.";
1368 case NERR_PasswordFilterError:
1369 return "The password does not meet the requirements of the password filter DLLs.";
1373 msg = strerror (error_number);
1404 "_dbus_command_for_pid() not implemented on Windows");
1429 if (!_dbus_get_install_root (&runtime_prefix))
1435 if (_dbus_string_get_length (&runtime_prefix) == 0)
1447 &runtime_prefix, 0, _dbus_string_get_length (&runtime_prefix),
1448 path, 0, strlen (DBUS_PREFIX) + 1))
1460 for (i = 0; i < _dbus_string_get_length (path); i++)
1462 if (_dbus_string_get_byte (path, i) ==
'\\')
1463 _dbus_string_set_byte (path, i,
'/');
1471#define DBUS_STANDARD_SESSION_SERVICEDIR "/dbus-1/services"
1472#define DBUS_STANDARD_SYSTEM_SERVICEDIR "/dbus-1/system-services"
1508 const char *common_progs;
1519 if (data_dir !=
NULL)
1545 _dbus_string_get_const_data (&p)))
1560 if (common_progs !=
NULL)
1570 DBUS_STANDARD_SESSION_SERVICEDIR,
1609 const char *basename)
1643 return _dbus_get_config_file_name(str,
"system.conf");
1657 return _dbus_get_config_file_name(str,
"session.conf");
void dbus_set_error(DBusError *error, const char *name, const char *format,...)
Assigns an error name and message to a DBusError.
dbus_bool_t dbus_error_is_set(const DBusError *error)
Checks whether an error occurred (the error is set).
#define _dbus_assert(condition)
Aborts with an error message if the condition is false.
const char * _dbus_error_from_system_errno(void)
Converts the current system errno value into a DBusError name.
const char * _dbus_strerror_from_errno(void)
Get error message from errno.
#define NULL
A null pointer, defined appropriately for C or C++.
#define TRUE
Expands to "1".
#define FALSE
Expands to "0".
void dbus_free(void *memory)
Frees a block of memory previously allocated by dbus_malloc() or dbus_malloc0().
#define dbus_new0(type, count)
Safe macro for using dbus_malloc0().
#define DBUS_ERROR_NOT_SUPPORTED
Requested operation isn't supported (like ENOSYS on UNIX).
#define DBUS_ERROR_FAILED
A generic error; "something went wrong" - see the error message for more.
#define DBUS_ERROR_NO_MEMORY
There was not enough memory to complete an operation.
dbus_bool_t _dbus_string_set_length(DBusString *str, int length)
Sets the length of a string.
dbus_bool_t _dbus_string_append(DBusString *str, const char *buffer)
Appends a nul-terminated C-style string to a DBusString.
dbus_bool_t _dbus_string_init(DBusString *str)
Initializes a string.
void _dbus_string_init_const(DBusString *str, const char *value)
Initializes a constant string.
DBUS_PRIVATE_EXPORT dbus_bool_t _dbus_string_append_int(DBusString *str, long value)
Appends an integer to a DBusString.
dbus_bool_t _dbus_parse_unix_user_from_config(const DBusString *username, dbus_uid_t *uid_p)
Parse a UNIX user from the bus config file.
dbus_bool_t _dbus_string_ends_with_c_str(const DBusString *a, const char *c_str)
Returns whether a string ends with the given suffix.
dbus_bool_t _dbus_string_starts_with_c_str(const DBusString *a, const char *c_str)
Checks whether a string starts with the given C string.
dbus_bool_t _dbus_string_init_from_string(DBusString *str, const DBusString *from)
Initializes a string from another string.
void _dbus_string_free(DBusString *str)
Frees a string created by _dbus_string_init(), and fills it with the same contents as #_DBUS_STRING_I...
dbus_bool_t _dbus_unix_groups_from_uid(dbus_uid_t uid, dbus_gid_t **group_ids, int *n_group_ids)
Gets all groups corresponding to the given UNIX user ID.
dbus_bool_t _dbus_unix_user_is_process_owner(dbus_uid_t uid)
Checks to see if the UNIX user ID matches the UID of the process.
dbus_bool_t _dbus_string_find_byte_backward(const DBusString *str, int start, unsigned char byte, int *found)
Find the given byte scanning backward from the given start.
dbus_bool_t _dbus_windows_user_is_process_owner(const char *windows_sid)
Checks to see if the Windows user SID matches the owner of the process.
dbus_bool_t _dbus_parse_unix_group_from_config(const DBusString *groupname, dbus_gid_t *gid_p)
Parse a UNIX group from the bus config file.
dbus_bool_t _dbus_unix_user_is_at_console(dbus_uid_t uid, DBusError *error)
Checks to see if the UNIX user ID is at the console.
dbus_bool_t _dbus_string_copy_len(const DBusString *source, int start, int len, DBusString *dest, int insert_at)
Like _dbus_string_copy(), but can copy a segment from the middle of the source string.
dbus_bool_t _dbus_string_get_dirname(const DBusString *filename, DBusString *dirname)
Get the directory name from a complete filename.
dbus_bool_t _dbus_string_replace_len(const DBusString *source, int start, int len, DBusString *dest, int replace_at, int replace_len)
Replaces a segment of dest string with a segment of source string.
dbus_bool_t _dbus_stat(const DBusString *filename, DBusStat *statbuf, DBusError *error)
stat() wrapper.
dbus_bool_t _dbus_get_standard_session_servicedirs(DBusList **dirs)
Returns the standard directories for a session bus to look for service activation files.
void _dbus_daemon_report_ready(void)
Report to a service manager that the daemon calling this function is ready for use.
dbus_bool_t _dbus_write_pid_to_file_and_pipe(const DBusString *pidfile, DBusPipe *print_pid_pipe, dbus_pid_t pid_to_write, DBusError *error)
Writes the given pid_to_write to a pidfile (if non-NULL) and/or to a pipe (if non-NULL).
void _dbus_directory_close(DBusDirIter *iter)
Closes a directory iteration.
unsigned long dbus_uid_t
A user ID.
dbus_bool_t _dbus_get_session_config_file(DBusString *str)
Get the absolute path of the session.conf file.
unsigned long dbus_pid_t
A process ID.
void _dbus_daemon_report_reloading(void)
Report to a service manager that the daemon calling this function is reloading configuration.
unsigned long dbus_gid_t
A group ID.
dbus_bool_t _dbus_command_for_pid(unsigned long pid, DBusString *str, int max_len, DBusError *error)
Get a printable string describing the command used to execute the process with pid.
dbus_bool_t _dbus_get_system_config_file(DBusString *str)
Get the absolute path of the system.conf file (there is no system bus on Windows so this can just ret...
DBusDirIter * _dbus_directory_open(const DBusString *filename, DBusError *error)
Open a directory to iterate over.
dbus_bool_t _dbus_set_up_transient_session_servicedirs(DBusList **dirs, DBusError *error)
Returns the standard directories for a session bus to look for transient service activation files.
#define DBUS_UID_UNSET
an invalid UID used to represent an uninitialized dbus_uid_t field
dbus_bool_t _dbus_verify_daemon_user(const char *user)
Verify that after the fork we can successfully change to this user.
const char * _dbus_getenv(const char *varname)
Wrapper for getenv().
dbus_bool_t _dbus_get_standard_system_servicedirs(DBusList **dirs)
Returns the standard directories for a system bus to look for service activation files.
void _dbus_daemon_report_reloaded(void)
Report to a service manager that the daemon calling this function is reloading configuration.
#define DBUS_GID_UNSET
an invalid GID used to represent an uninitialized dbus_gid_t field
dbus_bool_t _dbus_change_to_daemon_user(const char *user, DBusError *error)
Changes the user and group the bus is running as.
void _dbus_daemon_report_stopping(void)
Report to a service manager that the daemon calling this function is shutting down.
dbus_bool_t _dbus_directory_get_next_file(DBusDirIter *iter, DBusString *filename, DBusError *error)
Get next file in the directory.
dbus_bool_t _dbus_concat_dir_and_file(DBusString *dir, const DBusString *next_component)
Appends the given filename to the given directory.
dbus_bool_t _dbus_become_daemon(const DBusString *pidfile, DBusPipe *print_pid_pipe, DBusError *error, dbus_bool_t keep_umask)
Does the chdir, fork, setsid, etc.
dbus_bool_t _dbus_split_paths_and_append(DBusString *dirs, const char *suffix, DBusList **dir_list)
Split paths into a list of char strings.
dbus_bool_t _dbus_replace_install_prefix(DBusString *path)
Replace the DBUS_PREFIX in the given path, in-place, by the current D-Bus installation directory.
dbus_uint32_t dbus_bool_t
A boolean, valid values are TRUE and FALSE.
Internals of directory iterator.
Object representing an exception.
Portable struct with stat() results.
unsigned long nlink
Number of hard links.
unsigned long size
Size of file.
dbus_uid_t uid
User owning file.
unsigned long mode
File mode.
dbus_gid_t gid
Group owning file.
unsigned long atime
Access time.
unsigned long ctime
Creation time.
unsigned long mtime
Modify time.