summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2017-05-03 15:28:37 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2017-05-03 15:28:37 (GMT)
commitd2f034e206d0c76548eb7ddc4f23ed18bc6ce26c (patch)
tree02ae316b20d098b42b3de470a0d5a895b3ab2ad5 /win
parent126d43773ca468803c238c2deb4c947f80f4f68d (diff)
parentd329be0030f6800be40dc3606491b8880814d336 (diff)
downloadtcl-d2f034e206d0c76548eb7ddc4f23ed18bc6ce26c.zip
tcl-d2f034e206d0c76548eb7ddc4f23ed18bc6ce26c.tar.gz
tcl-d2f034e206d0c76548eb7ddc4f23ed18bc6ce26c.tar.bz2
merge core-8-6-branch
Diffstat (limited to 'win')
-rw-r--r--win/tclWinInit.c20
-rw-r--r--win/tclWinInt.h2
-rw-r--r--win/tclWinPipe.c4
-rw-r--r--win/tclWinReg.c10
4 files changed, 13 insertions, 23 deletions
diff --git a/win/tclWinInit.c b/win/tclWinInit.c
index 026fbfc..c590865 100644
--- a/win/tclWinInit.c
+++ b/win/tclWinInit.c
@@ -80,10 +80,7 @@ typedef struct {
/*
* Windows version dependend functions
*/
-static TclWinProcs _tclWinProcs = {
- NULL
-};
-TclWinProcs *tclWinProcs = &_tclWinProcs;
+TclWinProcs tclWinProcs;
/*
* The following arrays contain the human readable strings for the Windows
@@ -141,7 +138,7 @@ TclpInitPlatform(void)
{
WSADATA wsaData;
WORD wVersionRequested = MAKEWORD(2, 2);
- HINSTANCE hInstance;
+ HMODULE handle;
tclPlatform = TCL_PLATFORM_WINDOWS;
@@ -164,12 +161,10 @@ TclpInitPlatform(void)
/*
* Fill available functions depending on windows version
*/
- hInstance = LoadLibraryW(L"kernel32");
- if (hInstance != NULL) {
- _tclWinProcs.cancelSynchronousIo =
- (BOOL (WINAPI *)(HANDLE)) GetProcAddress(hInstance,
+ handle = GetModuleHandle(TEXT("KERNEL32"));
+ tclWinProcs.cancelSynchronousIo =
+ (BOOL (WINAPI *)(HANDLE)) GetProcAddress(handle,
"CancelSynchronousIo");
- }
}
/*
@@ -557,16 +552,13 @@ TclpSetVariables(
TclGetProcessGlobalValue(&defaultLibraryDir), TCL_GLOBAL_ONLY);
if (!osInfoInitialized) {
- HANDLE handle = LoadLibraryW(L"NTDLL");
+ HMODULE handle = GetModuleHandle(TEXT("NTDLL"));
int(__stdcall *getversion)(void *) =
(int(__stdcall *)(void *)) GetProcAddress(handle, "RtlGetVersion");
osInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
if (!getversion || getversion(&osInfo)) {
GetVersionExW(&osInfo);
}
- if (handle) {
- FreeLibrary(handle);
- }
osInfoInitialized = 1;
}
GetSystemInfo(&sys.info);
diff --git a/win/tclWinInt.h b/win/tclWinInt.h
index 76f5f68..43799d0 100644
--- a/win/tclWinInt.h
+++ b/win/tclWinInt.h
@@ -38,7 +38,7 @@ typedef struct TclWinProcs {
BOOL (WINAPI *cancelSynchronousIo)(HANDLE);
} TclWinProcs;
-MODULE_SCOPE TclWinProcs *tclWinProcs;
+MODULE_SCOPE TclWinProcs tclWinProcs;
/*
* Some versions of Borland C have a define for the OSVERSIONINFO for
diff --git a/win/tclWinPipe.c b/win/tclWinPipe.c
index 4a1e75a..3e7e5eb 100644
--- a/win/tclWinPipe.c
+++ b/win/tclWinPipe.c
@@ -3329,8 +3329,8 @@ TclPipeThreadStop(
/*
* Cancel all sync-IO of this thread (may be blocked there).
*/
- if (tclWinProcs->cancelSynchronousIo) {
- tclWinProcs->cancelSynchronousIo(hThread);
+ if (tclWinProcs.cancelSynchronousIo) {
+ tclWinProcs.cancelSynchronousIo(hThread);
}
/*
diff --git a/win/tclWinReg.c b/win/tclWinReg.c
index 5f7fd31..de48b9b 100644
--- a/win/tclWinReg.c
+++ b/win/tclWinReg.c
@@ -1197,14 +1197,12 @@ RecursiveDeleteKey(
*/
if (mode && !checkExProc) {
- HINSTANCE dllH;
+ HMODULE handle;
checkExProc = 1;
- dllH = LoadLibrary(TEXT("advapi32.dll"));
- if (dllH) {
- regDeleteKeyExProc = (FARPROC)
- GetProcAddress(dllH, "RegDeleteKeyExW");
- }
+ handle = GetModuleHandle(TEXT("ADVAPI32"));
+ regDeleteKeyExProc = (FARPROC)
+ GetProcAddress(handle, "RegDeleteKeyExW");
}
if (mode && regDeleteKeyExProc) {
result = regDeleteKeyExProc(startKey, keyName, mode, 0);