Andreas Mohr | 5aa96c1 | 1999-03-14 12:34:25 +0000 | [diff] [blame] | 1 | /* |
| 2 | * TAPI32 Assisted Telephony |
| 3 | * |
| 4 | * Copyright 1999 Andreas Mohr |
Alexandre Julliard | 0799c1a | 2002-03-09 23:29:33 +0000 | [diff] [blame] | 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
Andreas Mohr | 5aa96c1 | 1999-03-14 12:34:25 +0000 | [diff] [blame] | 19 | */ |
| 20 | |
Alexandre Julliard | e37c6e1 | 2003-09-05 23:08:26 +0000 | [diff] [blame] | 21 | #include <stdarg.h> |
Rein Klazes | ab14429 | 2004-04-12 22:05:17 +0000 | [diff] [blame] | 22 | #include <stdio.h> |
Jim Aston | 2e1cafa | 1999-03-14 16:35:05 +0000 | [diff] [blame] | 23 | #include "windef.h" |
Alexandre Julliard | e37c6e1 | 2003-09-05 23:08:26 +0000 | [diff] [blame] | 24 | #include "winbase.h" |
Rein Klazes | ab14429 | 2004-04-12 22:05:17 +0000 | [diff] [blame] | 25 | #include "winreg.h" |
Andreas Mohr | 5aa96c1 | 1999-03-14 12:34:25 +0000 | [diff] [blame] | 26 | #include "tapi.h" |
Alexandre Julliard | 0799c1a | 2002-03-09 23:29:33 +0000 | [diff] [blame] | 27 | #include "wine/debug.h" |
Andreas Mohr | 5aa96c1 | 1999-03-14 12:34:25 +0000 | [diff] [blame] | 28 | |
Alexandre Julliard | 0799c1a | 2002-03-09 23:29:33 +0000 | [diff] [blame] | 29 | WINE_DEFAULT_DEBUG_CHANNEL(tapi); |
Patrik Stridvall | b4b9fae | 1999-04-19 14:56:29 +0000 | [diff] [blame] | 30 | |
Patrik Stridvall | fcfacb9 | 2000-03-24 20:46:04 +0000 | [diff] [blame] | 31 | /*********************************************************************** |
| 32 | * tapiGetLocationInfo (TAPI32.@) |
| 33 | */ |
Andreas Mohr | 5aa96c1 | 1999-03-14 12:34:25 +0000 | [diff] [blame] | 34 | DWORD WINAPI tapiGetLocationInfo(LPSTR lpszCountryCode, LPSTR lpszCityCode) |
| 35 | { |
Rein Klazes | ab14429 | 2004-04-12 22:05:17 +0000 | [diff] [blame] | 36 | HKEY hkey, hsubkey; |
| 37 | DWORD currid; |
| 38 | DWORD valsize; |
| 39 | DWORD type; |
| 40 | DWORD bufsize; |
| 41 | BYTE buf[100]; |
| 42 | char szlockey[20]; |
| 43 | if(!RegOpenKeyA(HKEY_LOCAL_MACHINE, |
| 44 | "Software\\Microsoft\\Windows\\CurrentVersion\\Telephony\\Locations", |
| 45 | &hkey) != ERROR_SUCCESS) { |
| 46 | valsize = sizeof( DWORD); |
| 47 | if(!RegQueryValueExA(hkey, "CurrentID", 0, &type, (LPBYTE) &currid, |
| 48 | &valsize) && type == REG_DWORD) { |
| 49 | /* find a subkey called Location1, Location2... */ |
| 50 | sprintf( szlockey, "Location%lu", currid); |
| 51 | if( !RegOpenKeyA( hkey, szlockey, &hsubkey)) { |
| 52 | if( lpszCityCode) { |
| 53 | bufsize=sizeof(buf); |
| 54 | if( !RegQueryValueExA( hsubkey, "AreaCode", 0, &type, buf, |
| 55 | &bufsize) && type == REG_SZ) { |
| 56 | strncpy( lpszCityCode, (char *) buf, 8); |
| 57 | if(bufsize > 8) lpszCityCode[7] = '\0'; |
| 58 | } else |
| 59 | lpszCityCode[0] = '\0'; |
| 60 | } |
| 61 | if( lpszCountryCode) { |
| 62 | bufsize=sizeof(buf); |
| 63 | if( !RegQueryValueExA( hsubkey, "Country", 0, &type, buf, |
| 64 | &bufsize) && type == REG_DWORD) |
| 65 | snprintf( lpszCountryCode, 8, "%lu", *(LPDWORD) buf ); |
| 66 | else |
| 67 | lpszCountryCode[0] = '\0'; |
| 68 | } |
| 69 | TRACE("(%p \"%s\", %p \"%s\"): success.\n", |
| 70 | lpszCountryCode, debugstr_a(lpszCountryCode), |
| 71 | lpszCityCode, debugstr_a(lpszCityCode)); |
| 72 | RegCloseKey( hkey); |
| 73 | RegCloseKey( hsubkey); |
| 74 | return 0; /* SUCCESS */ |
| 75 | } |
| 76 | } |
| 77 | RegCloseKey( hkey); |
| 78 | } |
| 79 | WARN("(%p, %p): failed (no telephony registry entries?).\n", |
| 80 | lpszCountryCode, lpszCityCode); |
| 81 | return TAPIERR_REQUESTFAILED; |
Andreas Mohr | 5aa96c1 | 1999-03-14 12:34:25 +0000 | [diff] [blame] | 82 | } |
| 83 | |
Patrik Stridvall | fcfacb9 | 2000-03-24 20:46:04 +0000 | [diff] [blame] | 84 | /*********************************************************************** |
| 85 | * tapiRequestMakeCall (TAPI32.@) |
| 86 | */ |
Andreas Mohr | 5aa96c1 | 1999-03-14 12:34:25 +0000 | [diff] [blame] | 87 | DWORD WINAPI tapiRequestMakeCall(LPCSTR lpszDestAddress, LPCSTR lpszAppName, |
| 88 | LPCSTR lpszCalledParty, LPCSTR lpszComment) |
| 89 | { |
Alexandre Julliard | 9fe7a25 | 1999-05-14 08:17:14 +0000 | [diff] [blame] | 90 | FIXME("(%s, %s, %s, %s): stub.\n", lpszDestAddress, lpszAppName, lpszCalledParty, lpszComment); |
Andreas Mohr | 5aa96c1 | 1999-03-14 12:34:25 +0000 | [diff] [blame] | 91 | return 0; |
| 92 | } |