From: Alex Henrie alexhenrie24@gmail.com
--- dlls/tapi32/assisted.c | 21 ++++++--------------- dlls/tapi32/line.c | 32 ++++++++++---------------------- 2 files changed, 16 insertions(+), 37 deletions(-)
diff --git a/dlls/tapi32/assisted.c b/dlls/tapi32/assisted.c index 298087de71e..2c1916270d1 100644 --- a/dlls/tapi32/assisted.c +++ b/dlls/tapi32/assisted.c @@ -44,28 +44,19 @@ DWORD WINAPI tapiGetLocationInfoW(LPWSTR countrycode, LPWSTR citycode) 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}; + L"Software\Microsoft\Windows\CurrentVersion\Telephony\Locations";
if(RegOpenKeyW(HKEY_LOCAL_MACHINE, locations_keyW, &hkey) == ERROR_SUCCESS) { valsize = sizeof( DWORD); - if(!RegQueryValueExW(hkey, currentidW, 0, &type, (LPBYTE) &currid, &valsize) && + if(!RegQueryValueExW(hkey, L"CurrentID", 0, &type, (BYTE *) &currid, &valsize) && type == REG_DWORD) { /* find a subkey called Location1, Location2... */ - swprintf( szlockey, ARRAY_SIZE(szlockey), locationW, currid); + swprintf( szlockey, ARRAY_SIZE(szlockey), L"Location%u", currid); if( !RegOpenKeyW( hkey, szlockey, &hsubkey)) { if( citycode) { bufsize=sizeof(buf); - if( !RegQueryValueExW( hsubkey, areacodeW, 0, &type, buf, &bufsize) && + if( !RegQueryValueExW( hsubkey, L"AreaCode", 0, &type, buf, &bufsize) && type == REG_SZ) { lstrcpynW( citycode, (WCHAR *) buf, 8); } else @@ -73,9 +64,9 @@ DWORD WINAPI tapiGetLocationInfoW(LPWSTR countrycode, LPWSTR citycode) } if( countrycode) { bufsize=sizeof(buf); - if( !RegQueryValueExW( hsubkey, countryW, 0, &type, buf, &bufsize) && + if( !RegQueryValueExW( hsubkey, L"Country", 0, &type, buf, &bufsize) && type == REG_DWORD) - swprintf( countrycode, 8, fmtW, *(LPDWORD) buf ); + swprintf( countrycode, 8, L"%u", *(DWORD *) buf ); else countrycode[0] = '\0'; } diff --git a/dlls/tapi32/line.c b/dlls/tapi32/line.c index a4f21a250c5..b50d1f9dd10 100644 --- a/dlls/tapi32/line.c +++ b/dlls/tapi32/line.c @@ -489,19 +489,7 @@ DWORD WINAPI lineGetCountryA(DWORD dwCountryID, DWORD dwAPIVersion, LPLINECOUNTR DWORD WINAPI lineGetCountryW(DWORD id, DWORD version, LPLINECOUNTRYLIST list) { static const WCHAR country_listW[] = - {'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','\','C','o','u','n','t','r','y',' ','L','i','s','t',0}; - static const WCHAR international_ruleW[] = - {'I','n','t','e','r','n','a','t','i','o','n','a','l','R','u','l','e',0}; - static const WCHAR longdistance_ruleW[] = - {'L','o','n','g','D','i','s','t','a','n','c','e','R','u','l','e',0}; - static const WCHAR samearea_ruleW[] = - {'S','a','m','e','A','r','e','a','R','u','l','e',0}; - static const WCHAR nameW[] = - {'N','a','m','e',0}; - static const WCHAR country_codeW[] = - {'C','o','u','n','t','r','y','C','o','d','e',0}; + L"Software\Microsoft\Windows\CurrentVersion\Telephony\Country List"; DWORD total_size, offset, i, num_countries, max_subkey_len; LINECOUNTRYENTRY *entry; WCHAR *subkey_name; @@ -550,16 +538,16 @@ DWORD WINAPI lineGetCountryW(DWORD id, DWORD version, LPLINECOUNTRYLIST list) if (id && (wcstol(subkey_name, NULL, 10) != id)) continue; if (RegOpenKeyW(hkey, subkey_name, &hsubkey) != ERROR_SUCCESS) continue;
- RegQueryValueExW(hsubkey, international_ruleW, NULL, NULL, NULL, &size_int); + RegQueryValueExW(hsubkey, L"InternationalRule", NULL, NULL, NULL, &size_int); len = size_int;
- RegQueryValueExW(hsubkey, longdistance_ruleW, NULL, NULL, NULL, &size_long); + RegQueryValueExW(hsubkey, L"LongDistanceRule", NULL, NULL, NULL, &size_long); len += size_long;
- RegQueryValueExW(hsubkey, nameW, NULL, NULL, NULL, &size_name); + RegQueryValueExW(hsubkey, L"Name", NULL, NULL, NULL, &size_name); len += size_name;
- RegQueryValueExW(hsubkey, samearea_ruleW, NULL, NULL, NULL, &size_same); + RegQueryValueExW(hsubkey, L"SameAreaRule", NULL, NULL, NULL, &size_same); len += size_same;
if (total_size < offset + len) @@ -576,7 +564,7 @@ DWORD WINAPI lineGetCountryW(DWORD id, DWORD version, LPLINECOUNTRYLIST list) if (id) i = 0; entry[i].dwCountryID = wcstol(subkey_name, NULL, 10); size = sizeof(DWORD); - RegQueryValueExW(hsubkey, country_codeW, NULL, NULL, (BYTE *)&entry[i].dwCountryCode, &size); + RegQueryValueExW(hsubkey, L"CountryCode", NULL, NULL, (BYTE *)&entry[i].dwCountryCode, &size); entry[i].dwNextCountryID = 0;
if (i > 0) entry[i - 1].dwNextCountryID = entry[i].dwCountryID; @@ -584,25 +572,25 @@ DWORD WINAPI lineGetCountryW(DWORD id, DWORD version, LPLINECOUNTRYLIST list) /* add country name */ entry[i].dwCountryNameSize = size_name; entry[i].dwCountryNameOffset = offset; - RegQueryValueExW(hsubkey, nameW, NULL, NULL, (BYTE *)list + offset, &size_name); + RegQueryValueExW(hsubkey, L"Name", NULL, NULL, (BYTE *)list + offset, &size_name); offset += size_name;
/* add Same Area Rule */ entry[i].dwSameAreaRuleSize = size_same; entry[i].dwSameAreaRuleOffset = offset; - RegQueryValueExW(hsubkey, samearea_ruleW, NULL, NULL, (BYTE *)list + offset, &size_same); + RegQueryValueExW(hsubkey, L"SameAreaRule", NULL, NULL, (BYTE *)list + offset, &size_same); offset += size_same;
/* add Long Distance Rule */ entry[i].dwLongDistanceRuleSize = size_long; entry[i].dwLongDistanceRuleOffset = offset; - RegQueryValueExW(hsubkey, longdistance_ruleW, NULL, NULL, (BYTE *)list + offset, &size_long); + RegQueryValueExW(hsubkey, L"LongDistanceRule", NULL, NULL, (BYTE *)list + offset, &size_long); offset += size_long;
/* add Long Distance Rule */ entry[i].dwInternationalRuleSize = size_int; entry[i].dwInternationalRuleOffset = offset; - RegQueryValueExW(hsubkey, international_ruleW, NULL, NULL, (BYTE *)list + offset, &size_int); + RegQueryValueExW(hsubkey, L"InternationalRule", NULL, NULL, (BYTE *)list + offset, &size_int); offset += size_int; RegCloseKey(hsubkey);