Don't try to set fields in nonexistant lpLineCountryList.

Supply valid tapi codes.
oldstable
Guy Albertelli 2002-02-01 19:01:31 +00:00 committed by Alexandre Julliard
parent 7e105b49c4
commit b10454965e
2 changed files with 19 additions and 14 deletions

View File

@ -286,7 +286,15 @@ DWORD WINAPI lineGetCountry(DWORD dwCountryID, DWORD dwAPIVersion, LPLINECOUNTRY
DWORD dwAvailSize, dwOffset, i; DWORD dwAvailSize, dwOffset, i;
LPLINECOUNTRYENTRY lpLCE; LPLINECOUNTRYENTRY lpLCE;
TRACE("(%08lx, %08lx, %p): stub.\n", dwCountryID, dwAPIVersion, lpLineCountryList); if(!lpLineCountryList) {
TRACE("(%08lx, %08lx, %p): stub. Returning LINEERR_INVALPOINTER\n",
dwCountryID, dwAPIVersion, lpLineCountryList);
return LINEERR_INVALPOINTER;
}
TRACE("(%08lx, %08lx, %p(%ld)): stub.\n",
dwCountryID, dwAPIVersion, lpLineCountryList,
lpLineCountryList->dwTotalSize);
dwAvailSize = lpLineCountryList->dwTotalSize; dwAvailSize = lpLineCountryList->dwTotalSize;
dwOffset = sizeof (LINECOUNTRYLIST); dwOffset = sizeof (LINECOUNTRYLIST);
@ -294,11 +302,9 @@ DWORD WINAPI lineGetCountry(DWORD dwCountryID, DWORD dwAPIVersion, LPLINECOUNTRY
if(dwAvailSize<dwOffset) if(dwAvailSize<dwOffset)
return LINEERR_STRUCTURETOOSMALL; return LINEERR_STRUCTURETOOSMALL;
if(!lpLineCountryList)
return LINEERR_INVALPOINTER;
memset(lpLineCountryList, 0, dwAvailSize); memset(lpLineCountryList, 0, dwAvailSize);
lpLineCountryList->dwTotalSize = dwAvailSize;
lpLineCountryList->dwUsedSize = dwOffset; lpLineCountryList->dwUsedSize = dwOffset;
lpLineCountryList->dwNumCountries = 0; lpLineCountryList->dwNumCountries = 0;
lpLineCountryList->dwCountryListSize = 0; lpLineCountryList->dwCountryListSize = 0;
@ -330,7 +336,7 @@ DWORD WINAPI lineGetCountry(DWORD dwCountryID, DWORD dwAPIVersion, LPLINECOUNTRY
lpLineCountryList->dwCountryListSize += len; lpLineCountryList->dwCountryListSize += len;
lpLineCountryList->dwUsedSize += sizeof (LINECOUNTRYENTRY); /* maybe wrong */ lpLineCountryList->dwUsedSize += sizeof (LINECOUNTRYENTRY); /* maybe wrong */
TRACE("Adding country %s at %p\n", TAPI_LCList[i].lpCountryName, lpLCE); TRACE("Adding country %s at %p\n", TAPI_LCList[i].lpCountryName, &lpLCE[i]);
lpLCE[i].dwCountryID = TAPI_LCList[i].dwCountryID; lpLCE[i].dwCountryID = TAPI_LCList[i].dwCountryID;
lpLCE[i].dwCountryCode = TAPI_LCList[i].dwCountryCode; lpLCE[i].dwCountryCode = TAPI_LCList[i].dwCountryCode;

View File

@ -19,15 +19,14 @@ typedef HANDLE HLINEAPP, *LPHLINEAPP;
typedef HANDLE HPHONE, *LPHPHONE; typedef HANDLE HPHONE, *LPHPHONE;
typedef HANDLE HPHONEAPP, *LPHPHONEAPP; typedef HANDLE HPHONEAPP, *LPHPHONEAPP;
/* FIXME: bogus codes !! */ #define TAPIERR_REQUESTFAILED -16L
#define TAPIERR_REQUESTFAILED 20 #define LINEERR_INCOMPATIBLEAPIVERSION 0x8000000C
#define LINEERR_INCOMPATIBLEAPIVERSION 1 #define LINEERR_NOMEM 0x80000044
#define LINEERR_NOMEM 1 #define LINEERR_INIFILECORRUPT 0x8000000E
#define LINEERR_INIFILECORRUPT 1 #define LINEERR_OPERATIONFAILED 0x80000048
#define LINEERR_OPERATIONFAILED 1 #define LINEERR_INVALCOUNTRYCODE 0x80000022
#define LINEERR_INVALCOUNTRYCODE 1 #define LINEERR_STRUCTURETOOSMALL 0x8000004D
#define LINEERR_STRUCTURETOOSMALL 1 #define LINEERR_INVALPOINTER 0x80000035
#define LINEERR_INVALPOINTER 1
typedef struct lineaddresscaps_tag { typedef struct lineaddresscaps_tag {
DWORD dwTotalSize; DWORD dwTotalSize;