QFileSystemEngine: Remove the remainder of Windows XP functions
The attempt at loading these functions at runtime with WinRT always failed, so stop trying. Change-Id: I658f552684924f8aa2cafffd14cfc5179ac08498 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
325b46ce62
commit
1c6d5b0696
|
|
@ -1,6 +1,6 @@
|
|||
EXEEXT = .exe
|
||||
EXTRA_CXXFLAGS = -DUNICODE
|
||||
EXTRA_LFLAGS = -static -s -lole32 -luuid -ladvapi32 -lkernel32
|
||||
EXTRA_LFLAGS = -static -s -lole32 -luuid -ladvapi32 -lkernel32 -lnetapi32
|
||||
QTOBJS = \
|
||||
qfilesystemengine_win.o \
|
||||
qfilesystemiterator_win.o \
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ CXXFLAGS_BARE = $(CFLAGS_BARE)
|
|||
CXXFLAGS = $(CFLAGS)
|
||||
|
||||
LFLAGS =
|
||||
LIBS = ole32.lib advapi32.lib shell32.lib
|
||||
LIBS = ole32.lib advapi32.lib shell32.lib netapi32.lib
|
||||
ADDCLEAN = qmake.pdb qmake.ilk
|
||||
|
||||
#qmake code
|
||||
|
|
|
|||
|
|
@ -142,8 +142,8 @@ bootstrap { #Qt code
|
|||
} else:win32 {
|
||||
SOURCES += qfilesystemengine_win.cpp qfsfileengine_win.cpp qfilesystemiterator_win.cpp qsettings_win.cpp \
|
||||
qsystemlibrary.cpp qlocale_win.cpp registry.cpp
|
||||
win32-msvc*:LIBS += ole32.lib advapi32.lib
|
||||
mingw:LIBS += -lole32 -luuid -ladvapi32 -lkernel32
|
||||
win32-msvc*:LIBS += ole32.lib advapi32.lib netapi32.lib
|
||||
mingw:LIBS += -lole32 -luuid -ladvapi32 -lkernel32 -lnetapi32
|
||||
}
|
||||
|
||||
qnx {
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ win32 {
|
|||
io/qwindowspipereader.cpp \
|
||||
io/qwindowspipewriter.cpp
|
||||
|
||||
LIBS += -lmpr -luserenv
|
||||
LIBS += -lmpr -lnetapi32 -luserenv
|
||||
} else {
|
||||
SOURCES += \
|
||||
io/qstandardpaths_winrt.cpp \
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@
|
|||
#include <objbase.h>
|
||||
#ifndef Q_OS_WINRT
|
||||
# include <shlobj.h>
|
||||
# include <lm.h>
|
||||
# include <accctrl.h>
|
||||
#endif
|
||||
#include <initguid.h>
|
||||
|
|
@ -226,44 +227,10 @@ QT_END_NAMESPACE
|
|||
} // anonymous namespace
|
||||
#endif // QT_CONFIG(fslibs)
|
||||
|
||||
typedef DWORD (WINAPI *PtrNetShareEnum)(LPWSTR, DWORD, LPBYTE*, DWORD, LPDWORD, LPDWORD, LPDWORD);
|
||||
static PtrNetShareEnum ptrNetShareEnum = 0;
|
||||
typedef DWORD (WINAPI *PtrNetApiBufferFree)(LPVOID);
|
||||
static PtrNetApiBufferFree ptrNetApiBufferFree = 0;
|
||||
typedef struct _SHARE_INFO_1 {
|
||||
LPWSTR shi1_netname;
|
||||
DWORD shi1_type;
|
||||
LPWSTR shi1_remark;
|
||||
} SHARE_INFO_1;
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
Q_CORE_EXPORT int qt_ntfs_permission_lookup = 0;
|
||||
|
||||
namespace {
|
||||
struct UNCLibResolver
|
||||
{
|
||||
UNCLibResolver()
|
||||
{
|
||||
#if !defined(Q_OS_WINRT)
|
||||
HINSTANCE hLib = QSystemLibrary::load(L"Netapi32");
|
||||
if (hLib) {
|
||||
ptrNetShareEnum = (PtrNetShareEnum)GetProcAddress(hLib, "NetShareEnum");
|
||||
if (ptrNetShareEnum)
|
||||
ptrNetApiBufferFree = (PtrNetApiBufferFree)GetProcAddress(hLib, "NetApiBufferFree");
|
||||
}
|
||||
#endif // !Q_OS_WINRT
|
||||
}
|
||||
};
|
||||
Q_GLOBAL_STATIC(UNCLibResolver, uncLibResolver)
|
||||
} // anonymous namespace
|
||||
|
||||
static bool resolveUNCLibs()
|
||||
{
|
||||
uncLibResolver();
|
||||
return ptrNetShareEnum && ptrNetApiBufferFree;
|
||||
}
|
||||
|
||||
static QString readSymLink(const QFileSystemEntry &link)
|
||||
{
|
||||
QString result;
|
||||
|
|
@ -396,25 +363,27 @@ static inline bool getFindData(QString path, WIN32_FIND_DATA &findData)
|
|||
|
||||
bool QFileSystemEngine::uncListSharesOnServer(const QString &server, QStringList *list)
|
||||
{
|
||||
if (resolveUNCLibs()) {
|
||||
SHARE_INFO_1 *BufPtr, *p;
|
||||
DWORD res;
|
||||
DWORD er = 0, tr = 0, resume = 0, i;
|
||||
do {
|
||||
res = ptrNetShareEnum((wchar_t*)server.utf16(), 1, (LPBYTE *)&BufPtr, DWORD(-1), &er, &tr, &resume);
|
||||
if (res == ERROR_SUCCESS || res == ERROR_MORE_DATA) {
|
||||
p = BufPtr;
|
||||
for (i = 1; i <= er; ++i) {
|
||||
if (list && p->shi1_type == 0)
|
||||
list->append(QString::fromWCharArray(p->shi1_netname));
|
||||
p++;
|
||||
}
|
||||
DWORD res = ERROR_NOT_SUPPORTED;
|
||||
#ifndef Q_OS_WINRT
|
||||
SHARE_INFO_1 *BufPtr, *p;
|
||||
DWORD er = 0, tr = 0, resume = 0, i;
|
||||
do {
|
||||
res = NetShareEnum((wchar_t*)server.utf16(), 1, (LPBYTE *)&BufPtr, DWORD(-1), &er, &tr, &resume);
|
||||
if (res == ERROR_SUCCESS || res == ERROR_MORE_DATA) {
|
||||
p = BufPtr;
|
||||
for (i = 1; i <= er; ++i) {
|
||||
if (list && p->shi1_type == 0)
|
||||
list->append(QString::fromWCharArray(p->shi1_netname));
|
||||
p++;
|
||||
}
|
||||
ptrNetApiBufferFree(BufPtr);
|
||||
} while (res == ERROR_MORE_DATA);
|
||||
return res == ERROR_SUCCESS;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
NetApiBufferFree(BufPtr);
|
||||
} while (res == ERROR_MORE_DATA);
|
||||
#else
|
||||
Q_UNUSED(server);
|
||||
Q_UNUSED(list);
|
||||
#endif
|
||||
return res == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
void QFileSystemEngine::clearWinStatData(QFileSystemMetaData &data)
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ macx {
|
|||
}
|
||||
|
||||
win32 {
|
||||
LIBS += -luser32 -lole32 -ladvapi32 -lshell32
|
||||
LIBS += -luser32 -lole32 -ladvapi32 -lshell32 -lnetapi32
|
||||
mingw: LIBS += -luuid
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue