I want to get size (MB) of one file which bigger 2GB.
Example: ${GetSizeBigger2GB} $OUT $PATH
${GetSizeBigger2GB} $OUT "D:\VMWARE\Disk.vhd"
This is possiable ?.
NSIS get file size bigger 2GB
9 posts
FileFunc.nsh
I tested on Windows 10 x64 v1809
Function .onInit
InitPluginsDir
${GetSize} "D:\VMWare\XP86" "/M=XP86-flat.vmdk /S=0M /G=0" $0 $1 $2
MessageBox MB_OK|MB_USERICON '$0'
FunctionEnd
Result = empty
(In This PC, XP86-flat.vmdk = 2,5GB of size)
With:
${GetSize} "$WINDIR" "/M=Explorer.exe /S=0K /G=0" $0 $1 $2
Result $0 = 4144
Maybe, the .vmdk extension have 4 characters 🙂
Function .onInit
InitPluginsDir
${GetSize} "D:\VMWare\XP86" "/M=XP86-flat.vmdk /S=0M /G=0" $0 $1 $2
MessageBox MB_OK|MB_USERICON '$0'
FunctionEnd
Result = empty
(In This PC, XP86-flat.vmdk = 2,5GB of size)
With:
${GetSize} "$WINDIR" "/M=Explorer.exe /S=0K /G=0" $0 $1 $2
Result $0 = 4144
Maybe, the .vmdk extension have 4 characters 🙂
for <= 4GiB files:
StrCpy $1 ""64-bit limit:
FileOpen $9 "D:\VMWARE\Disk.vhd" r
StrCmp $9 "" +3
FileSeek $9 0 END $1
FileClose $9
IntFmt $1 "%u" $1
DetailPrint $1
!include LogicLib.nsh
StrCpy $1 -1
FileOpen $9 "D:\VMWARE\Disk.vhd" r
StrCmp $9 "" +3
System::Call 'KERNEL32::GetFileSize(p$9,*i.r2)i.r1'
FileClose $9
${If} $1 = -1
DetailPrint Failed
${Else}
IntFmt $2 "%#x00000000" $2
System::Int64Op $2 | $1
Pop $1
DetailPrint $1
${EndIf}
I tested on Windows 10 x64 v1809.
for <= 4GiB files:---------result=empty
64-bit limit:-----------------result=-1
for <= 4GiB files:---------result=empty
64-bit limit:-----------------result=-1
Does the FileOpen call fail? Is that file perhaps in use/locked?
If you can't open a handle you can ask the directory:
!include LogicLib.nshThis information might not be up to date.
System::Call 'KERNEL32::FindFirstFile(t "c:\hiberfil.sys", @r1)p.r0' ; NSIS 3+
${If} $0 P<> -1
System::Call 'KERNEL32::FindClose(pr0)'
System::Call '*$1(i,l,l,l,i.r1,i.r0)'
IntFmt $1 "0x%x" $1
IntFmt $0 "%.8x" $0
StrCpy $1 $1$0
DetailPrint Directory.Size=$1
${EndIf}
That's great !!. 🙂

I have been searching online for a week.
Thanks again Anders.

I have been searching online for a week.
Thanks again Anders.
You can probably just do a pointless 64-bit operation like
System::Int64Op $1 + 0to convert from hex.
Pop $1