 
 TYPEDEF: ACL* PACL
 
-: ACCESS_ALLOWED_ACE_TYPE 0 ; inline
-: ACCESS_DENIED_ACE_TYPE 1 ; inline
-: SYSTEM_AUDIT_ACE_TYPE 2 ; inline
-: SYSTEM_ALARM_ACE_TYPE 3 ; inline
-
-: OBJECT_INHERIT_ACE HEX: 1 ; inline
-: CONTAINER_INHERIT_ACE HEX: 2 ; inline
-: NO_PROPAGATE_INHERIT_ACE HEX: 4 ; inline
-: INHERIT_ONLY_ACE HEX: 8 ; inline
-: VALID_INHERIT_FLAGS HEX: f ; inline
+CONSTANT: ACCESS_ALLOWED_ACE_TYPE 0
+CONSTANT: ACCESS_DENIED_ACE_TYPE 1
+CONSTANT: SYSTEM_AUDIT_ACE_TYPE 2
+CONSTANT: SYSTEM_ALARM_ACE_TYPE 3
+
+CONSTANT: OBJECT_INHERIT_ACE HEX: 1
+CONSTANT: CONTAINER_INHERIT_ACE HEX: 2
+CONSTANT: NO_PROPAGATE_INHERIT_ACE HEX: 4
+CONSTANT: INHERIT_ONLY_ACE HEX: 8
+CONSTANT: VALID_INHERIT_FLAGS HEX: f
 
 C-STRUCT: ACE_HEADER
     { "BYTE" "AceType" }

USING: alias alien.syntax kernel math windows.types math.bitwise ;
IN: windows.advapi32
LIBRARY: advapi32

: PROV_RSA_FULL       1 ; inline
: PROV_RSA_SIG        2 ; inline
: PROV_DSS            3 ; inline
: PROV_FORTEZZA       4 ; inline
: PROV_MS_EXCHANGE    5 ; inline
: PROV_SSL            6 ; inline
: PROV_RSA_SCHANNEL  12 ; inline
: PROV_DSS_DH        13 ; inline
: PROV_EC_ECDSA_SIG  14 ; inline
: PROV_EC_ECNRA_SIG  15 ; inline
: PROV_EC_ECDSA_FULL 16 ; inline
: PROV_EC_ECNRA_FULL 17 ; inline
: PROV_DH_SCHANNEL   18 ; inline
: PROV_SPYRUS_LYNKS  20 ; inline
: PROV_RNG           21 ; inline
: PROV_INTEL_SEC     22 ; inline
: PROV_REPLACE_OWF   23 ; inline
: PROV_RSA_AES       24 ; inline

: MS_DEF_DH_SCHANNEL_PROV
    "Microsoft DH Schannel Cryptographic Provider" ; inline

: MS_DEF_DSS_DH_PROV
    "Microsoft Base DSS and Diffie-Hellman Cryptographic Provider" ; inline

: MS_DEF_DSS_PROV
    "Microsoft Base DSS Cryptographic Provider" ; inline

: MS_DEF_PROV
    "Microsoft Base Cryptographic Provider v1.0" ; inline

: MS_DEF_RSA_SCHANNEL_PROV
    "Microsoft RSA Schannel Cryptographic Provider" ; inline

! Unsupported (!)
: MS_DEF_RSA_SIG_PROV
    "Microsoft RSA Signature Cryptographic Provider" ; inline

: MS_ENH_DSS_DH_PROV
    "Microsoft Enhanced DSS and Diffie-Hellman Cryptographic Provider" ; inline

: MS_ENH_RSA_AES_PROV
    "Microsoft Enhanced RSA and AES Cryptographic Provider" ; inline

: MS_ENHANCED_PROV
    "Microsoft Enhanced Cryptographic Provider v1.0" ; inline

: MS_SCARD_PROV
    "Microsoft Base Smart Card Crypto Provider" ; inline

: MS_STRONG_PROV
    "Microsoft Strong Cryptographic Provider" ; inline

: CRYPT_VERIFYCONTEXT  HEX: F0000000 ; inline
: CRYPT_NEWKEYSET      HEX: 8 ; inline
: CRYPT_DELETEKEYSET   HEX: 10 ; inline
: CRYPT_MACHINE_KEYSET HEX: 20 ; inline
: CRYPT_SILENT         HEX: 40 ; inline

C-STRUCT: ACL
    { "BYTE" "AclRevision" }



! typedef enum _TOKEN_INFORMATION_CLASS {
CONSTANT: TokenUser 1
CONSTANT: TokenGroups 2
CONSTANT: TokenPrivileges 3
CONSTANT: TokenOwner 4
CONSTANT: TokenPrimaryGroup 5
CONSTANT: TokenDefaultDacl 6
CONSTANT: TokenSource 7
CONSTANT: TokenType 8
CONSTANT: TokenImpersonationLevel 9
CONSTANT: TokenStatistics 10
CONSTANT: TokenRestrictedSids 11
CONSTANT: TokenSessionId 12
CONSTANT: TokenGroupsAndPrivileges 13
CONSTANT: TokenSessionReference 14
CONSTANT: TokenSandBoxInert 15
! } TOKEN_INFORMATION_CLASS;

CONSTANT: DELETE                     HEX: 00010000
CONSTANT: READ_CONTROL               HEX: 00020000
CONSTANT: WRITE_DAC                  HEX: 00040000
CONSTANT: WRITE_OWNER                HEX: 00080000
CONSTANT: SYNCHRONIZE                HEX: 00100000
CONSTANT: STANDARD_RIGHTS_REQUIRED   HEX: 000f0000

ALIAS: STANDARD_RIGHTS_READ       READ_CONTROL
ALIAS: STANDARD_RIGHTS_WRITE      READ_CONTROL
ALIAS: STANDARD_RIGHTS_EXECUTE    READ_CONTROL

CONSTANT: TOKEN_TOKEN_ADJUST_DEFAULT   HEX: 0080
CONSTANT: TOKEN_ADJUST_GROUPS          HEX: 0040
CONSTANT: TOKEN_ADJUST_PRIVILEGES      HEX: 0020
CONSTANT: TOKEN_ADJUST_SESSIONID       HEX: 0100
CONSTANT: TOKEN_ASSIGN_PRIMARY         HEX: 0001
CONSTANT: TOKEN_DUPLICATE              HEX: 0002
ALIAS: TOKEN_EXECUTE                STANDARD_RIGHTS_EXECUTE
CONSTANT: TOKEN_IMPERSONATE            HEX: 0004
CONSTANT: TOKEN_QUERY                  HEX: 0008
CONSTANT: TOKEN_QUERY_SOURCE           HEX: 0010
CONSTANT: TOKEN_ADJUST_DEFAULT         HEX: 0080
: TOKEN_READ ( -- n ) { STANDARD_RIGHTS_READ TOKEN_QUERY } flags ;

: TOKEN_WRITE ( -- n )
    {
