mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 05:33:47 +01:00
Move DLL support to lib/fs
This commit is contained in:
parent
8fc15e4861
commit
02bb701bba
@ -134,18 +134,3 @@ ENABLE_GCC_WARNING(aggregate-return)
|
||||
/* =====
|
||||
* Time
|
||||
* ===== */
|
||||
|
||||
#ifdef _WIN32
|
||||
HANDLE
|
||||
load_windows_system_library(const TCHAR *library_name)
|
||||
{
|
||||
TCHAR path[MAX_PATH];
|
||||
unsigned n;
|
||||
n = GetSystemDirectory(path, MAX_PATH);
|
||||
if (n == 0 || n + _tcslen(library_name) + 2 >= MAX_PATH)
|
||||
return 0;
|
||||
_tcscat(path, TEXT("\\"));
|
||||
_tcscat(path, library_name);
|
||||
return LoadLibrary(path);
|
||||
}
|
||||
#endif /* defined(_WIN32) */
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "lib/fs/path.h"
|
||||
#include "lib/encoding/time_fmt.h"
|
||||
#include "lib/encoding/cstring.h"
|
||||
#include "lib/fs/winlib.h"
|
||||
|
||||
void tor_log_mallinfo(int severity);
|
||||
|
||||
@ -76,8 +77,4 @@ void tor_log_mallinfo(int severity);
|
||||
((isSock) ? read_all_from_socket((fd), (buf), (count)) \
|
||||
: read_all_from_fd((int)(fd), (buf), (count)))
|
||||
|
||||
#ifdef _WIN32
|
||||
HANDLE load_windows_system_library(const TCHAR *library_name);
|
||||
#endif
|
||||
|
||||
#endif /* !defined(TOR_UTIL_H) */
|
||||
|
@ -15,6 +15,10 @@ src_lib_libtor_fs_a_SOURCES = \
|
||||
src/lib/fs/storagedir.c \
|
||||
src/lib/fs/userdb.c
|
||||
|
||||
if WIN32
|
||||
src_lib_libtor_fs_a_SOURCES += src/lib/fs/winlib.c
|
||||
endif
|
||||
|
||||
src_lib_libtor_fs_testing_a_SOURCES = \
|
||||
$(src_lib_libtor_fs_a_SOURCES)
|
||||
src_lib_libtor_fs_testing_a_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_CPPFLAGS)
|
||||
@ -28,4 +32,5 @@ noinst_HEADERS += \
|
||||
src/lib/fs/mmap.h \
|
||||
src/lib/fs/path.h \
|
||||
src/lib/fs/storagedir.h \
|
||||
src/lib/fs/userdb.h
|
||||
src/lib/fs/userdb.h \
|
||||
src/lib/fs/winlib.h
|
||||
|
21
src/lib/fs/winlib.c
Normal file
21
src/lib/fs/winlib.c
Normal file
@ -0,0 +1,21 @@
|
||||
/* Copyright (c) 2003, Roger Dingledine
|
||||
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
|
||||
* Copyright (c) 2007-2018, The Tor Project, Inc. */
|
||||
/* See LICENSE for licensing information */
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "lib/fs/winlib.h"
|
||||
|
||||
HANDLE
|
||||
load_windows_system_library(const TCHAR *library_name)
|
||||
{
|
||||
TCHAR path[MAX_PATH];
|
||||
unsigned n;
|
||||
n = GetSystemDirectory(path, MAX_PATH);
|
||||
if (n == 0 || n + _tcslen(library_name) + 2 >= MAX_PATH)
|
||||
return 0;
|
||||
_tcscat(path, TEXT("\\"));
|
||||
_tcscat(path, library_name);
|
||||
return LoadLibrary(path);
|
||||
}
|
||||
#endif /* defined(_WIN32) */
|
16
src/lib/fs/winlib.h
Normal file
16
src/lib/fs/winlib.h
Normal file
@ -0,0 +1,16 @@
|
||||
/* Copyright (c) 2003, Roger Dingledine
|
||||
* Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
|
||||
* Copyright (c) 2007-2018, The Tor Project, Inc. */
|
||||
/* See LICENSE for licensing information */
|
||||
|
||||
#ifndef TOR_WINLIB_H
|
||||
#define TOR_WINLIB_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
|
||||
HANDLE load_windows_system_library(const TCHAR *library_name);
|
||||
#endif
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user