summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/lzma/CPP/Windows/FileSystem.cpp
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/lzma/CPP/Windows/FileSystem.cpp')
-rw-r--r--3rdparty/lzma/CPP/Windows/FileSystem.cpp28
1 files changed, 18 insertions, 10 deletions
diff --git a/3rdparty/lzma/CPP/Windows/FileSystem.cpp b/3rdparty/lzma/CPP/Windows/FileSystem.cpp
index 6c1f48a206c..6a262d92d7f 100644
--- a/3rdparty/lzma/CPP/Windows/FileSystem.cpp
+++ b/3rdparty/lzma/CPP/Windows/FileSystem.cpp
@@ -19,6 +19,8 @@ namespace NWindows {
namespace NFile {
namespace NSystem {
+#ifdef _WIN32
+
bool MyGetVolumeInformation(
CFSTR rootPath,
UString &volumeName,
@@ -69,14 +71,14 @@ UINT MyGetDriveType(CFSTR pathName)
}
}
-typedef BOOL (WINAPI * GetDiskFreeSpaceExA_Pointer)(
+typedef BOOL (WINAPI * Func_GetDiskFreeSpaceExA)(
LPCSTR lpDirectoryName, // directory name
PULARGE_INTEGER lpFreeBytesAvailable, // bytes available to caller
PULARGE_INTEGER lpTotalNumberOfBytes, // bytes on disk
PULARGE_INTEGER lpTotalNumberOfFreeBytes // free bytes on disk
);
-typedef BOOL (WINAPI * GetDiskFreeSpaceExW_Pointer)(
+typedef BOOL (WINAPI * Func_GetDiskFreeSpaceExW)(
LPCWSTR lpDirectoryName, // directory name
PULARGE_INTEGER lpFreeBytesAvailable, // bytes available to caller
PULARGE_INTEGER lpTotalNumberOfBytes, // bytes on disk
@@ -90,12 +92,14 @@ bool MyGetDiskFreeSpace(CFSTR rootPath, UInt64 &clusterSize, UInt64 &totalSize,
#ifndef _UNICODE
if (!g_IsNT)
{
- GetDiskFreeSpaceExA_Pointer pGetDiskFreeSpaceEx = (GetDiskFreeSpaceExA_Pointer)GetProcAddress(
- GetModuleHandle(TEXT("kernel32.dll")), "GetDiskFreeSpaceExA");
- if (pGetDiskFreeSpaceEx)
+ const
+ Func_GetDiskFreeSpaceExA f = Z7_GET_PROC_ADDRESS(
+ Func_GetDiskFreeSpaceExA, GetModuleHandle(TEXT("kernel32.dll")),
+ "GetDiskFreeSpaceExA");
+ if (f)
{
ULARGE_INTEGER freeBytesToCaller2, totalSize2, freeSize2;
- sizeIsDetected = BOOLToBool(pGetDiskFreeSpaceEx(fs2fas(rootPath), &freeBytesToCaller2, &totalSize2, &freeSize2));
+ sizeIsDetected = BOOLToBool(f(fs2fas(rootPath), &freeBytesToCaller2, &totalSize2, &freeSize2));
totalSize = totalSize2.QuadPart;
freeSize = freeSize2.QuadPart;
}
@@ -105,12 +109,14 @@ bool MyGetDiskFreeSpace(CFSTR rootPath, UInt64 &clusterSize, UInt64 &totalSize,
else
#endif
{
- GetDiskFreeSpaceExW_Pointer pGetDiskFreeSpaceEx = (GetDiskFreeSpaceExW_Pointer)GetProcAddress(
- GetModuleHandle(TEXT("kernel32.dll")), "GetDiskFreeSpaceExW");
- if (pGetDiskFreeSpaceEx)
+ const
+ Func_GetDiskFreeSpaceExW f = Z7_GET_PROC_ADDRESS(
+ Func_GetDiskFreeSpaceExW, GetModuleHandle(TEXT("kernel32.dll")),
+ "GetDiskFreeSpaceExW");
+ if (f)
{
ULARGE_INTEGER freeBytesToCaller2, totalSize2, freeSize2;
- sizeIsDetected = BOOLToBool(pGetDiskFreeSpaceEx(fs2us(rootPath), &freeBytesToCaller2, &totalSize2, &freeSize2));
+ sizeIsDetected = BOOLToBool(f(fs2us(rootPath), &freeBytesToCaller2, &totalSize2, &freeSize2));
totalSize = totalSize2.QuadPart;
freeSize = freeSize2.QuadPart;
}
@@ -126,6 +132,8 @@ bool MyGetDiskFreeSpace(CFSTR rootPath, UInt64 &clusterSize, UInt64 &totalSize,
return true;
}
+#endif
+
}}}
#endif