Class: Chef::ReservedNames::Win32::Security

Inherits:
Object
  • Object
show all
Extended by:
Mixin::WideString, API::Error, API::Macros, API::Security
Includes:
Mixin::WideString, API::Error, API::Security
Defined in:
lib/chef/win32/security.rb,
lib/chef/win32/security/ace.rb,
lib/chef/win32/security/acl.rb,
lib/chef/win32/security/sid.rb,
lib/chef/win32/security/token.rb,
lib/chef/win32/security/securable_object.rb,
lib/chef/win32/security/security_descriptor.rb

Defined Under Namespace

Classes: ACE, ACL, SID, SecurableObject, SecurityDescriptor, Token

Constant Summary

Constants included from API::Security

API::Security::ACCESS_ALLOWED_ACE_TYPE, API::Security::ACCESS_ALLOWED_CALLBACK_ACE_TYPE, API::Security::ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE, API::Security::ACCESS_ALLOWED_COMPOUND_ACE_TYPE, API::Security::ACCESS_ALLOWED_OBJECT_ACE_TYPE, API::Security::ACCESS_DENIED_ACE_TYPE, API::Security::ACCESS_DENIED_CALLBACK_ACE_TYPE, API::Security::ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE, API::Security::ACCESS_DENIED_OBJECT_ACE_TYPE, API::Security::ACCESS_MAX_MS_ACE_TYPE, API::Security::ACCESS_MAX_MS_OBJECT_ACE_TYPE, API::Security::ACCESS_MAX_MS_V2_ACE_TYPE, API::Security::ACCESS_MAX_MS_V3_ACE_TYPE, API::Security::ACCESS_MAX_MS_V4_ACE_TYPE, API::Security::ACCESS_MAX_MS_V5_ACE_TYPE, API::Security::ACCESS_MIN_MS_ACE_TYPE, API::Security::ACCESS_MIN_MS_OBJECT_ACE_TYPE, API::Security::ACCESS_SYSTEM_SECURITY, API::Security::ACL_REVISION, API::Security::ACL_REVISION1, API::Security::ACL_REVISION2, API::Security::ACL_REVISION3, API::Security::ACL_REVISION4, API::Security::ACL_REVISION_DS, API::Security::CONTAINER_INHERIT_ACE, API::Security::DACL_SECURITY_INFORMATION, API::Security::DELETE, API::Security::ELEVATION_TYPE, API::Security::FAILED_ACCESS_ACE_FLAG, API::Security::FILE_ADD_FILE, API::Security::FILE_ADD_SUBDIRECTORY, API::Security::FILE_ALL_ACCESS, API::Security::FILE_APPEND_DATA, API::Security::FILE_CREATE_PIPE_INSTANCE, API::Security::FILE_DELETE_CHILD, API::Security::FILE_EXECUTE, API::Security::FILE_GENERIC_EXECUTE, API::Security::FILE_GENERIC_READ, API::Security::FILE_GENERIC_WRITE, API::Security::FILE_LIST_DIRECTORY, API::Security::FILE_READ_ATTRIBUTES, API::Security::FILE_READ_DATA, API::Security::FILE_READ_EA, API::Security::FILE_TRAVERSE, API::Security::FILE_WRITE_ATTRIBUTES, API::Security::FILE_WRITE_DATA, API::Security::FILE_WRITE_EA, API::Security::GENERIC_ALL, API::Security::GENERIC_EXECUTE, API::Security::GENERIC_READ, API::Security::GENERIC_WRITE, API::Security::GROUP_SECURITY_INFORMATION, API::Security::INHERITED_ACE, API::Security::INHERIT_ONLY_ACE, API::Security::LABEL_SECURITY_INFORMATION, API::Security::LOGON32_LOGON_BATCH, API::Security::LOGON32_LOGON_INTERACTIVE, API::Security::LOGON32_LOGON_NETWORK, API::Security::LOGON32_LOGON_NETWORK_CLEARTEXT, API::Security::LOGON32_LOGON_NEW_CREDENTIALS, API::Security::LOGON32_LOGON_SERVICE, API::Security::LOGON32_LOGON_UNLOCK, API::Security::LOGON32_PROVIDER_DEFAULT, API::Security::LOGON32_PROVIDER_WINNT35, API::Security::LOGON32_PROVIDER_WINNT40, API::Security::LOGON32_PROVIDER_WINNT50, API::Security::MAXDWORD, API::Security::MAX_ACL_REVISION, API::Security::MIN_ACL_REVISION, API::Security::NO_PROPAGATE_INHERIT_ACE, API::Security::OBJECT_INHERIT_ACE, API::Security::OWNER_SECURITY_INFORMATION, API::Security::POLICY_AUDIT_LOG_ADMIN, API::Security::POLICY_CREATE_ACCOUNT, API::Security::POLICY_CREATE_PRIVILEGE, API::Security::POLICY_CREATE_SECRET, API::Security::POLICY_GET_PRIVATE_INFORMATION, API::Security::POLICY_LOOKUP_NAMES, API::Security::POLICY_NOTIFICATION, API::Security::POLICY_SERVER_ADMIN, API::Security::POLICY_SET_AUDIT_REQUIREMENTS, API::Security::POLICY_SET_DEFAULT_QUOTA_LIMITS, API::Security::POLICY_TRUST_ADMIN, API::Security::POLICY_VIEW_AUDIT_INFORMATION, API::Security::POLICY_VIEW_LOCAL_INFORMATION, API::Security::PROTECTED_DACL_SECURITY_INFORMATION, API::Security::PROTECTED_SACL_SECURITY_INFORMATION, API::Security::READ_CONTROL, API::Security::SACL_SECURITY_INFORMATION, API::Security::SECURITY_DESCRIPTOR_MIN_LENGTH, API::Security::SECURITY_DESCRIPTOR_REVISION, API::Security::SECURITY_DESCRIPTOR_REVISION1, API::Security::SECURITY_IMPERSONATION_LEVEL, API::Security::SE_DACL_AUTO_INHERITED, API::Security::SE_DACL_AUTO_INHERIT_REQ, API::Security::SE_DACL_DEFAULTED, API::Security::SE_DACL_PRESENT, API::Security::SE_DACL_PROTECTED, API::Security::SE_GROUP_DEFAULTED, API::Security::SE_OBJECT_TYPE, API::Security::SE_OWNER_DEFAULTED, API::Security::SE_PRIVILEGE_ENABLED, API::Security::SE_PRIVILEGE_ENABLED_BY_DEFAULT, API::Security::SE_PRIVILEGE_REMOVED, API::Security::SE_PRIVILEGE_USED_FOR_ACCESS, API::Security::SE_PRIVILEGE_VALID_ATTRIBUTES, API::Security::SE_RM_CONTROL_VALID, API::Security::SE_SACL_AUTO_INHERITED, API::Security::SE_SACL_AUTO_INHERIT_REQ, API::Security::SE_SACL_DEFAULTED, API::Security::SE_SACL_PRESENT, API::Security::SE_SACL_PROTECTED, API::Security::SE_SELF_RELATIVE, API::Security::SID_NAME_USE, API::Security::SPECIFIC_RIGHTS_ALL, API::Security::STANDARD_RIGHTS_ALL, API::Security::STANDARD_RIGHTS_EXECUTE, API::Security::STANDARD_RIGHTS_READ, API::Security::STANDARD_RIGHTS_REQUIRED, API::Security::STANDARD_RIGHTS_WRITE, API::Security::SUBFOLDERS_AND_FILES_ONLY, API::Security::SUCCESSFUL_ACCESS_ACE_FLAG, API::Security::SYNCHRONIZE, API::Security::SYSTEM_ALARM_ACE_TYPE, API::Security::SYSTEM_ALARM_CALLBACK_ACE_TYPE, API::Security::SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE, API::Security::SYSTEM_ALARM_OBJECT_ACE_TYPE, API::Security::SYSTEM_AUDIT_ACE_TYPE, API::Security::SYSTEM_AUDIT_CALLBACK_ACE_TYPE, API::Security::SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE, API::Security::SYSTEM_AUDIT_OBJECT_ACE_TYPE, API::Security::SYSTEM_MANDATORY_LABEL_ACE_TYPE, API::Security::TOKEN_ADJUST_DEFAULT, API::Security::TOKEN_ADJUST_GROUPS, API::Security::TOKEN_ADJUST_PRIVILEGES, API::Security::TOKEN_ADJUST_SESSIONID, API::Security::TOKEN_ALL_ACCESS, API::Security::TOKEN_ASSIGN_PRIMARY, API::Security::TOKEN_DUPLICATE, API::Security::TOKEN_IMPERSONATE, API::Security::TOKEN_INFORMATION_CLASS, API::Security::TOKEN_QUERY, API::Security::TOKEN_QUERY_SOURCE, API::Security::TOKEN_READ, API::Security::UNPROTECTED_DACL_SECURITY_INFORMATION, API::Security::UNPROTECTED_SACL_SECURITY_INFORMATION, API::Security::VALID_INHERIT_FLAGS, API::Security::WRITE, API::Security::WRITE_DAC, API::Security::WRITE_OWNER

Constants included from API::Error

API::Error::DONT_RESOLVE_DLL_REFERENCES, API::Error::EPT_S_CANT_CREATE, API::Error::EPT_S_CANT_PERFORM_OP, API::Error::EPT_S_INVALID_ENTRY, API::Error::EPT_S_NOT_REGISTERED, API::Error::ERROR_ACCESS_DENIED, API::Error::ERROR_ACCESS_DISABLED_BY_POLICY, API::Error::ERROR_ACCOUNT_DISABLED, API::Error::ERROR_ACCOUNT_EXPIRED, API::Error::ERROR_ACCOUNT_LOCKED_OUT, API::Error::ERROR_ACCOUNT_RESTRICTION, API::Error::ERROR_ACTIVE_CONNECTIONS, API::Error::ERROR_ADAP_HDW_ERR, API::Error::ERROR_ADDRESS_ALREADY_ASSOCIATED, API::Error::ERROR_ADDRESS_NOT_ASSOCIATED, API::Error::ERROR_ALIAS_EXISTS, API::Error::ERROR_ALLOTTED_SPACE_EXCEEDED, API::Error::ERROR_ALL_USER_TRUST_QUOTA_EXCEEDED, API::Error::ERROR_ALREADY_ASSIGNED, API::Error::ERROR_ALREADY_EXISTS, API::Error::ERROR_ALREADY_INITIALIZED, API::Error::ERROR_ALREADY_REGISTERED, API::Error::ERROR_ALREADY_RUNNING_LKG, API::Error::ERROR_ALREADY_WAITING, API::Error::ERROR_APP_WRONG_OS, API::Error::ERROR_ARENA_TRASHED, API::Error::ERROR_ARITHMETIC_OVERFLOW, API::Error::ERROR_ATOMIC_LOCKS_NOT_SUPPORTED, API::Error::ERROR_AUTHENTICATION_FIREWALL_FAILED, API::Error::ERROR_AUTODATASEG_EXCEEDS_64k, API::Error::ERROR_BADDB, API::Error::ERROR_BADKEY, API::Error::ERROR_BAD_ARGUMENTS, API::Error::ERROR_BAD_COMMAND, API::Error::ERROR_BAD_CONFIGURATION, API::Error::ERROR_BAD_DESCRIPTOR_FORMAT, API::Error::ERROR_BAD_DEVICE, API::Error::ERROR_BAD_DEV_TYPE, API::Error::ERROR_BAD_DRIVER, API::Error::ERROR_BAD_DRIVER_LEVEL, API::Error::ERROR_BAD_DYNALINK, API::Error::ERROR_BAD_ENVIRONMENT, API::Error::ERROR_BAD_EXE_FORMAT, API::Error::ERROR_BAD_FORMAT, API::Error::ERROR_BAD_IMPERSONATION_LEVEL, API::Error::ERROR_BAD_INHERITANCE_ACL, API::Error::ERROR_BAD_LENGTH, API::Error::ERROR_BAD_LOGON_SESSION_STATE, API::Error::ERROR_BAD_NETPATH, API::Error::ERROR_BAD_NET_NAME, API::Error::ERROR_BAD_NET_RESP, API::Error::ERROR_BAD_PATHNAME, API::Error::ERROR_BAD_PIPE, API::Error::ERROR_BAD_PROFILE, API::Error::ERROR_BAD_PROVIDER, API::Error::ERROR_BAD_QUERY_SYNTAX, API::Error::ERROR_BAD_REM_ADAP, API::Error::ERROR_BAD_THREADID_ADDR, API::Error::ERROR_BAD_TOKEN_TYPE, API::Error::ERROR_BAD_UNIT, API::Error::ERROR_BAD_USERNAME, API::Error::ERROR_BAD_USER_PROFILE, API::Error::ERROR_BAD_VALIDATION_CLASS, API::Error::ERROR_BEGINNING_OF_MEDIA, API::Error::ERROR_BOOT_ALREADY_ACCEPTED, API::Error::ERROR_BROKEN_PIPE, API::Error::ERROR_BUSY, API::Error::ERROR_BUSY_DRIVE, API::Error::ERROR_BUS_RESET, API::Error::ERROR_CALLBACK_SUPPLIED_INVALID_DATA, API::Error::ERROR_CALL_NOT_IMPLEMENTED, API::Error::ERROR_CANCELLED, API::Error::ERROR_CANCEL_VIOLATION, API::Error::ERROR_CANNOT_COPY, API::Error::ERROR_CANNOT_DETECT_DRIVER_FAILURE, API::Error::ERROR_CANNOT_DETECT_PROCESS_ABORT, API::Error::ERROR_CANNOT_FIND_WND_CLASS, API::Error::ERROR_CANNOT_IMPERSONATE, API::Error::ERROR_CANNOT_MAKE, API::Error::ERROR_CANNOT_OPEN_PROFILE, API::Error::ERROR_CANTOPEN, API::Error::ERROR_CANTREAD, API::Error::ERROR_CANTWRITE, API::Error::ERROR_CANT_ACCESS_DOMAIN_INFO, API::Error::ERROR_CANT_ACCESS_FILE, API::Error::ERROR_CANT_DISABLE_MANDATORY, API::Error::ERROR_CANT_OPEN_ANONYMOUS, API::Error::ERROR_CANT_RESOLVE_FILENAME, API::Error::ERROR_CAN_NOT_COMPLETE, API::Error::ERROR_CHILD_ALIVE_NOWAIT, API::Error::ERROR_CHILD_MUST_BE_VOLATILE, API::Error::ERROR_CHILD_NOT_COMPLETE, API::Error::ERROR_CHILD_WINDOW_MENU, API::Error::ERROR_CIRCULAR_DEPENDENCY, API::Error::ERROR_CLASS_ALREADY_EXISTS, API::Error::ERROR_CLASS_DOES_NOT_EXIST, API::Error::ERROR_CLASS_HAS_WINDOWS, API::Error::ERROR_CLIPBOARD_NOT_OPEN, API::Error::ERROR_CLIPPING_NOT_SUPPORTED, API::Error::ERROR_COLORSPACE_MISMATCH, API::Error::ERROR_COMMITMENT_LIMIT, API::Error::ERROR_CONNECTED_OTHER_PASSWORD, API::Error::ERROR_CONNECTION_ABORTED, API::Error::ERROR_CONNECTION_ACTIVE, API::Error::ERROR_CONNECTION_COUNT_LIMIT, API::Error::ERROR_CONNECTION_INVALID, API::Error::ERROR_CONNECTION_REFUSED, API::Error::ERROR_CONNECTION_UNAVAIL, API::Error::ERROR_CONTEXT_EXPIRED, API::Error::ERROR_CONTINUE, API::Error::ERROR_CONTROL_ID_NOT_FOUND, API::Error::ERROR_COUNTER_TIMEOUT, API::Error::ERROR_CRC, API::Error::ERROR_CREATE_FAILED, API::Error::ERROR_CURRENT_DIRECTORY, API::Error::ERROR_CURRENT_DOMAIN_NOT_ALLOWED, API::Error::ERROR_DATABASE_DOES_NOT_EXIST, API::Error::ERROR_DATATYPE_MISMATCH, API::Error::ERROR_DC_NOT_FOUND, API::Error::ERROR_DDE_FAIL, API::Error::ERROR_DELETING_ICM_XFORM, API::Error::ERROR_DEPENDENT_SERVICES_RUNNING, API::Error::ERROR_DESTINATION_ELEMENT_FULL, API::Error::ERROR_DESTROY_OBJECT_OF_OTHER_THREAD, API::Error::ERROR_DEVICE_ALREADY_REMEMBERED, API::Error::ERROR_DEVICE_DOOR_OPEN, API::Error::ERROR_DEVICE_IN_USE, API::Error::ERROR_DEVICE_NOT_CONNECTED, API::Error::ERROR_DEVICE_NOT_PARTITIONED, API::Error::ERROR_DEVICE_REINITIALIZATION_NEEDED, API::Error::ERROR_DEVICE_REMOVED, API::Error::ERROR_DEVICE_REQUIRES_CLEANING, API::Error::ERROR_DEV_NOT_EXIST, API::Error::ERROR_DIFFERENT_SERVICE_ACCOUNT, API::Error::ERROR_DIRECTORY, API::Error::ERROR_DIRECT_ACCESS_HANDLE, API::Error::ERROR_DIR_NOT_EMPTY, API::Error::ERROR_DIR_NOT_ROOT, API::Error::ERROR_DISCARDED, API::Error::ERROR_DISK_CHANGE, API::Error::ERROR_DISK_CORRUPT, API::Error::ERROR_DISK_FULL, API::Error::ERROR_DISK_OPERATION_FAILED, API::Error::ERROR_DISK_RECALIBRATE_FAILED, API::Error::ERROR_DISK_RESET_FAILED, API::Error::ERROR_DISK_TOO_FRAGMENTED, API::Error::ERROR_DLL_INIT_FAILED, API::Error::ERROR_DLL_NOT_FOUND, API::Error::ERROR_DOMAIN_CONTROLLER_EXISTS, API::Error::ERROR_DOMAIN_CONTROLLER_NOT_FOUND, API::Error::ERROR_DOMAIN_EXISTS, API::Error::ERROR_DOMAIN_LIMIT_EXCEEDED, API::Error::ERROR_DOMAIN_TRUST_INCONSISTENT, API::Error::ERROR_DOWNGRADE_DETECTED, API::Error::ERROR_DRIVER_BLOCKED, API::Error::ERROR_DRIVE_LOCKED, API::Error::ERROR_DUPLICATE_SERVICE_NAME, API::Error::ERROR_DUPLICATE_TAG, API::Error::ERROR_DUP_DOMAINNAME, API::Error::ERROR_DUP_FCB, API::Error::ERROR_DUP_NAME, API::Error::ERROR_DYNLINK_FROM_INVALID_RING, API::Error::ERROR_EAS_DIDNT_FIT, API::Error::ERROR_EAS_NOT_SUPPORTED, API::Error::ERROR_EA_ACCESS_DENIED, API::Error::ERROR_EA_FILE_CORRUPT, API::Error::ERROR_EA_LIST_INCONSISTENT, API::Error::ERROR_EA_TABLE_FULL, API::Error::ERROR_END_OF_MEDIA, API::Error::ERROR_ENVVAR_NOT_FOUND, API::Error::ERROR_EOM_OVERFLOW, API::Error::ERROR_EVENTLOG_CANT_START, API::Error::ERROR_EVENTLOG_FILE_CHANGED, API::Error::ERROR_EVENTLOG_FILE_CORRUPT, API::Error::ERROR_EXCEPTION_IN_SERVICE, API::Error::ERROR_EXCL_SEM_ALREADY_OWNED, API::Error::ERROR_EXE_MACHINE_TYPE_MISMATCH, API::Error::ERROR_EXE_MARKED_INVALID, API::Error::ERROR_EXTENDED_ERROR, API::Error::ERROR_FAILED_SERVICE_CONTROLLER_CONNECT, API::Error::ERROR_FAIL_I24, API::Error::ERROR_FAIL_NOACTION_REBOOT, API::Error::ERROR_FAIL_RESTART, API::Error::ERROR_FAIL_SHUTDOWN, API::Error::ERROR_FCB_UNAVAILABLE, API::Error::ERROR_FILEMARK_DETECTED, API::Error::ERROR_FILENAME_EXCED_RANGE, API::Error::ERROR_FILE_CORRUPT, API::Error::ERROR_FILE_EXISTS, API::Error::ERROR_FILE_INVALID, API::Error::ERROR_FILE_NOT_FOUND, API::Error::ERROR_FLOPPY_BAD_REGISTERS, API::Error::ERROR_FLOPPY_ID_MARK_NOT_FOUND, API::Error::ERROR_FLOPPY_UNKNOWN_ERROR, API::Error::ERROR_FLOPPY_WRONG_CYLINDER, API::Error::ERROR_FULLSCREEN_MODE, API::Error::ERROR_FUNCTION_FAILED, API::Error::ERROR_FUNCTION_NOT_CALLED, API::Error::ERROR_GENERIC_NOT_MAPPED, API::Error::ERROR_GEN_FAILURE, API::Error::ERROR_GLOBAL_ONLY_HOOK, API::Error::ERROR_GRACEFUL_DISCONNECT, API::Error::ERROR_GROUP_EXISTS, API::Error::ERROR_HANDLE_DISK_FULL, API::Error::ERROR_HANDLE_EOF, API::Error::ERROR_HOOK_NEEDS_HMOD, API::Error::ERROR_HOOK_NOT_INSTALLED, API::Error::ERROR_HOOK_TYPE_NOT_ALLOWED, API::Error::ERROR_HOST_DOWN, API::Error::ERROR_HOST_UNREACHABLE, API::Error::ERROR_HOTKEY_ALREADY_REGISTERED, API::Error::ERROR_HOTKEY_NOT_REGISTERED, API::Error::ERROR_HWNDS_HAVE_DIFF_PARENT, API::Error::ERROR_ICM_NOT_ENABLED, API::Error::ERROR_ILLEGAL_ELEMENT_ADDRESS, API::Error::ERROR_ILL_FORMED_PASSWORD, API::Error::ERROR_INCORRECT_ADDRESS, API::Error::ERROR_INDEX_ABSENT, API::Error::ERROR_INFLOOP_IN_RELOC_CHAIN, API::Error::ERROR_INFO_NOT_AVAIL, API::Error::ERROR_INSTALL_ALREADY_RUNNING, API::Error::ERROR_INSTALL_FAILURE, API::Error::ERROR_INSTALL_LANGUAGE_UNSUPPORTED, API::Error::ERROR_INSTALL_LOG_FAILURE, API::Error::ERROR_INSTALL_NOTUSED, API::Error::ERROR_INSTALL_PACKAGE_INVALID, API::Error::ERROR_INSTALL_PACKAGE_OPEN_FAILED, API::Error::ERROR_INSTALL_PACKAGE_REJECTED, API::Error::ERROR_INSTALL_PACKAGE_VERSION, API::Error::ERROR_INSTALL_PLATFORM_UNSUPPORTED, API::Error::ERROR_INSTALL_REMOTE_DISALLOWED, API::Error::ERROR_INSTALL_SERVICE_FAILURE, API::Error::ERROR_INSTALL_SOURCE_ABSENT, API::Error::ERROR_INSTALL_SUSPEND, API::Error::ERROR_INSTALL_TEMP_UNWRITABLE, API::Error::ERROR_INSTALL_TRANSFORM_FAILURE, API::Error::ERROR_INSTALL_UI_FAILURE, API::Error::ERROR_INSTALL_USEREXIT, API::Error::ERROR_INSUFFICIENT_BUFFER, API::Error::ERROR_INTERNAL_DB_CORRUPTION, API::Error::ERROR_INTERNAL_DB_ERROR, API::Error::ERROR_INTERNAL_ERROR, API::Error::ERROR_INTERRUPT, API::Error::ERROR_INVALID_ACCEL_HANDLE, API::Error::ERROR_INVALID_ACCESS, API::Error::ERROR_INVALID_ACCOUNT_NAME, API::Error::ERROR_INVALID_ACL, API::Error::ERROR_INVALID_ADDRESS, API::Error::ERROR_INVALID_AT_INTERRUPT_TIME, API::Error::ERROR_INVALID_BLOCK, API::Error::ERROR_INVALID_BLOCK_LENGTH, API::Error::ERROR_INVALID_CALLGATE, API::Error::ERROR_INVALID_CATEGORY, API::Error::ERROR_INVALID_CMM, API::Error::ERROR_INVALID_COLORINDEX, API::Error::ERROR_INVALID_COLORSPACE, API::Error::ERROR_INVALID_COMBOBOX_MESSAGE, API::Error::ERROR_INVALID_COMMAND_LINE, API::Error::ERROR_INVALID_COMPUTERNAME, API::Error::ERROR_INVALID_CURSOR_HANDLE, API::Error::ERROR_INVALID_DATA, API::Error::ERROR_INVALID_DATATYPE, API::Error::ERROR_INVALID_DLL, API::Error::ERROR_INVALID_DOMAINNAME, API::Error::ERROR_INVALID_DOMAIN_ROLE, API::Error::ERROR_INVALID_DOMAIN_STATE, API::Error::ERROR_INVALID_DRIVE, API::Error::ERROR_INVALID_DWP_HANDLE, API::Error::ERROR_INVALID_EA_HANDLE, API::Error::ERROR_INVALID_EA_NAME, API::Error::ERROR_INVALID_EDIT_HEIGHT, API::Error::ERROR_INVALID_ENVIRONMENT, API::Error::ERROR_INVALID_EVENTNAME, API::Error::ERROR_INVALID_EVENT_COUNT, API::Error::ERROR_INVALID_EXE_SIGNATURE, API::Error::ERROR_INVALID_FIELD, API::Error::ERROR_INVALID_FILTER_PROC, API::Error::ERROR_INVALID_FLAGS, API::Error::ERROR_INVALID_FLAG_NUMBER, API::Error::ERROR_INVALID_FORM_NAME, API::Error::ERROR_INVALID_FORM_SIZE, API::Error::ERROR_INVALID_FUNCTION, API::Error::ERROR_INVALID_GROUPNAME, API::Error::ERROR_INVALID_GROUP_ATTRIBUTES, API::Error::ERROR_INVALID_GW_COMMAND, API::Error::ERROR_INVALID_HANDLE, API::Error::ERROR_INVALID_HANDLE_STATE, API::Error::ERROR_INVALID_HOOK_FILTER, API::Error::ERROR_INVALID_HOOK_HANDLE, API::Error::ERROR_INVALID_ICON_HANDLE, API::Error::ERROR_INVALID_ID_AUTHORITY, API::Error::ERROR_INVALID_IMPORT_OF_NON_DLL, API::Error::ERROR_INVALID_INDEX, API::Error::ERROR_INVALID_KEYBOARD_HANDLE, API::Error::ERROR_INVALID_LB_MESSAGE, API::Error::ERROR_INVALID_LEVEL, API::Error::ERROR_INVALID_LIST_FORMAT, API::Error::ERROR_INVALID_LOGON_HOURS, API::Error::ERROR_INVALID_LOGON_TYPE, API::Error::ERROR_INVALID_MEMBER, API::Error::ERROR_INVALID_MENU_HANDLE, API::Error::ERROR_INVALID_MESSAGE, API::Error::ERROR_INVALID_MESSAGEDEST, API::Error::ERROR_INVALID_MESSAGENAME, API::Error::ERROR_INVALID_MINALLOCSIZE, API::Error::ERROR_INVALID_MODULETYPE, API::Error::ERROR_INVALID_MONITOR_HANDLE, API::Error::ERROR_INVALID_MSGBOX_STYLE, API::Error::ERROR_INVALID_NAME, API::Error::ERROR_INVALID_NETNAME, API::Error::ERROR_INVALID_OPLOCK_PROTOCOL, API::Error::ERROR_INVALID_ORDINAL, API::Error::ERROR_INVALID_OWNER, API::Error::ERROR_INVALID_PARAMETER, API::Error::ERROR_INVALID_PASSWORD, API::Error::ERROR_INVALID_PASSWORDNAME, API::Error::ERROR_INVALID_PIXEL_FORMAT, API::Error::ERROR_INVALID_PRIMARY_GROUP, API::Error::ERROR_INVALID_PRINTER_COMMAND, API::Error::ERROR_INVALID_PRINTER_NAME, API::Error::ERROR_INVALID_PRINTER_STATE, API::Error::ERROR_INVALID_PRIORITY, API::Error::ERROR_INVALID_PROFILE, API::Error::ERROR_INVALID_SCROLLBAR_RANGE, API::Error::ERROR_INVALID_SECURITY_DESCR, API::Error::ERROR_INVALID_SEGDPL, API::Error::ERROR_INVALID_SEGMENT_NUMBER, API::Error::ERROR_INVALID_SEPARATOR_FILE, API::Error::ERROR_INVALID_SERVER_STATE, API::Error::ERROR_INVALID_SERVICENAME, API::Error::ERROR_INVALID_SERVICE_ACCOUNT, API::Error::ERROR_INVALID_SERVICE_CONTROL, API::Error::ERROR_INVALID_SERVICE_LOCK, API::Error::ERROR_INVALID_SHARENAME, API::Error::ERROR_INVALID_SHOWWIN_COMMAND, API::Error::ERROR_INVALID_SID, API::Error::ERROR_INVALID_SIGNAL_NUMBER, API::Error::ERROR_INVALID_SPI_VALUE, API::Error::ERROR_INVALID_STACKSEG, API::Error::ERROR_INVALID_STARTING_CODESEG, API::Error::ERROR_INVALID_SUB_AUTHORITY, API::Error::ERROR_INVALID_TABLE, API::Error::ERROR_INVALID_TARGET_HANDLE, API::Error::ERROR_INVALID_TASK_INDEX, API::Error::ERROR_INVALID_TASK_NAME, API::Error::ERROR_INVALID_THREAD_ID, API::Error::ERROR_INVALID_TIME, API::Error::ERROR_INVALID_TRANSFORM, API::Error::ERROR_INVALID_USER_BUFFER, API::Error::ERROR_INVALID_VERIFY_SWITCH, API::Error::ERROR_INVALID_WINDOW_HANDLE, API::Error::ERROR_INVALID_WINDOW_STYLE, API::Error::ERROR_INVALID_WORKSTATION, API::Error::ERROR_IOPL_NOT_ENABLED, API::Error::ERROR_IO_DEVICE, API::Error::ERROR_IO_INCOMPLETE, API::Error::ERROR_IO_PENDING, API::Error::ERROR_IRQ_BUSY, API::Error::ERROR_IS_JOINED, API::Error::ERROR_IS_JOIN_PATH, API::Error::ERROR_IS_JOIN_TARGET, API::Error::ERROR_IS_SUBSTED, API::Error::ERROR_IS_SUBST_PATH, API::Error::ERROR_IS_SUBST_TARGET, API::Error::ERROR_ITERATED_DATA_EXCEEDS_64k, API::Error::ERROR_JOIN_TO_JOIN, API::Error::ERROR_JOIN_TO_SUBST, API::Error::ERROR_JOURNAL_DELETE_IN_PROGRESS, API::Error::ERROR_JOURNAL_ENTRY_DELETED, API::Error::ERROR_JOURNAL_HOOK_SET, API::Error::ERROR_JOURNAL_NOT_ACTIVE, API::Error::ERROR_KEY_DELETED, API::Error::ERROR_KEY_HAS_CHILDREN, API::Error::ERROR_KM_DRIVER_BLOCKED, API::Error::ERROR_LABEL_TOO_LONG, API::Error::ERROR_LAST_ADMIN, API::Error::ERROR_LB_WITHOUT_TABSTOPS, API::Error::ERROR_LICENSE_QUOTA_EXCEEDED, API::Error::ERROR_LISTBOX_ID_NOT_FOUND, API::Error::ERROR_LM_CROSS_ENCRYPTION_REQUIRED, API::Error::ERROR_LOCAL_USER_SESSION_KEY, API::Error::ERROR_LOCKED, API::Error::ERROR_LOCK_FAILED, API::Error::ERROR_LOCK_VIOLATION, API::Error::ERROR_LOGIN_TIME_RESTRICTION, API::Error::ERROR_LOGIN_WKSTA_RESTRICTION, API::Error::ERROR_LOGON_FAILURE, API::Error::ERROR_LOGON_NOT_GRANTED, API::Error::ERROR_LOGON_SESSION_COLLISION, API::Error::ERROR_LOGON_SESSION_EXISTS, API::Error::ERROR_LOGON_TYPE_NOT_GRANTED, API::Error::ERROR_LOG_FILE_FULL, API::Error::ERROR_LUIDS_EXHAUSTED, API::Error::ERROR_MACHINE_LOCKED, API::Error::ERROR_MAGAZINE_NOT_PRESENT, API::Error::ERROR_MAPPED_ALIGNMENT, API::Error::ERROR_MAX_SESSIONS_REACHED, API::Error::ERROR_MAX_THRDS_REACHED, API::Error::ERROR_MEDIA_CHANGED, API::Error::ERROR_MEMBERS_PRIMARY_GROUP, API::Error::ERROR_MEMBER_IN_ALIAS, API::Error::ERROR_MEMBER_IN_GROUP, API::Error::ERROR_MEMBER_NOT_IN_ALIAS, API::Error::ERROR_MEMBER_NOT_IN_GROUP, API::Error::ERROR_MENU_ITEM_NOT_FOUND, API::Error::ERROR_MESSAGE_SYNC_ONLY, API::Error::ERROR_METAFILE_NOT_SUPPORTED, API::Error::ERROR_META_EXPANSION_TOO_LONG, API::Error::ERROR_MOD_NOT_FOUND, API::Error::ERROR_MONITORS_NOT_SUPPORTED, API::Error::ERROR_MORE_DATA, API::Error::ERROR_MORE_WRITES, API::Error::ERROR_MR_MID_NOT_FOUND, API::Error::ERROR_MUTUAL_AUTH_FAILED, API::Error::ERROR_NEGATIVE_SEEK, API::Error::ERROR_NESTING_NOT_ALLOWED, API::Error::ERROR_NETLOGON_NOT_STARTED, API::Error::ERROR_NETNAME_DELETED, API::Error::ERROR_NETWORK_ACCESS_DENIED, API::Error::ERROR_NETWORK_BUSY, API::Error::ERROR_NETWORK_UNREACHABLE, API::Error::ERROR_NET_WRITE_FAULT, API::Error::ERROR_NOACCESS, API::Error::ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT, API::Error::ERROR_NOLOGON_SERVER_TRUST_ACCOUNT, API::Error::ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT, API::Error::ERROR_NONE_MAPPED, API::Error::ERROR_NONPAGED_SYSTEM_RESOURCES, API::Error::ERROR_NON_MDICHILD_WINDOW, API::Error::ERROR_NOTIFY_ENUM_DIR, API::Error::ERROR_NOT_ALL_ASSIGNED, API::Error::ERROR_NOT_AUTHENTICATED, API::Error::ERROR_NOT_CHILD_WINDOW, API::Error::ERROR_NOT_CONNECTED, API::Error::ERROR_NOT_CONTAINER, API::Error::ERROR_NOT_CURRENT_CTRY, API::Error::ERROR_NOT_DOS_DISK, API::Error::ERROR_NOT_ENOUGH_MEMORY, API::Error::ERROR_NOT_ENOUGH_QUOTA, API::Error::ERROR_NOT_ENOUGH_SERVER_MEMORY, API::Error::ERROR_NOT_FOUND, API::Error::ERROR_NOT_FROZEN, API::Error::ERROR_NOT_JOINED, API::Error::ERROR_NOT_LOCKED, API::Error::ERROR_NOT_LOGGED_ON, API::Error::ERROR_NOT_LOGON_PROCESS, API::Error::ERROR_NOT_OWNER, API::Error::ERROR_NOT_READY, API::Error::ERROR_NOT_REGISTRY_FILE, API::Error::ERROR_NOT_SAME_DEVICE, API::Error::ERROR_NOT_SUBSTED, API::Error::ERROR_NOT_SUPPORTED, API::Error::ERROR_NOT_SUPPORTED_ON_SBS, API::Error::ERROR_NO_ASSOCIATION, API::Error::ERROR_NO_CHILD_PROCESS, API::Error::ERROR_NO_DATA, API::Error::ERROR_NO_DATA_DETECTED, API::Error::ERROR_NO_IMPERSONATION_TOKEN, API::Error::ERROR_NO_INHERITANCE, API::Error::ERROR_NO_ITEMS, API::Error::ERROR_NO_LOGON_SERVERS, API::Error::ERROR_NO_LOG_SPACE, API::Error::ERROR_NO_MATCH, API::Error::ERROR_NO_MEDIA_IN_DRIVE, API::Error::ERROR_NO_MORE_DEVICES, API::Error::ERROR_NO_MORE_FILES, API::Error::ERROR_NO_MORE_ITEMS, API::Error::ERROR_NO_MORE_SEARCH_HANDLES, API::Error::ERROR_NO_MORE_USER_HANDLES, API::Error::ERROR_NO_NETWORK, API::Error::ERROR_NO_NET_OR_BAD_PATH, API::Error::ERROR_NO_PROC_SLOTS, API::Error::ERROR_NO_QUOTAS_FOR_ACCOUNT, API::Error::ERROR_NO_RECOVERY_PROGRAM, API::Error::ERROR_NO_SCROLLBARS, API::Error::ERROR_NO_SECURITY_ON_OBJECT, API::Error::ERROR_NO_SHUTDOWN_IN_PROGRESS, API::Error::ERROR_NO_SIGNAL_SENT, API::Error::ERROR_NO_SITENAME, API::Error::ERROR_NO_SPOOL_SPACE, API::Error::ERROR_NO_SUCH_ALIAS, API::Error::ERROR_NO_SUCH_DOMAIN, API::Error::ERROR_NO_SUCH_GROUP, API::Error::ERROR_NO_SUCH_LOGON_SESSION, API::Error::ERROR_NO_SUCH_MEMBER, API::Error::ERROR_NO_SUCH_PACKAGE, API::Error::ERROR_NO_SUCH_PRIVILEGE, API::Error::ERROR_NO_SUCH_SITE, API::Error::ERROR_NO_SUCH_USER, API::Error::ERROR_NO_SYSTEM_MENU, API::Error::ERROR_NO_SYSTEM_RESOURCES, API::Error::ERROR_NO_TOKEN, API::Error::ERROR_NO_TRACKING_SERVICE, API::Error::ERROR_NO_TRUST_LSA_SECRET, API::Error::ERROR_NO_TRUST_SAM_ACCOUNT, API::Error::ERROR_NO_UNICODE_TRANSLATION, API::Error::ERROR_NO_USER_SESSION_KEY, API::Error::ERROR_NO_VOLUME_ID, API::Error::ERROR_NO_VOLUME_LABEL, API::Error::ERROR_NO_WILDCARD_CHARACTERS, API::Error::ERROR_NT_CROSS_ENCRYPTION_REQUIRED, API::Error::ERROR_NULL_LM_PASSWORD, API::Error::ERROR_OLD_WIN_VERSION, API::Error::ERROR_ONLY_IF_CONNECTED, API::Error::ERROR_OPEN_FAILED, API::Error::ERROR_OPEN_FILES, API::Error::ERROR_OPERATION_ABORTED, API::Error::ERROR_OPLOCK_NOT_GRANTED, API::Error::ERROR_OUT_OF_PAPER, API::Error::ERROR_OUT_OF_STRUCTURES, API::Error::ERROR_OVERRIDE_NOCHANGES, API::Error::ERROR_PAGED_SYSTEM_RESOURCES, API::Error::ERROR_PAGEFILE_QUOTA, API::Error::ERROR_PARTIAL_COPY, API::Error::ERROR_PARTITION_FAILURE, API::Error::ERROR_PASSWORD_EXPIRED, API::Error::ERROR_PASSWORD_MUST_CHANGE, API::Error::ERROR_PASSWORD_RESTRICTION, API::Error::ERROR_PATCH_PACKAGE_INVALID, API::Error::ERROR_PATCH_PACKAGE_OPEN_FAILED, API::Error::ERROR_PATCH_PACKAGE_UNSUPPORTED, API::Error::ERROR_PATH_BUSY, API::Error::ERROR_PATH_NOT_FOUND, API::Error::ERROR_PER_USER_TRUST_QUOTA_EXCEEDED, API::Error::ERROR_PIPE_BUSY, API::Error::ERROR_PIPE_CONNECTED, API::Error::ERROR_PIPE_LISTENING, API::Error::ERROR_PIPE_NOT_CONNECTED, API::Error::ERROR_PKINIT_FAILURE, API::Error::ERROR_POINT_NOT_FOUND, API::Error::ERROR_POPUP_ALREADY_ACTIVE, API::Error::ERROR_PORT_UNREACHABLE, API::Error::ERROR_POSSIBLE_DEADLOCK, API::Error::ERROR_POTENTIAL_FILE_FOUND, API::Error::ERROR_PRINTER_ALREADY_EXISTS, API::Error::ERROR_PRINTER_DELETED, API::Error::ERROR_PRINTER_DRIVER_ALREADY_INSTALLED, API::Error::ERROR_PRINTQ_FULL, API::Error::ERROR_PRINT_CANCELLED, API::Error::ERROR_PRIVATE_DIALOG_INDEX, API::Error::ERROR_PRIVILEGE_NOT_HELD, API::Error::ERROR_PROCESS_ABORTED, API::Error::ERROR_PROC_NOT_FOUND, API::Error::ERROR_PRODUCT_UNINSTALLED, API::Error::ERROR_PRODUCT_VERSION, API::Error::ERROR_PROFILE_NOT_ASSOCIATED_WITH_DEVICE, API::Error::ERROR_PROFILE_NOT_FOUND, API::Error::ERROR_PROTECTION_VIOLATION, API::Error::ERROR_PROTOCOL_UNREACHABLE, API::Error::ERROR_READ_FAULT, API::Error::ERROR_REDIRECTOR_HAS_OPEN_HANDLES, API::Error::ERROR_REDIR_PAUSED, API::Error::ERROR_REGISTRY_CORRUPT, API::Error::ERROR_REGISTRY_IO_FAILED, API::Error::ERROR_REGISTRY_RECOVERED, API::Error::ERROR_REG_NAT_CONSUMPTION, API::Error::ERROR_RELOC_CHAIN_XEEDS_SEGLIM, API::Error::ERROR_REMOTE_PRINT_CONNECTIONS_BLOCKED, API::Error::ERROR_REMOTE_SESSION_LIMIT_EXCEEDED, API::Error::ERROR_REM_NOT_LIST, API::Error::ERROR_REQUEST_ABORTED, API::Error::ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION, API::Error::ERROR_REQ_NOT_ACCEP, API::Error::ERROR_RESOURCE_DATA_NOT_FOUND, API::Error::ERROR_RESOURCE_LANG_NOT_FOUND, API::Error::ERROR_RESOURCE_NAME_NOT_FOUND, API::Error::ERROR_RESOURCE_TYPE_NOT_FOUND, API::Error::ERROR_RETRY, API::Error::ERROR_REVISION_MISMATCH, API::Error::ERROR_RING2SEG_MUST_BE_MOVABLE, API::Error::ERROR_RING2_STACK_IN_USE, API::Error::ERROR_RMODE_APP, API::Error::ERROR_RXACT_COMMIT_FAILURE, API::Error::ERROR_RXACT_INVALID_STATE, API::Error::ERROR_SAME_DRIVE, API::Error::ERROR_SCOPE_NOT_FOUND, API::Error::ERROR_SCREEN_ALREADY_LOCKED, API::Error::ERROR_SECRET_TOO_LONG, API::Error::ERROR_SECTOR_NOT_FOUND, API::Error::ERROR_SEEK, API::Error::ERROR_SEEK_ON_DEVICE, API::Error::ERROR_SEM_IS_SET, API::Error::ERROR_SEM_NOT_FOUND, API::Error::ERROR_SEM_OWNER_DIED, API::Error::ERROR_SEM_TIMEOUT, API::Error::ERROR_SEM_USER_LIMIT, API::Error::ERROR_SERIAL_NO_DEVICE, API::Error::ERROR_SERVER_DISABLED, API::Error::ERROR_SERVER_HAS_OPEN_HANDLES, API::Error::ERROR_SERVER_NOT_DISABLED, API::Error::ERROR_SERVER_SHUTDOWN_IN_PROGRESS, API::Error::ERROR_SERVICE_ALREADY_RUNNING, API::Error::ERROR_SERVICE_CANNOT_ACCEPT_CTRL, API::Error::ERROR_SERVICE_DATABASE_LOCKED, API::Error::ERROR_SERVICE_DEPENDENCY_DELETED, API::Error::ERROR_SERVICE_DEPENDENCY_FAIL, API::Error::ERROR_SERVICE_DISABLED, API::Error::ERROR_SERVICE_DOES_NOT_EXIST, API::Error::ERROR_SERVICE_EXISTS, API::Error::ERROR_SERVICE_LOGON_FAILED, API::Error::ERROR_SERVICE_MARKED_FOR_DELETE, API::Error::ERROR_SERVICE_NEVER_STARTED, API::Error::ERROR_SERVICE_NOT_ACTIVE, API::Error::ERROR_SERVICE_NOT_FOUND, API::Error::ERROR_SERVICE_NOT_IN_EXE, API::Error::ERROR_SERVICE_NO_THREAD, API::Error::ERROR_SERVICE_REQUEST_TIMEOUT, API::Error::ERROR_SERVICE_SPECIFIC_ERROR, API::Error::ERROR_SERVICE_START_HANG, API::Error::ERROR_SESSION_CREDENTIAL_CONFLICT, API::Error::ERROR_SETCOUNT_ON_BAD_LB, API::Error::ERROR_SETMARK_DETECTED, API::Error::ERROR_SET_NOT_FOUND, API::Error::ERROR_SET_POWER_STATE_FAILED, API::Error::ERROR_SET_POWER_STATE_VETOED, API::Error::ERROR_SHARING_BUFFER_EXCEEDED, API::Error::ERROR_SHARING_PAUSED, API::Error::ERROR_SHARING_VIOLATION, API::Error::ERROR_SHUTDOWN_IN_PROGRESS, API::Error::ERROR_SIGNAL_PENDING, API::Error::ERROR_SIGNAL_REFUSED, API::Error::ERROR_SINGLE_INSTANCE_APP, API::Error::ERROR_SMARTCARD_SUBSYSTEM_FAILURE, API::Error::ERROR_SOME_NOT_MAPPED, API::Error::ERROR_SOURCE_ELEMENT_EMPTY, API::Error::ERROR_SPECIAL_ACCOUNT, API::Error::ERROR_SPECIAL_GROUP, API::Error::ERROR_SPECIAL_USER, API::Error::ERROR_STACK_OVERFLOW, API::Error::ERROR_SUBST_TO_JOIN, API::Error::ERROR_SUBST_TO_SUBST, API::Error::ERROR_SUCCESS, API::Error::ERROR_SUCCESS_REBOOT_INITIATED, API::Error::ERROR_SWAPERROR, API::Error::ERROR_SYNC_FOREGROUND_REFRESH_REQUIRED, API::Error::ERROR_SYSTEM_TRACE, API::Error::ERROR_TAG_NOT_FOUND, API::Error::ERROR_TAG_NOT_PRESENT, API::Error::ERROR_THREAD_1_INACTIVE, API::Error::ERROR_THREAD_ALREADY_IN_TASK, API::Error::ERROR_TIMEOUT, API::Error::ERROR_TIME_SKEW, API::Error::ERROR_TLW_WITH_WSCHILD, API::Error::ERROR_TOKEN_ALREADY_IN_USE, API::Error::ERROR_TOO_MANY_CMDS, API::Error::ERROR_TOO_MANY_CONTEXT_IDS, API::Error::ERROR_TOO_MANY_LINKS, API::Error::ERROR_TOO_MANY_LUIDS_REQUESTED, API::Error::ERROR_TOO_MANY_MODULES, API::Error::ERROR_TOO_MANY_MUXWAITERS, API::Error::ERROR_TOO_MANY_NAMES, API::Error::ERROR_TOO_MANY_OPEN_FILES, API::Error::ERROR_TOO_MANY_POSTS, API::Error::ERROR_TOO_MANY_SECRETS, API::Error::ERROR_TOO_MANY_SEMAPHORES, API::Error::ERROR_TOO_MANY_SEM_REQUESTS, API::Error::ERROR_TOO_MANY_SESS, API::Error::ERROR_TOO_MANY_SIDS, API::Error::ERROR_TOO_MANY_TCBS, API::Error::ERROR_TRANSFORM_NOT_SUPPORTED, API::Error::ERROR_TRUSTED_DOMAIN_FAILURE, API::Error::ERROR_TRUSTED_RELATIONSHIP_FAILURE, API::Error::ERROR_TRUST_FAILURE, API::Error::ERROR_UNABLE_TO_LOCK_MEDIA, API::Error::ERROR_UNABLE_TO_MOVE_REPLACEMENT, API::Error::ERROR_UNABLE_TO_MOVE_REPLACEMENT_2, API::Error::ERROR_UNABLE_TO_REMOVE_REPLACED, API::Error::ERROR_UNABLE_TO_UNLOAD_MEDIA, API::Error::ERROR_UNCERTAIN_MEDIA, API::Error::ERROR_UNEXP_NET_ERR, API::Error::ERROR_UNKNOWN_COMPONENT, API::Error::ERROR_UNKNOWN_FEATURE, API::Error::ERROR_UNKNOWN_PATCH, API::Error::ERROR_UNKNOWN_PORT, API::Error::ERROR_UNKNOWN_PRINTER_DRIVER, API::Error::ERROR_UNKNOWN_PRINTPROCESSOR, API::Error::ERROR_UNKNOWN_PRINT_MONITOR, API::Error::ERROR_UNKNOWN_PRODUCT, API::Error::ERROR_UNKNOWN_PROPERTY, API::Error::ERROR_UNKNOWN_REVISION, API::Error::ERROR_UNRECOGNIZED_MEDIA, API::Error::ERROR_UNRECOGNIZED_VOLUME, API::Error::ERROR_UNSUPPORTED_TYPE, API::Error::ERROR_USER_DEFINED_BASE, API::Error::ERROR_USER_DELETE_TRUST_QUOTA_EXCEEDED, API::Error::ERROR_USER_EXISTS, API::Error::ERROR_USER_MAPPED_FILE, API::Error::ERROR_USER_NOT_FOUND, API::Error::ERROR_USER_PROFILE_LOAD, API::Error::ERROR_VC_DISCONNECTED, API::Error::ERROR_VIOKBD_REQUEST, API::Error::ERROR_WAIT_NO_CHILDREN, API::Error::ERROR_WINDOW_NOT_COMBOBOX, API::Error::ERROR_WINDOW_NOT_DIALOG, API::Error::ERROR_WINDOW_OF_OTHER_THREAD, API::Error::ERROR_WORKING_SET_QUOTA, API::Error::ERROR_WRITE_FAULT, API::Error::ERROR_WRITE_PROTECT, API::Error::ERROR_WRONG_DISK, API::Error::ERROR_WRONG_PASSWORD, API::Error::ERROR_WRONG_TARGET_NAME, API::Error::ERR_TSTDUP, API::Error::ERR_TSTOVFL, API::Error::FORMAT_MESSAGE_ALLOCATE_BUFFER, API::Error::FORMAT_MESSAGE_ARGUMENT_ARRAY, API::Error::FORMAT_MESSAGE_FROM_HMODULE, API::Error::FORMAT_MESSAGE_FROM_STRING, API::Error::FORMAT_MESSAGE_FROM_SYSTEM, API::Error::FORMAT_MESSAGE_IGNORE_INSERTS, API::Error::FORMAT_MESSAGE_MAX_WIDTH_MASK, API::Error::LOAD_IGNORE_CODE_AUTHZ_LEVEL, API::Error::LOAD_LIBRARY_AS_DATAFILE, API::Error::LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE, API::Error::LOAD_LIBRARY_AS_IMAGE_RESOURCE, API::Error::LOAD_LIBRARY_SEARCH_APPLICATION_DIR, API::Error::LOAD_LIBRARY_SEARCH_DEFAULT_DIRS, API::Error::LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR, API::Error::LOAD_LIBRARY_SEARCH_SYSTEM32, API::Error::LOAD_LIBRARY_SEARCH_USER_DIRS, API::Error::LOAD_WITH_ALTERED_SEARCH_PATH, API::Error::NO_ERROR, API::Error::OR_INVALID_OID, API::Error::OR_INVALID_OXID, API::Error::OR_INVALID_SET, API::Error::RPC_S_ADDRESS_ERROR, API::Error::RPC_S_ALREADY_LISTENING, API::Error::RPC_S_ALREADY_REGISTERED, API::Error::RPC_S_BINDING_HAS_NO_AUTH, API::Error::RPC_S_BINDING_INCOMPLETE, API::Error::RPC_S_CALL_CANCELLED, API::Error::RPC_S_CALL_FAILED, API::Error::RPC_S_CALL_FAILED_DNE, API::Error::RPC_S_CALL_IN_PROGRESS, API::Error::RPC_S_CANNOT_SUPPORT, API::Error::RPC_S_CANT_CREATE_ENDPOINT, API::Error::RPC_S_COMM_FAILURE, API::Error::RPC_S_DUPLICATE_ENDPOINT, API::Error::RPC_S_ENTRY_ALREADY_EXISTS, API::Error::RPC_S_ENTRY_NOT_FOUND, API::Error::RPC_S_ENTRY_TYPE_MISMATCH, API::Error::RPC_S_FP_DIV_ZERO, API::Error::RPC_S_FP_OVERFLOW, API::Error::RPC_S_FP_UNDERFLOW, API::Error::RPC_S_GROUP_MEMBER_NOT_FOUND, API::Error::RPC_S_GRP_ELT_NOT_ADDED, API::Error::RPC_S_GRP_ELT_NOT_REMOVED, API::Error::RPC_S_INCOMPLETE_NAME, API::Error::RPC_S_INTERFACE_NOT_EXPORTED, API::Error::RPC_S_INTERFACE_NOT_FOUND, API::Error::RPC_S_INTERNAL_ERROR, API::Error::RPC_S_INVALID_ASYNC_CALL, API::Error::RPC_S_INVALID_ASYNC_HANDLE, API::Error::RPC_S_INVALID_AUTH_IDENTITY, API::Error::RPC_S_INVALID_BINDING, API::Error::RPC_S_INVALID_BOUND, API::Error::RPC_S_INVALID_ENDPOINT_FORMAT, API::Error::RPC_S_INVALID_NAF_ID, API::Error::RPC_S_INVALID_NAME_SYNTAX, API::Error::RPC_S_INVALID_NETWORK_OPTIONS, API::Error::RPC_S_INVALID_NET_ADDR, API::Error::RPC_S_INVALID_OBJECT, API::Error::RPC_S_INVALID_RPC_PROTSEQ, API::Error::RPC_S_INVALID_STRING_BINDING, API::Error::RPC_S_INVALID_STRING_UUID, API::Error::RPC_S_INVALID_TAG, API::Error::RPC_S_INVALID_TIMEOUT, API::Error::RPC_S_INVALID_VERS_OPTION, API::Error::RPC_S_MAX_CALLS_TOO_SMALL, API::Error::RPC_S_NAME_SERVICE_UNAVAILABLE, API::Error::RPC_S_NOTHING_TO_EXPORT, API::Error::RPC_S_NOT_ALL_OBJS_EXPORTED, API::Error::RPC_S_NOT_ALL_OBJS_UNEXPORTED, API::Error::RPC_S_NOT_CANCELLED, API::Error::RPC_S_NOT_LISTENING, API::Error::RPC_S_NOT_RPC_ERROR, API::Error::RPC_S_NO_BINDINGS, API::Error::RPC_S_NO_CALL_ACTIVE, API::Error::RPC_S_NO_CONTEXT_AVAILABLE, API::Error::RPC_S_NO_ENDPOINT_FOUND, API::Error::RPC_S_NO_ENTRY_NAME, API::Error::RPC_S_NO_INTERFACES, API::Error::RPC_S_NO_MORE_BINDINGS, API::Error::RPC_S_NO_MORE_MEMBERS, API::Error::RPC_S_NO_PRINC_NAME, API::Error::RPC_S_NO_PROTSEQS, API::Error::RPC_S_NO_PROTSEQS_REGISTERED, API::Error::RPC_S_OBJECT_NOT_FOUND, API::Error::RPC_S_OUT_OF_RESOURCES, API::Error::RPC_S_PRF_ELT_NOT_ADDED, API::Error::RPC_S_PRF_ELT_NOT_REMOVED, API::Error::RPC_S_PROCNUM_OUT_OF_RANGE, API::Error::RPC_S_PROFILE_NOT_ADDED, API::Error::RPC_S_PROTOCOL_ERROR, API::Error::RPC_S_PROTSEQ_NOT_FOUND, API::Error::RPC_S_PROTSEQ_NOT_SUPPORTED, API::Error::RPC_S_SEC_PKG_ERROR, API::Error::RPC_S_SEND_INCOMPLETE, API::Error::RPC_S_SERVER_TOO_BUSY, API::Error::RPC_S_SERVER_UNAVAILABLE, API::Error::RPC_S_STRING_TOO_LONG, API::Error::RPC_S_TYPE_ALREADY_REGISTERED, API::Error::RPC_S_UNKNOWN_AUTHN_LEVEL, API::Error::RPC_S_UNKNOWN_AUTHN_SERVICE, API::Error::RPC_S_UNKNOWN_AUTHN_TYPE, API::Error::RPC_S_UNKNOWN_AUTHZ_SERVICE, API::Error::RPC_S_UNKNOWN_IF, API::Error::RPC_S_UNKNOWN_MGR_TYPE, API::Error::RPC_S_UNSUPPORTED_AUTHN_LEVEL, API::Error::RPC_S_UNSUPPORTED_NAME_SYNTAX, API::Error::RPC_S_UNSUPPORTED_TRANS_SYN, API::Error::RPC_S_UNSUPPORTED_TYPE, API::Error::RPC_S_UUID_LOCAL_ONLY, API::Error::RPC_S_UUID_NO_ADDRESS, API::Error::RPC_S_WRONG_KIND_OF_BINDING, API::Error::RPC_S_ZERO_DIVIDE, API::Error::RPC_X_BAD_STUB_DATA, API::Error::RPC_X_BYTE_COUNT_TOO_SMALL, API::Error::RPC_X_ENUM_VALUE_OUT_OF_RANGE, API::Error::RPC_X_INVALID_ES_ACTION, API::Error::RPC_X_INVALID_PIPE_OBJECT, API::Error::RPC_X_NO_MORE_ENTRIES, API::Error::RPC_X_NULL_REF_POINTER, API::Error::RPC_X_PIPE_CLOSED, API::Error::RPC_X_PIPE_DISCIPLINE_ERROR, API::Error::RPC_X_PIPE_EMPTY, API::Error::RPC_X_SS_CANNOT_GET_CALL_HANDLE, API::Error::RPC_X_SS_CHAR_TRANS_OPEN_FAIL, API::Error::RPC_X_SS_CHAR_TRANS_SHORT_FILE, API::Error::RPC_X_SS_CONTEXT_DAMAGED, API::Error::RPC_X_SS_HANDLES_MISMATCH, API::Error::RPC_X_SS_IN_NULL_CONTEXT, API::Error::RPC_X_WRONG_ES_VERSION, API::Error::RPC_X_WRONG_PIPE_ORDER, API::Error::RPC_X_WRONG_PIPE_VERSION, API::Error::RPC_X_WRONG_STUB_VERSION, API::Error::SEM_FAILCRITICALERRORS, API::Error::SEM_NOALIGNMENTFAULTEXCEPT, API::Error::SEM_NOGPFAULTERRORBOX, API::Error::SEM_NOOPENFILEERRORBOX, API::Error::S_OK

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Mixin::WideString

utf8_to_wide, wide_to_utf8, wstring

Class Method Details

.access_check(security_descriptor, token, desired_access, generic_mapping) ⇒ Object


38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/chef/win32/security.rb', line 38

def self.access_check(security_descriptor, token, desired_access, generic_mapping)
  token_handle = token.handle.handle
  security_descriptor_ptr = security_descriptor.pointer

  rights_ptr = FFI::MemoryPointer.new(:ulong)
  rights_ptr.write_ulong(desired_access)

  # This function takes care of calling MapGenericMask, so you don't have to
  MapGenericMask(rights_ptr, generic_mapping)

  result_ptr = FFI::MemoryPointer.new(:ulong)

  # Because optional actually means required
  privileges = PRIVILEGE_SET.new
  privileges[:PrivilegeCount] = 0
  privileges_length_ptr = FFI::MemoryPointer.new(:ulong)
  privileges_length_ptr.write_ulong(privileges.size)

  granted_access_ptr = FFI::MemoryPointer.new(:ulong)

  unless AccessCheck(security_descriptor_ptr, token_handle, rights_ptr.read_ulong,
    generic_mapping, privileges, privileges_length_ptr, granted_access_ptr,
    result_ptr)
    Chef::ReservedNames::Win32::Error.raise!
  end
  result_ptr.read_ulong == 1
end

.add_access_allowed_ace(acl, sid, access_mask, revision = ACL_REVISION) ⇒ Object


75
76
77
78
79
80
81
# File 'lib/chef/win32/security.rb', line 75

def self.add_access_allowed_ace(acl, sid, access_mask, revision = ACL_REVISION)
  acl = acl.pointer if acl.respond_to?(:pointer)
  sid = sid.pointer if sid.respond_to?(:pointer)
  unless AddAccessAllowedAce(acl, revision, access_mask, sid)
    Chef::ReservedNames::Win32::Error.raise!
  end
end

.add_access_allowed_ace_ex(acl, sid, access_mask, flags = 0, revision = ACL_REVISION) ⇒ Object


83
84
85
86
87
88
89
# File 'lib/chef/win32/security.rb', line 83

def self.add_access_allowed_ace_ex(acl, sid, access_mask, flags = 0, revision = ACL_REVISION)
  acl = acl.pointer if acl.respond_to?(:pointer)
  sid = sid.pointer if sid.respond_to?(:pointer)
  unless AddAccessAllowedAceEx(acl, revision, flags, access_mask, sid)
    Chef::ReservedNames::Win32::Error.raise!
  end
end

.add_access_denied_ace(acl, sid, access_mask, revision = ACL_REVISION) ⇒ Object


91
92
93
94
95
96
97
# File 'lib/chef/win32/security.rb', line 91

def self.add_access_denied_ace(acl, sid, access_mask, revision = ACL_REVISION)
  acl = acl.pointer if acl.respond_to?(:pointer)
  sid = sid.pointer if sid.respond_to?(:pointer)
  unless AddAccessDeniedAce(acl, revision, access_mask, sid)
    Chef::ReservedNames::Win32::Error.raise!
  end
end

.add_access_denied_ace_ex(acl, sid, access_mask, flags = 0, revision = ACL_REVISION) ⇒ Object


99
100
101
102
103
104
105
# File 'lib/chef/win32/security.rb', line 99

def self.add_access_denied_ace_ex(acl, sid, access_mask, flags = 0, revision = ACL_REVISION)
  acl = acl.pointer if acl.respond_to?(:pointer)
  sid = sid.pointer if sid.respond_to?(:pointer)
  unless AddAccessDeniedAceEx(acl, revision, flags, access_mask, sid)
    Chef::ReservedNames::Win32::Error.raise!
  end
end

.add_account_right(name, privilege) ⇒ Object


107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/chef/win32/security.rb', line 107

def self.(name, privilege)
  privilege_pointer = FFI::MemoryPointer.new LSA_UNICODE_STRING, 1
  privilege_lsa_string = LSA_UNICODE_STRING.new(privilege_pointer)
  privilege_lsa_string[:Buffer] = FFI::MemoryPointer.from_string(privilege.to_wstring)
  privilege_lsa_string[:Length] = privilege.length * 2
  privilege_lsa_string[:MaximumLength] = (privilege.length + 1) * 2

  with_lsa_policy(name) do |policy_handle, sid|
    result = LsaAddAccountRights(policy_handle.read_pointer, sid, privilege_pointer, 1)
    test_and_raise_lsa_nt_status(result)
  end
end

.add_ace(acl, ace, insert_position = MAXDWORD, revision = ACL_REVISION) ⇒ Object


66
67
68
69
70
71
72
73
# File 'lib/chef/win32/security.rb', line 66

def self.add_ace(acl, ace, insert_position = MAXDWORD, revision = ACL_REVISION)
  acl = acl.pointer if acl.respond_to?(:pointer)
  ace = ace.pointer if ace.respond_to?(:pointer)
  ace_size = ACE_HEADER.new(ace)[:AceSize]
  unless AddAce(acl, revision, insert_position, ace, ace_size)
    Chef::ReservedNames::Win32::Error.raise!
  end
end

.adjust_token_privileges(token, privileges) ⇒ Object


133
134
135
136
137
138
139
140
141
142
# File 'lib/chef/win32/security.rb', line 133

def self.adjust_token_privileges(token, privileges)
  token = token.handle if token.respond_to?(:handle)
  old_privileges_size = FFI::Buffer.new(:long).write_long(privileges.size_with_privileges)
  old_privileges = TOKEN_PRIVILEGES.new(FFI::Buffer.new(old_privileges_size.read_long))
  unless AdjustTokenPrivileges(token.handle, false, privileges, privileges.size_with_privileges, old_privileges, old_privileges_size)
    Chef::ReservedNames::Win32::Error.raise!
  end

  old_privileges
end

.convert_sid_to_string_sid(sid) ⇒ Object


144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/chef/win32/security.rb', line 144

def self.convert_sid_to_string_sid(sid)
  sid = sid.pointer if sid.respond_to?(:pointer)
  result = FFI::MemoryPointer.new :pointer
  # TODO: use the W version
  unless ConvertSidToStringSidA(sid, result)
    Chef::ReservedNames::Win32::Error.raise!
  end

  result_string = result.read_pointer.read_string

  Chef::ReservedNames::Win32::Memory.local_free(result.read_pointer)

  result_string
end

.convert_string_sid_to_sid(string_sid) ⇒ Object


159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/chef/win32/security.rb', line 159

def self.convert_string_sid_to_sid(string_sid)
  result = FFI::MemoryPointer.new :pointer
  unless ConvertStringSidToSidW(string_sid.to_wstring, result)
    Chef::ReservedNames::Win32::Error.raise!
  end

  result_pointer = result.read_pointer
  sid = SID.new(result_pointer)

  # The result pointer must be freed with local_free
  ObjectSpace.define_finalizer(sid, Memory.local_free_finalizer(result_pointer))

  sid
end

.delete_ace(acl, index) ⇒ Object


174
175
176
177
178
179
# File 'lib/chef/win32/security.rb', line 174

def self.delete_ace(acl, index)
  acl = acl.pointer if acl.respond_to?(:pointer)
  unless DeleteAce(acl, index)
    Chef::ReservedNames::Win32::Error.raise!
  end
end

.equal_sid(sid1, sid2) ⇒ Object


181
182
183
184
185
# File 'lib/chef/win32/security.rb', line 181

def self.equal_sid(sid1, sid2)
  sid1 = sid1.pointer if sid1.respond_to?(:pointer)
  sid2 = sid2.pointer if sid2.respond_to?(:pointer)
  EqualSid(sid1, sid2)
end

.free_sid(sid) ⇒ Object


187
188
189
190
191
192
# File 'lib/chef/win32/security.rb', line 187

def self.free_sid(sid)
  sid = sid.pointer if sid.respond_to?(:pointer)
  unless FreeSid(sid).null?
    Chef::ReservedNames::Win32::Error.raise!
  end
end

.get_account_right(name) ⇒ Object


194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# File 'lib/chef/win32/security.rb', line 194

def self.(name)
  privileges = []
  privilege_pointer = FFI::MemoryPointer.new(:pointer)
  privilege_length = FFI::MemoryPointer.new(:ulong)

  with_lsa_policy(name) do |policy_handle, sid|
    result = LsaEnumerateAccountRights(policy_handle.read_pointer, sid, privilege_pointer, privilege_length)
    win32_error = LsaNtStatusToWinError(result)
    return [] if win32_error == 2 # FILE_NOT_FOUND - No rights assigned

    test_and_raise_lsa_nt_status(result)

    privilege_length.read_ulong.times do |i|
      privilege = LSA_UNICODE_STRING.new(privilege_pointer.read_pointer + i * LSA_UNICODE_STRING.size)
      privileges << privilege[:Buffer].read_wstring
    end
    result = LsaFreeMemory(privilege_pointer.read_pointer)
    test_and_raise_lsa_nt_status(result)
  end

  privileges
end

.get_ace(acl, index) ⇒ Object


217
218
219
220
221
222
223
224
# File 'lib/chef/win32/security.rb', line 217

def self.get_ace(acl, index)
  acl = acl.pointer if acl.respond_to?(:pointer)
  ace = FFI::Buffer.new :pointer
  unless GetAce(acl, index, ace)
    Chef::ReservedNames::Win32::Error.raise!
  end
  ACE.new(ace.read_pointer, acl)
end

.get_file_security(path, info = OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION) ⇒ Object


231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
# File 'lib/chef/win32/security.rb', line 231

def self.get_file_security(path, info = OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION)
  size_ptr = FFI::MemoryPointer.new(:ulong)

  success = GetFileSecurityW(path.to_wstring, info, nil, 0, size_ptr)

  if !success && FFI::LastError.error != ERROR_INSUFFICIENT_BUFFER
    Chef::ReservedNames::Win32::Error.raise!
  end

  security_descriptor_ptr = FFI::MemoryPointer.new(size_ptr.read_ulong)
  unless GetFileSecurityW(path.to_wstring, info, security_descriptor_ptr, size_ptr.read_ulong, size_ptr)
    Chef::ReservedNames::Win32::Error.raise!
  end

  SecurityDescriptor.new(security_descriptor_ptr)
end

.get_length_sid(sid) ⇒ Object


226
227
228
229
# File 'lib/chef/win32/security.rb', line 226

def self.get_length_sid(sid)
  sid = sid.pointer if sid.respond_to?(:pointer)
  GetLengthSid(sid)
end

.get_named_security_info(path, type = :SE_FILE_OBJECT, info = OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION) ⇒ Object


248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
# File 'lib/chef/win32/security.rb', line 248

def self.get_named_security_info(path, type = :SE_FILE_OBJECT, info = OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION)
  security_descriptor = FFI::MemoryPointer.new :pointer
  hr = GetNamedSecurityInfoW(path.to_wstring, type, info, nil, nil, nil, nil, security_descriptor)
  if hr != ERROR_SUCCESS
    Chef::ReservedNames::Win32::Error.raise!("get_named_security_info(#{path}, #{type}, #{info})", hr)
  end

  result_pointer = security_descriptor.read_pointer
  result = SecurityDescriptor.new(result_pointer)

  # This memory has to be freed with LocalFree.
  ObjectSpace.define_finalizer(result, Memory.local_free_finalizer(result_pointer))

  result
end

.get_security_descriptor_control(security_descriptor) ⇒ Object


264
265
266
267
268
269
270
271
272
# File 'lib/chef/win32/security.rb', line 264

def self.get_security_descriptor_control(security_descriptor)
  security_descriptor = security_descriptor.pointer if security_descriptor.respond_to?(:pointer)
  result = FFI::Buffer.new :ushort
  version = FFI::Buffer.new :uint32
  unless GetSecurityDescriptorControl(security_descriptor, result, version)
    Chef::ReservedNames::Win32::Error.raise!
  end
  [ result.read_ushort, version.read_uint32 ]
end

.get_security_descriptor_dacl(security_descriptor) ⇒ Object


274
275
276
277
278
279
280
281
282
283
284
# File 'lib/chef/win32/security.rb', line 274

def self.get_security_descriptor_dacl(security_descriptor)
  security_descriptor = security_descriptor.pointer if security_descriptor.respond_to?(:pointer)
  present = FFI::Buffer.new :bool
  defaulted = FFI::Buffer.new :bool
  acl = FFI::Buffer.new :pointer
  unless GetSecurityDescriptorDacl(security_descriptor, present, acl, defaulted)
    Chef::ReservedNames::Win32::Error.raise!
  end
  acl = acl.read_pointer
  [ present.read_char != 0, acl.null? ? nil : ACL.new(acl, security_descriptor), defaulted.read_char != 0 ]
end

.get_security_descriptor_group(security_descriptor) ⇒ Object


286
287
288
289
290
291
292
293
294
295
296
297
# File 'lib/chef/win32/security.rb', line 286

def self.get_security_descriptor_group(security_descriptor)
  security_descriptor = security_descriptor.pointer if security_descriptor.respond_to?(:pointer)
  result = FFI::Buffer.new :pointer
  defaulted = FFI::Buffer.new :long
  unless GetSecurityDescriptorGroup(security_descriptor, result, defaulted)
    Chef::ReservedNames::Win32::Error.raise!
  end

  sid = SID.new(result.read_pointer, security_descriptor)
  defaulted = defaulted.read_char != 0
  [ sid, defaulted ]
end

.get_security_descriptor_owner(security_descriptor) ⇒ Object


299
300
301
302
303
304
305
306
307
308
309
310
# File 'lib/chef/win32/security.rb', line 299

def self.get_security_descriptor_owner(security_descriptor)
  security_descriptor = security_descriptor.pointer if security_descriptor.respond_to?(:pointer)
  result = FFI::Buffer.new :pointer
  defaulted = FFI::Buffer.new :long
  unless GetSecurityDescriptorOwner(security_descriptor, result, defaulted)
    Chef::ReservedNames::Win32::Error.raise!
  end

  sid = SID.new(result.read_pointer, security_descriptor)
  defaulted = defaulted.read_char != 0
  [ sid, defaulted ]
end

.get_security_descriptor_sacl(security_descriptor) ⇒ Object


312
313
314
315
316
317
318
319
320
321
322
# File 'lib/chef/win32/security.rb', line 312

def self.get_security_descriptor_sacl(security_descriptor)
  security_descriptor = security_descriptor.pointer if security_descriptor.respond_to?(:pointer)
  present = FFI::Buffer.new :bool
  defaulted = FFI::Buffer.new :bool
  acl = FFI::Buffer.new :pointer
  unless GetSecurityDescriptorSacl(security_descriptor, present, acl, defaulted)
    Chef::ReservedNames::Win32::Error.raise!
  end
  acl = acl.read_pointer
  [ present.read_char != 0, acl.null? ? nil : ACL.new(acl, security_descriptor), defaulted.read_char != 0 ]
end

.get_token_information_elevation_type(token) ⇒ Object


356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
# File 'lib/chef/win32/security.rb', line 356

def self.get_token_information_elevation_type(token)
  token_result_size = FFI::MemoryPointer.new(:ulong)
  if GetTokenInformation(token.handle.handle, :TokenElevationType, nil, 0, token_result_size)
    raise "Expected ERROR_INSUFFICIENT_BUFFER from GetTokenInformation, and got no error!"
  elsif FFI::LastError.error != ERROR_INSUFFICIENT_BUFFER
    Chef::ReservedNames::Win32::Error.raise!
  end

  info_ptr = FFI::MemoryPointer.new(:pointer)
  token_info_pointer = TOKEN_ELEVATION_TYPE.new info_ptr
  token_info_length = 4
  unless GetTokenInformation(token.handle.handle, :TokenElevationType, token_info_pointer, token_info_length, token_result_size)
    Chef::ReservedNames::Win32::Error.raise!
  end
  token_info_pointer[:ElevationType]
end

.get_token_information_owner(token) ⇒ Object


324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
# File 'lib/chef/win32/security.rb', line 324

def self.get_token_information_owner(token)
  owner_result_size = FFI::MemoryPointer.new(:ulong)
  if GetTokenInformation(token.handle.handle, :TokenOwner, nil, 0, owner_result_size)
    raise "Expected ERROR_INSUFFICIENT_BUFFER from GetTokenInformation, and got no error!"
  elsif FFI::LastError.error != ERROR_INSUFFICIENT_BUFFER
    Chef::ReservedNames::Win32::Error.raise!
  end

  owner_result_storage = FFI::MemoryPointer.new owner_result_size.read_ulong
  unless GetTokenInformation(token.handle.handle, :TokenOwner, owner_result_storage, owner_result_size.read_ulong, owner_result_size)
    Chef::ReservedNames::Win32::Error.raise!
  end
  owner_result = TOKEN_OWNER.new owner_result_storage
  SID.new(owner_result[:Owner], owner_result_storage)
end

.get_token_information_primary_group(token) ⇒ Object


340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
# File 'lib/chef/win32/security.rb', line 340

def self.get_token_information_primary_group(token)
  group_result_size = FFI::MemoryPointer.new(:ulong)
  if GetTokenInformation(token.handle.handle, :TokenPrimaryGroup, nil, 0, group_result_size)
    raise "Expected ERROR_INSUFFICIENT_BUFFER from GetTokenInformation, and got no error!"
  elsif FFI::LastError.error != ERROR_INSUFFICIENT_BUFFER
    Chef::ReservedNames::Win32::Error.raise!
  end

  group_result_storage = FFI::MemoryPointer.new group_result_size.read_ulong
  unless GetTokenInformation(token.handle.handle, :TokenPrimaryGroup, group_result_storage, group_result_size.read_ulong, group_result_size)
    Chef::ReservedNames::Win32::Error.raise!
  end
  group_result = TOKEN_PRIMARY_GROUP.new group_result_storage
  SID.new(group_result[:PrimaryGroup], group_result_storage)
end

.has_admin_privileges?Boolean

Checks if the caller has the admin privileges in their security token

Returns:

  • (Boolean)

653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
# File 'lib/chef/win32/security.rb', line 653

def self.has_admin_privileges?
  # a regular user doesn't have privileges to call Chef::ReservedNames::Win32::Security.OpenProcessToken
  # hence we return false if the open_current_process_token fails with `Access is denied.` error message.
  begin
    process_token = open_current_process_token(TOKEN_READ)
  rescue Exception => run_error
    return false if run_error.message =~ /Access is denied/

    Chef::ReservedNames::Win32::Error.raise!
  end

  # display token elevation details
  token_elevation_type = get_token_information_elevation_type(process_token)
  Chef::Log.trace("Token Elevation Type: #{token_elevation_type}")

  elevation_result = FFI::Buffer.new(:ulong)
  elevation_result_size = FFI::MemoryPointer.new(:uint32)
  success = GetTokenInformation(process_token.handle.handle, :TokenElevation, elevation_result, 4, elevation_result_size)

  # Assume process is not elevated if the call fails.
  # Process is elevated if the result is different than 0.
  success && (elevation_result.read_ulong != 0)
end

.initialize_acl(acl_size) ⇒ Object


373
374
375
376
377
378
379
# File 'lib/chef/win32/security.rb', line 373

def self.initialize_acl(acl_size)
  acl = FFI::MemoryPointer.new acl_size
  unless InitializeAcl(acl, acl_size, ACL_REVISION)
    Chef::ReservedNames::Win32::Error.raise!
  end
  ACL.new(acl)
end

.initialize_security_descriptor(revision = SECURITY_DESCRIPTOR_REVISION) ⇒ Object


381
382
383
384
385
386
387
# File 'lib/chef/win32/security.rb', line 381

def self.initialize_security_descriptor(revision = SECURITY_DESCRIPTOR_REVISION)
  security_descriptor = FFI::MemoryPointer.new SECURITY_DESCRIPTOR_MIN_LENGTH
  unless InitializeSecurityDescriptor(security_descriptor, revision)
    Chef::ReservedNames::Win32::Error.raise!
  end
  SecurityDescriptor.new(security_descriptor)
end

.is_valid_acl(acl) ⇒ Object


389
390
391
392
# File 'lib/chef/win32/security.rb', line 389

def self.is_valid_acl(acl)
  acl = acl.pointer if acl.respond_to?(:pointer)
  IsValidAcl(acl) != 0
end

.is_valid_security_descriptor(security_descriptor) ⇒ Object


394
395
396
397
# File 'lib/chef/win32/security.rb', line 394

def self.is_valid_security_descriptor(security_descriptor)
  security_descriptor = security_descriptor.pointer if security_descriptor.respond_to?(:pointer)
  IsValidSecurityDescriptor(security_descriptor) != 0
end

.is_valid_sid(sid) ⇒ Object


399
400
401
402
# File 'lib/chef/win32/security.rb', line 399

def self.is_valid_sid(sid)
  sid = sid.pointer if sid.respond_to?(:pointer)
  IsValidSid(sid) != 0
end

.logon_user(username, domain, password, logon_type, logon_provider) ⇒ Object


677
678
679
680
681
682
683
684
685
686
687
# File 'lib/chef/win32/security.rb', line 677

def self.logon_user(username, domain, password, logon_type, logon_provider)
  username = wstring(username)
  domain = wstring(domain)
  password = wstring(password)

  token = FFI::Buffer.new(:pointer)
  unless LogonUserW(username, domain, password, logon_type, logon_provider, token)
    Chef::ReservedNames::Win32::Error.raise!
  end
  Token.new(Handle.new(token.read_pointer))
end

.lookup_account_name(name, system_name = nil) ⇒ Object


404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
# File 'lib/chef/win32/security.rb', line 404

def self.(name, system_name = nil)
  # Figure out how big the buffers need to be
  sid_size = FFI::Buffer.new(:long).write_long(0)
  referenced_domain_name_size = FFI::Buffer.new(:long).write_long(0)
  system_name = system_name.to_wstring if system_name
  if LookupAccountNameW(system_name, name.to_wstring, nil, sid_size, nil, referenced_domain_name_size, nil)
    raise "Expected ERROR_INSUFFICIENT_BUFFER from LookupAccountName, and got no error!"
  elsif !([NO_ERROR, ERROR_INSUFFICIENT_BUFFER].include?(FFI::LastError.error))
    Chef::ReservedNames::Win32::Error.raise!
  end

  sid = FFI::MemoryPointer.new :char, sid_size.read_long
  referenced_domain_name = FFI::MemoryPointer.new :char, (referenced_domain_name_size.read_long * 2)
  use = FFI::Buffer.new(:long).write_long(0)
  unless LookupAccountNameW(system_name, name.to_wstring, sid, sid_size, referenced_domain_name, referenced_domain_name_size, use)
    Chef::ReservedNames::Win32::Error.raise!
  end

  [ referenced_domain_name.read_wstring(referenced_domain_name_size.read_long), SID.new(sid), use.read_long ]
end

.lookup_account_sid(sid, system_name = nil) ⇒ Object


425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
# File 'lib/chef/win32/security.rb', line 425

def self.(sid, system_name = nil)
  sid = sid.pointer if sid.respond_to?(:pointer)
  # Figure out how big the buffer needs to be
  name_size = FFI::Buffer.new(:long).write_long(0)
  referenced_domain_name_size = FFI::Buffer.new(:long).write_long(0)
  system_name = system_name.to_wstring if system_name
  if LookupAccountSidW(system_name, sid, nil, name_size, nil, referenced_domain_name_size, nil)
    raise "Expected ERROR_INSUFFICIENT_BUFFER from LookupAccountSid, and got no error!"
  elsif FFI::LastError.error != ERROR_INSUFFICIENT_BUFFER
    Chef::ReservedNames::Win32::Error.raise!
  end

  name = FFI::MemoryPointer.new :char, (name_size.read_long * 2)
  referenced_domain_name = FFI::MemoryPointer.new :char, (referenced_domain_name_size.read_long * 2)
  use = FFI::Buffer.new(:long).write_long(0)
  unless LookupAccountSidW(system_name, sid, name, name_size, referenced_domain_name, referenced_domain_name_size, use)
    Chef::ReservedNames::Win32::Error.raise!
  end

  [ referenced_domain_name.read_wstring(referenced_domain_name_size.read_long), name.read_wstring(name_size.read_long), use.read_long ]
end

.lookup_privilege_display_name(system_name, name) ⇒ Object


464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
# File 'lib/chef/win32/security.rb', line 464

def self.lookup_privilege_display_name(system_name, name)
  system_name = system_name.to_wstring if system_name
  display_name_size = FFI::Buffer.new(:long).write_long(0)
  language_id = FFI::Buffer.new(:long)
  if LookupPrivilegeDisplayNameW(system_name, name.to_wstring, nil, display_name_size, language_id)
    raise "Expected ERROR_INSUFFICIENT_BUFFER from LookupPrivilegeDisplayName, and got no error!"
  elsif FFI::LastError.error != ERROR_INSUFFICIENT_BUFFER
    Chef::ReservedNames::Win32::Error.raise!
  end

  display_name = FFI::MemoryPointer.new :char, (display_name_size.read_long * 2)
  unless LookupPrivilegeDisplayNameW(system_name, name.to_wstring, display_name, display_name_size, language_id)
    Chef::ReservedNames::Win32::Error.raise!
  end

  [ display_name.read_wstring(display_name_size.read_long), language_id.read_long ]
end

.lookup_privilege_name(system_name, luid) ⇒ Object


447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
# File 'lib/chef/win32/security.rb', line 447

def self.lookup_privilege_name(system_name, luid)
  system_name = system_name.to_wstring if system_name
  name_size = FFI::Buffer.new(:long).write_long(0)
  if LookupPrivilegeNameW(system_name, luid, nil, name_size)
    raise "Expected ERROR_INSUFFICIENT_BUFFER from LookupPrivilegeName, and got no error!"
  elsif FFI::LastError.error != ERROR_INSUFFICIENT_BUFFER
    Chef::ReservedNames::Win32::Error.raise!
  end

  name = FFI::MemoryPointer.new :char, (name_size.read_long * 2)
  unless LookupPrivilegeNameW(system_name, luid, name, name_size)
    Chef::ReservedNames::Win32::Error.raise!
  end

  name.read_wstring(name_size.read_long)
end

.lookup_privilege_value(system_name, name) ⇒ Object


482
483
484
485
486
487
488
489
# File 'lib/chef/win32/security.rb', line 482

def self.lookup_privilege_value(system_name, name)
  luid = FFI::Buffer.new(:uint64).write_uint64(0)
  system_name = system_name.to_wstring if system_name
  unless LookupPrivilegeValueW(system_name, name.to_wstring, luid)
    Win32::Error.raise!
  end
  luid.read_uint64
end

.make_absolute_sd(security_descriptor) ⇒ Object


491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
# File 'lib/chef/win32/security.rb', line 491

def self.make_absolute_sd(security_descriptor)
  security_descriptor = security_descriptor.pointer if security_descriptor.respond_to?(:pointer)

  # Figure out buffer sizes
  absolute_sd_size = FFI::Buffer.new(:long).write_long(0)
  dacl_size = FFI::Buffer.new(:long).write_long(0)
  sacl_size = FFI::Buffer.new(:long).write_long(0)
  owner_size = FFI::Buffer.new(:long).write_long(0)
  group_size = FFI::Buffer.new(:long).write_long(0)
  if MakeAbsoluteSD(security_descriptor, nil, absolute_sd_size, nil, dacl_size, nil, sacl_size, nil, owner_size, nil, group_size)
    raise "Expected ERROR_INSUFFICIENT_BUFFER from MakeAbsoluteSD, and got no error!"
  elsif FFI::LastError.error != ERROR_INSUFFICIENT_BUFFER
    Chef::ReservedNames::Win32::Error.raise!
  end

  absolute_sd = FFI::MemoryPointer.new absolute_sd_size.read_long
  owner = FFI::MemoryPointer.new owner_size.read_long
  group = FFI::MemoryPointer.new group_size.read_long
  dacl = FFI::MemoryPointer.new dacl_size.read_long
  sacl = FFI::MemoryPointer.new sacl_size.read_long
  unless MakeAbsoluteSD(security_descriptor, absolute_sd, absolute_sd_size, dacl, dacl_size, sacl, sacl_size, owner, owner_size, group, group_size)
    Chef::ReservedNames::Win32::Error.raise!
  end

  [ SecurityDescriptor.new(absolute_sd), SID.new(owner), SID.new(group), ACL.new(dacl), ACL.new(sacl) ]
end

.open_current_process_token(desired_access = TOKEN_READ) ⇒ Object


518
519
520
# File 'lib/chef/win32/security.rb', line 518

def self.open_current_process_token(desired_access = TOKEN_READ)
  open_process_token(Chef::ReservedNames::Win32::Process.get_current_process, desired_access)
end

.open_process_token(process, desired_access) ⇒ Object


522
523
524
525
526
527
528
529
530
# File 'lib/chef/win32/security.rb', line 522

def self.open_process_token(process, desired_access)
  process = process.handle if process.respond_to?(:handle)
  process = process.handle if process.respond_to?(:handle)
  token = FFI::Buffer.new(:ulong)
  unless OpenProcessToken(process, desired_access, token)
    Chef::ReservedNames::Win32::Error.raise!
  end
  Token.new(Handle.new(token.read_ulong))
end

.query_security_access_mask(security_information) ⇒ Object


532
533
534
535
536
# File 'lib/chef/win32/security.rb', line 532

def self.query_security_access_mask(security_information)
  result = FFI::Buffer.new(:long)
  QuerySecurityAccessMask(security_information, result)
  result.read_long
end

.remove_account_right(name, privilege) ⇒ Object


120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/chef/win32/security.rb', line 120

def self.(name, privilege)
  privilege_pointer = FFI::MemoryPointer.new LSA_UNICODE_STRING, 1
  privilege_lsa_string = LSA_UNICODE_STRING.new(privilege_pointer)
  privilege_lsa_string[:Buffer] = FFI::MemoryPointer.from_string(privilege.to_wstring)
  privilege_lsa_string[:Length] = privilege.length * 2
  privilege_lsa_string[:MaximumLength] = (privilege.length + 1) * 2

  with_lsa_policy(name) do |policy_handle, sid|
    result = LsaRemoveAccountRights(policy_handle.read_pointer, sid, false, privilege_pointer, 1)
    test_and_raise_lsa_nt_status(result)
  end
end

.set_file_security(path, security_information, security_descriptor) ⇒ Object


538
539
540
541
542
543
# File 'lib/chef/win32/security.rb', line 538

def self.set_file_security(path, security_information, security_descriptor)
  security_descriptor = security_descriptor.pointer if security_descriptor.respond_to?(:pointer)
  unless SetFileSecurityW(path.to_wstring, security_information, security_descriptor)
    Chef::ReservedNames::Win32::Error.raise!
  end
end

.set_named_security_info(path, type, args) ⇒ Object


545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
# File 'lib/chef/win32/security.rb', line 545

def self.set_named_security_info(path, type, args)
  owner = args[:owner]
  group = args[:group]
  dacl = args[:dacl]
  sacl = args[:sacl]
  owner = owner.pointer if owner && owner.respond_to?(:pointer)
  group = group.pointer if group && group.respond_to?(:pointer)
  dacl = dacl.pointer if dacl && dacl.respond_to?(:pointer)
  sacl = sacl.pointer if sacl && sacl.respond_to?(:pointer)

  # Determine the security_information flags
  security_information = 0
  security_information |= OWNER_SECURITY_INFORMATION if args.key?(:owner)
  security_information |= GROUP_SECURITY_INFORMATION if args.key?(:group)
  security_information |= DACL_SECURITY_INFORMATION if args.key?(:dacl)
  security_information |= SACL_SECURITY_INFORMATION if args.key?(:sacl)
  if args.key?(:dacl_inherits)
    security_information |= (args[:dacl_inherits] ? UNPROTECTED_DACL_SECURITY_INFORMATION : PROTECTED_DACL_SECURITY_INFORMATION)
  end
  if args.key?(:sacl_inherits)
    security_information |= (args[:sacl_inherits] ? UNPROTECTED_SACL_SECURITY_INFORMATION : PROTECTED_SACL_SECURITY_INFORMATION)
  end

  hr = SetNamedSecurityInfoW(path.to_wstring, type, security_information, owner, group, dacl, sacl)
  if hr != ERROR_SUCCESS
    Chef::ReservedNames::Win32::Error.raise! nil, hr
  end
end

.set_security_access_mask(security_information) ⇒ Object


574
575
576
577
578
# File 'lib/chef/win32/security.rb', line 574

def self.set_security_access_mask(security_information)
  result = FFI::Buffer.new(:long)
  SetSecurityAccessMask(security_information, result)
  result.read_long
end

.set_security_descriptor_group(security_descriptor, sid, defaulted = false) ⇒ Object


590
591
592
593
594
595
596
597
# File 'lib/chef/win32/security.rb', line 590

def self.set_security_descriptor_group(security_descriptor, sid, defaulted = false)
  security_descriptor = security_descriptor.pointer if security_descriptor.respond_to?(:pointer)
  sid = sid.pointer if sid.respond_to?(:pointer)

  unless SetSecurityDescriptorGroup(security_descriptor, sid, defaulted)
    Chef::ReservedNames::Win32::Error.raise!
  end
end

.set_security_descriptor_owner(security_descriptor, sid, defaulted = false) ⇒ Object


599
600
601
602
603
604
605
606
# File 'lib/chef/win32/security.rb', line 599

def self.set_security_descriptor_owner(security_descriptor, sid, defaulted = false)
  security_descriptor = security_descriptor.pointer if security_descriptor.respond_to?(:pointer)
  sid = sid.pointer if sid.respond_to?(:pointer)

  unless SetSecurityDescriptorOwner(security_descriptor, sid, defaulted)
    Chef::ReservedNames::Win32::Error.raise!
  end
end

.set_security_descriptor_sacl(security_descriptor, acl, defaulted = false, present = nil) ⇒ Object


608
609
610
611
612
613
614
615
616
# File 'lib/chef/win32/security.rb', line 608

def self.set_security_descriptor_sacl(security_descriptor, acl, defaulted = false, present = nil)
  security_descriptor = security_descriptor.pointer if security_descriptor.respond_to?(:pointer)
  acl = acl.pointer if acl.respond_to?(:pointer)
  present = !security_descriptor.null? if present.nil?

  unless SetSecurityDescriptorSacl(security_descriptor, present, acl, defaulted)
    Chef::ReservedNames::Win32::Error.raise!
  end
end

.test_and_raise_lsa_nt_status(result) ⇒ Object


689
690
691
692
693
694
# File 'lib/chef/win32/security.rb', line 689

def self.test_and_raise_lsa_nt_status(result)
  win32_error = LsaNtStatusToWinError(result)
  if win32_error != 0
    Chef::ReservedNames::Win32::Error.raise!(nil, win32_error)
  end
end

.with_lsa_policy(username) ⇒ Object


618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
# File 'lib/chef/win32/security.rb', line 618

def self.with_lsa_policy(username)
  sid = (username)[1]

  access = 0
  access |= POLICY_CREATE_ACCOUNT
  access |= POLICY_LOOKUP_NAMES

  policy_handle = FFI::MemoryPointer.new(:pointer)
  result = LsaOpenPolicy(nil, LSA_OBJECT_ATTRIBUTES.new, access, policy_handle)
  test_and_raise_lsa_nt_status(result)

  begin
    yield policy_handle, sid.pointer
  ensure
    result = LsaClose(policy_handle.read_pointer)
    test_and_raise_lsa_nt_status(result)
  end
end

.with_privileges(*privilege_names) ⇒ Object


637
638
639
640
641
642
643
644
645
646
647
648
649
# File 'lib/chef/win32/security.rb', line 637

def self.with_privileges(*privilege_names)
  # Set privileges
  token = open_current_process_token(TOKEN_READ | TOKEN_ADJUST_PRIVILEGES)
  old_privileges = token.enable_privileges(*privilege_names)

  # Let the caller do their privileged stuff
  begin
    yield
  ensure
    # Set privileges back to what they were before
    token.adjust_privileges(old_privileges)
  end
end

Instance Method Details

#set_security_descriptor_dacl(security_descriptor, acl, defaulted = false, present = nil) ⇒ Object


580
581
582
583
584
585
586
587
588
# File 'lib/chef/win32/security.rb', line 580

def set_security_descriptor_dacl(security_descriptor, acl, defaulted = false, present = nil)
  security_descriptor = security_descriptor.pointer if security_descriptor.respond_to?(:pointer)
  acl = acl.pointer if acl.respond_to?(:pointer)
  present = !security_descriptor.null? if present.nil?

  unless SetSecurityDescriptorDacl(security_descriptor, present, acl, defaulted)
    Chef::ReservedNames::Win32::Error.raise!
  end
end