]> gitweb.factorcode.org Git - factor.git/commitdiff
Merge branch 'master' of git://factorcode.org/git/factor
authorJoe Groff <arcata@gmail.com>
Sun, 20 Sep 2009 02:16:34 +0000 (21:16 -0500)
committerJoe Groff <arcata@gmail.com>
Sun, 20 Sep 2009 02:16:34 +0000 (21:16 -0500)
basis/io/backend/windows/nt/privileges/privileges.factor
basis/windows/advapi32/advapi32.factor
basis/windows/kernel32/kernel32.factor
basis/windows/types/types.factor
basis/windows/usp10/usp10.factor
basis/windows/winsock/winsock.factor

index 6acc1f354445d2a3837c81023b7c0ba3c3989954..6022e91efdcbf4c4e3280c659390d642bc646bee 100755 (executable)
@@ -1,44 +1,43 @@
-USING: alien alien.c-types alien.data alien.syntax arrays continuations\r
-destructors generic io.mmap io.ports io.backend.windows io.files.windows\r
-kernel libc math math.bitwise namespaces quotations sequences windows\r
-windows.advapi32 windows.kernel32 windows.types io.backend system accessors\r
-io.backend.windows.privileges windows.errors ;\r
-IN: io.backend.windows.nt.privileges\r
-\r
-TYPEDEF: TOKEN_PRIVILEGES* PTOKEN_PRIVILEGES\r
-\r
-! Security tokens\r
-!  http://msdn.microsoft.com/msdnmag/issues/05/03/TokenPrivileges/\r
-\r
-: (open-process-token) ( handle -- handle )\r
-    { TOKEN_ADJUST_PRIVILEGES TOKEN_QUERY } flags PHANDLE <c-object>\r
-    [ OpenProcessToken win32-error=0/f ] keep *void* ;\r
-\r
-: open-process-token ( -- handle )\r
-    #! remember to CloseHandle\r
-    GetCurrentProcess (open-process-token) ;\r
-\r
-: with-process-token ( quot -- )\r
-    #! quot: ( token-handle -- token-handle )\r
-    [ open-process-token ] dip\r
-    [ keep ] curry\r
-    [ CloseHandle drop ] [ ] cleanup ; inline\r
-\r
-: lookup-privilege ( string -- luid )\r
-    [ f ] dip LUID <struct>\r
-    [ LookupPrivilegeValue win32-error=0/f ] keep ;\r
-\r
-: make-token-privileges ( name ? -- obj )\r
-    TOKEN_PRIVILEGES <struct>\r
-        1 >>PrivilegeCount\r
-        LUID_AND_ATTRIBUTES malloc-struct &free\r
-            swap [ SE_PRIVILEGE_ENABLED >>Attributes ] when\r
-        >>Privileges\r
-    [ lookup-privilege ] dip\r
-    [ Privileges>> (>>Luid) ] keep ;\r
-\r
-M: winnt set-privilege ( name ? -- )\r
-    [\r
-        -rot 0 -rot make-token-privileges\r
-        dup length f f AdjustTokenPrivileges win32-error=0/f\r
-    ] with-process-token ;\r
+USING: alien alien.c-types alien.data alien.syntax arrays continuations
+destructors generic io.mmap io.ports io.backend.windows io.files.windows
+kernel libc locals math math.bitwise namespaces quotations sequences windows
+windows.advapi32 windows.kernel32 windows.types io.backend system accessors
+io.backend.windows.privileges classes.struct windows.errors ;
+IN: io.backend.windows.nt.privileges
+
+TYPEDEF: TOKEN_PRIVILEGES* PTOKEN_PRIVILEGES
+
+! Security tokens
+!  http://msdn.microsoft.com/msdnmag/issues/05/03/TokenPrivileges/
+
+: (open-process-token) ( handle -- handle )
+    { TOKEN_ADJUST_PRIVILEGES TOKEN_QUERY } flags PHANDLE <c-object>
+    [ OpenProcessToken win32-error=0/f ] keep *void* ;
+
+: open-process-token ( -- handle )
+    #! remember to CloseHandle
+    GetCurrentProcess (open-process-token) ;
+
+: with-process-token ( quot -- )
+    #! quot: ( token-handle -- token-handle )
+    [ open-process-token ] dip
+    [ keep ] curry
+    [ CloseHandle drop ] [ ] cleanup ; inline
+
+: lookup-privilege ( string -- luid )
+    [ f ] dip LUID <struct>
+    [ LookupPrivilegeValue win32-error=0/f ] keep ;
+
+:: make-token-privileges ( name enabled? -- obj )
+    TOKEN_PRIVILEGES <struct>
+        1 >>PrivilegeCount
+        LUID_AND_ATTRIBUTES malloc-struct &free
+            enabled? [ SE_PRIVILEGE_ENABLED >>Attributes ] when
+            name lookup-privilege >>Luid
+        >>Privileges ;
+
+M: winnt set-privilege ( name ? -- )
+    [
+        -rot 0 -rot make-token-privileges
+        dup byte-length f f AdjustTokenPrivileges win32-error=0/f
+    ] with-process-token ;
index 1bc7f30caf32785f434ed69b675ed2921d94f706..21f048a00f43bcba99f7dc66c5cdff6f204a3fe9 100755 (executable)
@@ -1,5 +1,5 @@
 USING: alien.syntax kernel math windows.types windows.kernel32
-math.bitwise ;
+math.bitwise classes.struct ;
 IN: windows.advapi32
 
 LIBRARY: advapi32
index ef8952be73565e330a59de4aabd8f3c1d6c45c43..075b0218b3e4cde1c2bf2762edff8a1c193316d0 100755 (executable)
@@ -690,8 +690,8 @@ STRUCT: OFSTRUCT
     { nErrCode WORD }
     { Reserved1 WORD }
     { Reserved2 WORD }
-    ! { szPathName { CHAR OFS_MAXPATHNAME } } ;
     { szPathName { CHAR 128 } } ;
+    ! { szPathName { CHAR OFS_MAXPATHNAME } } ;
 
 TYPEDEF: OFSTRUCT* LPOFSTRUCT
 
index fa043b8033ba4952f1e2d54adb7651b7af583759..6275f2d3c95a9007e43b1b358e099a25b71a0a15 100755 (executable)
@@ -11,6 +11,12 @@ TYPEDEF: uchar               UCHAR
 TYPEDEF: uchar               BYTE
 
 TYPEDEF: ushort              wchar_t
+SYMBOL: wchar_t*
+<<
+{ char* utf16n } \ wchar_t* typedef
+\ wchar_t \ wchar_t* "pointer-c-type" set-word-prop
+>>
+
 TYPEDEF: wchar_t             WCHAR
 
 TYPEDEF: short               SHORT
@@ -70,9 +76,6 @@ TYPEDEF: ulonglong   ULARGE_INTEGER
 TYPEDEF: LARGE_INTEGER* PLARGE_INTEGER
 TYPEDEF: ULARGE_INTEGER* PULARGE_INTEGER
 
-SYMBOL: wchar_t*
-<< { char* utf16n } \ wchar_t* typedef >>
-
 TYPEDEF: wchar_t*  LPCSTR
 TYPEDEF: wchar_t*  LPWSTR
 TYPEDEF: WCHAR       TCHAR
index cf8e69ba24de94e4f4794f40caefe5493e716332..eb57a469258ff10558ad03f7b28c9c7c34f96a5b 100755 (executable)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2009 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: alien.syntax alien.destructors ;
+USING: alien.syntax alien.destructors classes.struct ;
 IN: windows.usp10
 
 LIBRARY: usp10
index 2e59b9fec18f38288d1fe27d59ca5d697847cde1..dc751e64a6e40c6b4216744fc3d5fc7fe009d336 100755 (executable)
@@ -204,8 +204,8 @@ CONSTANT: MAX_PROTOCOL_CHAIN 7
 
 STRUCT: WSAPROTOCOLCHAIN
     { ChainLen int }
-    ! { ChainEntries { DWORD MAX_PROTOCOL_CHAIN } } ;
     { ChainEntries { DWORD 7 } } ;
+    ! { ChainEntries { DWORD MAX_PROTOCOL_CHAIN } } ;
 TYPEDEF: WSAPROTOCOLCHAIN* LPWSAPROTOCOLCHAIN
 
 CONSTANT: WSAPROTOCOL_LEN 255