Skip to content

Commit bd4cf20

Browse files
committed
Remove Windows 9X support
1 parent 95c7bd8 commit bd4cf20

File tree

8 files changed

+4
-417
lines changed

8 files changed

+4
-417
lines changed

src/common/classes/locks.cpp

Lines changed: 0 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -39,124 +39,6 @@ namespace Firebird {
3939

4040
#if defined(WIN_NT)
4141

42-
// Win9X support
43-
#ifdef WIN9X_SUPPORT
44-
45-
// NS: This code is adapted from from KernelEx project, with the explicit
46-
// permission from the author. KernelEx project aims to provide Windows XP
47-
// compatibility layer for Windows 98 and Windows ME. For further information
48-
// please refer to http://www.sourceforge.net/projects/kernelex/
49-
50-
static const K32OBJ_CRITICAL_SECTION = 4;
51-
static const TDBX_WIN98 = 0x50;
52-
static const TDBX_WINME = 0x80;
53-
54-
typedef struct _CRIT_SECT // Size = 0x20
55-
{
56-
BYTE Type; // 00 = 4: K32_OBJECT_CRITICAL_SECTION
57-
int RecursionCount; // 04 initially 0, incremented on lock
58-
void* OwningThread; // 08 pointer to TDBX
59-
DWORD un3; // 0C
60-
int LockCount; // 10 initially 1, decremented on lock
61-
struct _CRIT_SECT* Next; // 14
62-
void* PLst; // 18 list of processes using it?
63-
struct _WIN_CRITICAL_SECTION* UserCS; // 1C pointer to user defined CRITICAL_SECTION
64-
} CRIT_SECT, *PCRIT_SECT;
65-
66-
typedef struct _WIN_CRITICAL_SECTION
67-
{
68-
BYTE Type; //= 4: K32_OBJECT_CRITICAL_SECTION
69-
PCRIT_SECT crit;
70-
DWORD un1;
71-
DWORD un2;
72-
DWORD un3;
73-
DWORD un4;
74-
} WIN_CRITICAL_SECTION, *PWIN_CRITICAL_SECTION;
75-
76-
static DWORD tdbx_offset;
77-
78-
__declspec(naked) BOOL WINAPI TryEnterCrst(CRIT_SECT* crit)
79-
{
80-
__asm {
81-
mov edx, [esp+4]
82-
xor eax, eax
83-
inc eax
84-
xor ecx, ecx
85-
cmpxchg [edx+10h], ecx ;if (OP1==eax) { OP1=OP2; ZF=1; } else { eax=OP1; ZF=0 }
86-
;mov ecx, ppTDBXCur
87-
mov ecx, fs:[18h]
88-
add ecx, [tdbx_offset]
89-
mov ecx, [ecx] ;ecx will contain TDBX now
90-
cmp eax, 1
91-
jnz L1
92-
;critical section was unowned => successful lock
93-
mov [edx+8], ecx
94-
inc dword ptr [edx+4]
95-
ret 4
96-
L1:
97-
cmp [edx+8], ecx
98-
jnz L2
99-
;critical section owned by this thread
100-
dec dword ptr [edx+10h]
101-
inc dword ptr [edx+4]
102-
xor eax, eax
103-
inc eax
104-
ret 4
105-
L2:
106-
;critical section owned by other thread - do nothing
107-
xor eax, eax
108-
ret 4
109-
}
110-
}
111-
112-
BOOL WINAPI TryEnterCriticalSection_Win9X(CRITICAL_SECTION* cs)
113-
{
114-
WIN_CRITICAL_SECTION* mycs = (WIN_CRITICAL_SECTION*) cs;
115-
if (mycs->Type != K32OBJ_CRITICAL_SECTION)
116-
RaiseException(STATUS_ACCESS_VIOLATION, 0, 0, NULL);
117-
118-
return TryEnterCrst(mycs->crit);
119-
}
120-
121-
#endif
122-
123-
// On Win 98 and Win ME TryEnterCriticalSection is defined, but not implemented
124-
// So direct linking to it won't hurt and will signal our incompatibility with Win 95
125-
TryEnterCS::tTryEnterCriticalSection TryEnterCS::m_funct =
126-
reinterpret_cast<TryEnterCS::tTryEnterCriticalSection>(TryEnterCriticalSection);
127-
128-
static TryEnterCS tryEnterCS;
129-
130-
TryEnterCS::TryEnterCS()
131-
{
132-
// Win9X support
133-
#ifdef WIN9X_SUPPORT
134-
OSVERSIONINFO OsVersionInfo;
135-
136-
OsVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
137-
if (GetVersionEx((LPOSVERSIONINFO) &OsVersionInfo))
138-
{
139-
if (OsVersionInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS &&
140-
OsVersionInfo.dwMajorVersion == 4)
141-
{
142-
// Windows 98
143-
if (OsVersionInfo.dwMinorVersion == 10)
144-
{
145-
tdbx_offset = TDBX_WIN98;
146-
m_funct = TryEnterCriticalSection_Win9X;
147-
}
148-
149-
// Windows ME
150-
if (OsVersionInfo.dwMinorVersion == 90)
151-
{
152-
tdbx_offset = TDBX_WINME;
153-
m_funct = TryEnterCriticalSection_Win9X;
154-
}
155-
}
156-
}
157-
#endif
158-
}
159-
16042
void Spinlock::init()
16143
{
16244
SetCriticalSectionSpinCount(&spinlock, 4000);

src/common/classes/locks.h

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -55,22 +55,6 @@ class Exception; // Needed for catch
5555

5656
// Windows version of the class
5757

58-
class TryEnterCS
59-
{
60-
public:
61-
TryEnterCS();
62-
63-
static bool tryEnter(LPCRITICAL_SECTION lpCS)
64-
{
65-
return ((m_funct) (lpCS) == TRUE);
66-
}
67-
68-
private:
69-
typedef BOOL (WINAPI *tTryEnterCriticalSection)(LPCRITICAL_SECTION lpCriticalSection);
70-
71-
static tTryEnterCriticalSection m_funct;
72-
};
73-
7458
class Mutex : public Reasons
7559
{
7660
protected:
@@ -97,7 +81,7 @@ class Mutex : public Reasons
9781

9882
~Mutex()
9983
{
100-
#if defined DEV_BUILD && !defined WIN9X_SUPPORT
84+
#if defined DEV_BUILD
10185
if (spinlock.OwningThread != 0)
10286
DebugBreak();
10387
fb_assert(lockCount == 0);
@@ -116,7 +100,7 @@ class Mutex : public Reasons
116100

117101
bool tryEnter(const char* aReason)
118102
{
119-
const bool ret = TryEnterCS::tryEnter(&spinlock);
103+
const bool ret = (TryEnterCriticalSection(&spinlock) == TRUE);
120104
if (ret)
121105
{
122106
reason(aReason);
@@ -129,7 +113,7 @@ class Mutex : public Reasons
129113

130114
void leave()
131115
{
132-
#if defined DEV_BUILD && !defined WIN9X_SUPPORT
116+
#if defined DEV_BUILD
133117
// NS: This check is based on internal structure on CRITICAL_SECTION
134118
// On 9X it works differently, and future OS versions may break this check as well
135119
if ((U_IPTR) spinlock.OwningThread != GetCurrentThreadId())

src/common/common.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -551,11 +551,6 @@ extern "C" int remove(const char* path);
551551
#define INET_ERRNO WSAGetLastError()
552552
#define H_ERRNO WSAGetLastError()
553553

554-
// For Visual Studio 2003 and earlier enable Windows 9X support
555-
#if defined _MSC_VER && (_MSC_VER < 1400)
556-
#define WIN9X_SUPPORT
557-
#endif
558-
559554
#endif /* WIN_NT */
560555

561556

src/common/isc.cpp

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -505,40 +505,6 @@ SLONG ISC_set_prefix(const TEXT* sw, const TEXT* path)
505505
}
506506

507507

508-
#ifdef WIN9X_SUPPORT
509-
510-
static DWORD os_type = 0;
511-
512-
// Returns the type of OS: true for NT,
513-
// false for the 16-bit based ones (9x/ME, ...).
514-
//
515-
bool ISC_is_WinNT()
516-
{
517-
// NS: this is thread safe.
518-
// In the worst case initialization will be called more than once
519-
if (!os_type)
520-
{
521-
// The first time this routine is called we use the Windows API
522-
// call GetVersion to determine whether Windows NT or 9X
523-
// is running.
524-
OSVERSIONINFO OsVersionInfo;
525-
526-
OsVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
527-
if (GetVersionEx((LPOSVERSIONINFO) &OsVersionInfo))
528-
{
529-
os_type = OsVersionInfo.dwPlatformId;
530-
fb_assert(os_type);
531-
}
532-
else {
533-
os_type = VER_PLATFORM_WIN32_NT; // Default to NT
534-
}
535-
}
536-
537-
return os_type >= VER_PLATFORM_WIN32_NT; // Windows NT, CE and future platforms
538-
}
539-
#endif
540-
541-
542508
#ifdef WIN_NT
543509
LPSECURITY_ATTRIBUTES ISC_get_security_desc()
544510
{

src/common/isc_proto.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@ void iscLogStatus(const TEXT* text, const ISC_STATUS* status_vector);
3939
void iscLogStatus(const TEXT* text, const Firebird::IStatus* status);
4040
void iscLogException(const TEXT* text, const Firebird::Exception& e);
4141

42-
#ifdef WIN9X_SUPPORT
43-
bool ISC_is_WinNT();
44-
#endif
45-
4642
#ifdef WIN_NT
4743
struct _SECURITY_ATTRIBUTES* ISC_get_security_desc();
4844
#endif

0 commit comments

Comments
 (0)