mshtml: Implement MediaQueryList's addListener method.
[wine.git] / dlls / tapi32 / line.c
bloba4f21a250c5d9385f16c300977bbab87e5133815
1 /*
2 * TAPI32 line services
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 <string.h>
22 #include <stdlib.h>
23 #include <stdarg.h>
24 #include <stdio.h>
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winternl.h"
28 #include "wingdi.h"
29 #include "winreg.h"
30 #include "winnls.h"
31 #include "winerror.h"
32 #include "objbase.h"
33 #include "tapi.h"
34 #include "wine/debug.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(tapi);
38 /* registry keys */
39 static const char szCountrylistKey[] =
40 "Software\\Microsoft\\Windows\\CurrentVersion\\Telephony\\Country List";
41 static const char szLocationsKey[] =
42 "Software\\Microsoft\\Windows\\CurrentVersion\\Telephony\\Locations";
43 static const char szCardsKey[] =
44 "Software\\Microsoft\\Windows\\CurrentVersion\\Telephony\\Cards";
47 /***********************************************************************
48 * lineAccept (TAPI32.@)
50 DWORD WINAPI lineAccept(HCALL hCall, LPCSTR lpsUserUserInfo, DWORD dwSize)
52 FIXME("(%p, %s, %ld): stub.\n", hCall, lpsUserUserInfo, dwSize);
53 return 1;
56 /***********************************************************************
57 * lineAddProviderA (TAPI32.@)
59 DWORD WINAPI lineAddProviderA(LPCSTR lpszProviderName, HWND hwndOwner, LPDWORD lpdwPermanentProviderID)
61 FIXME("(%s, %p, %p): stub.\n", lpszProviderName, hwndOwner, lpdwPermanentProviderID);
62 return LINEERR_OPERATIONFAILED;
65 /***********************************************************************
66 * lineAddProviderW (TAPI32.@)
68 DWORD WINAPI lineAddProviderW(LPCWSTR lpszProviderName, HWND hwndOwner, LPDWORD lpdwPermanentProviderID)
70 FIXME("(%s, %p, %p): stub.\n", wine_dbgstr_w(lpszProviderName), hwndOwner, lpdwPermanentProviderID);
71 return LINEERR_OPERATIONFAILED;
74 /***********************************************************************
75 * lineAddToConference (TAPI32.@)
77 DWORD WINAPI lineAddToConference(HCALL hConfCall, HCALL hConsultCall)
79 FIXME("(%p, %p): stub.\n", hConfCall, hConsultCall);
80 return 1;
83 /***********************************************************************
84 * lineAnswer (TAPI32.@)
86 DWORD WINAPI lineAnswer(HCALL hCall, LPCSTR lpsUserUserInfo, DWORD dwSize)
88 FIXME("(%p, %s, %ld): stub.\n", hCall, lpsUserUserInfo, dwSize);
89 return 1;
92 /***********************************************************************
93 * lineBlindTransfer (TAPI32.@)
95 DWORD WINAPI lineBlindTransferA(HCALL hCall, LPCSTR lpszDestAddress, DWORD dwCountryCode)
97 FIXME("(%p, %s, %08lx): stub.\n", hCall, lpszDestAddress, dwCountryCode);
98 return 1;
101 /***********************************************************************
102 * lineClose (TAPI32.@)
104 DWORD WINAPI lineClose(HLINE hLine)
106 FIXME("(%p): stub.\n", hLine);
107 return 0;
110 /***********************************************************************
111 * lineCompleteCall (TAPI32.@)
113 DWORD WINAPI lineCompleteCall(HCALL hCall, LPDWORD lpdwCompletionID, DWORD dwCompletionMode, DWORD dwMessageID)
115 FIXME("(%p, %p, %08lx, %08lx): stub.\n", hCall, lpdwCompletionID, dwCompletionMode, dwMessageID);
116 return 1;
119 /***********************************************************************
120 * lineCompleteTransfer (TAPI32.@)
122 DWORD WINAPI lineCompleteTransfer(HCALL hCall, HCALL hConsultCall, LPHCALL lphConfCall, DWORD dwTransferMode)
124 FIXME("(%p, %p, %p, %08lx): stub.\n", hCall, hConsultCall, lphConfCall, dwTransferMode);
125 return 1;
128 /***********************************************************************
129 * lineConfigDialog (TAPI32.@)
131 DWORD WINAPI lineConfigDialogA(DWORD dwDeviceID, HWND hwndOwner, LPCSTR lpszDeviceClass)
133 FIXME("(%08lx, %p, %s): stub.\n", dwDeviceID, hwndOwner, lpszDeviceClass);
134 return 0;
137 /***********************************************************************
138 * lineConfigDialogW (TAPI32.@)
140 DWORD WINAPI lineConfigDialogW(DWORD dwDeviceID, HWND hwndOwner, LPCWSTR lpszDeviceClass)
142 FIXME("(%08lx, %p, %s): stub.\n", dwDeviceID, hwndOwner, debugstr_w(lpszDeviceClass));
143 return 0;
146 /***********************************************************************
147 * lineConfigDialogEdit (TAPI32.@)
149 DWORD WINAPI lineConfigDialogEditA(DWORD dwDeviceID, HWND hwndOwner, LPCSTR lpszDeviceClass, LPVOID const lpDeviceConfigIn, DWORD dwSize, LPVARSTRING lpDeviceConfigOut)
151 FIXME("stub.\n");
152 return 0;
155 /***********************************************************************
156 * lineConfigProvider (TAPI32.@)
158 DWORD WINAPI lineConfigProvider(HWND hwndOwner, DWORD dwPermanentProviderID)
160 FIXME("(%p, %08lx): stub.\n", hwndOwner, dwPermanentProviderID);
161 return 0;
164 /***********************************************************************
165 * lineDeallocateCall (TAPI32.@)
167 DWORD WINAPI lineDeallocateCall(HCALL hCall)
169 FIXME("(%p): stub.\n", hCall);
170 return 0;
173 /***********************************************************************
174 * lineDevSpecific (TAPI32.@)
176 DWORD WINAPI lineDevSpecific(HLINE hLine, DWORD dwAddressId, HCALL hCall, LPVOID lpParams, DWORD dwSize)
178 FIXME("(%p, %08lx, %p, %p, %ld): stub.\n", hLine, dwAddressId, hCall, lpParams, dwSize);
179 return 1;
182 /***********************************************************************
183 * lineDevSpecificFeature (TAPI32.@)
185 DWORD WINAPI lineDevSpecificFeature(HLINE hLine, DWORD dwFeature, LPVOID lpParams, DWORD dwSize)
187 FIXME("(%p, %08lx, %p, %ld): stub.\n", hLine, dwFeature, lpParams, dwSize);
188 return 1;
191 /***********************************************************************
192 * lineDial (TAPI32.@)
194 DWORD WINAPI lineDialA(HCALL hCall, LPCSTR lpszDestAddress, DWORD dwCountryCode)
196 FIXME("(%p, %s, %08lx): stub.\n", hCall, lpszDestAddress, dwCountryCode);
197 return 1;
200 /***********************************************************************
201 * lineDialW (TAPI32.@)
203 DWORD WINAPI lineDialW(HCALL hCall, LPCWSTR lpszDestAddress, DWORD dwCountryCode)
205 FIXME("(%p, %s, %08lx): stub.\n", hCall, debugstr_w(lpszDestAddress), dwCountryCode);
206 return 1;
209 /***********************************************************************
210 * lineDrop (TAPI32.@)
212 DWORD WINAPI lineDrop(HCALL hCall, LPCSTR lpsUserUserInfo, DWORD dwSize)
214 FIXME("(%p, %s, %08lx): stub.\n", hCall, lpsUserUserInfo, dwSize);
215 return 1;
218 /***********************************************************************
219 * lineForward (TAPI32.@)
221 DWORD WINAPI lineForwardA(HLINE hLine, DWORD bAllAddress, DWORD dwAddressID, LPLINEFORWARDLIST lpForwardList, DWORD dwNumRingsNoAnswer, LPHCALL lphConsultCall, LPLINECALLPARAMS lpCallParams)
223 FIXME("stub.\n");
224 return 1;
227 /***********************************************************************
228 * lineGatherDigits (TAPI32.@)
230 DWORD WINAPI lineGatherDigitsA(HCALL hCall, DWORD dwDigitModes, LPSTR lpsDigits, DWORD dwNumDigits, LPCSTR lpszTerminationDigits, DWORD dwFirstDigitTimeout, DWORD dwInterDigitTimeout)
232 FIXME("stub.\n");
233 return 0;
236 /***********************************************************************
237 * lineGenerateDigits (TAPI32.@)
239 DWORD WINAPI lineGenerateDigitsA(HCALL hCall, DWORD dwDigitModes, LPCSTR lpszDigits, DWORD dwDuration)
241 FIXME("(%p, %08lx, %s, %ld): stub.\n", hCall, dwDigitModes, lpszDigits, dwDuration);
242 return 0;
245 /***********************************************************************
246 * lineGenerateTone (TAPI32.@)
248 DWORD WINAPI lineGenerateTone(HCALL hCall, DWORD dwToneMode, DWORD dwDuration, DWORD dwNumTones, LPLINEGENERATETONE lpTones)
250 FIXME("(%p, %08lx, %ld, %ld, %p): stub.\n", hCall, dwToneMode, dwDuration, dwNumTones, lpTones);
251 return 0;
254 /***********************************************************************
255 * lineGetAddressCaps (TAPI32.@)
257 DWORD WINAPI lineGetAddressCapsA(HLINEAPP hLineApp, DWORD dwDeviceID, DWORD dwAddressID, DWORD dwAPIVersion, DWORD dwExtVersion, LPLINEADDRESSCAPS lpAddressCaps)
259 FIXME("(%p, %08lx, %08lx, %08lx, %08lx, %p): stub.\n", hLineApp, dwDeviceID, dwAddressID, dwAPIVersion, dwExtVersion, lpAddressCaps);
260 return 0;
263 /***********************************************************************
264 * lineGetAddressID (TAPI32.@)
266 DWORD WINAPI lineGetAddressIDA(HLINE hLine, LPDWORD lpdwAddressID, DWORD dwAddressMode, LPCSTR lpsAddress, DWORD dwSize)
268 FIXME("%p, %p, %08lx, %s, %ld): stub.\n", hLine, lpdwAddressID, dwAddressMode, lpsAddress, dwSize);
269 return 0;
272 /***********************************************************************
273 * lineGetAddressStatus (TAPI32.@)
275 DWORD WINAPI lineGetAddressStatusA(HLINE hLine, DWORD dwAddressID, LPLINEADDRESSSTATUS lpAddressStatus)
277 FIXME("(%p, %08lx, %p): stub.\n", hLine, dwAddressID, lpAddressStatus);
278 return 0;
281 /***********************************************************************
282 * lineGetAppPriority (TAPI32.@)
284 DWORD WINAPI lineGetAppPriorityA(LPCSTR lpszAppFilename, DWORD dwMediaMode, LPLINEEXTENSIONID const lpExtensionID, DWORD dwRequestMode, LPVARSTRING lpExtensionName, LPDWORD lpdwPriority)
286 FIXME("(%s, %08lx, %p, %08lx, %p, %p): stub.\n", lpszAppFilename, dwMediaMode, lpExtensionID, dwRequestMode, lpExtensionName, lpdwPriority);
287 return 0;
290 /***********************************************************************
291 * lineGetCallInfo (TAPI32.@)
293 DWORD WINAPI lineGetCallInfoA(HCALL hCall, LPLINECALLINFO lpCallInfo)
295 FIXME("(%p, %p): stub.\n", hCall, lpCallInfo);
296 return 0;
299 /***********************************************************************
300 * lineGetCallInfoW (TAPI32.@)
302 DWORD WINAPI lineGetCallInfoW(HCALL hCall, LPLINECALLINFO lpCallInfo)
304 FIXME("(%p, %p): stub.\n", hCall, lpCallInfo);
305 return 0;
308 /***********************************************************************
309 * lineGetCallStatus (TAPI32.@)
311 DWORD WINAPI lineGetCallStatus(HCALL hCall, LPLINECALLSTATUS lpCallStatus)
313 FIXME("(%p, %p): stub.\n", hCall, lpCallStatus);
314 return 0;
317 /***********************************************************************
318 * lineGetConfRelatedCalls (TAPI32.@)
320 DWORD WINAPI lineGetConfRelatedCalls(HCALL hCall, LPLINECALLLIST lpCallList)
322 FIXME("(%p, %p): stub.\n", hCall, lpCallList);
323 return 0;
326 /***********************************************************************
327 * lineGetCountryA (TAPI32.@)
329 DWORD WINAPI lineGetCountryA(DWORD dwCountryID, DWORD dwAPIVersion, LPLINECOUNTRYLIST lpLineCountryList)
331 DWORD dwAvailSize, dwOffset, i, num_countries, max_subkey_len;
332 LPLINECOUNTRYENTRY lpLCE;
333 HKEY hkey;
334 char *subkey_name;
336 if(!lpLineCountryList) {
337 TRACE("(%08lx, %08lx, %p): stub. Returning LINEERR_INVALPOINTER\n",
338 dwCountryID, dwAPIVersion, lpLineCountryList);
339 return LINEERR_INVALPOINTER;
342 TRACE("(%08lx, %08lx, %p(%ld)): stub.\n",
343 dwCountryID, dwAPIVersion, lpLineCountryList,
344 lpLineCountryList->dwTotalSize);
346 if(RegOpenKeyA(HKEY_LOCAL_MACHINE, szCountrylistKey, &hkey)
347 != ERROR_SUCCESS)
348 return LINEERR_INIFILECORRUPT;
351 dwAvailSize = lpLineCountryList->dwTotalSize;
352 dwOffset = sizeof (LINECOUNTRYLIST);
354 if(dwAvailSize<dwOffset)
355 return LINEERR_STRUCTURETOOSMALL;
357 memset(lpLineCountryList, 0, dwAvailSize);
359 lpLineCountryList->dwTotalSize = dwAvailSize;
360 lpLineCountryList->dwUsedSize = dwOffset;
361 lpLineCountryList->dwNumCountries = 0;
362 lpLineCountryList->dwCountryListSize = 0;
363 lpLineCountryList->dwCountryListOffset = dwOffset;
365 lpLCE = (LPLINECOUNTRYENTRY)(&lpLineCountryList[1]);
367 if(RegQueryInfoKeyA(hkey, NULL, NULL, NULL, &num_countries, &max_subkey_len,
368 NULL, NULL, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) {
369 RegCloseKey(hkey);
370 return LINEERR_STRUCTURETOOSMALL;
373 if(dwCountryID)
374 dwOffset = sizeof (LINECOUNTRYENTRY);
375 else
376 dwOffset += num_countries * sizeof (LINECOUNTRYENTRY);
378 max_subkey_len++;
379 subkey_name = HeapAlloc(GetProcessHeap(), 0, max_subkey_len);
380 for(i = 0; i < num_countries; i++)
382 DWORD len, size, size_int, size_long, size_name, size_same;
383 HKEY hsubkey;
385 if(RegEnumKeyA(hkey, i, subkey_name, max_subkey_len) !=
386 ERROR_SUCCESS)
387 continue;
389 if(dwCountryID && (atoi(subkey_name) != dwCountryID))
390 continue;
392 if(RegOpenKeyA(hkey, subkey_name, &hsubkey) != ERROR_SUCCESS)
393 continue;
395 RegQueryValueExA(hsubkey, "InternationalRule", NULL, NULL,
396 NULL, &size_int);
397 len = size_int;
399 RegQueryValueExA(hsubkey, "LongDistanceRule", NULL, NULL,
400 NULL, &size_long);
401 len += size_long;
403 RegQueryValueExA(hsubkey, "Name", NULL, NULL,
404 NULL, &size_name);
405 len += size_name;
407 RegQueryValueExA(hsubkey, "SameAreaRule", NULL, NULL,
408 NULL, &size_same);
409 len += size_same;
411 if(dwAvailSize < (dwOffset+len))
413 dwOffset += len;
414 RegCloseKey(hsubkey);
415 if(dwCountryID)
416 break;
417 continue;
420 lpLineCountryList->dwNumCountries++;
421 lpLineCountryList->dwCountryListSize += sizeof (LINECOUNTRYENTRY);
422 lpLineCountryList->dwUsedSize += len + sizeof (LINECOUNTRYENTRY);
424 if(dwCountryID)
425 i = 0;
427 lpLCE[i].dwCountryID = atoi(subkey_name);
428 size = sizeof(DWORD);
429 RegQueryValueExA(hsubkey, "CountryCode", NULL, NULL,
430 (BYTE*)&lpLCE[i].dwCountryCode, &size);
432 lpLCE[i].dwNextCountryID = 0;
434 if(i > 0)
435 lpLCE[i-1].dwNextCountryID = lpLCE[i].dwCountryID;
437 /* add country name */
438 lpLCE[i].dwCountryNameSize = size_name;
439 lpLCE[i].dwCountryNameOffset = dwOffset;
440 RegQueryValueExA(hsubkey, "Name", NULL, NULL,
441 ((LPBYTE)lpLineCountryList)+dwOffset,
442 &size_name);
443 dwOffset += size_name;
445 /* add Same Area Rule */
446 lpLCE[i].dwSameAreaRuleSize = size_same;
447 lpLCE[i].dwSameAreaRuleOffset = dwOffset;
448 RegQueryValueExA(hsubkey, "SameAreaRule", NULL, NULL,
449 ((LPBYTE)lpLineCountryList)+dwOffset,
450 &size_same);
451 dwOffset += size_same;
453 /* add Long Distance Rule */
454 lpLCE[i].dwLongDistanceRuleSize = size_long;
455 lpLCE[i].dwLongDistanceRuleOffset = dwOffset;
456 RegQueryValueExA(hsubkey, "LongDistanceRule", NULL, NULL,
457 ((LPBYTE)lpLineCountryList)+dwOffset,
458 &size_long);
459 dwOffset += size_long;
461 /* add Long Distance Rule */
462 lpLCE[i].dwInternationalRuleSize = size_int;
463 lpLCE[i].dwInternationalRuleOffset = dwOffset;
464 RegQueryValueExA(hsubkey, "InternationalRule", NULL, NULL,
465 ((LPBYTE)lpLineCountryList)+dwOffset,
466 &size_int);
467 dwOffset += size_int;
468 RegCloseKey(hsubkey);
470 TRACE("Added country %s at %p\n", (LPSTR)lpLineCountryList + lpLCE[i].dwCountryNameOffset,
471 &lpLCE[i]);
473 if(dwCountryID) break;
476 lpLineCountryList->dwNeededSize = dwOffset;
478 TRACE("%ld available %ld required\n", dwAvailSize, dwOffset);
480 HeapFree(GetProcessHeap(), 0, subkey_name);
481 RegCloseKey(hkey);
483 return 0;
486 /***********************************************************************
487 * lineGetCountryW (TAPI32.@)
489 DWORD WINAPI lineGetCountryW(DWORD id, DWORD version, LPLINECOUNTRYLIST list)
491 static const WCHAR country_listW[] =
492 {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
493 'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
494 'T','e','l','e','p','h','o','n','y','\\','C','o','u','n','t','r','y',' ','L','i','s','t',0};
495 static const WCHAR international_ruleW[] =
496 {'I','n','t','e','r','n','a','t','i','o','n','a','l','R','u','l','e',0};
497 static const WCHAR longdistance_ruleW[] =
498 {'L','o','n','g','D','i','s','t','a','n','c','e','R','u','l','e',0};
499 static const WCHAR samearea_ruleW[] =
500 {'S','a','m','e','A','r','e','a','R','u','l','e',0};
501 static const WCHAR nameW[] =
502 {'N','a','m','e',0};
503 static const WCHAR country_codeW[] =
504 {'C','o','u','n','t','r','y','C','o','d','e',0};
505 DWORD total_size, offset, i, num_countries, max_subkey_len;
506 LINECOUNTRYENTRY *entry;
507 WCHAR *subkey_name;
508 HKEY hkey;
510 if (!list) return LINEERR_INVALPOINTER;
511 TRACE("(%08lx, %08lx, %p(%ld))\n", id, version, list, list->dwTotalSize);
513 if (RegOpenKeyW(HKEY_LOCAL_MACHINE, country_listW, &hkey) != ERROR_SUCCESS)
514 return LINEERR_INIFILECORRUPT;
516 total_size = list->dwTotalSize;
517 offset = sizeof(LINECOUNTRYLIST);
518 if (total_size < offset) return LINEERR_STRUCTURETOOSMALL;
520 memset(list, 0, total_size);
521 list->dwTotalSize = total_size;
522 list->dwUsedSize = offset;
523 list->dwNumCountries = 0;
524 list->dwCountryListSize = 0;
525 list->dwCountryListOffset = offset;
527 entry = (LINECOUNTRYENTRY *)(list + 1);
529 if (RegQueryInfoKeyW(hkey, NULL, NULL, NULL, &num_countries, &max_subkey_len,
530 NULL, NULL, NULL, NULL, NULL, NULL) != ERROR_SUCCESS)
532 RegCloseKey(hkey);
533 return LINEERR_OPERATIONFAILED;
535 if (id) offset = sizeof(LINECOUNTRYENTRY);
536 else offset += num_countries * sizeof(LINECOUNTRYENTRY);
538 max_subkey_len++;
539 if (!(subkey_name = HeapAlloc(GetProcessHeap(), 0, max_subkey_len * sizeof(WCHAR))))
541 RegCloseKey(hkey);
542 return LINEERR_NOMEM;
544 for (i = 0; i < num_countries; i++)
546 DWORD len, size, size_int, size_long, size_name, size_same;
547 HKEY hsubkey;
549 if (RegEnumKeyW(hkey, i, subkey_name, max_subkey_len) != ERROR_SUCCESS) continue;
550 if (id && (wcstol(subkey_name, NULL, 10) != id)) continue;
551 if (RegOpenKeyW(hkey, subkey_name, &hsubkey) != ERROR_SUCCESS) continue;
553 RegQueryValueExW(hsubkey, international_ruleW, NULL, NULL, NULL, &size_int);
554 len = size_int;
556 RegQueryValueExW(hsubkey, longdistance_ruleW, NULL, NULL, NULL, &size_long);
557 len += size_long;
559 RegQueryValueExW(hsubkey, nameW, NULL, NULL, NULL, &size_name);
560 len += size_name;
562 RegQueryValueExW(hsubkey, samearea_ruleW, NULL, NULL, NULL, &size_same);
563 len += size_same;
565 if (total_size < offset + len)
567 offset += len;
568 RegCloseKey(hsubkey);
569 if (id) break;
570 continue;
572 list->dwNumCountries++;
573 list->dwCountryListSize += sizeof(LINECOUNTRYENTRY);
574 list->dwUsedSize += len + sizeof(LINECOUNTRYENTRY);
576 if (id) i = 0;
577 entry[i].dwCountryID = wcstol(subkey_name, NULL, 10);
578 size = sizeof(DWORD);
579 RegQueryValueExW(hsubkey, country_codeW, NULL, NULL, (BYTE *)&entry[i].dwCountryCode, &size);
580 entry[i].dwNextCountryID = 0;
582 if (i > 0) entry[i - 1].dwNextCountryID = entry[i].dwCountryID;
584 /* add country name */
585 entry[i].dwCountryNameSize = size_name;
586 entry[i].dwCountryNameOffset = offset;
587 RegQueryValueExW(hsubkey, nameW, NULL, NULL, (BYTE *)list + offset, &size_name);
588 offset += size_name;
590 /* add Same Area Rule */
591 entry[i].dwSameAreaRuleSize = size_same;
592 entry[i].dwSameAreaRuleOffset = offset;
593 RegQueryValueExW(hsubkey, samearea_ruleW, NULL, NULL, (BYTE *)list + offset, &size_same);
594 offset += size_same;
596 /* add Long Distance Rule */
597 entry[i].dwLongDistanceRuleSize = size_long;
598 entry[i].dwLongDistanceRuleOffset = offset;
599 RegQueryValueExW(hsubkey, longdistance_ruleW, NULL, NULL, (BYTE *)list + offset, &size_long);
600 offset += size_long;
602 /* add Long Distance Rule */
603 entry[i].dwInternationalRuleSize = size_int;
604 entry[i].dwInternationalRuleOffset = offset;
605 RegQueryValueExW(hsubkey, international_ruleW, NULL, NULL, (BYTE *)list + offset, &size_int);
606 offset += size_int;
607 RegCloseKey(hsubkey);
609 TRACE("added country %s at %p\n",
610 debugstr_w((const WCHAR *)((const char *)list + entry[i].dwCountryNameOffset)), &entry[i]);
611 if (id) break;
613 list->dwNeededSize = offset;
615 TRACE("%ld available %ld required\n", total_size, offset);
617 HeapFree(GetProcessHeap(), 0, subkey_name);
618 RegCloseKey(hkey);
619 return 0;
622 /***********************************************************************
623 * lineGetDevCapsW (TAPI32.@)
625 DWORD WINAPI lineGetDevCapsW(HLINEAPP hLineApp, DWORD dwDeviceID, DWORD dwAPIVersion,
626 DWORD dwExtVersion, LPLINEDEVCAPS lpLineDevCaps)
628 static int warn_once;
630 if(!warn_once++)
631 FIXME("(%p, %08lx, %08lx, %08lx, %p): stub.\n", hLineApp, dwDeviceID, dwAPIVersion,
632 dwExtVersion, lpLineDevCaps);
633 return LINEERR_OPERATIONFAILED;
636 /***********************************************************************
637 * lineGetDevCapsA (TAPI32.@)
639 DWORD WINAPI lineGetDevCapsA(HLINEAPP hLineApp, DWORD dwDeviceID, DWORD dwAPIVersion,
640 DWORD dwExtVersion, LPLINEDEVCAPS lpLineDevCaps)
642 static int warn_once;
644 if(!warn_once++)
645 FIXME("(%p, %08lx, %08lx, %08lx, %p): stub.\n", hLineApp, dwDeviceID, dwAPIVersion,
646 dwExtVersion, lpLineDevCaps);
647 return LINEERR_OPERATIONFAILED;
650 /***********************************************************************
651 * lineGetDevConfig (TAPI32.@)
653 DWORD WINAPI lineGetDevConfigA(DWORD dwDeviceID, LPVARSTRING lpDeviceConfig, LPCSTR lpszDeviceClass)
655 FIXME("(%08lx, %p, %s): stub.\n", dwDeviceID, lpDeviceConfig, lpszDeviceClass);
656 return 0;
659 /***********************************************************************
660 * lineGetDevConfigW (TAPI32.@)
662 DWORD WINAPI lineGetDevConfigW(DWORD dwDeviceID, LPVARSTRING lpDeviceConfig, LPCWSTR lpszDeviceClass)
664 FIXME("(%08lx, %p, %s): stub.\n", dwDeviceID, lpDeviceConfig, debugstr_w(lpszDeviceClass));
665 return 0;
668 /***********************************************************************
669 * lineGetIDW (TAPI32.@)
671 DWORD WINAPI lineGetIDW(HLINE hLine, DWORD dwAddressID, HCALL hCall, DWORD dwSelect,
672 LPVARSTRING lpDeviceID, LPCWSTR lpszDeviceClass)
674 FIXME("(%p, %08lx, %p, %08lx, %p, %s): stub.\n", hLine, dwAddressID, hCall,
675 dwSelect, lpDeviceID,
676 debugstr_w(lpszDeviceClass));
677 return LINEERR_OPERATIONFAILED;
680 /***********************************************************************
681 * lineGetIDA (TAPI32.@)
683 DWORD WINAPI lineGetIDA(HLINE hLine, DWORD dwAddressID, HCALL hCall, DWORD dwSelect,
684 LPVARSTRING lpDeviceID, LPCSTR lpszDeviceClass)
686 FIXME("(%p, %08lx, %p, %08lx, %p, %s): stub.\n", hLine, dwAddressID, hCall,
687 dwSelect, lpDeviceID, lpszDeviceClass);
688 return LINEERR_OPERATIONFAILED;
691 /***********************************************************************
692 * lineGetIcon (TAPI32.@)
694 DWORD WINAPI lineGetIconA(DWORD dwDeviceID, LPCSTR lpszDeviceClass, HICON *lphIcon)
696 FIXME("(%08lx, %s, %p): stub.\n", dwDeviceID, lpszDeviceClass, lphIcon);
697 return 0;
700 /***********************************************************************
701 * lineGetIconW (TAPI32.@)
703 DWORD WINAPI lineGetIconW(DWORD dwDeviceID, LPCWSTR lpszDeviceClass, HICON *lphIcon)
705 FIXME("(%08lx, %s, %p): stub.\n", dwDeviceID, debugstr_w(lpszDeviceClass), lphIcon);
706 return 0;
709 /***********************************************************************
710 * lineGetLineDevStatus (TAPI32.@)
712 DWORD WINAPI lineGetLineDevStatusA(HLINE hLine, LPLINEDEVSTATUS lpLineDevStatus)
714 FIXME("(%p, %p): stub.\n", hLine, lpLineDevStatus);
715 return 0;
718 /***********************************************************************
719 * lineGetMessage (TAPI32.@)
721 DWORD WINAPI lineGetMessage(HLINEAPP hLineApp, LPLINEMESSAGE lpMessage, DWORD dwTimeout)
723 FIXME("(%p, %p, %08lx): stub.\n", hLineApp, lpMessage, dwTimeout);
724 return 0;
727 /***********************************************************************
728 * lineGetNewCalls (TAPI32.@)
730 DWORD WINAPI lineGetNewCalls(HLINE hLine, DWORD dwAddressID, DWORD dwSelect, LPLINECALLLIST lpCallList)
732 FIXME("(%p, %08lx, %08lx, %p): stub.\n", hLine, dwAddressID, dwSelect, lpCallList);
733 return 0;
736 /***********************************************************************
737 * lineGetNumRings (TAPI32.@)
739 DWORD WINAPI lineGetNumRings(HLINE hLine, DWORD dwAddressID, LPDWORD lpdwNumRings)
741 FIXME("(%p, %08lx, %p): stub.\n", hLine, dwAddressID, lpdwNumRings);
742 return 0;
745 /***********************************************************************
746 * lineGetProviderListA (TAPI32.@)
748 DWORD WINAPI lineGetProviderListA(DWORD dwAPIVersion, LPLINEPROVIDERLIST lpProviderList)
750 FIXME("(%08lx, %p): stub.\n", dwAPIVersion, lpProviderList);
751 return LINEERR_OPERATIONFAILED;
754 /***********************************************************************
755 * lineGetProviderListW (TAPI32.@)
757 DWORD WINAPI lineGetProviderListW(DWORD dwAPIVersion, LPLINEPROVIDERLIST lpProviderList)
759 FIXME("(%08lx, %p): stub.\n", dwAPIVersion, lpProviderList);
760 return LINEERR_OPERATIONFAILED;
763 /***********************************************************************
764 * lineGetRequest (TAPI32.@)
766 DWORD WINAPI lineGetRequestA(HLINEAPP hLineApp, DWORD dwRequestMode, LPVOID lpRequestBuffer)
768 FIXME("%p, %08lx, %p): stub.\n", hLineApp, dwRequestMode, lpRequestBuffer);
769 return 0;
772 /***********************************************************************
773 * lineGetStatusMessages (TAPI32.@)
775 DWORD WINAPI lineGetStatusMessages(HLINE hLine, LPDWORD lpdwLineStatus, LPDWORD lpdwAddressStates)
777 FIXME("(%p, %p, %p): stub.\n", hLine, lpdwLineStatus, lpdwAddressStates);
778 return 0;
781 /***********************************************************************
782 * lineGetTranslateCapsW (TAPI32.@)
784 DWORD WINAPI lineGetTranslateCapsW(HLINEAPP line_app, DWORD api_version, LINETRANSLATECAPS *caps)
786 FIXME("(%p, %08lx, %p): stub.\n", line_app, api_version, caps);
787 return LINEERR_OPERATIONFAILED;
790 /***********************************************************************
791 * lineGetTranslateCaps (TAPI32.@)
793 * get address translate capabilities. Returns a LINETRANSLATECAPS
794 * structure:
796 * +-----------------------+
797 * |TotalSize |
798 * |NeededSize |
799 * |UsedSize |
800 * +-----------------------+
801 * |NumLocations |
802 * |LocationsListSize |
803 * |LocationsListOffset | -+
804 * |CurrentLocationID | |
805 * +-----------------------+ |
806 * |NumCards | |
807 * |CardListSize | |
808 * |CardListOffset | -|--+
809 * |CurrentPreferredCardID | | |
810 * +-----------------------+ | |
811 * | | <+ |
812 * |LINELOCATIONENTRY #1 | |
813 * | | |
814 * +-----------------------+ |
815 * ~ ~ |
816 * +-----------------------+ |
817 * | | |
818 * |LINELOCATIONENTRY | |
819 * | #NumLocations| |
820 * +-----------------------+ |
821 * | | <---+
822 * |LINECARDENTRY #1 |
823 * | |
824 * +-----------------------+
825 * ~ ~
826 * +-----------------------+
827 * | |
828 * |LINECARDENTRY #NumCards|
829 * | |
830 * +-----------------------+
831 * | room for strings named|
832 * | in the structures |
833 * | above. |
834 * +-----------------------+
836 DWORD WINAPI lineGetTranslateCapsA(HLINEAPP hLineApp, DWORD dwAPIVersion,
837 LPLINETRANSLATECAPS lpTranslateCaps)
839 HKEY hkLocations, hkCards, hkCardLocations, hsubkey;
840 int numlocations, numcards;
841 DWORD maxlockeylen,
842 maxcardkeylen;
843 char *loc_key_name = NULL;
844 char *card_key_name = NULL;
845 LPBYTE strptr;
846 int length;
847 int i;
848 DWORD lendword;
849 DWORD currentid;
850 LPLINELOCATIONENTRY pLocEntry;
851 LPLINECARDENTRY pCardEntry;
853 TRACE("(%p, %08lx, %p (tot. size %ld)\n", hLineApp, dwAPIVersion,
854 lpTranslateCaps, lpTranslateCaps->dwTotalSize );
855 if( lpTranslateCaps->dwTotalSize < sizeof(LINETRANSLATECAPS))
856 return LINEERR_STRUCTURETOOSMALL;
857 if( RegCreateKeyA(HKEY_LOCAL_MACHINE, szLocationsKey, &hkLocations)
858 != ERROR_SUCCESS ) {
859 ERR("unexpected registry error 1.\n");
860 return LINEERR_INIFILECORRUPT;
862 lendword = sizeof( DWORD);
863 if( RegQueryValueExA( hkLocations, "CurrentID", NULL, NULL,
864 (LPBYTE) &currentid, &lendword) != ERROR_SUCCESS )
865 currentid = -1; /* change this later */
866 if(RegQueryInfoKeyA(hkLocations, NULL, NULL, NULL, NULL, &maxlockeylen,
867 NULL, NULL, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) {
868 RegCloseKey(hkLocations);
869 ERR("unexpected registry error 2.\n");
870 return LINEERR_INIFILECORRUPT;
872 maxlockeylen++;
873 if( maxlockeylen < 10)
874 maxlockeylen = 10; /* need this also if there is no key */
875 loc_key_name = HeapAlloc( GetProcessHeap(), 0, maxlockeylen);
876 /* first time through: calculate needed space */
877 length=0;
878 i=0;
879 numlocations=0;
880 while( RegEnumKeyA(hkLocations, i, loc_key_name, maxlockeylen)
881 == ERROR_SUCCESS){
882 DWORD size_val;
883 i++;
884 if( _strnicmp(loc_key_name, "location", 8) ||
885 (RegOpenKeyA(hkLocations, loc_key_name, &hsubkey)
886 != ERROR_SUCCESS))
887 continue;
888 numlocations++;
889 length += sizeof(LINELOCATIONENTRY);
890 RegQueryValueExA(hsubkey, "Name",NULL,NULL,NULL,&size_val);
891 length += size_val;
892 RegQueryValueExA(hsubkey, "AreaCode",NULL,NULL,NULL,&size_val);
893 length += size_val;
894 RegQueryValueExA(hsubkey, "OutsideAccess",NULL,NULL,NULL,&size_val);
895 length += size_val;
896 RegQueryValueExA(hsubkey, "LongDistanceAccess",NULL,NULL,NULL,&size_val);
897 length += size_val;
898 RegQueryValueExA(hsubkey, "DisableCallWaiting",NULL,NULL,NULL,&size_val);
899 length += size_val;
900 /* fixme: what about TollPrefixList???? */
901 RegCloseKey(hsubkey);
903 if(numlocations == 0) {
904 /* add one location */
905 if( RegCreateKeyA( hkLocations, "Location1", &hsubkey)
906 == ERROR_SUCCESS) {
907 DWORD dwval;
908 char buf[10];
909 numlocations = 1;
910 length += sizeof(LINELOCATIONENTRY) + 20 ;
911 RegSetValueExA( hsubkey, "AreaCode", 0, REG_SZ, (const BYTE *)"010", 4);
912 GetLocaleInfoA( LOCALE_SYSTEM_DEFAULT, LOCALE_ICOUNTRY, buf, 8);
913 dwval = atoi(buf);
914 RegSetValueExA( hsubkey, "Country", 0, REG_DWORD, (LPBYTE)&dwval,
915 sizeof(DWORD));
916 RegSetValueExA( hsubkey, "DisableCallWaiting", 0, REG_SZ, (const BYTE *)"", 1);
917 dwval = 1;
918 RegSetValueExA( hsubkey, "Flags", 0, REG_DWORD, (LPBYTE)&dwval,
919 sizeof(DWORD));
920 RegSetValueExA( hsubkey, "LongDistanceAccess", 0, REG_SZ, (const BYTE *)"", 1);
921 RegSetValueExA( hsubkey, "Name", 0, REG_SZ, (const BYTE *)"New Location", 13);
922 RegSetValueExA( hsubkey, "OutsideAccess", 0, REG_SZ, (const BYTE *)"", 1);
923 RegCloseKey(hsubkey);
924 dwval = 1;
925 RegSetValueExA( hkLocations, "CurrentID", 0, REG_DWORD,
926 (LPBYTE)&dwval, sizeof(DWORD));
927 dwval = 2;
928 RegSetValueExA( hkLocations, "NextID", 0, REG_DWORD, (LPBYTE)&dwval,
929 sizeof(DWORD));
932 /* do the card list */
933 numcards=0;
934 if( RegCreateKeyA(HKEY_CURRENT_USER, szCardsKey, &hkCards)
935 == ERROR_SUCCESS ) {
936 if(RegQueryInfoKeyA(hkCards, NULL, NULL, NULL, NULL, &maxcardkeylen,
937 NULL, NULL, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) {
938 maxcardkeylen++;
939 if( maxcardkeylen < 6) maxcardkeylen = 6;
940 card_key_name = HeapAlloc(GetProcessHeap(), 0, maxcardkeylen);
941 i=0;
942 while( RegEnumKeyA(hkCards, i, card_key_name, maxcardkeylen) ==
943 ERROR_SUCCESS){
944 DWORD size_val;
945 i++;
946 if( _strnicmp(card_key_name, "card", 4) || ERROR_SUCCESS !=
947 (RegOpenKeyA(hkCards, card_key_name, &hsubkey) ))
948 continue;
949 numcards++;
950 length += sizeof(LINECARDENTRY);
951 RegQueryValueExA(hsubkey, "Name",NULL,NULL,NULL,&size_val);
952 length += size_val;
953 RegQueryValueExA(hsubkey, "LocalRule",NULL,NULL,NULL,&size_val);
954 length += size_val;
955 RegQueryValueExA(hsubkey, "LDRule",NULL,NULL,NULL,&size_val);
956 length += size_val;
957 RegQueryValueExA(hsubkey, "InternationalRule",NULL,NULL,NULL,
958 &size_val);
959 length += size_val;
960 RegCloseKey(hsubkey);
963 /* add one card (direct call) */
964 if (numcards == 0 &&
965 ERROR_SUCCESS == RegCreateKeyA( hkCards, "Card1", &hsubkey)) {
966 DWORD dwval;
967 numcards = 1;
968 length += sizeof(LINECARDENTRY) + 22 ;
969 RegSetValueExA( hsubkey, "Name", 0, REG_SZ, (const BYTE *)"None (Direct Call)", 19);
970 dwval = 1;
971 RegSetValueExA( hsubkey, "Flags", 0, REG_DWORD, (LPBYTE)&dwval,
972 sizeof(DWORD));
973 RegSetValueExA( hsubkey, "InternationalRule", 0, REG_SZ, (const BYTE *)"", 1);
974 RegSetValueExA( hsubkey, "LDRule", 0, REG_SZ, (const BYTE *)"", 1);
975 RegSetValueExA( hsubkey, "LocalRule", 0, REG_SZ, (const BYTE *)"", 1);
976 RegCloseKey(hsubkey);
977 dwval = 2;
978 RegSetValueExA( hkCards, "NextID", 0, REG_DWORD, (LPBYTE)&dwval,
979 sizeof(DWORD));
981 } else hkCards = 0; /* should really fail */
982 /* check if sufficient room is available */
983 lpTranslateCaps->dwNeededSize = sizeof(LINETRANSLATECAPS) + length;
984 if ( lpTranslateCaps->dwNeededSize > lpTranslateCaps->dwTotalSize ) {
985 RegCloseKey( hkLocations);
986 if( hkCards) RegCloseKey( hkCards);
987 HeapFree(GetProcessHeap(), 0, loc_key_name);
988 HeapFree(GetProcessHeap(), 0, card_key_name);
989 lpTranslateCaps->dwUsedSize = sizeof(LINETRANSLATECAPS);
990 TRACE("Insufficient space: total %ld needed %ld used %ld\n",
991 lpTranslateCaps->dwTotalSize,
992 lpTranslateCaps->dwNeededSize,
993 lpTranslateCaps->dwUsedSize);
994 return 0;
996 /* fill in the LINETRANSLATECAPS structure */
997 lpTranslateCaps->dwUsedSize = lpTranslateCaps->dwNeededSize;
998 lpTranslateCaps->dwNumLocations = numlocations;
999 lpTranslateCaps->dwLocationListSize = sizeof(LINELOCATIONENTRY) *
1000 lpTranslateCaps->dwNumLocations;
1001 lpTranslateCaps->dwLocationListOffset = sizeof(LINETRANSLATECAPS);
1002 lpTranslateCaps->dwCurrentLocationID = currentid;
1003 lpTranslateCaps->dwNumCards = numcards;
1004 lpTranslateCaps->dwCardListSize = sizeof(LINECARDENTRY) *
1005 lpTranslateCaps->dwNumCards;
1006 lpTranslateCaps->dwCardListOffset = lpTranslateCaps->dwLocationListOffset +
1007 lpTranslateCaps->dwLocationListSize;
1008 lpTranslateCaps->dwCurrentPreferredCardID = 0;
1009 /* this is where the strings will be stored */
1010 strptr = ((LPBYTE) lpTranslateCaps) +
1011 lpTranslateCaps->dwCardListOffset + lpTranslateCaps->dwCardListSize;
1012 pLocEntry = (LPLINELOCATIONENTRY) (lpTranslateCaps + 1);
1013 /* key with Preferred CardIDs */
1014 if( RegOpenKeyA(HKEY_CURRENT_USER, szLocationsKey, &hkCardLocations)
1015 != ERROR_SUCCESS )
1016 hkCardLocations = 0;
1017 /* second time through all locations */
1018 i=0;
1019 while(RegEnumKeyA(hkLocations, i, loc_key_name, maxlockeylen)
1020 == ERROR_SUCCESS){
1021 DWORD size_val;
1022 i++;
1023 if( _strnicmp(loc_key_name, "location", 8) ||
1024 (RegOpenKeyA(hkLocations, loc_key_name, &hsubkey)
1025 != ERROR_SUCCESS))
1026 continue;
1027 size_val=sizeof(DWORD);
1028 if( RegQueryValueExA(hsubkey, "ID",NULL, NULL,
1029 (LPBYTE) &(pLocEntry->dwPermanentLocationID), &size_val) !=
1030 ERROR_SUCCESS)
1031 pLocEntry->dwPermanentLocationID = atoi( loc_key_name + 8);
1032 size_val=2048;
1033 RegQueryValueExA(hsubkey, "Name",NULL,NULL, strptr, &size_val);
1034 pLocEntry->dwLocationNameSize = size_val;
1035 pLocEntry->dwLocationNameOffset = strptr - (LPBYTE) lpTranslateCaps;
1036 strptr += size_val;
1038 size_val=2048;
1039 RegQueryValueExA(hsubkey, "AreaCode",NULL,NULL, strptr, &size_val);
1040 pLocEntry->dwCityCodeSize = size_val;
1041 pLocEntry->dwCityCodeOffset = strptr - (LPBYTE) lpTranslateCaps;
1042 strptr += size_val;
1044 size_val=2048;
1045 RegQueryValueExA(hsubkey, "OutsideAccess",NULL,NULL, strptr, &size_val);
1046 pLocEntry->dwLocalAccessCodeSize = size_val;
1047 pLocEntry->dwLocalAccessCodeOffset = strptr - (LPBYTE) lpTranslateCaps;
1048 strptr += size_val;
1049 size_val=2048;
1050 RegQueryValueExA(hsubkey, "LongDistanceAccess",NULL,NULL, strptr,
1051 &size_val);
1052 pLocEntry->dwLongDistanceAccessCodeSize= size_val;
1053 pLocEntry->dwLongDistanceAccessCodeOffset= strptr -
1054 (LPBYTE) lpTranslateCaps;
1055 strptr += size_val;
1056 size_val=2048;
1057 RegQueryValueExA(hsubkey, "DisableCallWaiting",NULL,NULL, strptr,
1058 &size_val);
1059 pLocEntry->dwCancelCallWaitingSize= size_val;
1060 pLocEntry->dwCancelCallWaitingOffset= strptr - (LPBYTE) lpTranslateCaps;
1061 strptr += size_val;
1063 pLocEntry->dwTollPrefixListSize = 0; /* FIXME */
1064 pLocEntry->dwTollPrefixListOffset = 0; /* FIXME */
1066 size_val=sizeof(DWORD);
1067 RegQueryValueExA(hsubkey, "Country",NULL,NULL,
1068 (LPBYTE) &(pLocEntry->dwCountryCode), &size_val);
1069 pLocEntry->dwCountryID = pLocEntry->dwCountryCode; /* FIXME */
1070 RegQueryValueExA(hsubkey, "Flags",NULL,NULL,
1071 (LPBYTE) &(pLocEntry->dwOptions), &size_val);
1072 RegCloseKey(hsubkey);
1073 /* get preferred cardid */
1074 pLocEntry->dwPreferredCardID = 0;
1075 if ( hkCardLocations) {
1076 size_val=sizeof(DWORD);
1077 if(RegOpenKeyA(hkCardLocations, loc_key_name, &hsubkey) ==
1078 ERROR_SUCCESS) {
1079 RegQueryValueExA(hsubkey, "CallingCard",NULL,NULL,
1080 (LPBYTE) &(pLocEntry->dwPreferredCardID), &size_val);
1081 RegCloseKey(hsubkey);
1085 /* make sure there is a currentID */
1086 if(currentid == -1){
1087 currentid = pLocEntry->dwPermanentLocationID;
1088 lpTranslateCaps->dwCurrentLocationID = currentid;
1090 if(pLocEntry->dwPermanentLocationID == currentid )
1091 lpTranslateCaps->dwCurrentPreferredCardID =
1092 pLocEntry->dwPreferredCardID;
1093 TRACE("added: ID %ld %s CountryCode %ld CityCode %s CardID %ld "
1094 "LocalAccess: %s LongDistanceAccess: %s CountryID %ld "
1095 "Options %ld CancelCallWait %s\n",
1096 pLocEntry->dwPermanentLocationID,
1097 debugstr_a( (char*)lpTranslateCaps + pLocEntry->dwLocationNameOffset),
1098 pLocEntry->dwCountryCode,
1099 debugstr_a( (char*)lpTranslateCaps + pLocEntry->dwCityCodeOffset),
1100 pLocEntry->dwPreferredCardID,
1101 debugstr_a( (char*)lpTranslateCaps + pLocEntry->dwLocalAccessCodeOffset),
1102 debugstr_a( (char*)lpTranslateCaps + pLocEntry->dwLongDistanceAccessCodeOffset),
1103 pLocEntry->dwCountryID,
1104 pLocEntry->dwOptions,
1105 debugstr_a( (char*)lpTranslateCaps + pLocEntry->dwCancelCallWaitingOffset));
1106 pLocEntry++;
1108 pCardEntry= (LPLINECARDENTRY) pLocEntry;
1109 /* do the card list */
1110 if( hkCards) {
1111 i=0;
1112 while( RegEnumKeyA(hkCards, i, card_key_name, maxcardkeylen) ==
1113 ERROR_SUCCESS){
1114 DWORD size_val;
1115 i++;
1116 if( _strnicmp(card_key_name, "card", 4) ||
1117 (RegOpenKeyA(hkCards, card_key_name, &hsubkey) != ERROR_SUCCESS))
1118 continue;
1119 size_val=sizeof(DWORD);
1120 if( RegQueryValueExA(hsubkey, "ID",NULL, NULL,
1121 (LPBYTE) &(pCardEntry->dwPermanentCardID), &size_val) !=
1122 ERROR_SUCCESS)
1123 pCardEntry->dwPermanentCardID= atoi( card_key_name + 4);
1124 size_val=2048;
1125 RegQueryValueExA(hsubkey, "Name",NULL,NULL, strptr, &size_val);
1126 pCardEntry->dwCardNameSize = size_val;
1127 pCardEntry->dwCardNameOffset = strptr - (LPBYTE) lpTranslateCaps;
1128 strptr += size_val;
1129 pCardEntry->dwCardNumberDigits = 1; /* FIXME */
1130 size_val=2048;
1131 RegQueryValueExA(hsubkey, "LocalRule",NULL,NULL, strptr, &size_val);
1132 pCardEntry->dwSameAreaRuleSize= size_val;
1133 pCardEntry->dwSameAreaRuleOffset= strptr - (LPBYTE) lpTranslateCaps;
1134 strptr += size_val;
1135 size_val=2048;
1136 RegQueryValueExA(hsubkey, "LDRule",NULL,NULL, strptr, &size_val);
1137 pCardEntry->dwLongDistanceRuleSize = size_val;
1138 pCardEntry->dwLongDistanceRuleOffset = strptr - (LPBYTE) lpTranslateCaps;
1139 strptr += size_val;
1140 size_val=2048;
1141 RegQueryValueExA(hsubkey, "InternationalRule",NULL,NULL, strptr,
1142 &size_val);
1143 pCardEntry->dwInternationalRuleSize = size_val;
1144 pCardEntry->dwInternationalRuleOffset = strptr -
1145 (LPBYTE) lpTranslateCaps;
1146 strptr += size_val;
1147 size_val=sizeof(DWORD);
1148 RegQueryValueExA(hsubkey, "Flags",NULL, NULL,
1149 (LPBYTE) &(pCardEntry->dwOptions), &size_val);
1150 TRACE( "added card: ID %ld name %s SameArea %s LongDistance %s International %s Options 0x%lx\n",
1151 pCardEntry->dwPermanentCardID,
1152 debugstr_a( (char*)lpTranslateCaps + pCardEntry->dwCardNameOffset),
1153 debugstr_a( (char*)lpTranslateCaps + pCardEntry->dwSameAreaRuleOffset),
1154 debugstr_a( (char*)lpTranslateCaps + pCardEntry->dwLongDistanceRuleOffset),
1155 debugstr_a( (char*)lpTranslateCaps + pCardEntry->dwInternationalRuleOffset),
1156 pCardEntry->dwOptions);
1158 pCardEntry++;
1162 if(hkLocations) RegCloseKey(hkLocations);
1163 if(hkCards) RegCloseKey(hkCards);
1164 if(hkCardLocations) RegCloseKey(hkCardLocations);
1165 HeapFree(GetProcessHeap(), 0, loc_key_name);
1166 HeapFree(GetProcessHeap(), 0, card_key_name);
1167 TRACE(" returning success tot %ld needed %ld used %ld\n",
1168 lpTranslateCaps->dwTotalSize,
1169 lpTranslateCaps->dwNeededSize,
1170 lpTranslateCaps->dwUsedSize );
1171 return 0; /* success */
1174 /***********************************************************************
1175 * lineHandoff (TAPI32.@)
1177 DWORD WINAPI lineHandoffA(HCALL hCall, LPCSTR lpszFileName, DWORD dwMediaMode)
1179 FIXME("(%p, %s, %08lx): stub.\n", hCall, lpszFileName, dwMediaMode);
1180 return 0;
1183 /***********************************************************************
1184 * lineHold (TAPI32.@)
1186 DWORD WINAPI lineHold(HCALL hCall)
1188 FIXME("(%p): stub.\n", hCall);
1189 return 1;
1192 /***********************************************************************
1193 * lineInitialize (TAPI32.@)
1195 DWORD WINAPI lineInitialize(
1196 LPHLINEAPP lphLineApp,
1197 HINSTANCE hInstance,
1198 LINECALLBACK lpfnCallback,
1199 LPCSTR lpszAppName,
1200 LPDWORD lpdwNumDevs)
1202 FIXME("(%p, %p, %p, %s, %p): stub.\n", lphLineApp, hInstance,
1203 lpfnCallback, debugstr_a(lpszAppName), lpdwNumDevs);
1204 return 0;
1207 /***********************************************************************
1208 * lineInitializeExA (TAPI32.@)
1210 LONG WINAPI lineInitializeExA(LPHLINEAPP lphLineApp, HINSTANCE hInstance, LINECALLBACK lpfnCallback, LPCSTR lpszFriendlyAppName, LPDWORD lpdwNumDevs, LPDWORD lpdwAPIVersion, LPLINEINITIALIZEEXPARAMS lpLineInitializeExParams)
1212 FIXME("(%p, %p, %p, %s, %p, %p, %p): stub.\n", lphLineApp, hInstance,
1213 lpfnCallback, debugstr_a(lpszFriendlyAppName), lpdwNumDevs, lpdwAPIVersion, lpLineInitializeExParams);
1214 return 0;
1217 /***********************************************************************
1218 * lineInitializeExW (TAPI32.@)
1220 LONG WINAPI lineInitializeExW(LPHLINEAPP lphLineApp, HINSTANCE hInstance, LINECALLBACK lpfnCallback, LPCWSTR lpszFriendlyAppName, LPDWORD lpdwNumDevs, LPDWORD lpdwAPIVersion, LPLINEINITIALIZEEXPARAMS lpLineInitializeExParams)
1222 FIXME("(%p, %p, %p, %s, %p, %p, %p): stub.\n", lphLineApp, hInstance,
1223 lpfnCallback, debugstr_w(lpszFriendlyAppName), lpdwNumDevs, lpdwAPIVersion, lpLineInitializeExParams);
1224 return 0;
1227 /***********************************************************************
1228 * lineMakeCallW (TAPI32.@)
1230 DWORD WINAPI lineMakeCallW(HLINE hLine, LPHCALL lphCall, LPCWSTR lpszDestAddress,
1231 DWORD dwCountryCode, LPLINECALLPARAMS lpCallParams)
1233 FIXME("(%p, %p, %s, %08lx, %p): stub.\n", hLine, lphCall, debugstr_w(lpszDestAddress),
1234 dwCountryCode, lpCallParams);
1235 return LINEERR_OPERATIONFAILED;
1238 /***********************************************************************
1239 * lineMakeCallA (TAPI32.@)
1241 DWORD WINAPI lineMakeCallA(HLINE hLine, LPHCALL lphCall, LPCSTR lpszDestAddress,
1242 DWORD dwCountryCode, LPLINECALLPARAMS lpCallParams)
1244 FIXME("(%p, %p, %s, %08lx, %p): stub.\n", hLine, lphCall, lpszDestAddress,
1245 dwCountryCode, lpCallParams);
1246 return LINEERR_OPERATIONFAILED;
1249 /***********************************************************************
1250 * lineMonitorDigits (TAPI32.@)
1252 DWORD WINAPI lineMonitorDigits(HCALL hCall, DWORD dwDigitModes)
1254 FIXME("(%p, %08lx): stub.\n", hCall, dwDigitModes);
1255 return 0;
1258 /***********************************************************************
1259 * lineMonitorMedia (TAPI32.@)
1261 DWORD WINAPI lineMonitorMedia(HCALL hCall, DWORD dwMediaModes)
1263 FIXME("(%p, %08lx): stub.\n", hCall, dwMediaModes);
1264 return 0;
1267 /***********************************************************************
1268 * lineMonitorTones (TAPI32.@)
1270 DWORD WINAPI lineMonitorTones(HCALL hCall, LPLINEMONITORTONE lpToneList, DWORD dwNumEntries)
1272 FIXME("(%p, %p, %08lx): stub.\n", hCall, lpToneList, dwNumEntries);
1273 return 0;
1276 /***********************************************************************
1277 * lineNegotiateAPIVersion (TAPI32.@)
1279 DWORD WINAPI lineNegotiateAPIVersion(
1280 HLINEAPP hLineApp,
1281 DWORD dwDeviceID,
1282 DWORD dwAPILowVersion,
1283 DWORD dwAPIHighVersion,
1284 LPDWORD lpdwAPIVersion,
1285 LPLINEEXTENSIONID lpExtensionID
1288 static int warn_once;
1290 if(!warn_once++)
1291 FIXME("(%p, %ld, %ld, %ld, %p, %p): stub.\n", hLineApp, dwDeviceID,
1292 dwAPILowVersion, dwAPIHighVersion, lpdwAPIVersion, lpExtensionID);
1293 *lpdwAPIVersion = dwAPIHighVersion;
1294 return 0;
1297 /***********************************************************************
1298 * lineNegotiateExtVersion (TAPI32.@)
1300 DWORD WINAPI lineNegotiateExtVersion(HLINEAPP hLineApp, DWORD dwDeviceID, DWORD dwAPIVersion, DWORD dwExtLowVersion, DWORD dwExtHighVersion, LPDWORD lpdwExtVersion)
1302 FIXME("stub.\n");
1303 return 0;
1306 /***********************************************************************
1307 * lineOpenW (TAPI32.@)
1309 DWORD WINAPI lineOpenW(HLINEAPP hLineApp, DWORD dwDeviceID, LPHLINE lphLine, DWORD dwAPIVersion, DWORD dwExtVersion, DWORD dwCallbackInstance, DWORD dwPrivileges, DWORD dwMediaModes, LPLINECALLPARAMS lpCallParams)
1311 FIXME("stub.\n");
1312 return 0;
1315 /***********************************************************************
1316 * lineOpen (TAPI32.@)
1318 DWORD WINAPI lineOpenA(HLINEAPP hLineApp, DWORD dwDeviceID, LPHLINE lphLine, DWORD dwAPIVersion, DWORD dwExtVersion, DWORD dwCallbackInstance, DWORD dwPrivileges, DWORD dwMediaModes, LPLINECALLPARAMS lpCallParams)
1320 FIXME("stub.\n");
1321 return 0;
1324 /***********************************************************************
1325 * linePark (TAPI32.@)
1327 DWORD WINAPI lineParkA(HCALL hCall, DWORD dwParkMode, LPCSTR lpszDirAddress, LPVARSTRING lpNonDirAddress)
1329 FIXME("(%p, %08lx, %s, %p): stub.\n", hCall, dwParkMode, lpszDirAddress, lpNonDirAddress);
1330 return 1;
1333 /***********************************************************************
1334 * linePickup (TAPI32.@)
1336 DWORD WINAPI linePickupA(HLINE hLine, DWORD dwAddressID, LPHCALL lphCall, LPCSTR lpszDestAddress, LPCSTR lpszGroupID)
1338 FIXME("(%p, %08lx, %p, %s, %s): stub.\n", hLine, dwAddressID, lphCall, lpszDestAddress, lpszGroupID);
1339 return 1;
1342 /***********************************************************************
1343 * linePrepareAddToConference (TAPI32.@)
1345 DWORD WINAPI linePrepareAddToConferenceA(HCALL hConfCall, LPHCALL lphConsultCall, LPLINECALLPARAMS lpCallParams)
1347 FIXME("(%p, %p, %p): stub.\n", hConfCall, lphConsultCall, lpCallParams);
1348 return 1;
1351 /***********************************************************************
1352 * lineRedirect (TAPI32.@)
1354 DWORD WINAPI lineRedirectA(
1355 HCALL hCall,
1356 LPCSTR lpszDestAddress,
1357 DWORD dwCountryCode) {
1359 FIXME(": stub.\n");
1360 return 1;
1363 /***********************************************************************
1364 * lineRegisterRequestRecipient (TAPI32.@)
1366 DWORD WINAPI lineRegisterRequestRecipient(HLINEAPP hLineApp, DWORD dwRegistrationInstance, DWORD dwRequestMode, DWORD dwEnable)
1368 FIXME("(%p, %08lx, %08lx, %08lx): stub.\n", hLineApp, dwRegistrationInstance, dwRequestMode, dwEnable);
1369 return 1;
1372 /***********************************************************************
1373 * lineReleaseUserUserInfo (TAPI32.@)
1375 DWORD WINAPI lineReleaseUserUserInfo(HCALL hCall)
1377 FIXME("(%p): stub.\n", hCall);
1378 return 1;
1381 /***********************************************************************
1382 * lineRemoveFromConference (TAPI32.@)
1384 DWORD WINAPI lineRemoveFromConference(HCALL hCall)
1386 FIXME("(%p): stub.\n", hCall);
1387 return 1;
1390 /***********************************************************************
1391 * lineRemoveProvider (TAPI32.@)
1393 DWORD WINAPI lineRemoveProvider(DWORD dwPermanentProviderID, HWND hwndOwner)
1395 FIXME("(%08lx, %p): stub.\n", dwPermanentProviderID, hwndOwner);
1396 return 1;
1399 /***********************************************************************
1400 * lineSecureCall (TAPI32.@)
1402 DWORD WINAPI lineSecureCall(HCALL hCall)
1404 FIXME("(%p): stub.\n", hCall);
1405 return 1;
1408 /***********************************************************************
1409 * lineSendUserUserInfo (TAPI32.@)
1411 DWORD WINAPI lineSendUserUserInfo(HCALL hCall, LPCSTR lpsUserUserInfo, DWORD dwSize)
1413 FIXME("(%p, %s, %08lx): stub.\n", hCall, lpsUserUserInfo, dwSize);
1414 return 1;
1417 /***********************************************************************
1418 * lineSetAppPriority (TAPI32.@)
1420 DWORD WINAPI lineSetAppPriorityA(LPCSTR lpszAppFilename, DWORD dwMediaMode, LPLINEEXTENSIONID const lpExtensionID, DWORD dwRequestMode, LPCSTR lpszExtensionName, DWORD dwPriority)
1422 FIXME("(%s, %08lx, %p, %08lx, %s, %08lx): stub.\n", lpszAppFilename, dwMediaMode, lpExtensionID, dwRequestMode, lpszExtensionName, dwPriority);
1423 return 0;
1426 /***********************************************************************
1427 * lineSetAppSpecific (TAPI32.@)
1429 DWORD WINAPI lineSetAppSpecific(HCALL hCall, DWORD dwAppSpecific)
1431 FIXME("(%p, %08lx): stub.\n", hCall, dwAppSpecific);
1432 return 0;
1435 /***********************************************************************
1436 * lineSetCallParams (TAPI32.@)
1438 DWORD WINAPI lineSetCallParams(HCALL hCall, DWORD dwBearerMode, DWORD dwMinRate, DWORD dwMaxRate, LPLINEDIALPARAMS lpDialParams)
1440 FIXME("(%p, %08lx, %08lx, %08lx, %p): stub.\n", hCall, dwBearerMode, dwMinRate, dwMaxRate, lpDialParams);
1441 return 1;
1444 /***********************************************************************
1445 * lineSetCallPrivilege (TAPI32.@)
1447 DWORD WINAPI lineSetCallPrivilege(HCALL hCall, DWORD dwCallPrivilege)
1449 FIXME("(%p, %08lx): stub.\n", hCall, dwCallPrivilege);
1450 return 0;
1453 /***********************************************************************
1454 * lineSetCurrentLocation (TAPI32.@)
1456 DWORD WINAPI lineSetCurrentLocation(HLINEAPP hLineApp, DWORD dwLocation)
1458 FIXME("(%p, %08lx): stub.\n", hLineApp, dwLocation);
1459 return 0;
1462 /***********************************************************************
1463 * lineSetDevConfig (TAPI32.@)
1465 DWORD WINAPI lineSetDevConfigA(DWORD dwDeviceID, LPVOID lpDeviceConfig, DWORD dwSize, LPCSTR lpszDeviceClass)
1467 FIXME("(%08lx, %p, %08lx, %s): stub.\n", dwDeviceID, lpDeviceConfig, dwSize, lpszDeviceClass);
1468 return 0;
1471 /***********************************************************************
1472 * lineSetDevConfigW (TAPI32.@)
1474 DWORD WINAPI lineSetDevConfigW(DWORD dwDeviceID, LPVOID lpDeviceConfig, DWORD dwSize, LPCWSTR lpszDeviceClass)
1476 FIXME("(%08lx, %p, %08lx, %s): stub.\n", dwDeviceID, lpDeviceConfig, dwSize, debugstr_w(lpszDeviceClass));
1477 return 0;
1480 /***********************************************************************
1481 * lineSetMediaControl (TAPI32.@)
1483 DWORD WINAPI lineSetMediaControl(
1484 HLINE hLine,
1485 DWORD dwAddressID,
1486 HCALL hCall,
1487 DWORD dwSelect,
1488 LPLINEMEDIACONTROLDIGIT const lpDigitList,
1489 DWORD dwDigitNumEntries,
1490 LPLINEMEDIACONTROLMEDIA const lpMediaList,
1491 DWORD dwMediaNumEntries,
1492 LPLINEMEDIACONTROLTONE const lpToneList,
1493 DWORD dwToneNumEntries,
1494 LPLINEMEDIACONTROLCALLSTATE const lpCallStateList,
1495 DWORD dwCallStateNumEntries)
1497 FIXME(": stub.\n");
1498 return 0;
1501 /***********************************************************************
1502 * lineSetMediaMode (TAPI32.@)
1504 DWORD WINAPI lineSetMediaMode(HCALL hCall, DWORD dwMediaModes)
1506 FIXME("(%p, %08lx): stub.\n", hCall, dwMediaModes);
1507 return 0;
1510 /***********************************************************************
1511 * lineSetNumRings (TAPI32.@)
1513 DWORD WINAPI lineSetNumRings(HLINE hLine, DWORD dwAddressID, DWORD dwNumRings)
1515 FIXME("(%p, %08lx, %08lx): stub.\n", hLine, dwAddressID, dwNumRings);
1516 return 0;
1519 /***********************************************************************
1520 * lineSetStatusMessages (TAPI32.@)
1522 DWORD WINAPI lineSetStatusMessages(HLINE hLine, DWORD dwLineStates, DWORD dwAddressStates)
1524 FIXME("(%p, %08lx, %08lx): stub.\n", hLine, dwLineStates, dwAddressStates);
1525 return 0;
1528 /***********************************************************************
1529 * lineSetTerminal (TAPI32.@)
1531 DWORD WINAPI lineSetTerminal(HLINE hLine, DWORD dwAddressID, HCALL hCall, DWORD dwSelect, DWORD dwTerminalModes, DWORD dwTerminalID, DWORD bEnable)
1533 FIXME("(%p, %08lx, %p, %08lx, %08lx, %08lx, %08lx): stub.\n", hLine, dwAddressID, hCall, dwSelect, dwTerminalModes, dwTerminalID, bEnable);
1534 return 1;
1537 /***********************************************************************
1538 * lineSetTollList (TAPI32.@)
1540 DWORD WINAPI lineSetTollListA(HLINEAPP hLineApp, DWORD dwDeviceID, LPCSTR lpszAddressIn, DWORD dwTollListOption)
1542 FIXME("(%p, %08lx, %s, %08lx): stub.\n", hLineApp, dwDeviceID, lpszAddressIn, dwTollListOption);
1543 return 0;
1546 /***********************************************************************
1547 * lineSetupConference (TAPI32.@)
1549 DWORD WINAPI lineSetupConferenceA(HCALL hCall, HLINE hLine, LPHCALL lphConfCall, LPHCALL lphConsultCall, DWORD dwNumParties, LPLINECALLPARAMS lpCallParams)
1551 FIXME("(%p, %p, %p, %p, %08lx, %p): stub.\n", hCall, hLine, lphConfCall, lphConsultCall, dwNumParties, lpCallParams);
1552 return 1;
1555 /***********************************************************************
1556 * lineSetupTransfer (TAPI32.@)
1558 DWORD WINAPI lineSetupTransferA(HCALL hCall, LPHCALL lphConsultCall, LPLINECALLPARAMS lpCallParams)
1560 FIXME("(%p, %p, %p): stub.\n", hCall, lphConsultCall, lpCallParams);
1561 return 1;
1564 /***********************************************************************
1565 * lineShutdown (TAPI32.@)
1567 DWORD WINAPI lineShutdown(HLINEAPP hLineApp)
1569 FIXME("(%p): stub.\n", hLineApp);
1570 return 0;
1573 /***********************************************************************
1574 * lineSwapHold (TAPI32.@)
1576 DWORD WINAPI lineSwapHold(HCALL hActiveCall, HCALL hHeldCall)
1578 FIXME("(active: %p, held: %p): stub.\n", hActiveCall, hHeldCall);
1579 return 1;
1582 /***********************************************************************
1583 * lineTranslateAddress (TAPI32.@)
1585 DWORD WINAPI lineTranslateAddressA(HLINEAPP hLineApp, DWORD dwDeviceID, DWORD dwAPIVersion, LPCSTR lpszAddressIn, DWORD dwCard, DWORD dwTranslateOptions, LPLINETRANSLATEOUTPUT lpTranslateOutput)
1587 FIXME("(%p, %08lx, %08lx, %s, %08lx, %08lx, %p): stub.\n", hLineApp, dwDeviceID, dwAPIVersion, lpszAddressIn, dwCard, dwTranslateOptions, lpTranslateOutput);
1588 return 0;
1591 /***********************************************************************
1592 * lineTranslateAddressW (TAPI32.@)
1594 DWORD WINAPI lineTranslateAddressW(HLINEAPP hLineApp, DWORD dwDeviceID,
1595 DWORD dwAPIVersion, LPCWSTR lpszAddressIn, DWORD dwCard,
1596 DWORD dwTranslateOptions, LPLINETRANSLATEOUTPUT lpTranslateOutput)
1598 FIXME("(%p, %08lx, %08lx, %s, %08lx, %08lx, %p): stub.\n", hLineApp, dwDeviceID, dwAPIVersion,
1599 debugstr_w(lpszAddressIn), dwCard, dwTranslateOptions, lpTranslateOutput);
1600 return 0;
1603 /***********************************************************************
1604 * lineTranslateDialog (TAPI32.@)
1606 DWORD WINAPI lineTranslateDialogA(HLINEAPP hLineApp, DWORD dwDeviceID, DWORD dwAPIVersion, HWND hwndOwner, LPCSTR lpszAddressIn)
1608 FIXME("(%p, %08lx, %08lx, %p, %s): stub.\n", hLineApp, dwDeviceID, dwAPIVersion, hwndOwner, lpszAddressIn);
1609 return 0;
1612 /***********************************************************************
1613 * lineTranslateDialogW (TAPI32.@)
1615 DWORD WINAPI lineTranslateDialogW(HLINEAPP hLineApp, DWORD dwDeviceID,
1616 DWORD dwAPIVersion, HWND hwndOwner, LPCWSTR lpszAddressIn)
1618 FIXME("(%p, %08lx, %08lx, %p, %s): stub.\n", hLineApp, dwDeviceID,
1619 dwAPIVersion, hwndOwner, debugstr_w(lpszAddressIn));
1620 return 0;
1623 /***********************************************************************
1624 * lineUncompleteCall (TAPI32.@)
1626 DWORD WINAPI lineUncompleteCall(HLINE hLine, DWORD dwCompletionID)
1628 FIXME("(%p, %08lx): stub.\n", hLine, dwCompletionID);
1629 return 1;
1632 /***********************************************************************
1633 * lineUnhold (TAPI32.@)
1635 DWORD WINAPI lineUnhold(HCALL hCall)
1637 FIXME("(%p): stub.\n", hCall);
1638 return 1;
1641 /***********************************************************************
1642 * lineUnpark (TAPI32.@)
1644 DWORD WINAPI lineUnparkA(HLINE hLine, DWORD dwAddressID, LPHCALL lphCall, LPCSTR lpszDestAddress)
1646 FIXME("(%p, %08lx, %p, %s): stub.\n", hLine, dwAddressID, lphCall, lpszDestAddress);
1647 return 1;