1999-03-14 13:34:25 +01:00
|
|
|
/*
|
|
|
|
* TAPI32 Assisted Telephony
|
|
|
|
*
|
|
|
|
* Copyright 1999 Andreas Mohr
|
2011-11-13 17:23:46 +01:00
|
|
|
* Copyright 2011 André Hentschel
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
1999-03-14 13:34:25 +01:00
|
|
|
*/
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2004-04-13 00:05:17 +02:00
|
|
|
#include <stdio.h>
|
1999-03-14 17:35:05 +01:00
|
|
|
#include "windef.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "winbase.h"
|
2006-11-10 15:25:21 +01:00
|
|
|
#include "wingdi.h"
|
2004-04-13 00:05:17 +02:00
|
|
|
#include "winreg.h"
|
2006-11-10 15:25:21 +01:00
|
|
|
#include "objbase.h"
|
1999-03-14 13:34:25 +01:00
|
|
|
#include "tapi.h"
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
1999-03-14 13:34:25 +01:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(tapi);
|
1999-04-19 16:56:29 +02:00
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
2011-11-13 17:23:46 +01:00
|
|
|
* tapiGetLocationInfoW (TAPI32.@)
|
2000-03-24 21:46:04 +01:00
|
|
|
*/
|
2011-11-13 17:23:46 +01:00
|
|
|
DWORD WINAPI tapiGetLocationInfoW(LPWSTR countrycode, LPWSTR citycode)
|
1999-03-14 13:34:25 +01:00
|
|
|
{
|
2004-04-13 00:05:17 +02:00
|
|
|
HKEY hkey, hsubkey;
|
|
|
|
DWORD currid;
|
|
|
|
DWORD valsize;
|
|
|
|
DWORD type;
|
|
|
|
DWORD bufsize;
|
2011-11-13 17:23:46 +01:00
|
|
|
BYTE buf[200];
|
|
|
|
WCHAR szlockey[20];
|
|
|
|
|
|
|
|
static const WCHAR currentidW[] = {'C','u','r','r','e','n','t','I','D',0};
|
|
|
|
static const WCHAR locationW[] = {'L','o','c','a','t','i','o','n','%','u',0};
|
|
|
|
static const WCHAR areacodeW[] = {'A','r','e','a','C','o','d','e',0};
|
|
|
|
static const WCHAR countryW[] = {'C','o','u','n','t','r','y',0};
|
|
|
|
static const WCHAR fmtW[] = {'%','u',0};
|
|
|
|
|
|
|
|
static const WCHAR locations_keyW[] =
|
|
|
|
{'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
|
|
|
|
'W','i','n','d','o','w','s','\\',
|
|
|
|
'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
|
|
|
|
'T','e','l','e','p','h','o','n','y','\\','L','o','c','a','t','i','o','n','s',0};
|
|
|
|
|
2015-11-27 05:12:30 +01:00
|
|
|
if(RegOpenKeyW(HKEY_LOCAL_MACHINE, locations_keyW, &hkey) == ERROR_SUCCESS) {
|
2004-04-13 00:05:17 +02:00
|
|
|
valsize = sizeof( DWORD);
|
2011-11-13 17:23:46 +01:00
|
|
|
if(!RegQueryValueExW(hkey, currentidW, 0, &type, (LPBYTE) &currid, &valsize) &&
|
|
|
|
type == REG_DWORD) {
|
2004-04-13 00:05:17 +02:00
|
|
|
/* find a subkey called Location1, Location2... */
|
2019-06-24 10:10:05 +02:00
|
|
|
swprintf( szlockey, ARRAY_SIZE(szlockey), locationW, currid);
|
2011-11-13 17:23:46 +01:00
|
|
|
if( !RegOpenKeyW( hkey, szlockey, &hsubkey)) {
|
|
|
|
if( citycode) {
|
2004-04-13 00:05:17 +02:00
|
|
|
bufsize=sizeof(buf);
|
2011-11-13 17:23:46 +01:00
|
|
|
if( !RegQueryValueExW( hsubkey, areacodeW, 0, &type, buf, &bufsize) &&
|
|
|
|
type == REG_SZ) {
|
|
|
|
lstrcpynW( citycode, (WCHAR *) buf, 8);
|
2004-04-13 00:05:17 +02:00
|
|
|
} else
|
2011-11-13 17:23:46 +01:00
|
|
|
citycode[0] = '\0';
|
2004-04-13 00:05:17 +02:00
|
|
|
}
|
2011-11-13 17:23:46 +01:00
|
|
|
if( countrycode) {
|
2004-04-13 00:05:17 +02:00
|
|
|
bufsize=sizeof(buf);
|
2011-11-13 17:23:46 +01:00
|
|
|
if( !RegQueryValueExW( hsubkey, countryW, 0, &type, buf, &bufsize) &&
|
|
|
|
type == REG_DWORD)
|
2019-06-24 10:10:05 +02:00
|
|
|
swprintf( countrycode, 8, fmtW, *(LPDWORD) buf );
|
2004-04-13 00:05:17 +02:00
|
|
|
else
|
2011-11-13 17:23:46 +01:00
|
|
|
countrycode[0] = '\0';
|
2004-04-13 00:05:17 +02:00
|
|
|
}
|
2011-11-13 17:23:46 +01:00
|
|
|
TRACE("(%p \"%s\", %p \"%s\"): success.\n", countrycode, debugstr_w(countrycode),
|
|
|
|
citycode, debugstr_w(citycode));
|
2004-04-13 00:05:17 +02:00
|
|
|
RegCloseKey( hkey);
|
|
|
|
RegCloseKey( hsubkey);
|
|
|
|
return 0; /* SUCCESS */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
RegCloseKey( hkey);
|
|
|
|
}
|
2011-11-13 17:23:46 +01:00
|
|
|
WARN("(%p, %p): failed (no telephony registry entries?).\n", countrycode, citycode);
|
2004-04-13 00:05:17 +02:00
|
|
|
return TAPIERR_REQUESTFAILED;
|
1999-03-14 13:34:25 +01:00
|
|
|
}
|
|
|
|
|
2011-11-13 17:23:46 +01:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* tapiGetLocationInfoA (TAPI32.@)
|
|
|
|
*/
|
|
|
|
DWORD WINAPI tapiGetLocationInfoA(LPSTR countrycode, LPSTR citycode)
|
|
|
|
{
|
|
|
|
DWORD ret, len;
|
|
|
|
LPWSTR country, city;
|
|
|
|
|
|
|
|
len = MultiByteToWideChar( CP_ACP, 0, countrycode, -1, NULL, 0 );
|
|
|
|
country = HeapAlloc( GetProcessHeap(), 0, len );
|
|
|
|
MultiByteToWideChar( CP_ACP, 0, countrycode, -1, country, len );
|
|
|
|
|
|
|
|
len = MultiByteToWideChar( CP_ACP, 0, citycode, -1, NULL, 0 );
|
|
|
|
city = HeapAlloc( GetProcessHeap(), 0, len );
|
|
|
|
MultiByteToWideChar( CP_ACP, 0, citycode, -1, city, len );
|
|
|
|
|
|
|
|
ret = tapiGetLocationInfoW(country, city);
|
|
|
|
|
|
|
|
HeapFree( GetProcessHeap(), 0, city );
|
|
|
|
HeapFree( GetProcessHeap(), 0, country );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* tapiRequestMakeCall (TAPI32.@)
|
|
|
|
*/
|
2004-10-14 02:28:29 +02:00
|
|
|
DWORD WINAPI tapiRequestMakeCallA(LPCSTR lpszDestAddress, LPCSTR lpszAppName,
|
1999-03-14 13:34:25 +01:00
|
|
|
LPCSTR lpszCalledParty, LPCSTR lpszComment)
|
|
|
|
{
|
1999-05-14 10:17:14 +02:00
|
|
|
FIXME("(%s, %s, %s, %s): stub.\n", lpszDestAddress, lpszAppName, lpszCalledParty, lpszComment);
|
1999-03-14 13:34:25 +01:00
|
|
|
return 0;
|
|
|
|
}
|