summaryrefslogtreecommitdiff
path: root/dbus/dbus-sysdeps-win.h
blob: be9cbe15922c267bf510df214048cc64792c5870 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* dbus-sysdeps.c Wrappers around system/libc features (internal to D-BUS implementation)
 *
 * Copyright (C) 2002, 2003  Red Hat, Inc.
 * Copyright (C) 2003 CodeFactory AB
 * Copyright (C) 2005 Novell, Inc.
 *
 * SPDX-License-Identifier: AFL-2.1 OR GPL-2.0-or-later
 *
 * Licensed under the Academic Free License version 2.1
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */

#ifndef DBUS_SYSDEPS_WIN_H
#define DBUS_SYSDEPS_WIN_H

extern void *_dbus_win_get_dll_hmodule (void);
#define WIN32_LEAN_AND_MEAN

#include "dbus-hash.h"
#include "dbus-string.h"
#include "dbus-threads-internal.h"
#include <ctype.h>
#include <malloc.h>
#include <windows.h>
#undef interface

#define DBUS_CONSOLE_DIR "/var/run/console/"


void _dbus_win_set_errno (int err);
DBUS_PRIVATE_EXPORT
const char* _dbus_win_error_from_last_error (void);

dbus_bool_t _dbus_win_startup_winsock (void);
void _dbus_win_warn_win_error  (const char *message,
                                unsigned long code);
DBUS_PRIVATE_EXPORT
char * _dbus_win_error_string (int error_number);
DBUS_PRIVATE_EXPORT
void _dbus_win_free_error_string (char *string);

extern const char* _dbus_lm_strerror  (int error_number);


dbus_bool_t _dbus_win_account_to_sid (const wchar_t *waccount,
                                      void         **ppsid,
                                      DBusError     *error);

dbus_bool_t
_dbus_win32_sid_to_name_and_domain (dbus_uid_t  uid,
                                    wchar_t   **wname,
                                    wchar_t   **wdomain,
                                    DBusError  *error);


/* Don't define DBUS_CONSOLE_DIR on Win32 */

wchar_t    *_dbus_win_utf8_to_utf16 (const char  *str,
                                     DBusError   *error);
char       *_dbus_win_utf16_to_utf8 (const wchar_t *str,
                                     DBusError *error);

DBUS_PRIVATE_EXPORT
void        _dbus_win_set_error_from_win_error (DBusError *error, int code);

dbus_bool_t
_dbus_win_sid_to_name_and_domain (dbus_uid_t uid,
                                  wchar_t  **wname,
                                  wchar_t  **wdomain,
                                  DBusError *error);

DBUS_PRIVATE_EXPORT
dbus_bool_t _dbus_get_install_root (DBusString *str);

void        _dbus_threads_windows_init_global (void);
void        _dbus_threads_windows_ensure_ctor_linked (void);

DBUS_PRIVATE_EXPORT
dbus_bool_t _dbus_getsid(char **sid, dbus_pid_t process_id);

HANDLE      _dbus_spawn_program (const char *name,
                                 char **argv,
                                 char **envp,
                                 dbus_bool_t inherit_handles,
                                 DBusError *error);

DBUS_PRIVATE_EXPORT
void _dbus_win_set_error_from_last_error (DBusError  *error,
                                          const char *format,
                                          ...) _DBUS_GNUC_PRINTF (2, 3);

DBUS_PRIVATE_EXPORT
HANDLE _dbus_win_event_create_inheritable (DBusError *error);
DBUS_PRIVATE_EXPORT
dbus_bool_t _dbus_win_event_set (HANDLE handle, DBusError *error);
DBUS_PRIVATE_EXPORT
dbus_bool_t _dbus_win_event_wait (HANDLE handle, int timeout, DBusError *error);
DBUS_PRIVATE_EXPORT
dbus_bool_t _dbus_win_event_free (HANDLE handle, DBusError *error);

dbus_bool_t _dbus_daemon_is_session_bus_address_published (const char *scope);
dbus_bool_t _dbus_daemon_publish_session_bus_address (const char *address,
                                                      const char *shm_name);
DBUS_PRIVATE_EXPORT
DBusRMutex  *_dbus_win_rmutex_named_new (const char* name);

DBUS_PRIVATE_EXPORT
void _dbus_test_win_autolaunch_set_command_line_parameter (const char *path);
DBUS_PRIVATE_EXPORT
void _dbus_test_win_set_autolaunch_handle_location (HANDLE *location);
#endif

/** @} end of sysdeps-win.h */