]> gitweb.factorcode.org Git - factor.git/commitdiff
Windows bindings for security tokens
authorDoug Coleman <doug.coleman@gmail.com>
Thu, 8 Sep 2011 20:06:19 +0000 (13:06 -0700)
committerDoug Coleman <doug.coleman@gmail.com>
Thu, 8 Sep 2011 22:47:57 +0000 (15:47 -0700)
basis/windows/advapi32/advapi32.factor
basis/windows/privileges/privileges.factor
basis/windows/shell32/shell32.factor

index c40cc232eb5f1f7b952298dceb06dcca69095762..5195d0e21c98f7b9109190488ebe164b8ea97703 100755 (executable)
@@ -127,25 +127,6 @@ CONSTANT: SE_SELF_RELATIVE 32768
 TYPEDEF: DWORD SECURITY_DESCRIPTOR_CONTROL
 TYPEDEF: SECURITY_DESCRIPTOR_CONTROL* PSECURITY_DESCRIPTOR_CONTROL
 
-
-! 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;
-
 ENUM: ACCESS_MODE
     NOT_USED_ACCESS
     GRANT_ACCESS
@@ -684,6 +665,124 @@ CONSTANT: PUBLICKEYBLOBEX HEX: A
 CONSTANT: SIMPLEBLOB HEX: 1
 CONSTANT: SYMMETRICWRAPKEYBLOB HEX: B
 
+TYPEDEF: void* SID
+
+CONSTANT: SECURITY_MAX_SID_SIZE 68
+
+ENUM: WELL_KNOWN_SID_TYPE
+    { WinNullSid                                     0 }
+    { WinWorldSid                                    1 }
+    { WinLocalSid                                    2 }
+    { WinCreatorOwnerSid                             3 }
+    { WinCreatorGroupSid                             4 }
+    { WinCreatorOwnerServerSid                       5 }
+    { WinCreatorGroupServerSid                       6 }
+    { WinNtAuthoritySid                              7 }
+    { WinDialupSid                                   8 }
+    { WinNetworkSid                                  9 }
+    { WinBatchSid                                    10 }
+    { WinInteractiveSid                              11 }
+    { WinServiceSid                                  12 }
+    { WinAnonymousSid                                13 }
+    { WinProxySid                                    14 }
+    { WinEnterpriseControllersSid                    15 }
+    { WinSelfSid                                     16 }
+    { WinAuthenticatedUserSid                        17 }
+    { WinRestrictedCodeSid                           18 }
+    { WinTerminalServerSid                           19 }
+    { WinRemoteLogonIdSid                            20 }
+    { WinLogonIdsSid                                 21 }
+    { WinLocalSystemSid                              22 }
+    { WinLocalServiceSid                             23 }
+    { WinNetworkServiceSid                           24 }
+    { WinBuiltinDomainSid                            25 }
+    { WinBuiltinAdministratorsSid                    26 }
+    { WinBuiltinUsersSid                             27 }
+    { WinBuiltinGuestsSid                            28 }
+    { WinBuiltinPowerUsersSid                        29 }
+    { WinBuiltinAccountOperatorsSid                  30 }
+    { WinBuiltinSystemOperatorsSid                   31 }
+    { WinBuiltinPrintOperatorsSid                    32 }
+    { WinBuiltinBackupOperatorsSid                   33 }
+    { WinBuiltinReplicatorSid                        34 }
+    { WinBuiltinPreWindows2000CompatibleAccessSid    35 }
+    { WinBuiltinRemoteDesktopUsersSid                36 }
+    { WinBuiltinNetworkConfigurationOperatorsSid     37 }
+    { WinAccountAdministratorSid                     38 }
+    { WinAccountGuestSid                             39 }
+    { WinAccountKrbtgtSid                            40 }
+    { WinAccountDomainAdminsSid                      41 }
+    { WinAccountDomainUsersSid                       42 }
+    { WinAccountDomainGuestsSid                      43 }
+    { WinAccountComputersSid                         44 }
+    { WinAccountControllersSid                       45 }
+    { WinAccountCertAdminsSid                        46 }
+    { WinAccountSchemaAdminsSid                      47 }
+    { WinAccountEnterpriseAdminsSid                  48 }
+    { WinAccountPolicyAdminsSid                      49 }
+    { WinAccountRasAndIasServersSid                  50 }
+    { WinNTLMAuthenticationSid                       51 }
+    { WinDigestAuthenticationSid                     52 }
+    { WinSChannelAuthenticationSid                   53 }
+    { WinThisOrganizationSid                         54 }
+    { WinOtherOrganizationSid                        55 }
+    { WinBuiltinIncomingForestTrustBuildersSid       56 }
+    { WinBuiltinPerfMonitoringUsersSid               57 }
+    { WinBuiltinPerfLoggingUsersSid                  58 }
+    { WinBuiltinAuthorizationAccessSid               59 }
+    { WinBuiltinTerminalServerLicenseServersSid      60 }
+    { WinBuiltinDCOMUsersSid                         61 }
+    { WinBuiltinIUsersSid                            62 }
+    { WinIUserSid                                    63 }
+    { WinBuiltinCryptoOperatorsSid                   64 }
+    { WinUntrustedLabelSid                           65 }
+    { WinLowLabelSid                                 66 }
+    { WinMediumLabelSid                              67 }
+    { WinHighLabelSid                                68 }
+    { WinSystemLabelSid                              69 }
+    { WinWriteRestrictedCodeSid                      70 }
+    { WinCreatorOwnerRightsSid                       71 }
+    { WinCacheablePrincipalsGroupSid                 72 }
+    { WinNonCacheablePrincipalsGroupSid              73 }
+    { WinEnterpriseReadonlyControllersSid            74 }
+    { WinAccountReadonlyControllersSid               75 }
+    { WinBuiltinEventLogReadersGroup                 76 }
+    { WinNewEnterpriseReadonlyControllersSid         77 }
+    { WinBuiltinCertSvcDComAccessGroup               78 } ;
+
+ENUM: TOKEN_INFORMATION_CLASS
+    { TokenUser    1 }
+    TokenGroups
+    TokenPrivileges
+    TokenOwner
+    TokenPrimaryGroup
+    TokenDefaultDacl
+    TokenSource
+    TokenType
+    TokenImpersonationLevel
+    TokenStatistics
+    TokenRestrictedSids
+    TokenSessionId
+    TokenGroupsAndPrivileges
+    TokenSessionReference
+    TokenSandBoxInert
+    TokenAuditPolicy
+    TokenOrigin
+    TokenElevationType
+    TokenLinkedToken
+    TokenElevation
+    TokenHasRestrictions
+    TokenAccessInformation
+    TokenVirtualizationAllowed
+    TokenVirtualizationEnabled
+    TokenIntegrityLevel
+    TokenUIAccess
+    TokenMandatoryPolicy
+    TokenLogonSid
+    MaxTokenInfoClass ;
+    
+TYPEDEF: TOKEN_INFORMATION_CLASS* PTOKEN_INFORMATION_CLASS
+
 TYPEDEF: uint ALG_ID
 
 STRUCT: PUBLICKEYSTRUC
@@ -819,7 +918,7 @@ FUNCTION: BOOL AllocateAndInitializeSid (
 ! : CreateServiceA ;
 ! : CreateServiceW ;
 ! : CreateTraceInstanceId ;
-! : CreateWellKnownSid ;
+FUNCTION: BOOL CreateWellKnownSid ( WELL_KNOWN_SID_TYPE WellKnownSidType, PSID DomainSid, PSID pSid, DWORD *cbSid ) ;
 ! : CredDeleteA ;
 ! : CredDeleteW ;
 ! : CredEnumerateA ;
@@ -1006,7 +1105,7 @@ FUNCTION: BOOL GetSecurityDescriptorSacl ( PSECURITY_DESCRIPTOR pSecurityDescrip
 ! : GetSidLengthRequired ;
 ! : GetSidSubAuthority ;
 ! : GetSidSubAuthorityCount ;
-! : GetTokenInformation ;
+FUNCTION: BOOL GetTokenInformation ( HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLenghth, PWORD ReturnLength ) ;
 ! : GetTraceEnableFlags ;
 ! : GetTraceEnableLevel ;
 ! : GetTraceLoggerHandle ;
index ed2827ed8a8428efafe87f0c5baac9b7e822128f..49c3a2dd24c2b592058d96de0b4524a60bf633c3 100644 (file)
@@ -2,7 +2,8 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors alien alien.data alien.syntax classes.struct
 continuations fry kernel libc literals locals sequences
-windows.advapi32 windows.errors windows.kernel32 windows.types ;
+windows.advapi32 windows.errors windows.kernel32 windows.types
+alien.c-types ;
 IN: windows.privileges
 
 TYPEDEF: TOKEN_PRIVILEGES* PTOKEN_PRIVILEGES
index 30104e772322cb958861a38f3448048ccd1a43ed..1b1d1b4f09c649df701c23942ce24b8aee418237 100644 (file)
@@ -223,3 +223,5 @@ FUNCTION: HRESULT SHGetDesktopFolder ( IShellFolder** ppshf ) ;
 
 FUNCTION: UINT DragQueryFileW ( HDROP hDrop, UINT iFile, LPWSTR lpszFile, UINT cch ) ;
 ALIAS: DragQueryFile DragQueryFileW
+
+FUNCTION: BOOL IsUserAnAdmin ( ) ;
\ No newline at end of file