| 275 | |
| 276 | |
| 277 | VOID CHardware::SetTotalRAMDigit() |
| 278 | { |
| 279 | DWORD dwTotalMegabytes; |
| 280 | |
| 281 | m_szHardwareID[ TOTAL_RAM_DIGIT ] = '?'; |
| 282 | |
| 283 | #if defined(WIN32) || defined(_WIN32) |
| 284 | |
| 285 | MEMORYSTATUS mStatus; |
| 286 | |
| 287 | mStatus.dwLength = sizeof( MEMORYSTATUS ); |
| 288 | |
| 289 | GlobalMemoryStatus( &mStatus ); |
| 290 | |
| 291 | dwTotalMegabytes = (DWORD)( mStatus.dwTotalPhys / (1024 * 1024)); // convert to megabytes |
| 292 | dwTotalMegabytes += 1; // Add 1Mb to produce accurate result due to reserved space |
| 293 | |
| 294 | #else |
| 295 | BYTE abDpmiMemInfo[0x30]; |
| 296 | |
| 297 | FillMemory(abDpmiMemInfo, sizeof(abDpmiMemInfo), -1); |
| 298 | |
| 299 | __asm { |
| 300 | push di ;save regs |
| 301 | |
| 302 | push ss |
| 303 | pop es ;make es point to stack |
| 304 | lea di,abDpmiMemInfo ;Get offset of buffer |
| 305 | mov ax,0500h ;DPMI -- Get Free Memory Info |
| 306 | int 31h ;Call DPMI |
| 307 | |
| 308 | pop di ;restore regs |
| 309 | } |
| 310 | |
| 311 | DWORD dwTotalPages = *(LPDWORD)&abDpmiMemInfo[0x18]; |
| 312 | |
| 313 | // check to see if the field is -1 (error) and just use 0 |
| 314 | // we're adding 1 to account for the memory below 1M (I think) |
| 315 | dwTotalMegabytes = (dwTotalPages == -1) ? 0 : (1 + dwTotalPages/(1024/4)); |
| 316 | #endif |
| 317 | |
| 318 | m_szHardwareID[ TOTAL_RAM_DIGIT ] = (CHAR)( dwTotalMegabytes % 9 ) + '0'; |
| 319 | |
| 320 | #ifdef HWID_DETAIL //////////////////////////////////////////////////////////// |
| 321 | m_dwTotalRamMegs = dwTotalMegabytes; |
| 322 | #endif |
| 323 | |
| 324 | } |
| 325 | |
| 326 | |
| 327 | VOID CHardware::SetFDConfigDigit() |
nothing calls this directly
no outgoing calls
no test coverage detected