Remove MSW code targeted at versions prior to WinXP.
In 3.1 WinXP is required so remove checks and code for prior versions.
This commit is contained in:
@@ -1679,15 +1679,6 @@ static bool wxCheckWin32Permission(const wxString& path, DWORD access)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( wxGetOsVersion() == wxOS_WINDOWS_9X )
|
|
||||||
{
|
|
||||||
// FAT directories always allow all access, even if they have the
|
|
||||||
// readonly flag set, and FAT files can only be read-only
|
|
||||||
return (dwAttr & FILE_ATTRIBUTE_DIRECTORY) ||
|
|
||||||
(access != GENERIC_WRITE ||
|
|
||||||
!(dwAttr & FILE_ATTRIBUTE_READONLY));
|
|
||||||
}
|
|
||||||
|
|
||||||
HANDLE h = ::CreateFile
|
HANDLE h = ::CreateFile
|
||||||
(
|
(
|
||||||
path.t_str(),
|
path.t_str(),
|
||||||
|
@@ -2606,13 +2606,6 @@ bool wxFileName::SetTimes(const wxDateTime *dtAccess,
|
|||||||
int flags;
|
int flags;
|
||||||
if ( IsDir() )
|
if ( IsDir() )
|
||||||
{
|
{
|
||||||
if ( wxGetOsVersion() == wxOS_WINDOWS_9X )
|
|
||||||
{
|
|
||||||
wxLogError(_("Setting directory access times is not supported "
|
|
||||||
"under this OS version"));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
path = GetPath();
|
path = GetPath();
|
||||||
flags = FILE_FLAG_BACKUP_SEMANTICS;
|
flags = FILE_FLAG_BACKUP_SEMANTICS;
|
||||||
}
|
}
|
||||||
|
@@ -300,19 +300,6 @@ bool wxPenRefData::Alloc()
|
|||||||
const COLORREF col = m_colour.GetPixel();
|
const COLORREF col = m_colour.GetPixel();
|
||||||
|
|
||||||
#ifdef wxHAVE_EXT_CREATE_PEN
|
#ifdef wxHAVE_EXT_CREATE_PEN
|
||||||
// Only NT can display dashed or dotted lines with width > 1
|
|
||||||
static const int os = wxGetOsVersion();
|
|
||||||
if ( os != wxOS_WINDOWS_NT &&
|
|
||||||
(m_style == wxPENSTYLE_DOT ||
|
|
||||||
m_style == wxPENSTYLE_LONG_DASH ||
|
|
||||||
m_style == wxPENSTYLE_SHORT_DASH ||
|
|
||||||
m_style == wxPENSTYLE_DOT_DASH ||
|
|
||||||
m_style == wxPENSTYLE_USER_DASH) &&
|
|
||||||
m_width > 1 )
|
|
||||||
{
|
|
||||||
m_width = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if it's a standard kind of pen which can be created with just
|
// check if it's a standard kind of pen which can be created with just
|
||||||
// CreatePen()
|
// CreatePen()
|
||||||
if ( m_join == wxJOIN_ROUND &&
|
if ( m_join == wxJOIN_ROUND &&
|
||||||
|
@@ -1341,15 +1341,7 @@ bool wxTopLevelWindowMSW::SetTransparent(wxByte alpha)
|
|||||||
|
|
||||||
bool wxTopLevelWindowMSW::CanSetTransparent()
|
bool wxTopLevelWindowMSW::CanSetTransparent()
|
||||||
{
|
{
|
||||||
// The API is available on win2k and above
|
return true;
|
||||||
|
|
||||||
static int os_type = -1;
|
|
||||||
static int ver_major = -1;
|
|
||||||
|
|
||||||
if (os_type == -1)
|
|
||||||
os_type = ::wxGetOsVersion(&ver_major);
|
|
||||||
|
|
||||||
return (os_type == wxOS_WINDOWS_NT && ver_major >= 5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxTopLevelWindowMSW::DoFreeze()
|
void wxTopLevelWindowMSW::DoFreeze()
|
||||||
|
@@ -891,36 +891,33 @@ bool wxShutdown(int WXUNUSED_IN_WINCE(flags))
|
|||||||
#else
|
#else
|
||||||
bool bOK = true;
|
bool bOK = true;
|
||||||
|
|
||||||
if ( wxGetOsVersion(NULL, NULL) == wxOS_WINDOWS_NT ) // if is NT or 2K
|
// Get a token for this process.
|
||||||
|
HANDLE hToken;
|
||||||
|
bOK = ::OpenProcessToken(GetCurrentProcess(),
|
||||||
|
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,
|
||||||
|
&hToken) != 0;
|
||||||
|
if ( bOK )
|
||||||
{
|
{
|
||||||
// Get a token for this process.
|
TOKEN_PRIVILEGES tkp;
|
||||||
HANDLE hToken;
|
|
||||||
bOK = ::OpenProcessToken(GetCurrentProcess(),
|
// Get the LUID for the shutdown privilege.
|
||||||
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,
|
bOK = ::LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME,
|
||||||
&hToken) != 0;
|
&tkp.Privileges[0].Luid) != 0;
|
||||||
|
|
||||||
if ( bOK )
|
if ( bOK )
|
||||||
{
|
{
|
||||||
TOKEN_PRIVILEGES tkp;
|
tkp.PrivilegeCount = 1; // one privilege to set
|
||||||
|
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
|
||||||
|
|
||||||
// Get the LUID for the shutdown privilege.
|
// Get the shutdown privilege for this process.
|
||||||
bOK = ::LookupPrivilegeValue(NULL, SE_SHUTDOWN_NAME,
|
::AdjustTokenPrivileges(hToken, FALSE, &tkp, 0,
|
||||||
&tkp.Privileges[0].Luid) != 0;
|
(PTOKEN_PRIVILEGES)NULL, 0);
|
||||||
|
|
||||||
if ( bOK )
|
// Cannot test the return value of AdjustTokenPrivileges.
|
||||||
{
|
bOK = ::GetLastError() == ERROR_SUCCESS;
|
||||||
tkp.PrivilegeCount = 1; // one privilege to set
|
|
||||||
tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
|
|
||||||
|
|
||||||
// Get the shutdown privilege for this process.
|
|
||||||
::AdjustTokenPrivileges(hToken, FALSE, &tkp, 0,
|
|
||||||
(PTOKEN_PRIVILEGES)NULL, 0);
|
|
||||||
|
|
||||||
// Cannot test the return value of AdjustTokenPrivileges.
|
|
||||||
bOK = ::GetLastError() == ERROR_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
::CloseHandle(hToken);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::CloseHandle(hToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( bOK )
|
if ( bOK )
|
||||||
|
@@ -761,8 +761,7 @@ long wxExecute(const wxString& cmd, int flags, wxProcess *handler,
|
|||||||
DWORD dwFlags = CREATE_SUSPENDED;
|
DWORD dwFlags = CREATE_SUSPENDED;
|
||||||
|
|
||||||
#ifndef __WXWINCE__
|
#ifndef __WXWINCE__
|
||||||
if ( (flags & wxEXEC_MAKE_GROUP_LEADER) &&
|
if ( (flags & wxEXEC_MAKE_GROUP_LEADER) )
|
||||||
(wxGetOsVersion() == wxOS_WINDOWS_NT) )
|
|
||||||
dwFlags |= CREATE_NEW_PROCESS_GROUP;
|
dwFlags |= CREATE_NEW_PROCESS_GROUP;
|
||||||
|
|
||||||
dwFlags |= CREATE_DEFAULT_ERROR_MODE ;
|
dwFlags |= CREATE_DEFAULT_ERROR_MODE ;
|
||||||
|
@@ -917,22 +917,9 @@ void wxWindowMSW::WarpPointer(int x, int y)
|
|||||||
|
|
||||||
void wxWindowMSW::MSWUpdateUIState(int action, int state)
|
void wxWindowMSW::MSWUpdateUIState(int action, int state)
|
||||||
{
|
{
|
||||||
// WM_CHANGEUISTATE only appeared in Windows 2000 so it can do us no good
|
// we send WM_CHANGEUISTATE so if nothing needs changing then the system
|
||||||
// to use it on older systems -- and could possibly do some harm
|
// won't send WM_UPDATEUISTATE
|
||||||
static int s_needToUpdate = -1;
|
::SendMessage(GetHwnd(), WM_CHANGEUISTATE, MAKEWPARAM(action, state), 0);
|
||||||
if ( s_needToUpdate == -1 )
|
|
||||||
{
|
|
||||||
int verMaj, verMin;
|
|
||||||
s_needToUpdate = wxGetOsVersion(&verMaj, &verMin) == wxOS_WINDOWS_NT &&
|
|
||||||
verMaj >= 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( s_needToUpdate )
|
|
||||||
{
|
|
||||||
// we send WM_CHANGEUISTATE so if nothing needs changing then the system
|
|
||||||
// won't send WM_UPDATEUISTATE
|
|
||||||
::SendMessage(GetHwnd(), WM_CHANGEUISTATE, MAKEWPARAM(action, state), 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user