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