gh-81927: Provide Windows predefined access type constants#20617
gh-81927: Provide Windows predefined access type constants#20617ZackerySpytz wants to merge 9 commits intopython:mainfrom
Conversation
|
This draft PR adds an |
| SET(ERROR_PIPE_BUSY); | ||
| SET(ERROR_PIPE_CONNECTED); | ||
| SET(ERROR_SEM_TIMEOUT); | ||
| #undef SET |
There was a problem hiding this comment.
The following error codes are listed twice: ERROR_MORE_DATA, ERROR_NETNAME_DELETED, and ERROR_NO_SYSTEM_RESOURCES.
I'd also add the following common codes. Most of these have an explicit errno mapping, but usually several codes map to the same errno value.
SET(ERROR_GEN_FAILURE);
SET(ERROR_INVALID_FUNCTION);
SET(ERROR_NOT_SUPPORTED);
SET(ERROR_INVALID_PARAMETER);
SET(ERROR_INVALID_HANDLE);
SET(ERROR_INVALID_NAME);
SET(ERROR_BAD_NET_NAME);
SET(ERROR_BAD_PATHNAME);
SET(ERROR_FILENAME_EXCED_RANGE);
SET(ERROR_FILE_NOT_FOUND);
SET(ERROR_PATH_NOT_FOUND);
SET(ERROR_BAD_NETPATH);
SET(ERROR_NO_MORE_FILES);
SET(ERROR_FILE_EXISTS);
SET(ERROR_NOT_SAME_DEVICE);
SET(ERROR_DIRECTORY);
SET(ERROR_TOO_MANY_OPEN_FILES);
SET(ERROR_DISK_FULL);
SET(ERROR_DIR_NOT_EMPTY);
SET(ERROR_CANT_ACCESS_FILE);
SET(ERROR_CANT_RESOLVE_FILENAME);
SET(ERROR_NOT_A_REPARSE_POINT);
SET(ERROR_INVALID_REPARSE_DATA);
SET(ERROR_REPARSE_TAG_INVALID);
SET(ERROR_ACCESS_DENIED);
SET(ERROR_NETWORK_ACCESS_DENIED);
SET(ERROR_SHARING_VIOLATION);
SET(ERROR_LOCK_VIOLATION);
SET(ERROR_NOT_READY);
SET(ERROR_NOT_LOCKED);
SET(ERROR_LOCK_FAILED);
SET(ERROR_BAD_EXE_FORMAT);
SET(ERROR_NOT_ENOUGH_MEMORY);
SET(ERROR_NOT_ENOUGH_QUOTA);There was a problem hiding this comment.
Here are few more error codes to consider:
SET(ERROR_BAD_PIPE);
SET(ERROR_PIPE_NOT_CONNECTED);
SET(ERROR_PIPE_LISTENING);
SET(ERROR_ELEVATION_REQUIRED);
SET(ERROR_PRIVILEGE_NOT_HELD);
SET(ERROR_SYMLINK_CLASS_DISABLED);ERROR_BAD_PIPEis from NTSTATUS_INVALID_PIPE_STATEorSTATUS_INVALID_READ_MODE.ERROR_ELEVATION_REQUIREDis returned byCreateProcessWif an executable requires elevation (e.g. regedit.exe or osk.exe). It can be handled by callingShellExecute[Ex]Wwith the "runas" verb.ERROR_PRIVILEGE_NOT_HELDmeans the caller lacks a required privilege, or in some cases that the privilege isn't enabled.ERROR_SYMLINK_CLASS_DISABLEDmeans the system's L2L (local to local) symlink policy has disabled evaluation of local symlinks that target local paths. If the L2R (local to remote), R2L, or R2R policy is disabled,ERROR_NETWORK_ACCESS_DENIEDis set instead. The link can be resolved manually viaos.readlink, but doing so violates system policy.
For checking exit status, here are some abnormal-termination status codes. This includes process initialization failures, unhandled exceptions, and unhandled console control events (Ctrl+C, Ctrl+Break, Ctrl+Close). Other than for testing purposes or providing a friendlier error message, usually there's nothing to handle in these cases.
SET(STATUS_ENTRYPOINT_NOT_FOUND);
SET(STATUS_DLL_NOT_FOUND);
SET(STATUS_ORDINAL_NOT_FOUND);
SET(STATUS_DLL_INIT_FAILED);
SET(STATUS_ACCESS_VIOLATION);
SET(STATUS_HEAP_CORRUPTION);
SET(STATUS_STACK_BUFFER_OVERRUN);
SET(STATUS_STACK_OVERFLOW);
SET(STATUS_ILLEGAL_INSTRUCTION);
SET(STATUS_PRIVILEGED_INSTRUCTION);
SET(STATUS_CONTROL_C_EXIT);STATUS_STACK_BUFFER_OVERRUN (0xC000_0409) is also used by the fastfail intrinsic, e.g. os.abort(). The reason for the fastfail is included in the exception record and the corresponding Windows Error Reporting event in the application event log -- e.g. FAST_FAIL_FATAL_APP_EXIT (7) for an abort.
If the process is still running, the status is STATUS_PENDING. In the Windows API it's the same value aliased as STILL_ACTIVE:
SET(STATUS_PENDING);
SET(STILL_ACTIVE);| SET(STANDARD_RIGHTS_EXECUTE); | ||
| SET(STANDARD_RIGHTS_ALL); | ||
| SET(SPECIFIC_RIGHTS_ALL); | ||
| consts = _PyNamespace_New(d); |
There was a problem hiding this comment.
This should also include generic rights and the access-system right:
SET(GENERIC_READ);
SET(GENERIC_WRITE);
SET(GENERIC_EXECUTE);
SET(GENERIC_ALL);
SET(MAXIMUM_ALLOWED);
SET(ACCESS_SYSTEM_SECURITY);The generic file mappings are also common for testing access:
SET(FILE_GENERIC_READ);
SET(FILE_GENERIC_WRITE);
SET(FILE_GENERIC_EXECUTE);
SET(FILE_ALL_ACCESS);|
This PR is stale because it has been open for 30 days with no activity. |
https://bugs.python.org/issue37746