From 65d76e6509af3399ae0ea8bb8c4446ea485855f1 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 30 Apr 2009 10:25:59 -0500 Subject: [PATCH] finish fixing the using list for windows.errors, more ffi bindings --- .../windows/nt/privileges/privileges.factor | 2 +- basis/io/mmap/windows/windows.factor | 6 +-- basis/windows/advapi32/advapi32.factor | 41 ++++++++++++++++++- extra/game-input/dinput/dinput.factor | 8 ++-- extra/system-info/windows/nt/nt.factor | 4 +- extra/system-info/windows/windows.factor | 2 +- 6 files changed, 50 insertions(+), 13 deletions(-) diff --git a/basis/io/backend/windows/nt/privileges/privileges.factor b/basis/io/backend/windows/nt/privileges/privileges.factor index 64218f75b0..33577a9394 100755 --- a/basis/io/backend/windows/nt/privileges/privileges.factor +++ b/basis/io/backend/windows/nt/privileges/privileges.factor @@ -2,7 +2,7 @@ USING: alien alien.c-types alien.syntax arrays continuations destructors generic io.mmap io.ports io.backend.windows io.files.windows kernel libc math math.bitwise namespaces quotations sequences windows windows.advapi32 windows.kernel32 io.backend system accessors -io.backend.windows.privileges ; +io.backend.windows.privileges windows.errors ; IN: io.backend.windows.nt.privileges TYPEDEF: TOKEN_PRIVILEGES* PTOKEN_PRIVILEGES diff --git a/basis/io/mmap/windows/windows.factor b/basis/io/mmap/windows/windows.factor index ebd8109d14..8fdc7fefd9 100644 --- a/basis/io/mmap/windows/windows.factor +++ b/basis/io/mmap/windows/windows.factor @@ -2,7 +2,7 @@ USING: alien alien.c-types arrays destructors generic io.mmap io.ports io.backend.windows io.files.windows io.backend.windows.privileges kernel libc math math.bitwise namespaces quotations sequences windows windows.advapi32 windows.kernel32 io.backend system -accessors locals ; +accessors locals windows.errors ; IN: io.mmap.windows : create-file-mapping ( hFile lpAttributes flProtect dwMaximumSizeHigh dwMaximumSizeLow lpName -- HANDLE ) @@ -12,8 +12,8 @@ IN: io.mmap.windows MapViewOfFile [ win32-error=0/f ] keep ; :: mmap-open ( path length access-mode create-mode protect access -- handle handle address ) - [let | lo [ length HEX: ffffffff bitand ] - hi [ length -32 shift HEX: ffffffff bitand ] | + [let | lo [ length 32 bits ] + hi [ length -32 shift 32 bits ] | { "SeCreateGlobalPrivilege" "SeLockMemoryPrivilege" } [ path access-mode create-mode 0 open-file |dispose dup handle>> f protect hi lo f create-file-mapping |dispose diff --git a/basis/windows/advapi32/advapi32.factor b/basis/windows/advapi32/advapi32.factor index f715af378b..fd037cb2a0 100644 --- a/basis/windows/advapi32/advapi32.factor +++ b/basis/windows/advapi32/advapi32.factor @@ -894,15 +894,52 @@ FUNCTION: LONG RegCreateKeyExW ( HKEY hKey, LPCTSTR lpSubKey, DWORD Reserved, LP ! : RegCreateKeyW ! : RegDeleteKeyA ; ! : RegDeleteKeyW ; + +FUNCTION: LONG RegDeleteKeyExW ( + HKEY hKey, + LPCTSTR lpSubKey, + DWORD Reserved, + LPTSTR lpClass, + DWORD dwOptions, + REGSAM samDesired, + LPSECURITY_ATTRIBUTES lpSecurityAttributes, + PHKEY phkResult, + LPDWORD lpdwDisposition + ) ; + +ALIAS: RegDeleteKeyEx RegDeleteKeyExW + ! : RegDeleteValueA ; ! : RegDeleteValueW ; ! : RegDisablePredefinedCache ; ! : RegEnumKeyA ; ! : RegEnumKeyExA ; -! : RegEnumKeyExW ; +FUNCTION: LONG RegEnumKeyExW ( + HKEY hKey, + DWORD dwIndex, + LPTSTR lpName, + LPDWORD lpcName, + LPDWORD lpReserved, + LPTSTR lpClass, + LPDWORD lpcClass, + PFILETIME lpftLastWriteTime + ) ; ! : RegEnumKeyW ; ! : RegEnumValueA ; -! : RegEnumValueW ; + +FUNCTION: LONG RegEnumValueW ( + HKEY hKey, + DWORD dwIndex, + LPTSTR lpValueName, + LPDWORD lpcchValueName, + LPDWORD lpReserved, + LPDWORD lpType, + LPBYTE lpData, + LPDWORD lpcbData + ) ; + +ALIAS: RegEnumValue RegEnumValueW + ! : RegFlushKey ; ! : RegGetKeySecurity ; ! : RegLoadKeyA ; diff --git a/extra/game-input/dinput/dinput.factor b/extra/game-input/dinput/dinput.factor index a2beaf6d9b..ce87c12237 100755 --- a/extra/game-input/dinput/dinput.factor +++ b/extra/game-input/dinput/dinput.factor @@ -2,10 +2,10 @@ USING: windows.dinput windows.dinput.constants parser alien.c-types windows.ole32 namespaces assocs kernel arrays vectors windows.kernel32 windows.com windows.dinput shuffle windows.user32 windows.messages sequences combinators locals -math.rectangles accessors math windows alien -alien.strings io.encodings.utf16 io.encodings.utf16n -continuations byte-arrays game-input.dinput.keys-array -game-input ui.backend.windows ; +math.rectangles accessors math alien alien.strings +io.encodings.utf16 io.encodings.utf16n continuations +byte-arrays game-input.dinput.keys-array game-input +ui.backend.windows windows.errors ; IN: game-input.dinput SINGLETON: dinput-game-input-backend diff --git a/extra/system-info/windows/nt/nt.factor b/extra/system-info/windows/nt/nt.factor index 7f71e08e83..5be2dc89e2 100755 --- a/extra/system-info/windows/nt/nt.factor +++ b/extra/system-info/windows/nt/nt.factor @@ -3,7 +3,7 @@ USING: alien alien.c-types alien.strings kernel libc math namespaces system-info.backend system-info.windows windows windows.advapi32 -windows.kernel32 system byte-arrays ; +windows.kernel32 system byte-arrays windows.errors ; IN: system-info.windows.nt M: winnt cpus ( -- n ) @@ -41,6 +41,6 @@ M: winnt available-virtual-mem ( -- n ) GetComputerName win32-error=0/f alien>native-string ; : username ( -- string ) - UNLEN 1+ + UNLEN 1 + [ dup ] keep GetUserName win32-error=0/f alien>native-string ; diff --git a/extra/system-info/windows/windows.factor b/extra/system-info/windows/windows.factor index 66abb59ee9..4d23430131 100755 --- a/extra/system-info/windows/windows.factor +++ b/extra/system-info/windows/windows.factor @@ -3,7 +3,7 @@ USING: alien alien.c-types kernel libc math namespaces windows windows.kernel32 windows.advapi32 words combinators vocabs.loader system-info.backend -system alien.strings ; +system alien.strings windows.errors ; IN: system-info.windows : system-info ( -- SYSTEM_INFO ) -- 2.34.1