mirror of
https://github.com/ip7z/7zip.git
synced 2026-04-21 06:03:40 +00:00
24.05
This commit is contained in:
parent
5b39dc76f1
commit
fc662341e6
501 changed files with 33187 additions and 10416 deletions
|
|
@ -71,6 +71,12 @@ UINT MyGetDriveType(CFSTR pathName)
|
|||
}
|
||||
}
|
||||
|
||||
#if !defined(Z7_WIN32_WINNT_MIN) || Z7_WIN32_WINNT_MIN < 0x0400
|
||||
// GetDiskFreeSpaceEx requires Windows95-OSR2, NT4
|
||||
#define Z7_USE_DYN_GetDiskFreeSpaceEx
|
||||
#endif
|
||||
|
||||
#ifdef Z7_USE_DYN_GetDiskFreeSpaceEx
|
||||
typedef BOOL (WINAPI * Func_GetDiskFreeSpaceExA)(
|
||||
LPCSTR lpDirectoryName, // directory name
|
||||
PULARGE_INTEGER lpFreeBytesAvailable, // bytes available to caller
|
||||
|
|
@ -84,6 +90,7 @@ typedef BOOL (WINAPI * Func_GetDiskFreeSpaceExW)(
|
|||
PULARGE_INTEGER lpTotalNumberOfBytes, // bytes on disk
|
||||
PULARGE_INTEGER lpTotalNumberOfFreeBytes // free bytes on disk
|
||||
);
|
||||
#endif
|
||||
|
||||
bool MyGetDiskFreeSpace(CFSTR rootPath, UInt64 &clusterSize, UInt64 &totalSize, UInt64 &freeSize)
|
||||
{
|
||||
|
|
@ -92,14 +99,22 @@ bool MyGetDiskFreeSpace(CFSTR rootPath, UInt64 &clusterSize, UInt64 &totalSize,
|
|||
#ifndef _UNICODE
|
||||
if (!g_IsNT)
|
||||
{
|
||||
#ifdef Z7_USE_DYN_GetDiskFreeSpaceEx
|
||||
const
|
||||
Func_GetDiskFreeSpaceExA f = Z7_GET_PROC_ADDRESS(
|
||||
Func_GetDiskFreeSpaceExA, GetModuleHandle(TEXT("kernel32.dll")),
|
||||
"GetDiskFreeSpaceExA");
|
||||
if (f)
|
||||
#endif
|
||||
{
|
||||
ULARGE_INTEGER freeBytesToCaller2, totalSize2, freeSize2;
|
||||
sizeIsDetected = BOOLToBool(f(fs2fas(rootPath), &freeBytesToCaller2, &totalSize2, &freeSize2));
|
||||
sizeIsDetected = BOOLToBool(
|
||||
#ifdef Z7_USE_DYN_GetDiskFreeSpaceEx
|
||||
f
|
||||
#else
|
||||
GetDiskFreeSpaceExA
|
||||
#endif
|
||||
(fs2fas(rootPath), &freeBytesToCaller2, &totalSize2, &freeSize2));
|
||||
totalSize = totalSize2.QuadPart;
|
||||
freeSize = freeSize2.QuadPart;
|
||||
}
|
||||
|
|
@ -109,14 +124,22 @@ bool MyGetDiskFreeSpace(CFSTR rootPath, UInt64 &clusterSize, UInt64 &totalSize,
|
|||
else
|
||||
#endif
|
||||
{
|
||||
#ifdef Z7_USE_DYN_GetDiskFreeSpaceEx
|
||||
const
|
||||
Func_GetDiskFreeSpaceExW f = Z7_GET_PROC_ADDRESS(
|
||||
Func_GetDiskFreeSpaceExW, GetModuleHandle(TEXT("kernel32.dll")),
|
||||
"GetDiskFreeSpaceExW");
|
||||
if (f)
|
||||
#endif
|
||||
{
|
||||
ULARGE_INTEGER freeBytesToCaller2, totalSize2, freeSize2;
|
||||
sizeIsDetected = BOOLToBool(f(fs2us(rootPath), &freeBytesToCaller2, &totalSize2, &freeSize2));
|
||||
sizeIsDetected = BOOLToBool(
|
||||
#ifdef Z7_USE_DYN_GetDiskFreeSpaceEx
|
||||
f
|
||||
#else
|
||||
GetDiskFreeSpaceExW
|
||||
#endif
|
||||
(fs2us(rootPath), &freeBytesToCaller2, &totalSize2, &freeSize2));
|
||||
totalSize = totalSize2.QuadPart;
|
||||
freeSize = freeSize2.QuadPart;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue