Talk:Determining free memory using the System plugin

From NSIS Wiki
Jump to navigationJump to search

What baout 64 bit windows?

on 64bit The following code :



System::Alloc 32

 Pop $1 
 System::Call "Kernel32::GlobalMemoryStatus(i) v (r1)" 
 System::Call "*$1(&i4 .r2, &i4 .r3, &i4 .r4, &i4 .r5, 
                   &i4 .r6, &i4.r7, &i4 .r8, &i4 .r9)" 
 System::Free $1 
  
 ; $5 => Free RAM 
 ; $4 => Total RAM 
 IntOp $R5 $5 / 1048576 ; 1048576 = 1024*1024, or MegaX 
 IntOp $R4 $4 / 1048576 ; 1048576 = 1024*1024, or MegaX 
 MessageBox MB_OK "R5: $R5   5: $5   R4: $R4   4: $4"

gives this: R5: -813 5: -852815872 R4: -256 4: -269082624

the real total memory is: 3.75GB of RAM

How do I make this work for a 64 bit system? if pissible hoe to make one coade to work for both 64bit and 32bit?

Thanks!



The forum thread told you to use the system plugin and its Int64Op