assisted.c 3.47 KB
Newer Older
1 2 3 4
/*
 * TAPI32 Assisted Telephony
 *
 * Copyright 1999  Andreas Mohr
5 6 7 8 9 10 11 12 13 14 15 16 17
 *
 * 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
18
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 20
 */

21 22 23
#include "config.h"
#include "wine/port.h"

24
#include <stdarg.h>
25
#include <stdio.h>
26
#include "windef.h"
27
#include "winbase.h"
28
#include "wingdi.h"
29
#include "winreg.h"
30
#include "objbase.h"
31
#include "tapi.h"
32
#include "wine/debug.h"
33

34
WINE_DEFAULT_DEBUG_CHANNEL(tapi);
35

36 37 38
/***********************************************************************
 *		tapiGetLocationInfo (TAPI32.@)
 */
39
DWORD WINAPI tapiGetLocationInfoA(LPSTR lpszCountryCode, LPSTR lpszCityCode)
40
{
41 42 43 44 45 46 47 48 49 50 51 52 53 54
    HKEY hkey, hsubkey;
    DWORD currid;
    DWORD valsize;
    DWORD type;
    DWORD bufsize;
    BYTE buf[100];
    char szlockey[20];
    if(!RegOpenKeyA(HKEY_LOCAL_MACHINE,
           "Software\\Microsoft\\Windows\\CurrentVersion\\Telephony\\Locations",
           &hkey) != ERROR_SUCCESS) { 
        valsize = sizeof( DWORD);
        if(!RegQueryValueExA(hkey, "CurrentID", 0, &type, (LPBYTE) &currid,
                    &valsize) && type == REG_DWORD) {
            /* find a subkey called Location1, Location2... */
55
            sprintf( szlockey, "Location%u", currid); 
56 57 58 59 60
            if( !RegOpenKeyA( hkey, szlockey, &hsubkey)) {
                if( lpszCityCode) {
                    bufsize=sizeof(buf);
                    if( !RegQueryValueExA( hsubkey, "AreaCode", 0, &type, buf,
                                &bufsize) && type == REG_SZ) {
61
			lstrcpynA( lpszCityCode, (char *) buf, 8);
62 63 64 65 66 67 68
                    } else 
                        lpszCityCode[0] = '\0';
                }
                if( lpszCountryCode) {
                    bufsize=sizeof(buf);
                    if( !RegQueryValueExA( hsubkey, "Country", 0, &type, buf,
                                &bufsize) && type == REG_DWORD)
69
                        snprintf( lpszCountryCode, 8, "%u", *(LPDWORD) buf );
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
                    else
                        lpszCountryCode[0] = '\0';
                }
                TRACE("(%p \"%s\", %p \"%s\"): success.\n",
                        lpszCountryCode, debugstr_a(lpszCountryCode),
                        lpszCityCode, debugstr_a(lpszCityCode));
                RegCloseKey( hkey);
                RegCloseKey( hsubkey);
                return 0; /* SUCCESS */
            }
        }
        RegCloseKey( hkey);
    }
    WARN("(%p, %p): failed (no telephony registry entries?).\n",
            lpszCountryCode, lpszCityCode);
    return TAPIERR_REQUESTFAILED;
86 87
}

88 89 90
/***********************************************************************
 *		tapiRequestMakeCall (TAPI32.@)
 */
91
DWORD WINAPI tapiRequestMakeCallA(LPCSTR lpszDestAddress, LPCSTR lpszAppName,
92 93
                                 LPCSTR lpszCalledParty, LPCSTR lpszComment)
{
94
    FIXME("(%s, %s, %s, %s): stub.\n", lpszDestAddress, lpszAppName, lpszCalledParty, lpszComment);
95 96
    return 0;
}