Memory Requirments

Post specialized setup scripts you have created here.
MLS
Posts: 56
Joined: Fri Jan 26, 2007 4:57 am

Memory Requirments

Postby MLS » Thu Jul 12, 2007 6:32 am

I came across a problem where a user had an odd amount of ram due to shared video ram. There system had 256Mb but reported 248Mb as 8Mb was reserved. Which as you can guess cause the installer to fail as it didn't meet the memory requirment.

Since the amount was marginal from the requirment I decided to allow this. But of course you can't check this in installaware. My solution was to use the windows api to get the information. Another problem was that installaware couldn't handle the structures needed.

To solve this I wrote a dll in powerbasic that is interfaced in the installer.

I have attached the source code and the compiled dll file. To use the dll you must add it into support files in the installaware ide

Code: Select all

TYPE MEMORYSTATUSEX
  dwLength AS DWORD
  dwMemoryLoad AS DWORD
  ullTotalPhys AS QUAD
  ullAvailPhys AS QUAD
  ullTotalPageFile AS QUAD
  ullAvailPageFile AS QUAD
  ullTotalVirtual AS QUAD
  ullAvailVirtual AS QUAD
  ullAvailExtendedVirtual AS QUAD
END TYPE

DECLARE FUNCTION GlobalMemoryStatusEx LIB "KERNEL32.DLL" ALIAS "GlobalMemoryStatusEx" (lpBuffer AS MEMORYSTATUSEX) AS LONG

FUNCTION TotalSystemRam ALIAS "TotalSystemRam" () EXPORT AS LONG
DIM objMemoryStatus AS MEMORYSTATUSEX
DIM lngResult AS LONG

objMemoryStatus.dwLength = LEN(objMemoryStatus)
lngResult = GlobalMemoryStatusEx(objMemoryStatus)

TotalSystemRam = CLNG((objMemoryStatus.ullTotalPhys \\ 1024)\\1024)

END FUNCTION


To use the dll in your script all you need is to cut and past the code below into your MSI Code where you normal check your memory requirment. I have attached the comparison code as well but you will need to tweak the message and amount of ram to your requirment

Code: Select all

~InstallAware Clipboard Data~
~End~
~{2337D68F-6C71-470F-8A70-E8399E7D3C27}~
~Terminate Install~
~{6D38B1FD-DFEE-4486-A9D5-04266E449939}~
~MessageBox~
~{CB80D442-B8D6-4001-859E-77D421F94B3D}~
~$TITLE$ Setup Error~
~This product requires at least 256 MB Physical Memory.$NEWLINE$$NEWLINE$Setup cannot continue.~
~3~
~1~
~~
~If~
~{4E423F3D-229E-4548-A005-FFA591B9C83C}~
~CHECKSYSTEM~
~2~
~247~
~TRUE~
~Call DLL Function~
~{609DEDE0-D68C-46E1-8720-FCF1331BE0F6}~
~$SUPPORTDIR$\\totalmemory.dll,TotalSystemRam,long,CHECKSYSTEM,$~
~mIDEFunc.dll\\mEXEFunc.dll~


Hope this helps anyone with a similar problem :)

File Attached:

TotalMemory.dll

Return to “Sample Scripts”

Who is online

Users browsing this forum: Bing [Bot] and 1 guest