00001 /* 00002 Copyright (c) 2007, Forkbeard team 00003 00004 All rights reserved. 00005 00006 Licensed under BSD license. See License.txt 00007 */ 00008 00039 #ifndef _COMMON_UTIL_H 00040 #define _COMMON_UTIL_H 00041 00042 #include <winsock2.h> 00043 #include <bthdef.h> 00044 #include <Ws2bth.h> 00045 #include <Bthsdpdef.h> 00046 #include <BluetoothAPIs.h> 00047 #include <string.h> 00048 #include <malloc.h> 00049 #include <stdio.h> 00050 #include <tchar.h> 00051 #include <stdlib.h> 00052 00053 /* --------------------------------------------------------------------------*/ 00060 int checkForWinSock(); 00061 /* --------------------------------------------------------------------------*/ 00062 00063 00064 00065 /* --------------------------------------------------------------------------*/ 00073 ULONGLONG htoi(char *string); 00074 /* --------------------------------------------------------------------------*/ 00075 00076 00077 00078 /* --------------------------------------------------------------------------*/ 00086 BLUETOOTH_ADDRESS stringToAddress(char *address); 00087 /* --------------------------------------------------------------------------*/ 00088 00089 00090 00091 00092 /* --------------------------------------------------------------------------*/ 00106 int authenticate(char *address, char *pinInput, BLUETOOTH_DEVICE_INFO *deviceInfo, int xml); 00107 /* --------------------------------------------------------------------------*/ 00108 00109 00110 00111 00112 /* --------------------------------------------------------------------------*/ 00120 int removeAuthentication(char *address); 00121 /* --------------------------------------------------------------------------*/ 00122 00123 00124 00125 00126 /* --------------------------------------------------------------------------*/ 00137 char * findDevice(BLUETOOTH_DEVICE_INFO *bdi, char * address); 00138 /* --------------------------------------------------------------------------*/ 00139 00140 00141 00142 00143 /* --------------------------------------------------------------------------*/ 00155 int asciiToUnicode( char* string, int length, wchar_t* outString, int size ); 00156 /* --------------------------------------------------------------------------*/ 00157 00158 00159 00160 00161 /* --------------------------------------------------------------------------*/ 00169 void takeOffStrangeMarks(char* string,int max); 00170 /* --------------------------------------------------------------------------*/ 00171 00172 00173 00174 00175 /* --------------------------------------------------------------------------*/ 00187 int utf8ToUnicode( char* string, int length, wchar_t* outString, int size ); 00188 /* --------------------------------------------------------------------------*/ 00189 00190 00191 00192 00193 /* --------------------------------------------------------------------------*/ 00203 char * removeNonprintableChars(WCHAR* Input, SIZE_T Length); 00204 /* --------------------------------------------------------------------------*/ 00205 00206 #endif