nExtMem() and Os()
Posted:
Mon Feb 22, 2016 1:23 pm
by sambomb
nExtMem() isn't returning the correct amount of memory and the OS() function doensn't work in windows 8 or above, returning windows NT instead
Is this related to my FWH / xHarbour version?
Compiler version: xHarbour build 1.2.1 Intl. (SimpLex) (Rev. 6715)
FiveWin Version: FWHX 10.6
Re: nExtMem() and Os()
Posted:
Mon Feb 22, 2016 2:24 pm
by sambomb
Gostaria de utilizar a função OS pois ela já retorna o modelo do SO também pois alguns modelos geram incompatibilidade, como o windows 7 starter...
? "Versão windows: " + OS() //Versão windows: Windows 7 Professional 6.01.7601 Service Pack 1
Re: nExtMem() and Os()
Posted:
Tue Feb 23, 2016 11:33 am
by sambomb
a nExtMem está retornando valores inválidos, minha máquina é um Windows 7 que tem 4 GB ( utilizável 3,24 ) sendo que reconhece apenas 2 GB em uma máquina com Windows 8.1, reconhece como negativo!
E a função Os() é nativa do xHarbour, mas parece que não foi atualizada, ela retorna todas as informações que eu preciso, queria saber não apenas a versão do Windows, mas também o tipo de licença dele como disse acima, mas muito obrigado, estou desenvolvendo uma rotina que poderei aproveitar trechos dessa TSystem
Re: nExtMem() and Os()
Posted:
Tue Feb 23, 2016 2:04 pm
by karinha
Windows 8.1, reconhece como negativo?
Você incorporou o GETSYSIN.PRG modificado por mim, logo acima?
Você tem a função Os() do xHarbour? Talvez o Marcelo Lombardo tenha uma mais recente.
Seria algo assim?
http://www.pctoledo.com.br/forum/viewtopic.php?f=4&t=16163Abs.
Re: nExtMem() and Os()
Posted:
Wed Feb 24, 2016 11:32 am
by sambomb
Não só no Windows 8.1
--> DadosSO
Versão windows: Windows 7 Professional 6.01.7601 Service Pack 1
Processador: AMD Athlon(tm) II X2 250 Processor 3017 Mhz
Data: 23/02/2016
Hora: 14:30:07
Nome de rede: LAZZO-PC
Usuário de rede: Lazzo
Acesso de gravação no 'C:\': True
Driver's ( 1 )
C: Serial: 4873455 Tamanho total: 465.662 GB Utilizado: 61.306 GB Restante: 404.356 GB
Cache HD: Cache não habilitado
Arquivos off-line: Desabilitado
- Code: Select all Expand view
aAdd( ::aTexto,"Memória: " + cValToChar( Int( nExtMem() / ( 1024 * 1024 ) ) + 1 ) + " MBs" )
Memória: -255 MBs
Memória livre - Sistema: 90 %
Memória livre - GDI: 90 %
Memória livre - User: 90 %
Re: nExtMem() and Os()
Posted:
Wed Feb 24, 2016 2:50 pm
by Carlos Mora
Don't know about xHarbour, but probably this is sth related to the numeric type used by nExtMem() an xHabour's integers. Using a 4 byte UNSIGNED LONG we can represent integers from 0 to 256^4-1, or 4,294,967,295, or SIGNED, ranging from -2,147,483,647 TO 2,147,483,648. I think the function is working fine, but returning an UNSIGNED LONG that xHarbour is handling as signed, so that's why you ar getting negative results. A quick temporary patch can be that, in case of a negative result, it should be substracted from 256^4-1, wich will result in your case to 3840 Mb, that is your claimd free mem.
Obvously, this patch will fail in PC with more than 4 GB, as probably will do anything in 32 bits with results expresing byte counts that a 4 byte LONG won't be able to represent.