advapi32/tests: Fix the ReadEventLog error checking.
[wine.git] / dlls / tapi32 / assisted.c
blob27a0c4ce55c5adf1b32fd2f3d6c6b09e7645a5c9
1 /*
2 * TAPI32 Assisted Telephony
4 * Copyright 1999 Andreas Mohr
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.
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.
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
21 #include "config.h"
22 #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"
34 WINE_DEFAULT_DEBUG_CHANNEL(tapi);
36 /***********************************************************************
37 * tapiGetLocationInfo (TAPI32.@)
39 DWORD WINAPI tapiGetLocationInfoA(LPSTR lpszCountryCode, LPSTR lpszCityCode)
41 HKEY hkey, hsubkey;
42 DWORD currid;
43 DWORD valsize;
44 DWORD type;
45 DWORD bufsize;
46 BYTE buf[100];
47 char szlockey[20];
48 if(!RegOpenKeyA(HKEY_LOCAL_MACHINE,
49 "Software\\Microsoft\\Windows\\CurrentVersion\\Telephony\\Locations",
50 &hkey) != ERROR_SUCCESS) {
51 valsize = sizeof( DWORD);
52 if(!RegQueryValueExA(hkey, "CurrentID", 0, &type, (LPBYTE) &currid,
53 &valsize) && type == REG_DWORD) {
54 /* find a subkey called Location1, Location2... */
55 sprintf( szlockey, "Location%u", currid);
56 if( !RegOpenKeyA( hkey, szlockey, &hsubkey)) {
57 if( lpszCityCode) {
58 bufsize=sizeof(buf);
59 if( !RegQueryValueExA( hsubkey, "AreaCode", 0, &type, buf,
60 &bufsize) && type == REG_SZ) {
61 lstrcpynA( lpszCityCode, (char *) buf, 8);
62 } else
63 lpszCityCode[0] = '\0';
65 if( lpszCountryCode) {
66 bufsize=sizeof(buf);
67 if( !RegQueryValueExA( hsubkey, "Country", 0, &type, buf,
68 &bufsize) && type == REG_DWORD)
69 snprintf( lpszCountryCode, 8, "%u", *(LPDWORD) buf );
70 else
71 lpszCountryCode[0] = '\0';
73 TRACE("(%p \"%s\", %p \"%s\"): success.\n",
74 lpszCountryCode, debugstr_a(lpszCountryCode),
75 lpszCityCode, debugstr_a(lpszCityCode));
76 RegCloseKey( hkey);
77 RegCloseKey( hsubkey);
78 return 0; /* SUCCESS */
81 RegCloseKey( hkey);
83 WARN("(%p, %p): failed (no telephony registry entries?).\n",
84 lpszCountryCode, lpszCityCode);
85 return TAPIERR_REQUESTFAILED;
88 /***********************************************************************
89 * tapiRequestMakeCall (TAPI32.@)
91 DWORD WINAPI tapiRequestMakeCallA(LPCSTR lpszDestAddress, LPCSTR lpszAppName,
92 LPCSTR lpszCalledParty, LPCSTR lpszComment)
94 FIXME("(%s, %s, %s, %s): stub.\n", lpszDestAddress, lpszAppName, lpszCalledParty, lpszComment);
95 return 0;