Remove support for Win9x from wxMSW.

Most importantly, this allows us to remove all MSLU-related stuff.

Some functions which were previously loaded dynamically can now be just used
directly, too.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76535 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-05-16 02:33:40 +00:00
parent e3c2531b4c
commit 0d4ad161d5
1036 changed files with 12134 additions and 16801 deletions

View File

@@ -472,109 +472,47 @@ bool wxGetDiskSpace(const wxString& WXUNUSED_IN_WINCE(path),
if ( path.empty() )
return false;
// old w32api don't have ULARGE_INTEGER
#if defined(__WIN32__) && \
(!defined(__GNUWIN32__) || wxCHECK_W32API_VERSION( 0, 3 ))
// GetDiskFreeSpaceEx() is not available under original Win95, check for
// it
typedef BOOL (WINAPI *GetDiskFreeSpaceEx_t)(LPCTSTR,
PULARGE_INTEGER,
PULARGE_INTEGER,
PULARGE_INTEGER);
#if defined(__WIN32__)
ULARGE_INTEGER bytesFree, bytesTotal;
GetDiskFreeSpaceEx_t
pGetDiskFreeSpaceEx = (GetDiskFreeSpaceEx_t)::GetProcAddress
(
::GetModuleHandle(wxT("kernel32.dll")),
#if wxUSE_UNICODE
"GetDiskFreeSpaceExW"
#else
"GetDiskFreeSpaceExA"
#endif
);
if ( pGetDiskFreeSpaceEx )
// may pass the path as is, GetDiskFreeSpaceEx() is smart enough
if ( !::GetDiskFreeSpaceEx(path.t_str(),
&bytesFree,
&bytesTotal,
NULL) )
{
ULARGE_INTEGER bytesFree, bytesTotal;
wxLogLastError(wxT("GetDiskFreeSpaceEx"));
// may pass the path as is, GetDiskFreeSpaceEx() is smart enough
if ( !pGetDiskFreeSpaceEx(path.t_str(),
&bytesFree,
&bytesTotal,
NULL) )
{
wxLogLastError(wxT("GetDiskFreeSpaceEx"));
return false;
}
return false;
}
// ULARGE_INTEGER is a union of a 64 bit value and a struct containing
// two 32 bit fields which may be or may be not named - try to make it
// compile in all cases
// ULARGE_INTEGER is a union of a 64 bit value and a struct containing
// two 32 bit fields which may be or may be not named - try to make it
// compile in all cases
#if defined(__BORLANDC__) && !defined(_ANONYMOUS_STRUCT)
#define UL(ul) ul.u
#define UL(ul) ul.u
#else // anon union
#define UL(ul) ul
#define UL(ul) ul
#endif
if ( pTotal )
{
#if wxUSE_LONGLONG
*pTotal = wxDiskspaceSize_t(UL(bytesTotal).HighPart, UL(bytesTotal).LowPart);
#else
*pTotal = wxDiskspaceSize_t(UL(bytesTotal).LowPart);
#endif
}
if ( pFree )
{
#if wxUSE_LONGLONG
*pFree = wxLongLong(UL(bytesFree).HighPart, UL(bytesFree).LowPart);
#else
*pFree = wxDiskspaceSize_t(UL(bytesFree).LowPart);
#endif
}
}
else
#endif // Win32
if ( pTotal )
{
// there's a problem with drives larger than 2GB, GetDiskFreeSpaceEx()
// should be used instead - but if it's not available, fall back on
// GetDiskFreeSpace() nevertheless...
DWORD lSectorsPerCluster,
lBytesPerSector,
lNumberOfFreeClusters,
lTotalNumberOfClusters;
// FIXME: this is wrong, we should extract the root drive from path
// instead, but this is the job for wxFileName...
if ( !::GetDiskFreeSpace(path.t_str(),
&lSectorsPerCluster,
&lBytesPerSector,
&lNumberOfFreeClusters,
&lTotalNumberOfClusters) )
{
wxLogLastError(wxT("GetDiskFreeSpace"));
return false;
}
wxDiskspaceSize_t lBytesPerCluster = (wxDiskspaceSize_t) lSectorsPerCluster;
lBytesPerCluster *= lBytesPerSector;
if ( pTotal )
{
*pTotal = lBytesPerCluster;
*pTotal *= lTotalNumberOfClusters;
}
if ( pFree )
{
*pFree = lBytesPerCluster;
*pFree *= lNumberOfFreeClusters;
}
#if wxUSE_LONGLONG
*pTotal = wxDiskspaceSize_t(UL(bytesTotal).HighPart, UL(bytesTotal).LowPart);
#else
*pTotal = wxDiskspaceSize_t(UL(bytesTotal).LowPart);
#endif
}
if ( pFree )
{
#if wxUSE_LONGLONG
*pFree = wxLongLong(UL(bytesFree).HighPart, UL(bytesFree).LowPart);
#else
*pFree = wxDiskspaceSize_t(UL(bytesFree).LowPart);
#endif
}
#endif // Win32
return true;
#endif
// __WXWINCE__
@@ -861,61 +799,14 @@ int wxKill(long pid, wxSignal sig, wxKillError *krc, int flags)
return 0;
}
typedef HANDLE (WINAPI *CreateToolhelp32Snapshot_t)(DWORD,DWORD);
typedef BOOL (WINAPI *Process32_t)(HANDLE,LPPROCESSENTRY32);
CreateToolhelp32Snapshot_t lpfCreateToolhelp32Snapshot;
Process32_t lpfProcess32First, lpfProcess32Next;
static void InitToolHelp32()
{
static bool s_initToolHelpDone = false;
if (s_initToolHelpDone)
return;
s_initToolHelpDone = true;
lpfCreateToolhelp32Snapshot = NULL;
lpfProcess32First = NULL;
lpfProcess32Next = NULL;
#if wxUSE_DYNLIB_CLASS
wxDynamicLibrary dllKernel(wxT("kernel32.dll"), wxDL_VERBATIM);
// Get procedure addresses.
// We are linking to these functions of Kernel32
// explicitly, because otherwise a module using
// this code would fail to load under Windows NT,
// which does not have the Toolhelp32
// functions in the Kernel 32.
lpfCreateToolhelp32Snapshot =
(CreateToolhelp32Snapshot_t)dllKernel.RawGetSymbol(wxT("CreateToolhelp32Snapshot"));
lpfProcess32First =
(Process32_t)dllKernel.RawGetSymbol(wxT("Process32First"));
lpfProcess32Next =
(Process32_t)dllKernel.RawGetSymbol(wxT("Process32Next"));
#endif // wxUSE_DYNLIB_CLASS
}
// By John Skiff
int wxKillAllChildren(long pid, wxSignal sig, wxKillError *krc)
{
InitToolHelp32();
if (krc)
*krc = wxKILL_OK;
// If not implemented for this platform (e.g. NT 4.0), silently ignore
if (!lpfCreateToolhelp32Snapshot || !lpfProcess32First || !lpfProcess32Next)
return 0;
// Take a snapshot of all processes in the system.
HANDLE hProcessSnap = lpfCreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
HANDLE hProcessSnap = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hProcessSnap == INVALID_HANDLE_VALUE) {
if (krc)
*krc = wxKILL_ERROR;
@@ -929,7 +820,7 @@ int wxKillAllChildren(long pid, wxSignal sig, wxKillError *krc)
// Walk the snapshot of the processes, and for each process,
// kill it if its parent is pid.
if (!lpfProcess32First(hProcessSnap, &pe)) {
if (!::Process32First(hProcessSnap, &pe)) {
// Can't get first process.
if (krc)
*krc = wxKILL_ERROR;
@@ -942,7 +833,7 @@ int wxKillAllChildren(long pid, wxSignal sig, wxKillError *krc)
if (wxKill(pe.th32ProcessID, sig, krc))
return -1;
}
} while (lpfProcess32Next (hProcessSnap, &pe));
} while (::Process32Next (hProcessSnap, &pe));
return 0;
@@ -1078,21 +969,7 @@ unsigned long wxGetProcessId()
bool wxIsDebuggerRunning()
{
#if wxUSE_DYNLIB_CLASS
// IsDebuggerPresent() is not available under Win95, so load it dynamically
wxDynamicLibrary dll(wxT("kernel32.dll"), wxDL_VERBATIM);
typedef BOOL (WINAPI *IsDebuggerPresent_t)();
if ( !dll.HasSymbol(wxT("IsDebuggerPresent")) )
{
// no way to know, assume no
return false;
}
return (*(IsDebuggerPresent_t)dll.GetSymbol(wxT("IsDebuggerPresent")))() != 0;
#else
return false;
#endif
return ::IsDebuggerPresent() != 0;
}
// ----------------------------------------------------------------------------