1 /* -*- mode: C; c-file-style: "gnu" -*- */
2 /* dbus-sysdeps.c Wrappers around system/libc features (internal to D-BUS implementation)
4 * Copyright (C) 2002, 2003 Red Hat, Inc.
5 * Copyright (C) 2003 CodeFactory AB
6 * Copyright (C) 2005 Novell, Inc.
8 * Licensed under the Academic Free License version 2.1
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #ifndef DBUS_SYSDEPS_WIN_H
27 #define DBUS_SYSDEPS_WIN_H
31 #include "dbus-hash.h"
32 #include "dbus-string.h"
44 #define mkdir(path, mode) _mkdir (path)
48 #define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
52 /* Declarations missing in mingw's headers */
53 extern BOOL WINAPI ConvertStringSidToSidA (LPCSTR StringSid, PSID *Sid);
54 extern BOOL WINAPI ConvertSidToStringSidA (PSID Sid, LPSTR *StringSid);
57 #define DBUS_CONSOLE_DIR "/var/run/console/"
61 int fd; /* File descriptor, SOCKET or file HANDLE */
62 int port_file_fd; /* File descriptor for file containing
63 * port number for "pseudo-unix" sockets
65 DBusString port_file; /* File name for said file */
66 dbus_bool_t close_on_exec;
67 dbus_bool_t non_blocking;
72 extern DBusSocket *win_fds;
73 extern int win32_n_fds;
76 void _dbus_win_startup_winsock (void);
77 void _dbus_win_warn_win_error (const char *message,
79 extern const char* _dbus_lm_strerror (int error_number);
83 fill_win_user_info_from_uid (dbus_uid_t uid,
87 fill_win_user_info_from_name (wchar_t *wname,
91 dbus_bool_t _dbus_win_account_to_sid (const wchar_t *waccount,
96 _dbus_win32_sid_to_name_and_domain (dbus_uid_t uid,
102 /* Don't define DBUS_CONSOLE_DIR on Win32 */
104 wchar_t *_dbus_win_utf8_to_utf16 (const char *str,
106 char *_dbus_win_utf16_to_utf8 (const wchar_t *str,
109 void _dbus_win_set_error_from_win_error (DBusError *error, int code);
111 dbus_uid_t _dbus_win_sid_to_uid_t (void *psid);
112 dbus_bool_t _dbus_uid_t_to_win_sid (dbus_uid_t uid,
115 _dbus_account_to_win_sid (const wchar_t *waccount,
119 _dbus_win_sid_to_name_and_domain (dbus_uid_t uid,
124 typedef struct DBusFile DBusFile;
126 dbus_bool_t _dbus_file_open (DBusFile *file,
127 const char *filename,
131 dbus_bool_t _dbus_file_close (DBusFile *file,
135 int _dbus_file_read (DBusFile *file,
139 int _dbus_file_write (DBusFile *file,
140 const DBusString *buffer,
144 dbus_bool_t _dbus_file_exists (const char *filename);
147 #define FDATA private_data
154 void _dbus_handle_to_socket (int handle,
155 DBusSocket **socket);
156 int _dbus_socket_to_handle (DBusSocket *socket);
159 fill_user_info (DBusUserInfo *info,
161 const DBusString *username,
164 // replace with a windows version
165 dbus_bool_t _dbus_open_unix_socket (int *fd,
167 int _dbus_connect_unix_socket (const char *path,
168 dbus_bool_t abstract,
170 int _dbus_listen_unix_socket (const char *path,
171 dbus_bool_t abstract,
174 dbus_bool_t _dbus_get_config_file_name(DBusString *config_file,
179 /** @} end of sysdeps-win.h */