EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Callback File System Questions

Also by EldoS: BizCrypto
Components for BizTalk® and SQL Server® Integration Services that let you securely store and transfer information in your business automation solutions.
#11984
Posted: 12/24/2009 03:44:40
by Volodymyr Zinin (EldoS Corp.)

Here is a listing of the function that does the error conversion.

Code
NTSTATUS
Error2NtStatus(
    IN ULONG Win32ErrorCode              
    )
{
    switch(Win32ErrorCode)
    {
    case ERROR_SUCCESS:
        return STATUS_SUCCESS;

    case ERROR_ACCESS_DENIED:
        return STATUS_ACCESS_DENIED;
        
    case ERROR_NOACCESS:
        return STATUS_ACCESS_VIOLATION;

    case ERROR_NOT_SUPPORTED:
        return STATUS_NOT_SUPPORTED;

    case ERROR_INVALID_PARAMETER:
        return STATUS_INVALID_PARAMETER;

    case ERROR_INVALID_HANDLE:
        return STATUS_INVALID_HANDLE;

    case ERROR_NOT_LOCKED:
        return STATUS_NOT_LOCKED;

    case ERROR_NO_SYSTEM_RESOURCES:
        return STATUS_INSUFFICIENT_RESOURCES;

    case ERROR_NOT_ENOUGH_MEMORY:
        return STATUS_NO_MEMORY;                        

    case ERROR_MORE_DATA:
        return STATUS_BUFFER_OVERFLOW;

    case ERROR_INSUFFICIENT_BUFFER:
        return STATUS_BUFFER_TOO_SMALL;
        
    case ERROR_NO_MORE_FILES:
        return STATUS_NO_MORE_FILES;

    case ERROR_FILE_NOT_FOUND:    
        return STATUS_NO_SUCH_FILE;

    case ERROR_INVALID_FUNCTION:
        return STATUS_NOT_SUPPORTED;

    case ERROR_CALL_NOT_IMPLEMENTED:
        return STATUS_NOT_IMPLEMENTED;

    case ERROR_HANDLE_EOF:
        return STATUS_END_OF_FILE;

    case ERROR_INVALID_NAME:
        return STATUS_OBJECT_NAME_INVALID;

    case ERROR_DISK_FULL:
        return STATUS_DISK_FULL;

    case ERROR_DISK_CORRUPT:
        return STATUS_DISK_CORRUPT_ERROR;

    case ERROR_BAD_COMMAND:
        return STATUS_INVALID_DEVICE_STATE;

    case ERROR_FILE_EXISTS:
        return STATUS_OBJECT_NAME_COLLISION;

    case ERROR_ALREADY_EXISTS:
        return STATUS_OBJECT_NAME_COLLISION;

    case ERROR_CANNOT_MAKE:
        return STATUS_CANNOT_MAKE;

    case ERROR_PROC_NOT_FOUND:
        return STATUS_PROCEDURE_NOT_FOUND;

    case ERROR_OPERATION_ABORTED:
        return STATUS_CANCELLED;

    case ERROR_IO_DEVICE:
    case TYPE_E_IOERROR:
        return STATUS_IO_DEVICE_ERROR;

    case ERROR_BAD_UNIT:
        return STATUS_NO_SUCH_DEVICE; //STATUS_DEVICE_DOES_NOT_EXIST

    case ERROR_BAD_ARGUMENTS:
        return STATUS_INVALID_PARAMETER;

    case ERROR_BAD_EXE_FORMAT:
        return STATUS_INVALID_IMAGE_FORMAT;

    case ERROR_WAIT_NO_CHILDREN:
        return STATUS_NOT_FOUND;

    case ERROR_RETRY:
        return STATUS_RETRY;

    case ERROR_INVALID_ADDRESS:
        return STATUS_CONFLICTING_ADDRESSES;

    case ERROR_BUSY:
        return STATUS_DEVICE_BUSY;

    case ERROR_DIRECTORY:
        return STATUS_NOT_A_DIRECTORY;

    case ERROR_TOO_MANY_OPEN_FILES:
        return STATUS_TOO_MANY_OPENED_FILES;

    case ERROR_EA_TABLE_FULL:
        return STATUS_EA_TOO_LARGE;

    case ERROR_FILE_INVALID:
        return STATUS_FILE_INVALID;

    case ERROR_CONNECTION_UNAVAIL:
        return STATUS_CONNECTION_DISCONNECTED; //STATUS_DFS_UNAVAILABLE                  

    case ERROR_TOO_MANY_LINKS:
        return STATUS_TOO_MANY_LINKS;

    case ERROR_BROKEN_PIPE:
        return STATUS_PIPE_BROKEN;

    case ERROR_ARITHMETIC_OVERFLOW:
        return STATUS_INTEGER_OVERFLOW;

    case ERROR_POSSIBLE_DEADLOCK:
        return STATUS_POSSIBLE_DEADLOCK;

    case ERROR_BUFFER_OVERFLOW:
        return STATUS_NAME_TOO_LONG;

    case ERROR_TOO_MANY_SEMAPHORES:
        return STATUS_INSUFFICIENT_RESOURCES;

    case ERROR_DIR_NOT_EMPTY:
        return STATUS_DIRECTORY_NOT_EMPTY;

    case ERROR_PATH_NOT_FOUND:
        return STATUS_OBJECT_PATH_NOT_FOUND;

    case ERROR_ARENA_TRASHED:
        return STATUS_DISK_CORRUPT_ERROR;

    case ERROR_INVALID_BLOCK:
        return STATUS_INVALID_ADDRESS;

    case ERROR_BAD_ENVIRONMENT:
        return STATUS_VARIABLE_NOT_FOUND;

    case ERROR_SHARING_VIOLATION:
        return STATUS_SHARING_VIOLATION;

    case ERROR_FILENAME_EXCED_RANGE:
        return STATUS_NAME_TOO_LONG;

    case ERROR_NOT_READY:
        return STATUS_DEVICE_NOT_READY; //or STATUS_NO_MEDIA_IN_DEVICE, STATUS_VOLUME_DISMOUNTED

    case ERROR_FILE_OFFLINE:
        return STATUS_FILE_IS_OFFLINE;    

    case ERROR_REMOTE_STORAGE_NOT_ACTIVE:
        return STATUS_REMOTE_STORAGE_NOT_ACTIVE;

    //
    // Winsock errors
    //

    case WSAEINTR:
        return STATUS_CANCELLED;

    case WSAEBADF:
        return STATUS_INVALID_HANDLE;

    case WSATRY_AGAIN:
        return STATUS_RETRY;


    default:
        return STATUS_UNSUCCESSFUL;
    }
}
#11985
Posted: 12/24/2009 04:21:16
by Takhir Bedertdinov (Premium support level)
Joined: 12/11/2009
Posts: 14

Thanks, Vladimir,
file_offline may be even better for file operations. Fixed :)
c:\pscp>copy Y:\level_01_dir_0000\file_0000_type_offset.dat .
The remote storage service was not able to recall the file.
0 file(s) copied.

Reply

Statistics

Topic viewed 24357 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!