ReactOS 0.4.15-dev-7931-gfd331f1
assisted.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winreg.h"
#include "objbase.h"
#include "tapi.h"
#include "wine/debug.h"
Include dependency graph for assisted.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (tapi)
 
DWORD WINAPI tapiGetLocationInfoW (LPWSTR countrycode, LPWSTR citycode)
 
DWORD WINAPI tapiGetLocationInfoA (LPSTR countrycode, LPSTR citycode)
 
DWORD WINAPI tapiRequestMakeCallA (LPCSTR lpszDestAddress, LPCSTR lpszAppName, LPCSTR lpszCalledParty, LPCSTR lpszComment)
 

Function Documentation

◆ tapiGetLocationInfoA()

DWORD WINAPI tapiGetLocationInfoA ( LPSTR  countrycode,
LPSTR  citycode 
)

Definition at line 99 of file assisted.c.

100{
101 DWORD ret, len;
102 LPWSTR country, city;
103
104 len = MultiByteToWideChar( CP_ACP, 0, countrycode, -1, NULL, 0 );
105 country = HeapAlloc( GetProcessHeap(), 0, len );
106 MultiByteToWideChar( CP_ACP, 0, countrycode, -1, country, len );
107
108 len = MultiByteToWideChar( CP_ACP, 0, citycode, -1, NULL, 0 );
109 city = HeapAlloc( GetProcessHeap(), 0, len );
110 MultiByteToWideChar( CP_ACP, 0, citycode, -1, city, len );
111
112 ret = tapiGetLocationInfoW(country, city);
113
114 HeapFree( GetProcessHeap(), 0, city );
115 HeapFree( GetProcessHeap(), 0, country );
116 return ret;
117}
DWORD WINAPI tapiGetLocationInfoW(LPWSTR countrycode, LPWSTR citycode)
Definition: assisted.c:37
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define CP_ACP
Definition: compat.h:109
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define MultiByteToWideChar
Definition: compat.h:110
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
int ret
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ tapiGetLocationInfoW()

DWORD WINAPI tapiGetLocationInfoW ( LPWSTR  countrycode,
LPWSTR  citycode 
)

Definition at line 37 of file assisted.c.

38{
39 HKEY hkey, hsubkey;
40 DWORD currid;
41 DWORD valsize;
42 DWORD type;
44 BYTE buf[200];
45 WCHAR szlockey[20];
46
47 static const WCHAR currentidW[] = {'C','u','r','r','e','n','t','I','D',0};
48 static const WCHAR locationW[] = {'L','o','c','a','t','i','o','n','%','u',0};
49 static const WCHAR areacodeW[] = {'A','r','e','a','C','o','d','e',0};
50 static const WCHAR countryW[] = {'C','o','u','n','t','r','y',0};
51 static const WCHAR fmtW[] = {'%','u',0};
52
53 static const WCHAR locations_keyW[] =
54 {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
55 'W','i','n','d','o','w','s','\\',
56 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
57 'T','e','l','e','p','h','o','n','y','\\','L','o','c','a','t','i','o','n','s',0};
58
59 if(RegOpenKeyW(HKEY_LOCAL_MACHINE, locations_keyW, &hkey) == ERROR_SUCCESS) {
60 valsize = sizeof( DWORD);
61 if(!RegQueryValueExW(hkey, currentidW, 0, &type, (LPBYTE) &currid, &valsize) &&
62 type == REG_DWORD) {
63 /* find a subkey called Location1, Location2... */
64 swprintf( szlockey, locationW, currid);
65 if( !RegOpenKeyW( hkey, szlockey, &hsubkey)) {
66 if( citycode) {
67 bufsize=sizeof(buf);
68 if( !RegQueryValueExW( hsubkey, areacodeW, 0, &type, buf, &bufsize) &&
69 type == REG_SZ) {
70 lstrcpynW( citycode, (WCHAR *) buf, 8);
71 } else
72 citycode[0] = '\0';
73 }
74 if( countrycode) {
75 bufsize=sizeof(buf);
76 if( !RegQueryValueExW( hsubkey, countryW, 0, &type, buf, &bufsize) &&
77 type == REG_DWORD)
78 swprintf( countrycode, fmtW, *(LPDWORD) buf );
79 else
80 countrycode[0] = '\0';
81 }
82 TRACE("(%p \"%s\", %p \"%s\"): success.\n", countrycode, debugstr_w(countrycode),
83 citycode, debugstr_w(citycode));
84 RegCloseKey( hkey);
85 RegCloseKey( hsubkey);
86 return 0; /* SUCCESS */
87 }
88 }
89 RegCloseKey( hkey);
90 }
91 WARN("(%p, %p): failed (no telephony registry entries?).\n", countrycode, citycode);
93}
#define WARN(fmt,...)
Definition: debug.h:112
#define RegCloseKey(hKey)
Definition: registry.h:49
#define ERROR_SUCCESS
Definition: deptool.c:10
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3268
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
#define lstrcpynW
Definition: compat.h:738
#define swprintf
Definition: precomp.h:40
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum GLuint GLsizei bufsize
Definition: glext.h:7473
#define debugstr_w
Definition: kernel32.h:32
#define REG_SZ
Definition: layer.c:22
#define DWORD
Definition: nt_native.h:44
#define REG_DWORD
Definition: sdbapi.c:596
#define TRACE(s)
Definition: solgame.cpp:4
#define TAPIERR_REQUESTFAILED
Definition: tapi.h:40
unsigned char * LPBYTE
Definition: typedefs.h:53
uint32_t * LPDWORD
Definition: typedefs.h:59
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned char BYTE
Definition: xxhash.c:193

Referenced by tapiGetLocationInfoA().

◆ tapiRequestMakeCallA()

DWORD WINAPI tapiRequestMakeCallA ( LPCSTR  lpszDestAddress,
LPCSTR  lpszAppName,
LPCSTR  lpszCalledParty,
LPCSTR  lpszComment 
)

Definition at line 122 of file assisted.c.

124{
125 FIXME("(%s, %s, %s, %s): stub.\n", lpszDestAddress, lpszAppName, lpszCalledParty, lpszComment);
126 return 0;
127}
#define FIXME(fmt,...)
Definition: debug.h:111

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( tapi  )