f0ac6e11c9d3949f715a1813983808de40862c0d
[reactos.git] / reactos / dll / win32 / tapi32 / assisted.c
1 /*
2 * TAPI32 Assisted Telephony
3 *
4 * Copyright 1999 Andreas Mohr
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 #define WIN32_NO_STATUS
22 #define _INC_WINDOWS
23 #define COM_NO_WINDOWS_H
24
25 #include <config.h>
26 //#include "wine/port.h"
27
28 //#include <stdarg.h>
29 #include <stdio.h>
30 #include <windef.h>
31 #include <winbase.h>
32 //#include "wingdi.h"
33 #include <winreg.h>
34 #include <objbase.h>
35 #include <tapi.h>
36 #include <wine/debug.h>
37
38 WINE_DEFAULT_DEBUG_CHANNEL(tapi);
39
40 /***********************************************************************
41 * tapiGetLocationInfo (TAPI32.@)
42 */
43 DWORD WINAPI tapiGetLocationInfoA(LPSTR lpszCountryCode, LPSTR lpszCityCode)
44 {
45 HKEY hkey, hsubkey;
46 DWORD currid;
47 DWORD valsize;
48 DWORD type;
49 DWORD bufsize;
50 BYTE buf[100];
51 char szlockey[20];
52 if(!RegOpenKeyA(HKEY_LOCAL_MACHINE,
53 "Software\\Microsoft\\Windows\\CurrentVersion\\Telephony\\Locations",
54 &hkey) != ERROR_SUCCESS) {
55 valsize = sizeof( DWORD);
56 if(!RegQueryValueExA(hkey, "CurrentID", 0, &type, (LPBYTE) &currid,
57 &valsize) && type == REG_DWORD) {
58 /* find a subkey called Location1, Location2... */
59 sprintf( szlockey, "Location%u", currid);
60 if( !RegOpenKeyA( hkey, szlockey, &hsubkey)) {
61 if( lpszCityCode) {
62 bufsize=sizeof(buf);
63 if( !RegQueryValueExA( hsubkey, "AreaCode", 0, &type, buf,
64 &bufsize) && type == REG_SZ) {
65 lstrcpynA( lpszCityCode, (char *) buf, 8);
66 } else
67 lpszCityCode[0] = '\0';
68 }
69 if( lpszCountryCode) {
70 bufsize=sizeof(buf);
71 if( !RegQueryValueExA( hsubkey, "Country", 0, &type, buf,
72 &bufsize) && type == REG_DWORD)
73 snprintf( lpszCountryCode, 8, "%u", *(LPDWORD) buf );
74 else
75 lpszCountryCode[0] = '\0';
76 }
77 TRACE("(%p \"%s\", %p \"%s\"): success.\n",
78 lpszCountryCode, debugstr_a(lpszCountryCode),
79 lpszCityCode, debugstr_a(lpszCityCode));
80 RegCloseKey( hkey);
81 RegCloseKey( hsubkey);
82 return 0; /* SUCCESS */
83 }
84 }
85 RegCloseKey( hkey);
86 }
87 WARN("(%p, %p): failed (no telephony registry entries?).\n",
88 lpszCountryCode, lpszCityCode);
89 return TAPIERR_REQUESTFAILED;
90 }
91
92 /***********************************************************************
93 * tapiRequestMakeCall (TAPI32.@)
94 */
95 DWORD WINAPI tapiRequestMakeCallA(LPCSTR lpszDestAddress, LPCSTR lpszAppName,
96 LPCSTR lpszCalledParty, LPCSTR lpszComment)
97 {
98 FIXME("(%s, %s, %s, %s): stub.\n", lpszDestAddress, lpszAppName, lpszCalledParty, lpszComment);
99 return 0;
100 }