diff --git a/extra/hardware-info/windows/ce/ce.factor b/extra/hardware-info/windows/ce/ce.factor index c61a3c8b8a..6537661b3e 100755 --- a/extra/hardware-info/windows/ce/ce.factor +++ b/extra/hardware-info/windows/ce/ce.factor @@ -5,7 +5,7 @@ IN: hardware-info.windows.ce : memory-status ( -- MEMORYSTATUS ) "MEMORYSTATUS" "MEMORYSTATUS" heap-size over set-MEMORYSTATUS-dwLength - [ GlobalMemoryStatus ] keep ; + dup GlobalMemoryStatus ; M: wince cpus ( -- n ) 1 ; diff --git a/extra/hardware-info/windows/nt/nt.factor b/extra/hardware-info/windows/nt/nt.factor index 51af5c5949..6215566f11 100755 --- a/extra/hardware-info/windows/nt/nt.factor +++ b/extra/hardware-info/windows/nt/nt.factor @@ -3,16 +3,13 @@ kernel libc math namespaces hardware-info.backend windows windows.advapi32 windows.kernel32 system ; IN: hardware-info.windows.nt -: system-info ( -- SYSTEM_INFO ) - "SYSTEM_INFO" [ GetSystemInfo ] keep ; - M: winnt cpus ( -- n ) system-info SYSTEM_INFO-dwNumberOfProcessors ; : memory-status ( -- MEMORYSTATUSEX ) "MEMORYSTATUSEX" "MEMORYSTATUSEX" heap-size over set-MEMORYSTATUSEX-dwLength - [ GlobalMemoryStatusEx ] keep swap zero? [ win32-error ] when ; + dup GlobalMemoryStatusEx win32-error=0/f ; M: winnt memory-load ( -- n ) memory-status MEMORYSTATUSEX-dwMemoryLoad ; @@ -35,21 +32,12 @@ M: winnt total-virtual-mem ( -- n ) M: winnt available-virtual-mem ( -- n ) memory-status MEMORYSTATUSEX-ullAvailVirtual ; -: pull-win32-string ( alien -- string ) - [ utf16n alien>string ] keep free ; - : computer-name ( -- string ) - MAX_COMPUTERNAME_LENGTH 1+ [ malloc ] keep - dupd GetComputerName zero? [ - free win32-error f - ] [ - pull-win32-string - ] if ; + MAX_COMPUTERNAME_LENGTH 1+ + [ dup ] keep + GetComputerName win32-error=0/f alien>native-string ; : username ( -- string ) - UNLEN 1+ [ malloc ] keep - dupd GetUserName zero? [ - free win32-error f - ] [ - pull-win32-string - ] if ; + UNLEN 1+ + [ dup ] keep + GetUserName win32-error=0/f alien>native-string ; diff --git a/extra/hardware-info/windows/windows.factor b/extra/hardware-info/windows/windows.factor index 3aa6824ff6..d3ebe87501 100755 --- a/extra/hardware-info/windows/windows.factor +++ b/extra/hardware-info/windows/windows.factor @@ -21,7 +21,7 @@ IN: hardware-info.windows : os-version ( -- os-version ) "OSVERSIONINFO" "OSVERSIONINFO" heap-size over set-OSVERSIONINFO-dwOSVersionInfoSize - [ GetVersionEx ] keep swap zero? [ win32-error ] when ; + dup GetVersionEx win32-error=0/f ; : windows-major ( -- n ) os-version OSVERSIONINFO-dwMajorVersion ; @@ -36,7 +36,7 @@ IN: hardware-info.windows os-version OSVERSIONINFO-dwPlatformId ; : windows-service-pack ( -- string ) - os-version OSVERSIONINFO-szCSDVersion utf16n alien>string ; + os-version OSVERSIONINFO-szCSDVersion alien>native-string ; : feature-present? ( n -- ? ) IsProcessorFeaturePresent zero? not ; @@ -51,8 +51,8 @@ IN: hardware-info.windows "ushort" ; : get-directory ( word -- str ) - >r MAX_UNICODE_PATH [ ] keep dupd r> - execute win32-error=0/f utf16n alien>string ; inline + [ MAX_UNICODE_PATH [ ] keep dupd ] dip + execute win32-error=0/f alien>native-string ; inline : windows-directory ( -- str ) \ GetWindowsDirectory get-directory ;