ReactOS 0.4.16-dev-2491-g3dc6630
main.c
Go to the documentation of this file.
1/*
2 * Bluetooth APIs
3 *
4 * Copyright 2016 Austin English
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 *
20 */
21
22#include <stdarg.h>
23#include <windef.h>
24#include <winbase.h>
25#include <winuser.h>
26#include <winreg.h>
27
28#include "wine/debug.h"
29#include "bthsdpdef.h"
30#include "bluetoothapis.h"
31#include "setupapi.h"
32
33#include "initguid.h"
34#include "bthdef.h"
35
37
39{
42};
43
44/*********************************************************************
45 * BluetoothFindFirstDevice
46 */
49{
50 FIXME("(%p %p): stub!\n", params, info);
52 return NULL;
53}
54
55/*********************************************************************
56 * BluetoothFindFirstRadio
57 */
59{
61 HANDLE device_ret;
62 DWORD err;
63
64 TRACE( "(%p, %p)\n", params, radio );
65
66 if (!params)
67 {
69 return NULL;
70 }
71 if (params->dwSize != sizeof( *params ))
72 {
74 return NULL;
75 }
76 if (!(find = calloc( 1, sizeof( *find ) )))
77 {
79 return NULL;
80 }
81
82 find->devinfo = SetupDiGetClassDevsW( &GUID_BTHPORT_DEVICE_INTERFACE, NULL, NULL,
84 if (find->devinfo == INVALID_HANDLE_VALUE)
85 {
86 free( find );
87 return NULL;
88 }
89
90 if (BluetoothFindNextRadio( find, &device_ret ))
91 {
92 *radio = device_ret;
93 return find;
94 }
95
96 err = GetLastError();
99 return NULL;
100}
101
102/*********************************************************************
103 * BluetoothFindRadioClose
104 */
106{
108
109 TRACE( "(%p)\n", find_handle );
110
111 if (!find_handle)
112 {
114 return FALSE;
115 }
116
118 free( find );
120 return TRUE;
121}
122
123/*********************************************************************
124 * BluetoothFindDeviceClose
125 */
127{
128 FIXME("(%p): stub!\n", find);
130 return FALSE;
131}
132
133/*********************************************************************
134 * BluetoothFindNextRadio
135 */
137{
138 char buffer[sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_W) + MAX_PATH * sizeof( WCHAR )];
141 SP_DEVICE_INTERFACE_DATA iface_data;
142 HANDLE device_ret;
143 BOOL found;
144
145 TRACE( "(%p, %p)\n", find_handle, radio );
146
147 if (!find_handle)
148 {
150 return FALSE;
151 }
152
153 iface_detail->cbSize = sizeof( *iface_detail );
154 iface_data.cbSize = sizeof( iface_data );
155 found = FALSE;
156 while (SetupDiEnumDeviceInterfaces( find->devinfo, NULL, &GUID_BTHPORT_DEVICE_INTERFACE, find->idx++,
157 &iface_data ))
158 {
159 if (!SetupDiGetDeviceInterfaceDetailW( find->devinfo, &iface_data, iface_detail, sizeof( buffer ), NULL,
160 NULL ))
161 continue;
162 device_ret = CreateFileW( iface_detail->DevicePath, GENERIC_READ | GENERIC_WRITE,
164 if (device_ret != INVALID_HANDLE_VALUE)
165 {
166 found = TRUE;
167 break;
168 }
169 }
170
171 if (found)
172 *radio = device_ret;
173
174 return found;
175}
176
177/*********************************************************************
178 * BluetoothGetRadioInfo
179 */
181{
182 FIXME("(%p, %p): stub!\n", radio, info);
184}
185
186/*********************************************************************
187 * BluetoothFindNextDevice
188 */
190{
191 FIXME("(%p, %p): stub!\n", find, info);
193 return FALSE;
194}
195
196/*********************************************************************
197 * BluetoothRegisterForAuthenticationEx
198 */
201{
202 FIXME("(%p, %p, %p, %p): stub!\n", info, out, callback, param);
204}
205
206/*********************************************************************
207 * BluetoothUnregisterAuthentication
208 */
210{
211 FIXME("(%p): stub!\n", handle);
213 return FALSE;
214}
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define FIXME(fmt,...)
Definition: precomp.h:53
BOOL(CALLBACK * PFN_AUTHENTICATION_CALLBACK_EX)(void *, BLUETOOTH_AUTHENTICATION_CALLBACK_PARAMS *)
static TAGID TAGID find
Definition: db.cpp:156
#define free
Definition: debug_ros.c:5
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HBLUETOOTH_RADIO_FIND WINAPI BluetoothFindFirstRadio(BLUETOOTH_FIND_RADIO_PARAMS *params, HANDLE *radio)
Definition: main.c:58
BOOL WINAPI BluetoothFindRadioClose(HBLUETOOTH_RADIO_FIND find_handle)
Definition: main.c:105
BOOL WINAPI BluetoothFindNextRadio(HBLUETOOTH_RADIO_FIND find_handle, HANDLE *radio)
Definition: main.c:136
DWORD WINAPI BluetoothRegisterForAuthenticationEx(const BLUETOOTH_DEVICE_INFO *info, HBLUETOOTH_AUTHENTICATION_REGISTRATION *out, PFN_AUTHENTICATION_CALLBACK_EX callback, void *param)
Definition: main.c:199
BOOL WINAPI BluetoothUnregisterAuthentication(HBLUETOOTH_AUTHENTICATION_REGISTRATION handle)
Definition: main.c:209
DWORD WINAPI BluetoothGetRadioInfo(HANDLE radio, PBLUETOOTH_RADIO_INFO info)
Definition: main.c:180
BOOL WINAPI BluetoothFindDeviceClose(HBLUETOOTH_DEVICE_FIND find)
Definition: main.c:126
BOOL WINAPI BluetoothFindNextDevice(HBLUETOOTH_DEVICE_FIND find, BLUETOOTH_DEVICE_INFO *info)
Definition: main.c:189
HBLUETOOTH_DEVICE_FIND WINAPI BluetoothFindFirstDevice(BLUETOOTH_DEVICE_SEARCH_PARAMS *params, BLUETOOTH_DEVICE_INFO *info)
Definition: main.c:47
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define OPEN_EXISTING
Definition: compat.h:775
#define SetLastError(x)
Definition: compat.h:752
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define GENERIC_READ
Definition: compat.h:135
#define MAX_PATH
Definition: compat.h:34
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
#define CreateFileW
Definition: compat.h:741
#define FILE_SHARE_READ
Definition: compat.h:136
BOOL WINAPI SetupDiEnumDeviceInterfaces(HDEVINFO DeviceInfoSet, PSP_DEVINFO_DATA DeviceInfoData, CONST GUID *InterfaceClassGuid, DWORD MemberIndex, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData)
Definition: devinst.c:2780
HDEVINFO WINAPI SetupDiGetClassDevsW(CONST GUID *class, LPCWSTR enumstr, HWND parent, DWORD flags)
Definition: devinst.c:2292
BOOL WINAPI SetupDiGetDeviceInterfaceDetailW(HDEVINFO DeviceInfoSet, PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData, PSP_DEVICE_INTERFACE_DETAIL_DATA_W DeviceInterfaceDetailData, DWORD DeviceInterfaceDetailDataSize, PDWORD RequiredSize, PSP_DEVINFO_DATA DeviceInfoData)
Definition: devinst.c:3011
BOOL WINAPI SetupDiDestroyDeviceInfoList(HDEVINFO devinfo)
Definition: devinst.c:2893
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint buffer
Definition: glext.h:5915
GLenum const GLfloat * params
Definition: glext.h:5645
GLfloat param
Definition: glext.h:5796
static IPrintDialogCallback callback
Definition: printdlg.c:326
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define GENERIC_WRITE
Definition: nt_native.h:90
#define err(...)
#define calloc
Definition: rosglue.h:14
#define DIGCF_DEVICEINTERFACE
Definition: setupapi.h:175
struct _SP_DEVICE_INTERFACE_DETAIL_DATA_W SP_DEVICE_INTERFACE_DETAIL_DATA_W
#define DIGCF_PRESENT
Definition: setupapi.h:172
#define TRACE(s)
Definition: solgame.cpp:4
WCHAR DevicePath[ANYSIZE_ARRAY]
Definition: setupapi.h:856
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define WINAPI
Definition: msvc.h:6
#define ERROR_REVISION_MISMATCH
Definition: winerror.h:1133
__wchar_t WCHAR
Definition: xmlstorage.h:180