зеркало из https://github.com/mozilla/pjs.git
merge commit for bug 450453
This commit is contained in:
Коммит
eb11a87fa9
|
@ -43,7 +43,6 @@
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <winsvc.h>
|
#include <winsvc.h>
|
||||||
#include "nsString.h"
|
|
||||||
#include "nsAutodialWin.h"
|
#include "nsAutodialWin.h"
|
||||||
#include "prlog.h"
|
#include "prlog.h"
|
||||||
|
|
||||||
|
@ -140,8 +139,8 @@ nsresult nsRASAutodial::Init()
|
||||||
mNumRASConnectionEntries = NumRASEntries();
|
mNumRASConnectionEntries = NumRASEntries();
|
||||||
|
|
||||||
// Get the name of the default entry.
|
// Get the name of the default entry.
|
||||||
nsresult result = GetDefaultEntryName(mDefaultEntryName,
|
nsresult result = GetDefaultEntryName(mDefaultEntryName,
|
||||||
sizeof(mDefaultEntryName));
|
RAS_MaxEntryName + 1);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -206,9 +205,9 @@ int nsRASAutodial::QueryAutodialBehavior()
|
||||||
// If we get to here, then the service is not going to dial on error, so we
|
// If we get to here, then the service is not going to dial on error, so we
|
||||||
// can dial ourselves if the control panel settings are set up that way.
|
// can dial ourselves if the control panel settings are set up that way.
|
||||||
HKEY hKey = 0;
|
HKEY hKey = 0;
|
||||||
LONG result = ::RegOpenKeyExW(
|
LONG result = ::RegOpenKeyEx(
|
||||||
HKEY_CURRENT_USER,
|
HKEY_CURRENT_USER,
|
||||||
L"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings",
|
"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings",
|
||||||
0,
|
0,
|
||||||
KEY_READ,
|
KEY_READ,
|
||||||
&hKey);
|
&hKey);
|
||||||
|
@ -224,7 +223,7 @@ int nsRASAutodial::QueryAutodialBehavior()
|
||||||
DWORD onDemand = 0;
|
DWORD onDemand = 0;
|
||||||
DWORD paramSize = sizeof(DWORD);
|
DWORD paramSize = sizeof(DWORD);
|
||||||
|
|
||||||
result = ::RegQueryValueExW(hKey, L"EnableAutodial", nsnull, &entryType, (LPBYTE)&autodial, ¶mSize);
|
result = ::RegQueryValueEx(hKey, "EnableAutodial", nsnull, &entryType, (LPBYTE)&autodial, ¶mSize);
|
||||||
if (result != ERROR_SUCCESS)
|
if (result != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
::RegCloseKey(hKey);
|
::RegCloseKey(hKey);
|
||||||
|
@ -232,7 +231,7 @@ int nsRASAutodial::QueryAutodialBehavior()
|
||||||
return AUTODIAL_NEVER;
|
return AUTODIAL_NEVER;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = ::RegQueryValueExW(hKey, L"NoNetAutodial", nsnull, &entryType, (LPBYTE)&onDemand, ¶mSize);
|
result = ::RegQueryValueEx(hKey, "NoNetAutodial", nsnull, &entryType, (LPBYTE)&onDemand, ¶mSize);
|
||||||
if (result != ERROR_SUCCESS)
|
if (result != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
::RegCloseKey(hKey);
|
::RegCloseKey(hKey);
|
||||||
|
@ -322,7 +321,7 @@ static nsresult DoPPCConnection()
|
||||||
// Return values:
|
// Return values:
|
||||||
// NS_OK: dialing was successful and caller should retry
|
// NS_OK: dialing was successful and caller should retry
|
||||||
// all other values indicate that the caller should not retry
|
// all other values indicate that the caller should not retry
|
||||||
nsresult nsRASAutodial::DialDefault(const PRUnichar* hostName)
|
nsresult nsRASAutodial::DialDefault(const char* hostName)
|
||||||
{
|
{
|
||||||
#ifndef WINCE
|
#ifndef WINCE
|
||||||
mDontRetryUntil = 0;
|
mDontRetryUntil = 0;
|
||||||
|
@ -463,15 +462,15 @@ PRBool nsRASAutodial::IsRASConnected()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the first RAS dial entry name from the phonebook.
|
// Get the first RAS dial entry name from the phonebook.
|
||||||
nsresult nsRASAutodial::GetFirstEntryName(PRUnichar* entryName, int bufferSize)
|
nsresult nsRASAutodial::GetFirstEntryName(char* entryName, int bufferSize)
|
||||||
{
|
{
|
||||||
// Need to load the DLL if not loaded yet.
|
// Need to load the DLL if not loaded yet.
|
||||||
if (!LoadRASapi32DLL())
|
if (!LoadRASapi32DLL())
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
|
|
||||||
RASENTRYNAMEW rasEntryName;
|
RASENTRYNAME rasEntryName;
|
||||||
rasEntryName.dwSize = sizeof(RASENTRYNAMEW);
|
rasEntryName.dwSize = sizeof(RASENTRYNAME);
|
||||||
DWORD cb = sizeof(RASENTRYNAMEW);
|
DWORD cb = sizeof(RASENTRYNAME);
|
||||||
DWORD cEntries = 0;
|
DWORD cEntries = 0;
|
||||||
|
|
||||||
DWORD result =
|
DWORD result =
|
||||||
|
@ -480,8 +479,9 @@ nsresult nsRASAutodial::GetFirstEntryName(PRUnichar* entryName, int bufferSize)
|
||||||
// ERROR_BUFFER_TOO_SMALL is OK because we only need one struct.
|
// ERROR_BUFFER_TOO_SMALL is OK because we only need one struct.
|
||||||
if (result == ERROR_SUCCESS || result == ERROR_BUFFER_TOO_SMALL)
|
if (result == ERROR_SUCCESS || result == ERROR_BUFFER_TOO_SMALL)
|
||||||
{
|
{
|
||||||
wcsncpy(entryName, rasEntryName.szEntryName,
|
#ifndef WINCE
|
||||||
bufferSize / sizeof(*entryName));
|
strncpy(entryName, rasEntryName.szEntryName, bufferSize);
|
||||||
|
#endif
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -495,9 +495,9 @@ int nsRASAutodial::NumRASEntries()
|
||||||
if (!LoadRASapi32DLL())
|
if (!LoadRASapi32DLL())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
RASENTRYNAMEW rasEntryName;
|
RASENTRYNAME rasEntryName;
|
||||||
rasEntryName.dwSize = sizeof(RASENTRYNAMEW);
|
rasEntryName.dwSize = sizeof(RASENTRYNAME);
|
||||||
DWORD cb = sizeof(RASENTRYNAMEW);
|
DWORD cb = sizeof(RASENTRYNAME);
|
||||||
DWORD cEntries = 0;
|
DWORD cEntries = 0;
|
||||||
|
|
||||||
|
|
||||||
|
@ -514,7 +514,7 @@ int nsRASAutodial::NumRASEntries()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the name of the default dial entry.
|
// Get the name of the default dial entry.
|
||||||
nsresult nsRASAutodial::GetDefaultEntryName(PRUnichar* entryName, int bufferSize)
|
nsresult nsRASAutodial::GetDefaultEntryName(char* entryName, int bufferSize)
|
||||||
{
|
{
|
||||||
// No RAS dialup entries.
|
// No RAS dialup entries.
|
||||||
if (mNumRASConnectionEntries <= 0)
|
if (mNumRASConnectionEntries <= 0)
|
||||||
|
@ -535,8 +535,8 @@ nsresult nsRASAutodial::GetDefaultEntryName(PRUnichar* entryName, int bufferSize
|
||||||
// or HKLM/Software/Microsoft/RAS Autodial/Default/DefaultInternet.
|
// or HKLM/Software/Microsoft/RAS Autodial/Default/DefaultInternet.
|
||||||
// For Windows 2K: HKCU/RemoteAccess/InternetProfile.
|
// For Windows 2K: HKCU/RemoteAccess/InternetProfile.
|
||||||
|
|
||||||
const PRUnichar* key = nsnull;
|
char* key = nsnull;
|
||||||
const PRUnichar* val = nsnull;
|
char* val = nsnull;
|
||||||
|
|
||||||
HKEY hKey = 0;
|
HKEY hKey = 0;
|
||||||
LONG result = 0;
|
LONG result = 0;
|
||||||
|
@ -545,10 +545,10 @@ nsresult nsRASAutodial::GetDefaultEntryName(PRUnichar* entryName, int bufferSize
|
||||||
if ((mOSVerInfo.dwMajorVersion == 4) // Windows NT
|
if ((mOSVerInfo.dwMajorVersion == 4) // Windows NT
|
||||||
|| ((mOSVerInfo.dwMajorVersion == 5) && (mOSVerInfo.dwMinorVersion == 0))) // Windows 2000
|
|| ((mOSVerInfo.dwMajorVersion == 5) && (mOSVerInfo.dwMinorVersion == 0))) // Windows 2000
|
||||||
{
|
{
|
||||||
key = L"RemoteAccess";
|
key = "RemoteAccess";
|
||||||
val = L"InternetProfile";
|
val = "InternetProfile";
|
||||||
|
|
||||||
result = ::RegOpenKeyExW(
|
result = ::RegOpenKeyEx(
|
||||||
HKEY_CURRENT_USER,
|
HKEY_CURRENT_USER,
|
||||||
key,
|
key,
|
||||||
0,
|
0,
|
||||||
|
@ -562,12 +562,12 @@ nsresult nsRASAutodial::GetDefaultEntryName(PRUnichar* entryName, int bufferSize
|
||||||
}
|
}
|
||||||
else // Windows XP
|
else // Windows XP
|
||||||
{
|
{
|
||||||
key = L"Software\\Microsoft\\RAS Autodial\\Default";
|
key = "Software\\Microsoft\\RAS Autodial\\Default";
|
||||||
val = L"DefaultInternet";
|
val = "DefaultInternet";
|
||||||
|
|
||||||
|
|
||||||
// Try HKCU first.
|
// Try HKCU first.
|
||||||
result = ::RegOpenKeyExW(
|
result = ::RegOpenKeyEx(
|
||||||
HKEY_CURRENT_USER,
|
HKEY_CURRENT_USER,
|
||||||
key,
|
key,
|
||||||
0,
|
0,
|
||||||
|
@ -577,7 +577,7 @@ nsresult nsRASAutodial::GetDefaultEntryName(PRUnichar* entryName, int bufferSize
|
||||||
if (result != ERROR_SUCCESS)
|
if (result != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
// If not present, try HKLM.
|
// If not present, try HKLM.
|
||||||
result = ::RegOpenKeyExW(
|
result = ::RegOpenKeyEx(
|
||||||
HKEY_LOCAL_MACHINE,
|
HKEY_LOCAL_MACHINE,
|
||||||
key,
|
key,
|
||||||
0,
|
0,
|
||||||
|
@ -595,7 +595,7 @@ nsresult nsRASAutodial::GetDefaultEntryName(PRUnichar* entryName, int bufferSize
|
||||||
DWORD entryType = 0;
|
DWORD entryType = 0;
|
||||||
DWORD buffSize = bufferSize;
|
DWORD buffSize = bufferSize;
|
||||||
|
|
||||||
result = ::RegQueryValueExW(hKey,
|
result = ::RegQueryValueEx(hKey,
|
||||||
val,
|
val,
|
||||||
nsnull,
|
nsnull,
|
||||||
&entryType,
|
&entryType,
|
||||||
|
@ -631,7 +631,7 @@ PRBool nsRASAutodial::IsAutodialServiceRunning()
|
||||||
}
|
}
|
||||||
|
|
||||||
SC_HANDLE hService =
|
SC_HANDLE hService =
|
||||||
OpenServiceW(hSCManager, L"RasAuto", SERVICE_QUERY_STATUS);
|
OpenService(hSCManager, "RasAuto", SERVICE_QUERY_STATUS);
|
||||||
|
|
||||||
if (hSCManager == nsnull)
|
if (hSCManager == nsnull)
|
||||||
{
|
{
|
||||||
|
@ -655,23 +655,23 @@ PRBool nsRASAutodial::IsAutodialServiceRunning()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the specified address to the autodial directory.
|
// Add the specified address to the autodial directory.
|
||||||
PRBool nsRASAutodial::AddAddressToAutodialDirectory(const PRUnichar* hostName)
|
PRBool nsRASAutodial::AddAddressToAutodialDirectory(const char* hostName)
|
||||||
{
|
{
|
||||||
// Need to load the DLL if not loaded yet.
|
// Need to load the DLL if not loaded yet.
|
||||||
if (!LoadRASapi32DLL())
|
if (!LoadRASapi32DLL())
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
|
|
||||||
// First see if there is already a db entry for this address.
|
// First see if there is already a db entry for this address.
|
||||||
RASAUTODIALENTRYW autodialEntry;
|
RASAUTODIALENTRY autodialEntry;
|
||||||
autodialEntry.dwSize = sizeof(RASAUTODIALENTRY);
|
autodialEntry.dwSize = sizeof(RASAUTODIALENTRY);
|
||||||
DWORD size = sizeof(RASAUTODIALENTRY);
|
DWORD size = sizeof(RASAUTODIALENTRY);
|
||||||
DWORD entries = 0;
|
DWORD entries = 0;
|
||||||
|
|
||||||
DWORD result = (*mpRasGetAutodialAddress)(hostName,
|
DWORD result = (*mpRasGetAutodialAddress)(hostName,
|
||||||
nsnull,
|
nsnull,
|
||||||
&autodialEntry,
|
&autodialEntry,
|
||||||
&size,
|
&size,
|
||||||
&entries);
|
&entries);
|
||||||
|
|
||||||
// If there is already at least 1 entry in db for this address, return.
|
// If there is already at least 1 entry in db for this address, return.
|
||||||
if (result != ERROR_FILE_NOT_FOUND)
|
if (result != ERROR_FILE_NOT_FOUND)
|
||||||
|
@ -683,13 +683,13 @@ PRBool nsRASAutodial::AddAddressToAutodialDirectory(const PRUnichar* hostName)
|
||||||
autodialEntry.dwSize = sizeof(RASAUTODIALENTRY);
|
autodialEntry.dwSize = sizeof(RASAUTODIALENTRY);
|
||||||
autodialEntry.dwFlags = 0;
|
autodialEntry.dwFlags = 0;
|
||||||
autodialEntry.dwDialingLocation = mAutodialServiceDialingLocation;
|
autodialEntry.dwDialingLocation = mAutodialServiceDialingLocation;
|
||||||
GetDefaultEntryName(autodialEntry.szEntry, sizeof(autodialEntry.szEntry));
|
GetDefaultEntryName(autodialEntry.szEntry, RAS_MaxEntryName);
|
||||||
|
|
||||||
result = (*mpRasSetAutodialAddress)(hostName,
|
result = (*mpRasSetAutodialAddress)(hostName,
|
||||||
0,
|
0,
|
||||||
&autodialEntry,
|
&autodialEntry,
|
||||||
sizeof(RASAUTODIALENTRY),
|
sizeof(RASAUTODIALENTRY),
|
||||||
1);
|
1);
|
||||||
|
|
||||||
if (result != ERROR_SUCCESS)
|
if (result != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
|
@ -698,7 +698,7 @@ PRBool nsRASAutodial::AddAddressToAutodialDirectory(const PRUnichar* hostName)
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGD(("Autodial: Added address %s to RAS autodial db for entry %s.",
|
LOGD(("Autodial: Added address %s to RAS autodial db for entry %s.",
|
||||||
hostName, NS_ConvertUTF16toUTF8(autodialEntry.szEntry).get()));
|
hostName, autodialEntry.szEntry));
|
||||||
|
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -707,9 +707,9 @@ PRBool nsRASAutodial::AddAddressToAutodialDirectory(const PRUnichar* hostName)
|
||||||
int nsRASAutodial::GetCurrentLocation()
|
int nsRASAutodial::GetCurrentLocation()
|
||||||
{
|
{
|
||||||
HKEY hKey = 0;
|
HKEY hKey = 0;
|
||||||
LONG result = ::RegOpenKeyExW(
|
LONG result = ::RegOpenKeyEx(
|
||||||
HKEY_LOCAL_MACHINE,
|
HKEY_LOCAL_MACHINE,
|
||||||
L"Software\\Microsoft\\Windows\\CurrentVersion\\Telephony\\Locations",
|
"Software\\Microsoft\\Windows\\CurrentVersion\\Telephony\\Locations",
|
||||||
0,
|
0,
|
||||||
KEY_READ,
|
KEY_READ,
|
||||||
&hKey);
|
&hKey);
|
||||||
|
@ -724,7 +724,7 @@ int nsRASAutodial::GetCurrentLocation()
|
||||||
DWORD location = 0;
|
DWORD location = 0;
|
||||||
DWORD paramSize = sizeof(DWORD);
|
DWORD paramSize = sizeof(DWORD);
|
||||||
|
|
||||||
result = ::RegQueryValueExW(hKey, L"CurrentID", nsnull, &entryType, (LPBYTE)&location, ¶mSize);
|
result = ::RegQueryValueEx(hKey, "CurrentID", nsnull, &entryType, (LPBYTE)&location, ¶mSize);
|
||||||
if (result != ERROR_SUCCESS)
|
if (result != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
::RegCloseKey(hKey);
|
::RegCloseKey(hKey);
|
||||||
|
@ -762,7 +762,7 @@ PRBool nsRASAutodial::LoadRASapi32DLL()
|
||||||
{
|
{
|
||||||
if (!mhRASapi32)
|
if (!mhRASapi32)
|
||||||
{
|
{
|
||||||
mhRASapi32 = ::LoadLibraryW(L"rasapi32.dll");
|
mhRASapi32 = ::LoadLibrary("rasapi32.dll");
|
||||||
if ((UINT)mhRASapi32 > 32)
|
if ((UINT)mhRASapi32 > 32)
|
||||||
{
|
{
|
||||||
// RasEnumConnections
|
// RasEnumConnections
|
||||||
|
@ -811,16 +811,16 @@ PRBool nsRASAutodial::LoadRASdlgDLL()
|
||||||
{
|
{
|
||||||
if (!mhRASdlg)
|
if (!mhRASdlg)
|
||||||
{
|
{
|
||||||
mhRASdlg = ::LoadLibraryW(L"rasdlg.dll");
|
mhRASdlg = ::LoadLibrary("rasdlg.dll");
|
||||||
if ((UINT)mhRASdlg > 32)
|
if ((UINT)mhRASdlg > 32)
|
||||||
{
|
{
|
||||||
// RasPhonebookDlg
|
// RasPhonebookDlg
|
||||||
mpRasPhonebookDlg =
|
mpRasPhonebookDlg =
|
||||||
(tRASPHONEBOOKDLG)::GetProcAddress(mhRASdlg, "RasPhonebookDlgW");
|
(tRASPHONEBOOKDLG)::GetProcAddress(mhRASdlg, "RasPhonebookDlgA");
|
||||||
|
|
||||||
// RasDialDlg
|
// RasDialDlg
|
||||||
mpRasDialDlg =
|
mpRasDialDlg =
|
||||||
(tRASDIALDLG)::GetProcAddress(mhRASdlg, "RasDialDlgW");
|
(tRASDIALDLG)::GetProcAddress(mhRASdlg, "RasDialDlgA");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,21 +52,21 @@ typedef struct tagRASAUTODIALENTRYA {
|
||||||
DWORD dwSize;
|
DWORD dwSize;
|
||||||
DWORD dwFlags;
|
DWORD dwFlags;
|
||||||
DWORD dwDialingLocation;
|
DWORD dwDialingLocation;
|
||||||
PRUnichar szEntry[RAS_MaxEntryName + 1];
|
CHAR szEntry[RAS_MaxEntryName + 1];
|
||||||
} RASAUTODIALENTRYW, *LPRASAUTODIALENTRYW;
|
} RASAUTODIALENTRYA, *LPRASAUTODIALENTRYA;
|
||||||
typedef RASAUTODIALENTRYW RASAUTODIALENTRY, *LPRASAUTODIALENTRY;
|
typedef RASAUTODIALENTRYA RASAUTODIALENTRY, *LPRASAUTODIALENTRY;
|
||||||
|
|
||||||
#define RASADP_LoginSessionDisable 1
|
#define RASADP_LoginSessionDisable 1
|
||||||
|
|
||||||
#endif // WINVER
|
#endif // WINVER
|
||||||
|
|
||||||
// Loading the RAS DLL dynamically.
|
// Loading the RAS DLL dynamically.
|
||||||
typedef DWORD (WINAPI* tRASPHONEBOOKDLG)(LPWSTR,LPWSTR,LPRASPBDLG);
|
typedef DWORD (WINAPI* tRASPHONEBOOKDLG)(LPTSTR,LPTSTR,LPRASPBDLG);
|
||||||
typedef DWORD (WINAPI* tRASDIALDLG)(LPWSTR,LPWSTR,LPWSTR,LPRASDIALDLG);
|
typedef DWORD (WINAPI* tRASDIALDLG)(LPTSTR,LPTSTR,LPTSTR,LPRASDIALDLG);
|
||||||
typedef DWORD (WINAPI* tRASENUMCONNECTIONS)(LPRASCONN,LPDWORD,LPDWORD);
|
typedef DWORD (WINAPI* tRASENUMCONNECTIONS)(LPRASCONN,LPDWORD,LPDWORD);
|
||||||
typedef DWORD (WINAPI* tRASENUMENTRIES)(LPWSTR,LPWSTR,LPRASENTRYNAMEW,LPDWORD,LPDWORD);
|
typedef DWORD (WINAPI* tRASENUMENTRIES)(LPTSTR,LPTSTR,LPRASENTRYNAME,LPDWORD,LPDWORD);
|
||||||
typedef DWORD (WINAPI* tRASSETAUTODIALADDRESS)(LPCWSTR,DWORD,LPRASAUTODIALENTRYW,DWORD,DWORD);
|
typedef DWORD (WINAPI* tRASSETAUTODIALADDRESS)(LPCTSTR,DWORD,LPRASAUTODIALENTRY,DWORD,DWORD);
|
||||||
typedef DWORD (WINAPI* tRASGETAUTODIALADDRESS)(LPCWSTR,LPDWORD,LPRASAUTODIALENTRYW,LPDWORD,LPDWORD);
|
typedef DWORD (WINAPI* tRASGETAUTODIALADDRESS)(LPCTSTR,LPDWORD,LPRASAUTODIALENTRY,LPDWORD,LPDWORD);
|
||||||
typedef DWORD (WINAPI* tRASGETAUTODIALENABLE)(DWORD,LPBOOL);
|
typedef DWORD (WINAPI* tRASGETAUTODIALENABLE)(DWORD,LPBOOL);
|
||||||
typedef DWORD (WINAPI* tRASGETAUTODIALPARAM)(DWORD,LPVOID,LPDWORD);
|
typedef DWORD (WINAPI* tRASGETAUTODIALPARAM)(DWORD,LPVOID,LPDWORD);
|
||||||
// For Windows NT 4, 2000, and XP, we sometimes want to open the RAS dialup
|
// For Windows NT 4, 2000, and XP, we sometimes want to open the RAS dialup
|
||||||
|
@ -107,10 +107,10 @@ private:
|
||||||
int NumRASEntries();
|
int NumRASEntries();
|
||||||
|
|
||||||
// Get the name of the default connection from the OS.
|
// Get the name of the default connection from the OS.
|
||||||
nsresult GetDefaultEntryName(PRUnichar* entryName, int bufferSize);
|
nsresult GetDefaultEntryName(char* entryName, int bufferSize);
|
||||||
|
|
||||||
// Get the name of the first RAS dial entry from the OS.
|
// Get the name of the first RAS dial entry from the OS.
|
||||||
nsresult GetFirstEntryName(PRUnichar* entryName, int bufferSize);
|
nsresult GetFirstEntryName(char* entryName, int bufferSize);
|
||||||
|
|
||||||
// Check to see if RAS already has a dialup connection going.
|
// Check to see if RAS already has a dialup connection going.
|
||||||
PRBool IsRASConnected();
|
PRBool IsRASConnected();
|
||||||
|
@ -119,7 +119,7 @@ private:
|
||||||
int QueryAutodialBehavior();
|
int QueryAutodialBehavior();
|
||||||
|
|
||||||
// Add the specified address to the autodial directory.
|
// Add the specified address to the autodial directory.
|
||||||
PRBool AddAddressToAutodialDirectory(const PRUnichar* hostName);
|
PRBool AddAddressToAutodialDirectory(const char* hostName);
|
||||||
|
|
||||||
// Get the current TAPI dialing location.
|
// Get the current TAPI dialing location.
|
||||||
int GetCurrentLocation();
|
int GetCurrentLocation();
|
||||||
|
@ -145,7 +145,7 @@ private:
|
||||||
int mNumRASConnectionEntries;
|
int mNumRASConnectionEntries;
|
||||||
|
|
||||||
// Default connection entry name.
|
// Default connection entry name.
|
||||||
PRUnichar mDefaultEntryName[RAS_MaxEntryName + 1];
|
char mDefaultEntryName[RAS_MaxEntryName + 1];
|
||||||
|
|
||||||
// Don't try to dial again within a few seconds of when user pressed cancel.
|
// Don't try to dial again within a few seconds of when user pressed cancel.
|
||||||
static PRIntervalTime mDontRetryUntil;
|
static PRIntervalTime mDontRetryUntil;
|
||||||
|
@ -184,7 +184,7 @@ public:
|
||||||
nsresult Init();
|
nsresult Init();
|
||||||
|
|
||||||
// Dial the default RAS dialup connection.
|
// Dial the default RAS dialup connection.
|
||||||
nsresult DialDefault(const PRUnichar* hostName);
|
nsresult DialDefault(const char* hostName);
|
||||||
|
|
||||||
// Should we try to dial on network error?
|
// Should we try to dial on network error?
|
||||||
PRBool ShouldDialOnNetworkError();
|
PRBool ShouldDialOnNetworkError();
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
|
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
nsNativeConnectionHelper::OnConnectionFailed(const PRUnichar* hostName)
|
nsNativeConnectionHelper::OnConnectionFailed(const char* hostName)
|
||||||
{
|
{
|
||||||
nsRASAutodial autodial;
|
nsRASAutodial autodial;
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ public:
|
||||||
*
|
*
|
||||||
* Return PR_TRUE if the connection should be re-attempted.
|
* Return PR_TRUE if the connection should be re-attempted.
|
||||||
*/
|
*/
|
||||||
static PRBool OnConnectionFailed(const PRUnichar* hostName);
|
static PRBool OnConnectionFailed(const char* hostName);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IsAutoDialEnabled
|
* IsAutoDialEnabled
|
||||||
|
|
|
@ -1252,10 +1252,8 @@ nsSocketTransport::RecoverFromError()
|
||||||
if (!tryAgain) {
|
if (!tryAgain) {
|
||||||
PRBool autodialEnabled;
|
PRBool autodialEnabled;
|
||||||
gSocketTransportService->GetAutodialEnabled(&autodialEnabled);
|
gSocketTransportService->GetAutodialEnabled(&autodialEnabled);
|
||||||
if (autodialEnabled) {
|
if (autodialEnabled)
|
||||||
tryAgain = nsNativeConnectionHelper::OnConnectionFailed(
|
tryAgain = nsNativeConnectionHelper::OnConnectionFailed(SocketHost().get());
|
||||||
NS_ConvertUTF8toUTF16(SocketHost()).get());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -114,22 +114,23 @@ nsFileProtocolHandler::ReadURLFile(nsIFile* aFile, nsIURI** aURI)
|
||||||
|
|
||||||
rv = NS_ERROR_NOT_AVAILABLE;
|
rv = NS_ERROR_NOT_AVAILABLE;
|
||||||
|
|
||||||
IUniformResourceLocatorW* urlLink = nsnull;
|
IUniformResourceLocator* urlLink = nsnull;
|
||||||
result = ::CoCreateInstance(CLSID_InternetShortcut, NULL, CLSCTX_INPROC_SERVER,
|
result = ::CoCreateInstance(CLSID_InternetShortcut, NULL, CLSCTX_INPROC_SERVER,
|
||||||
IID_IUniformResourceLocatorW, (void**)&urlLink);
|
IID_IUniformResourceLocator, (void**)&urlLink);
|
||||||
if (SUCCEEDED(result) && urlLink) {
|
if (SUCCEEDED(result) && urlLink) {
|
||||||
IPersistFile* urlFile = nsnull;
|
IPersistFile* urlFile = nsnull;
|
||||||
result = urlLink->QueryInterface(IID_IPersistFile, (void**)&urlFile);
|
result = urlLink->QueryInterface(IID_IPersistFile, (void**)&urlFile);
|
||||||
if (SUCCEEDED(result) && urlFile) {
|
if (SUCCEEDED(result) && urlFile) {
|
||||||
result = urlFile->Load(path.get(), STGM_READ);
|
result = urlFile->Load(path.get(), STGM_READ);
|
||||||
if (SUCCEEDED(result) ) {
|
if (SUCCEEDED(result) ) {
|
||||||
LPWSTR lpTemp = nsnull;
|
LPSTR lpTemp = nsnull;
|
||||||
|
|
||||||
// The URL this method will give us back seems to be already
|
// The URL this method will give us back seems to be already
|
||||||
// escaped. Hence, do not do escaping of our own.
|
// escaped. Hence, do not do escaping of our own.
|
||||||
result = urlLink->GetURL(&lpTemp);
|
result = urlLink->GetURL(&lpTemp);
|
||||||
if (SUCCEEDED(result) && lpTemp) {
|
if (SUCCEEDED(result) && lpTemp) {
|
||||||
rv = NS_NewURI(aURI, NS_ConvertUTF16toUTF8(lpTemp));
|
rv = NS_NewURI(aURI, lpTemp);
|
||||||
|
|
||||||
// free the string that GetURL alloc'd
|
// free the string that GetURL alloc'd
|
||||||
CoTaskMemFree(lpTemp);
|
CoTaskMemFree(lpTemp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ static void InitIPHelperLibrary(void)
|
||||||
if (sIPHelper)
|
if (sIPHelper)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sIPHelper = LoadLibraryW(L"iphlpapi.dll");
|
sIPHelper = LoadLibraryA("iphlpapi.dll");
|
||||||
if (!sIPHelper)
|
if (!sIPHelper)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче