dbus/dbus-sysdeps-win.h: add _dbus_win_get_dll-module (cherry picked from commit...
[platform/upstream/dbus.git] / dbus / dbus-sysdeps-win.h
1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2 /* dbus-sysdeps.c Wrappers around system/libc features (internal to D-BUS implementation)
3  * 
4  * Copyright (C) 2002, 2003  Red Hat, Inc.
5  * Copyright (C) 2003 CodeFactory AB
6  * Copyright (C) 2005 Novell, Inc.
7  *
8  * Licensed under the Academic Free License version 2.1
9  * 
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.
14  *
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.
19  * 
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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
23  *
24  */
25
26 #ifndef DBUS_SYSDEPS_WIN_H
27 #define DBUS_SYSDEPS_WIN_H
28
29 extern void *_dbus_win_get_dll_hmodule (void);
30 #define _WINSOCKAPI_
31
32 #include "dbus-hash.h"
33 #include "dbus-string.h"
34 #include <ctype.h>
35 #include <malloc.h>
36 #include <windows.h>
37 #undef interface
38
39 #include <aclapi.h>
40 #include <lm.h>
41 #include <io.h>
42 #include <share.h>
43 #include <direct.h>
44
45 #define mkdir(path, mode) _mkdir (path)
46
47 #ifndef DBUS_WINCE
48 #ifndef S_ISREG
49 #define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
50 #endif
51 #endif
52
53 /* Declarations missing in mingw's headers */
54 extern BOOL WINAPI ConvertStringSidToSidA (LPCSTR  StringSid, PSID *Sid);
55 extern BOOL WINAPI ConvertSidToStringSidA (PSID Sid, LPSTR *StringSid);
56
57
58 #define DBUS_CONSOLE_DIR "/var/run/console/"
59
60
61 void _dbus_win_startup_winsock (void);
62 void _dbus_win_warn_win_error  (const char *message,
63                                 int         code);
64 extern const char* _dbus_lm_strerror  (int error_number);
65
66
67 dbus_bool_t _dbus_win_account_to_sid (const wchar_t *waccount,
68                                       void         **ppsid,
69                                       DBusError     *error);
70
71 dbus_bool_t
72 _dbus_win32_sid_to_name_and_domain (dbus_uid_t  uid,
73                                     wchar_t   **wname,
74                                     wchar_t   **wdomain,
75                                     DBusError  *error);
76
77
78 /* Don't define DBUS_CONSOLE_DIR on Win32 */
79
80 wchar_t    *_dbus_win_utf8_to_utf16 (const char  *str,
81                                      DBusError   *error);
82 char       *_dbus_win_utf16_to_utf8 (const wchar_t *str,
83                                      DBusError *error);
84
85 void        _dbus_win_set_error_from_win_error (DBusError *error, int code);
86
87 dbus_bool_t
88 _dbus_win_sid_to_name_and_domain (dbus_uid_t uid,
89                                   wchar_t  **wname,
90                                   wchar_t  **wdomain,
91                                   DBusError *error);
92
93 typedef struct DBusFile DBusFile;
94
95 dbus_bool_t _dbus_file_open (DBusFile   *file,
96                              const char *filename,
97                              int         oflag,
98                              int         pmode);
99
100 dbus_bool_t _dbus_file_close (DBusFile  *file,
101                               DBusError *error);
102
103
104 int _dbus_file_read  (DBusFile   *file,
105                       DBusString *buffer,
106                       int         count);
107
108 int _dbus_file_write (DBusFile         *file,
109                       const DBusString *buffer,
110                       int               start,
111                       int               len);
112
113 dbus_bool_t _dbus_file_exists (const char *filename);
114
115
116 #define FDATA private_data
117 struct DBusFile
118   {
119     int FDATA;
120   };
121
122
123 dbus_bool_t _dbus_get_config_file_name(DBusString *config_file, 
124                                        char *s);
125
126
127
128 #endif
129
130 /** @} end of sysdeps-win.h */
131
132