Skip to content

Commit 3a7bc23

Browse files
committed
MDEV-9154 : Remove workarounds (mainly dynamic function loading)
for running obsolete versions of Windows
1 parent 22ede74 commit 3a7bc23

File tree

16 files changed

+62
-723
lines changed

16 files changed

+62
-723
lines changed

cmake/os/Windows.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ IF(CMAKE_C_COMPILER MATCHES "icl")
5050
ENDIF()
5151

5252
ADD_DEFINITIONS(-D_WINDOWS -D__WIN__ -D_CRT_SECURE_NO_DEPRECATE)
53-
ADD_DEFINITIONS(-D_WIN32_WINNT=0x0501)
53+
ADD_DEFINITIONS(-D_WIN32_WINNT=0x0600)
5454
# We do not want the windows.h macros min/max
5555
ADD_DEFINITIONS(-DNOMINMAX)
5656
# Speed up build process excluding unused header files

extra/yassl/taocrypt/src/random.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include <time.h>
2828

2929
#if defined(_WIN32)
30-
#define _WIN32_WINNT 0x0400
3130
#include <windows.h>
3231
#include <wincrypt.h>
3332
#else

include/my_pthread.h

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -54,37 +54,16 @@ typedef struct st_pthread_link {
5454
We use native conditions on Vista and later, and fallback to own
5555
implementation on earlier OS version.
5656
*/
57-
typedef union
58-
{
59-
/* Native condition (used on Vista and later) */
60-
CONDITION_VARIABLE native_cond;
61-
62-
/* Own implementation (used on XP) */
63-
struct
64-
{
65-
uint32 waiting;
66-
CRITICAL_SECTION lock_waiting;
67-
enum
68-
{
69-
SIGNAL= 0,
70-
BROADCAST= 1,
71-
MAX_EVENTS= 2
72-
} EVENTS;
73-
HANDLE events[MAX_EVENTS];
74-
HANDLE broadcast_block_event;
75-
};
76-
} pthread_cond_t;
57+
typedef CONDITION_VARIABLE pthread_cond_t;
7758

7859

7960
typedef int pthread_mutexattr_t;
8061
#define pthread_self() GetCurrentThreadId()
8162
#define pthread_handler_t EXTERNC void * __cdecl
8263
typedef void * (__cdecl *pthread_handler)(void *);
8364

84-
typedef volatile LONG my_pthread_once_t;
85-
#define MY_PTHREAD_ONCE_INIT 0
86-
#define MY_PTHREAD_ONCE_INPROGRESS 1
87-
#define MY_PTHREAD_ONCE_DONE 2
65+
typedef INIT_ONCE my_pthread_once_t;
66+
#define MY_PTHREAD_ONCE_INIT INIT_ONCE_STATIC_INIT;
8867

8968
#if !STRUCT_TIMESPEC_HAS_TV_SEC || !STRUCT_TIMESPEC_HAS_TV_NSEC
9069
struct timespec {

include/violite.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -211,14 +211,6 @@ void vio_end(void);
211211
#define SHUT_RD SD_RECEIVE
212212
#endif
213213

214-
/*
215-
Set thread id for io cancellation (required on Windows XP only,
216-
and should to be removed if XP is no more supported)
217-
*/
218-
219-
#define vio_set_thread_id(vio, tid) if(vio) vio->thread_id= tid
220-
#else
221-
#define vio_set_thread_id(vio, tid)
222214
#endif
223215

224216
/* This enumerator is used in parser - should be always visible */
@@ -288,7 +280,6 @@ struct st_vio
288280
#ifdef _WIN32
289281
HANDLE hPipe;
290282
OVERLAPPED overlapped;
291-
DWORD thread_id; /* Used on XP only by vio_shutdown() */
292283
DWORD read_timeout_ms;
293284
DWORD write_timeout_ms;
294285
#endif

mysys/my_default.c

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,43 +1124,7 @@ static int add_directory(MEM_ROOT *alloc, const char *dir, const char **dirs)
11241124
return 0;
11251125
}
11261126

1127-
11281127
#ifdef __WIN__
1129-
/*
1130-
This wrapper for GetSystemWindowsDirectory() will dynamically bind to the
1131-
function if it is available, emulate it on NT4 Terminal Server by stripping
1132-
the \SYSTEM32 from the end of the results of GetSystemDirectory(), or just
1133-
return GetSystemDirectory().
1134-
*/
1135-
1136-
typedef UINT (WINAPI *GET_SYSTEM_WINDOWS_DIRECTORY)(LPSTR, UINT);
1137-
1138-
static size_t my_get_system_windows_directory(char *buffer, size_t size)
1139-
{
1140-
size_t count;
1141-
GET_SYSTEM_WINDOWS_DIRECTORY
1142-
func_ptr= (GET_SYSTEM_WINDOWS_DIRECTORY)
1143-
GetProcAddress(GetModuleHandle("kernel32.dll"),
1144-
"GetSystemWindowsDirectoryA");
1145-
1146-
if (func_ptr)
1147-
return func_ptr(buffer, (uint) size);
1148-
1149-
/*
1150-
Windows NT 4.0 Terminal Server Edition:
1151-
To retrieve the shared Windows directory, call GetSystemDirectory and
1152-
trim the "System32" element from the end of the returned path.
1153-
*/
1154-
count= GetSystemDirectory(buffer, (uint) size);
1155-
if (count > 8 && stricmp(buffer+(count-8), "\\System32") == 0)
1156-
{
1157-
count-= 8;
1158-
buffer[count] = '\0';
1159-
}
1160-
return count;
1161-
}
1162-
1163-
11641128
static const char *my_get_module_parent(char *buf, size_t size)
11651129
{
11661130
char *last= NULL;
@@ -1209,7 +1173,7 @@ static const char **init_default_directories(MEM_ROOT *alloc)
12091173

12101174
{
12111175
char fname_buffer[FN_REFLEN];
1212-
if (my_get_system_windows_directory(fname_buffer, sizeof(fname_buffer)))
1176+
if (GetSystemWindowsDirectory(fname_buffer, sizeof(fname_buffer)))
12131177
errors += add_directory(alloc, fname_buffer, dirs);
12141178

12151179
if (GetWindowsDirectory(fname_buffer, sizeof(fname_buffer)))

0 commit comments

Comments
 (0)