]> gitweb.factorcode.org Git - factor.git/commitdiff
more windows loading fixes
authorJoe Groff <arcata@gmail.com>
Sat, 19 Sep 2009 07:44:40 +0000 (02:44 -0500)
committerJoe Groff <arcata@gmail.com>
Sat, 19 Sep 2009 07:44:40 +0000 (02:44 -0500)
basis/io/backend/windows/nt/privileges/privileges.factor
basis/windows/winsock/winsock.factor

index 6acc1f354445d2a3837c81023b7c0ba3c3989954..bb075233bd462f3ff8cfdf3492d053a8ad005769 100755 (executable)
@@ -1,44 +1,44 @@
-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 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 ? -- obj )
+    TOKEN_PRIVILEGES <struct>
+        1 >>PrivilegeCount
+        LUID_AND_ATTRIBUTES malloc-struct &free
+            swap [ SE_PRIVILEGE_ENABLED >>Attributes ] when
+        >>Privileges
+    [ lookup-privilege ] dip
+    [ Privileges>> (>>Luid) ] keep ;
+
+M: winnt set-privilege ( name ? -- )
+    [
+        -rot 0 -rot make-token-privileges
+        dup length f f AdjustTokenPrivileges win32-error=0/f
+    ] with-process-token ;
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