programming tools for Windows applications development
  Home  |   SwiftForth Archive  |   SwiftX Archive  |

Perhaps it can be useful

From: Alexander Seregin <a.seregin_at_foratec-com.ru>
Date: Thu, 24 Apr 2008 12:28:24 +0600

Hi all

I am not sure that I am the first, but trying to search in posted message make
me drained.
I made sort by subjects and tried to use find on page option in browser...

next function for enable/disable privilege by name of privilege

Function: OpenProcessToken ( a b c -- d )
Function: LookupPrivilegeValue ( a b c -- d )
Function: AdjustTokenPrivileges ( a b c d e f -- g )

: EnablePrivilege ( zaddr f - f')
   [OBJECTS TOKEN_PRIVILEGES MAKES tp OBJECTS]
   0 LOCALS| hToken |
   SWAP >R 0
   GetCurrentProcess TOKEN_ADJUST_PRIVILEGES &OF hToken OpenProcessToken
   IF 1+ tp Count !
      0 R@ tp Privileges ADDR LookupPrivilegeValue DROP
      ( f) DUP IF DROP SE_PRIVILEGE_ENABLED THEN tp Privileges Attr !
      hToken 0 tp ADDR TOKEN_PRIVILEGES SIZEOF 0 0 AdjustTokenPrivileges DROP
      GetLastError ERROR_SUCCESS = hToken CloseHandle DROP
   THEN R> DROP ;

Example of use: "SeDebugPrivilege" TRUE EnablePrivilege

some Win32 structure are absent in SwiftForth, here they are:

CLASS STARTUPINFO
   VARIABLE Size
   VARIABLE zReserved \ NULL
   VARIABLE zDesktop
   VARIABLE zTitle
   VARIABLE XPos
   VARIABLE YPos
   VARIABLE XSize
   VARIABLE YSize
   VARIABLE XChars
   VARIABLE YChars
   VARIABLE FillAttr
   VARIABLE Flags
   HVARIABLE ShowWindow
   HVARIABLE wReserved \ 0
   VARIABLE pReserved \ NULL
   VARIABLE hStdIn
   VARIABLE hStdOut
   VARIABLE hStdErr
END-CLASS

CLASS LUID_AND_ATTRIBUTES
   VARIABLE LUIDLow
   VARIABLE LUIDHigh
   VARIABLE Attr
END-CLASS

CLASS TOKEN_PRIVILEGES
   VARIABLE Count
   LUID_AND_ATTRIBUTES BUILDS Privileges
END-CLASS
...

I want to use 2VARIABLE inside class definition for 64bit values.

Alexander

----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com
For list command help, send subject "help" to sftalk-request_at_forth.com
Message archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users. For product support and
bug reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Wed Apr 23 2008 - 23:23:14 PDT

This archive was generated by hypermail 2.2.0 : Tue Dec 02 2008 - 03:04:44 PST