Commit cb1fc735 authored by Alexandre Julliard's avatar Alexandre Julliard

Changed the server to return STATUS_* error codes.

parent 2646fb60
......@@ -127,6 +127,13 @@ static inline DWORD copy_nameAtoW( LPWSTR dest, LPCSTR name )
return ERROR_SUCCESS;
}
/* do a server call without setting the last error code */
static inline int reg_server_call( enum request req )
{
unsigned int res = server_call_noerr( req );
if (res) res = RtlNtStatusToDosError(res);
return res;
}
/******************************************************************************
* RegCreateKeyExW [ADVAPI32.131]
......@@ -166,7 +173,7 @@ DWORD WINAPI RegCreateKeyExW( HKEY hkey, LPCWSTR name, DWORD reserved, LPWSTR cl
if (req->name[0] == '\\') return ERROR_BAD_PATHNAME;
lstrcpynW( req->class, class ? class : (LPWSTR)"\0\0",
server_remaining(req->class) / sizeof(WCHAR) );
if ((ret = server_call_noerr( REQ_CREATE_KEY )) == ERROR_SUCCESS)
if ((ret = reg_server_call( REQ_CREATE_KEY )) == ERROR_SUCCESS)
{
*retkey = req->hkey;
if (dispos) *dispos = req->created ? REG_CREATED_NEW_KEY : REG_OPENED_EXISTING_KEY;
......@@ -199,7 +206,7 @@ DWORD WINAPI RegCreateKeyExA( HKEY hkey, LPCSTR name, DWORD reserved, LPSTR clas
if (req->name[0] == '\\') return ERROR_BAD_PATHNAME;
lstrcpynAtoW( req->class, class ? class : "",
server_remaining(req->class) / sizeof(WCHAR) );
if ((ret = server_call_noerr( REQ_CREATE_KEY )) == ERROR_SUCCESS)
if ((ret = reg_server_call( REQ_CREATE_KEY )) == ERROR_SUCCESS)
{
*retkey = req->hkey;
if (dispos) *dispos = req->created ? REG_CREATED_NEW_KEY : REG_OPENED_EXISTING_KEY;
......@@ -266,7 +273,7 @@ DWORD WINAPI RegOpenKeyExW( HKEY hkey, LPCWSTR name, DWORD reserved, REGSAM acce
req->access = access;
if ((ret = copy_nameW( req->name, name )) != ERROR_SUCCESS) return ret;
if (req->name[0] == '\\') return ERROR_BAD_PATHNAME;
if ((ret = server_call_noerr( REQ_OPEN_KEY )) == ERROR_SUCCESS) *retkey = req->hkey;
if ((ret = reg_server_call( REQ_OPEN_KEY )) == ERROR_SUCCESS) *retkey = req->hkey;
return ret;
}
......@@ -288,7 +295,7 @@ DWORD WINAPI RegOpenKeyExA( HKEY hkey, LPCSTR name, DWORD reserved, REGSAM acces
req->access = access;
if ((ret = copy_nameAtoW( req->name, name )) != ERROR_SUCCESS) return ret;
if (req->name[0] == '\\') return ERROR_BAD_PATHNAME;
if ((ret = server_call_noerr( REQ_OPEN_KEY )) == ERROR_SUCCESS) *retkey = req->hkey;
if ((ret = reg_server_call( REQ_OPEN_KEY )) == ERROR_SUCCESS) *retkey = req->hkey;
return ret;
}
......@@ -350,7 +357,7 @@ DWORD WINAPI RegEnumKeyExW( HKEY hkey, DWORD index, LPWSTR name, LPDWORD name_le
req->hkey = hkey;
req->index = index;
if ((ret = server_call_noerr( REQ_ENUM_KEY )) != ERROR_SUCCESS) return ret;
if ((ret = reg_server_call( REQ_ENUM_KEY )) != ERROR_SUCCESS) return ret;
len = lstrlenW( req->name ) + 1;
cls_len = lstrlenW( req->class ) + 1;
......@@ -385,7 +392,7 @@ DWORD WINAPI RegEnumKeyExA( HKEY hkey, DWORD index, LPSTR name, LPDWORD name_len
req->hkey = hkey;
req->index = index;
if ((ret = server_call_noerr( REQ_ENUM_KEY )) != ERROR_SUCCESS) return ret;
if ((ret = reg_server_call( REQ_ENUM_KEY )) != ERROR_SUCCESS) return ret;
len = lstrlenW( req->name ) + 1;
cls_len = lstrlenW( req->class ) + 1;
......@@ -460,7 +467,7 @@ DWORD WINAPI RegQueryInfoKeyW( HKEY hkey, LPWSTR class, LPDWORD class_len, LPDWO
return ERROR_INVALID_PARAMETER;
req->hkey = hkey;
if ((ret = server_call_noerr( REQ_QUERY_KEY_INFO )) != ERROR_SUCCESS) return ret;
if ((ret = reg_server_call( REQ_QUERY_KEY_INFO )) != ERROR_SUCCESS) return ret;
if (class)
{
......@@ -502,7 +509,7 @@ DWORD WINAPI RegQueryInfoKeyA( HKEY hkey, LPSTR class, LPDWORD class_len, LPDWOR
return ERROR_INVALID_PARAMETER;
req->hkey = hkey;
if ((ret = server_call_noerr( REQ_QUERY_KEY_INFO )) != ERROR_SUCCESS) return ret;
if ((ret = reg_server_call( REQ_QUERY_KEY_INFO )) != ERROR_SUCCESS) return ret;
if (class)
{
......@@ -542,7 +549,7 @@ DWORD WINAPI RegCloseKey( HKEY hkey )
struct close_key_request *req = get_req_buffer();
TRACE( "(0x%x)\n", hkey );
req->hkey = hkey;
return server_call_noerr( REQ_CLOSE_KEY );
return reg_server_call( REQ_CLOSE_KEY );
}
......@@ -567,7 +574,7 @@ DWORD WINAPI RegDeleteKeyW( HKEY hkey, LPCWSTR name )
req->hkey = hkey;
if ((ret = copy_nameW( req->name, name )) != ERROR_SUCCESS) return ret;
if (req->name[0] == '\\') return ERROR_BAD_PATHNAME;
return server_call_noerr( REQ_DELETE_KEY );
return reg_server_call( REQ_DELETE_KEY );
}
......@@ -584,7 +591,7 @@ DWORD WINAPI RegDeleteKeyA( HKEY hkey, LPCSTR name )
req->hkey = hkey;
if ((ret = copy_nameAtoW( req->name, name )) != ERROR_SUCCESS) return ret;
if (req->name[0] == '\\') return ERROR_BAD_PATHNAME;
return server_call_noerr( REQ_DELETE_KEY );
return reg_server_call( REQ_DELETE_KEY );
}
......@@ -633,7 +640,7 @@ DWORD WINAPI RegSetValueExW( HKEY hkey, LPCWSTR name, DWORD reserved,
req->len = count;
if ((ret = copy_nameW( req->name, name )) != ERROR_SUCCESS) return ret;
memcpy( req->data, data, count );
return server_call_noerr( REQ_SET_KEY_VALUE );
return reg_server_call( REQ_SET_KEY_VALUE );
}
......@@ -671,7 +678,7 @@ DWORD WINAPI RegSetValueExA( HKEY hkey, LPCSTR name, DWORD reserved, DWORD type,
req->type = type;
req->len = count;
if ((ret = copy_nameAtoW( req->name, name )) != ERROR_SUCCESS) return ret;
return server_call_noerr( REQ_SET_KEY_VALUE );
return reg_server_call( REQ_SET_KEY_VALUE );
}
......@@ -755,7 +762,7 @@ DWORD WINAPI RegQueryValueExW( HKEY hkey, LPCWSTR name, LPDWORD reserved, LPDWOR
req->hkey = hkey;
if ((ret = copy_nameW( req->name, name )) != ERROR_SUCCESS) return ret;
if ((ret = server_call_noerr( REQ_GET_KEY_VALUE )) == ERROR_SUCCESS)
if ((ret = reg_server_call( REQ_GET_KEY_VALUE )) == ERROR_SUCCESS)
{
if (type) *type = req->type;
ret = copy_data( data, req->data, req->len, count, req->type );
......@@ -783,7 +790,7 @@ DWORD WINAPI RegQueryValueExA( HKEY hkey, LPCSTR name, LPDWORD reserved, LPDWORD
req->hkey = hkey;
if ((ret = copy_nameAtoW( req->name, name )) != ERROR_SUCCESS) return ret;
if ((ret = server_call_noerr( REQ_GET_KEY_VALUE )) == ERROR_SUCCESS)
if ((ret = reg_server_call( REQ_GET_KEY_VALUE )) == ERROR_SUCCESS)
{
if (type) *type = req->type;
ret = copy_data_WtoA( data, req->data, req->len, count, req->type );
......@@ -874,7 +881,7 @@ DWORD WINAPI RegEnumValueW( HKEY hkey, DWORD index, LPWSTR value, LPDWORD val_co
req->hkey = hkey;
req->index = index;
if ((ret = server_call_noerr( REQ_ENUM_KEY_VALUE )) != ERROR_SUCCESS) return ret;
if ((ret = reg_server_call( REQ_ENUM_KEY_VALUE )) != ERROR_SUCCESS) return ret;
len = lstrlenW( req->name ) + 1;
if (len > *val_count) return ERROR_MORE_DATA;
......@@ -903,7 +910,7 @@ DWORD WINAPI RegEnumValueA( HKEY hkey, DWORD index, LPSTR value, LPDWORD val_cou
req->hkey = hkey;
req->index = index;
if ((ret = server_call_noerr( REQ_ENUM_KEY_VALUE )) != ERROR_SUCCESS) return ret;
if ((ret = reg_server_call( REQ_ENUM_KEY_VALUE )) != ERROR_SUCCESS) return ret;
len = lstrlenW( req->name ) + 1;
if (len > *val_count) return ERROR_MORE_DATA;
......@@ -935,7 +942,7 @@ DWORD WINAPI RegDeleteValueW( HKEY hkey, LPCWSTR name )
req->hkey = hkey;
if ((ret = copy_nameW( req->name, name )) != ERROR_SUCCESS) return ret;
return server_call_noerr( REQ_DELETE_KEY_VALUE );
return reg_server_call( REQ_DELETE_KEY_VALUE );
}
......@@ -951,7 +958,7 @@ DWORD WINAPI RegDeleteValueA( HKEY hkey, LPCSTR name )
req->hkey = hkey;
if ((ret = copy_nameAtoW( req->name, name )) != ERROR_SUCCESS) return ret;
return server_call_noerr( REQ_DELETE_KEY_VALUE );
return reg_server_call( REQ_DELETE_KEY_VALUE );
}
......@@ -983,7 +990,7 @@ LONG WINAPI RegLoadKeyW( HKEY hkey, LPCWSTR subkey, LPCWSTR filename )
req->hkey = hkey;
req->file = file;
if ((ret = copy_nameW( req->name, subkey )) != ERROR_SUCCESS) goto done;
ret = server_call_noerr( REQ_LOAD_REGISTRY );
ret = reg_server_call( REQ_LOAD_REGISTRY );
CloseHandle( file );
done:
......@@ -1015,7 +1022,7 @@ LONG WINAPI RegLoadKeyA( HKEY hkey, LPCSTR subkey, LPCSTR filename )
req->hkey = hkey;
req->file = file;
if ((ret = copy_nameAtoW( req->name, subkey )) != ERROR_SUCCESS) goto done;
ret = server_call_noerr( REQ_LOAD_REGISTRY );
ret = reg_server_call( REQ_LOAD_REGISTRY );
CloseHandle( file );
done:
......@@ -1058,7 +1065,7 @@ LONG WINAPI RegSaveKeyA( HKEY hkey, LPCSTR file, LPSECURITY_ATTRIBUTES sa )
req->hkey = hkey;
req->file = handle;
ret = server_call_noerr( REQ_SAVE_REGISTRY );
ret = reg_server_call( REQ_SAVE_REGISTRY );
CloseHandle( handle );
if (!ret)
{
......
......@@ -17,38 +17,7 @@
#include "crtdll.h"
#include "ntdll_misc.h"
DEFAULT_DEBUG_CHANNEL(ntdll)
/* helper to make the server functions return STATUS_ codes */
static NTSTATUS ErrorCodeToStatus (DWORD Error)
{
TRACE("err=%lu\n", Error);
switch (Error)
{
case NO_ERROR: return STATUS_SUCCESS;
case ERROR_INSUFFICIENT_BUFFER: return STATUS_BUFFER_TOO_SMALL;
case ERROR_FILE_NOT_FOUND: return STATUS_OBJECT_NAME_NOT_FOUND;
case ERROR_NO_MORE_ITEMS: return STATUS_NO_MORE_ENTRIES;
/*
return STATUS_INVALID_PARAMETER;
return STATUS_INVALID_HANDLE
return STATUS_ACCESS_DENIED
*/
/* case ERROR_MORE_DATA: return STATUS_BUFFER_OVERFLOW;
case ERROR_KEY_DELETED: return STATUS_KEY_DELETED;
case ERROR_CHILD_MUST_BE_VOLATILE: return STATUS_CHILD_MUST_BE_VOLATILE;
case ERROR_ACCESS_DENIED: return STATUS_ACCESS_DENIED;
case ERROR_NOT_REGISTRY_FILE: return STATUS_NOT_REGISTRY_FILE;
*/
default:
FIXME("Error code %lu not implemented\n", Error);
}
return STATUS_UNSUCCESSFUL;
}
#define nt_server_call(kind) (ret=ErrorCodeToStatus(server_call_noerr(kind)))
DEFAULT_DEBUG_CHANNEL(ntdll);
/* copy a key name into the request buffer */
static inline NTSTATUS copy_nameU( LPWSTR Dest, PUNICODE_STRING Name, UINT Offset )
......@@ -163,7 +132,7 @@ NTSTATUS WINAPI NtCreateKey(
else
req->class[0] = 0x0000;
if (nt_server_call(REQ_CREATE_KEY) == STATUS_SUCCESS)
if (!(ret = server_call_noerr(REQ_CREATE_KEY)))
{
*KeyHandle = req->hkey;
if (Disposition) *Disposition = req->created ? REG_CREATED_NEW_KEY : REG_OPENED_EXISTING_KEY;
......@@ -202,7 +171,7 @@ NTSTATUS WINAPI NtOpenKey(
if (copy_nameU( req->name, ObjectAttributes->ObjectName, ObjectNameOffset ) != STATUS_SUCCESS)
return STATUS_INVALID_PARAMETER;
if (nt_server_call(REQ_OPEN_KEY) == STATUS_SUCCESS)
if (!(ret = server_call_noerr(REQ_OPEN_KEY)))
{
*KeyHandle = req->hkey;
}
......@@ -256,7 +225,7 @@ NTSTATUS WINAPI NtEnumerateKey(
req->hkey = KeyHandle;
req->index = Index;
if (nt_server_call(REQ_ENUM_KEY) != STATUS_SUCCESS) return ret;
if ((ret = server_call_noerr(REQ_ENUM_KEY)) != STATUS_SUCCESS) return ret;
switch (KeyInformationClass)
{
......@@ -338,7 +307,7 @@ NTSTATUS WINAPI NtQueryKey(
KeyHandle, KeyInformationClass, KeyInformation, Length, ResultLength);
req->hkey = KeyHandle;
if ((ret=nt_server_call(REQ_QUERY_KEY_INFO)) != STATUS_SUCCESS) return ret;
if ((ret = server_call_noerr(REQ_QUERY_KEY_INFO)) != STATUS_SUCCESS) return ret;
switch (KeyInformationClass)
{
......@@ -421,7 +390,7 @@ NTSTATUS WINAPI NtEnumerateValueKey(
req->hkey = KeyHandle;
req->index = Index;
if (nt_server_call(REQ_ENUM_KEY_VALUE) != STATUS_SUCCESS) return ret;
if ((ret = server_call_noerr(REQ_ENUM_KEY_VALUE)) != STATUS_SUCCESS) return ret;
switch (KeyInformationClass)
{
......@@ -567,7 +536,7 @@ NTSTATUS WINAPI NtQueryValueKey(
req->hkey = KeyHandle;
if (copy_nameU(req->name, ValueName, 0) != STATUS_SUCCESS) return STATUS_BUFFER_OVERFLOW;
if (nt_server_call(REQ_GET_KEY_VALUE) != STATUS_SUCCESS) return ret;
if ((ret = server_call_noerr(REQ_GET_KEY_VALUE)) != STATUS_SUCCESS) return ret;
switch(KeyValueInformationClass)
{
......
......@@ -14,22 +14,7 @@
#include "ntddk.h"
#include "ntdll_misc.h"
DEFAULT_DEBUG_CHANNEL(ntdll)
#define nt_server_call(kind) (ret=ErrorCodeToStatus(server_call_noerr(kind)))
/* helper to make the server functions return STATUS_ codes */
static NTSTATUS ErrorCodeToStatus (DWORD Error)
{
TRACE("err=%lu\n", Error);
switch (Error)
{
case NO_ERROR: return STATUS_SUCCESS;
default:
FIXME("Error code %lu not implemented\n", Error);
}
return STATUS_UNSUCCESSFUL;
}
DEFAULT_DEBUG_CHANNEL(ntdll);
/* copy a key name into the request buffer */
static inline NTSTATUS copy_nameU( LPWSTR Dest, PUNICODE_STRING Name )
......@@ -72,8 +57,8 @@ NTSTATUS WINAPI NtCreateSemaphore(
req->max = MaximumCount;
req->inherit = ObjectAttributes->Attributes & OBJ_INHERIT;
copy_nameU( req->name, ObjectAttributes->ObjectName );
if (nt_server_call( REQ_CREATE_SEMAPHORE ) != STATUS_SUCCESS) return ret;
*SemaphoreHandle = req->handle;
if (!(ret = server_call_noerr( REQ_CREATE_SEMAPHORE )))
*SemaphoreHandle = req->handle;
return ret;
}
......@@ -97,7 +82,7 @@ NTSTATUS WINAPI NtOpenSemaphore(
req->access = DesiredAcces;
req->inherit = ObjectAttributes->Attributes & OBJ_INHERIT;
copy_nameU( req->name, ObjectAttributes->ObjectName );
if (nt_server_call( REQ_OPEN_SEMAPHORE ) != STATUS_SUCCESS) return -1;
if ((ret = server_call_noerr( REQ_OPEN_SEMAPHORE )) != STATUS_SUCCESS) return -1;
return req->handle;
}
......@@ -133,7 +118,7 @@ NTSTATUS WINAPI NtReleaseSemaphore(
req->handle = SemaphoreHandle;
req->count = ReleaseCount;
if (nt_server_call( REQ_RELEASE_SEMAPHORE ) == STATUS_SUCCESS)
if (!(ret = server_call_noerr( REQ_RELEASE_SEMAPHORE )))
{
if (PreviousCount) *PreviousCount = req->prev_count;
}
......@@ -166,9 +151,8 @@ NTSTATUS WINAPI NtCreateEvent(
req->initial_state = InitialState;
req->inherit = ObjectAttributes->Attributes & OBJ_INHERIT;
copy_nameU( req->name, ObjectAttributes->ObjectName );
if (nt_server_call( REQ_CREATE_EVENT ) != STATUS_SUCCESS) return ret;
*EventHandle = req->handle;
return STATUS_SUCCESS;
if (!(ret = server_call_noerr( REQ_CREATE_EVENT ))) *EventHandle = req->handle;
return ret;
}
/******************************************************************************
......@@ -190,8 +174,7 @@ NTSTATUS WINAPI NtOpenEvent(
req->access = DesiredAccess;
req->inherit = ObjectAttributes->Attributes & OBJ_INHERIT;
copy_nameU( req->name, ObjectAttributes->ObjectName );
if (nt_server_call( REQ_OPEN_EVENT ) != STATUS_SUCCESS) return ret;
*EventHandle = req->handle;
if (!(ret = server_call_noerr( REQ_OPEN_EVENT ))) *EventHandle = req->handle;
return ret;
}
......@@ -206,12 +189,9 @@ static NTSTATUS EVENT_Operation(
enum event_op op )
{
struct event_op_request *req = get_req_buffer();
HRESULT ret;
req->handle = handle;
req->op = op;
nt_server_call( REQ_EVENT_OP );
return ret;
return server_call_noerr( REQ_EVENT_OP );
}
/******************************************************************************
......
......@@ -180,6 +180,19 @@ static int _px_tcp_ops[] = {
0
};
/* we need a special routine to handle WSA* errors */
static inline int sock_server_call( enum request req )
{
unsigned int res = server_call_noerr( req );
if (res)
{
/* do not map WSA errors */
if ((res < WSABASEERR) || (res >= 0x10000000)) res = RtlNtStatusToDosError(res);
SetLastError( res );
}
return res;
}
static int _check_ws(LPWSINFO pwsi, SOCKET s);
static char* _check_buffer(LPWSINFO pwsi, int size);
......@@ -204,7 +217,7 @@ static void _enable_event(SOCKET s, unsigned int event,
req->mask = event;
req->sstate = sstate;
req->cstate = cstate;
server_call( REQ_ENABLE_SOCKET_EVENT );
sock_server_call( REQ_ENABLE_SOCKET_EVENT );
}
static int _is_blocking(SOCKET s)
......@@ -214,7 +227,7 @@ static int _is_blocking(SOCKET s)
req->handle = s;
req->service = FALSE;
req->s_event = 0;
server_call( REQ_GET_SOCKET_EVENT );
sock_server_call( REQ_GET_SOCKET_EVENT );
return (req->state & WS_FD_NONBLOCKING) == 0;
}
......@@ -225,7 +238,7 @@ static unsigned int _get_sock_mask(SOCKET s)
req->handle = s;
req->service = FALSE;
req->s_event = 0;
server_call( REQ_GET_SOCKET_EVENT );
sock_server_call( REQ_GET_SOCKET_EVENT );
return req->mask;
}
......@@ -243,7 +256,7 @@ static int _get_sock_error(SOCKET s, unsigned int bit)
req->handle = s;
req->service = FALSE;
req->s_event = 0;
server_call( REQ_GET_SOCKET_EVENT );
sock_server_call( REQ_GET_SOCKET_EVENT );
return req->errors[bit];
}
......@@ -705,7 +718,7 @@ SOCKET WINAPI WINSOCK_accept(SOCKET s, struct sockaddr *addr,
req->lhandle = s;
req->access = GENERIC_READ|GENERIC_WRITE|SYNCHRONIZE;
req->inherit = TRUE;
server_call( REQ_ACCEPT_SOCKET );
sock_server_call( REQ_ACCEPT_SOCKET );
if( req->handle >= 0 )
{
int fd = _get_sock_fd( s = req->handle );
......@@ -1770,7 +1783,7 @@ SOCKET WINAPI WINSOCK_socket(INT af, INT type, INT protocol)
req->protocol = protocol;
req->access = GENERIC_READ|GENERIC_WRITE|SYNCHRONIZE;
req->inherit = TRUE;
server_call( REQ_CREATE_SOCKET );
sock_server_call( REQ_CREATE_SOCKET );
if ( req->handle >= 0)
{
TRACE("\tcreated %04x\n", req->handle);
......@@ -2073,7 +2086,7 @@ int WINAPI WSAEnumNetworkEvents(SOCKET s, WSAEVENT hEvent, LPWSANETWORKEVENTS lp
req->handle = s;
req->service = TRUE;
req->s_event = 0;
server_call( REQ_GET_SOCKET_EVENT );
sock_server_call( REQ_GET_SOCKET_EVENT );
lpEvent->lNetworkEvents = req->pmask;
memcpy(lpEvent->iErrorCode, req->errors, sizeof(lpEvent->iErrorCode));
if (hEvent)
......@@ -2096,7 +2109,7 @@ int WINAPI WSAEventSelect(SOCKET s, WSAEVENT hEvent, LONG lEvent)
req->handle = s;
req->mask = lEvent;
req->event = hEvent;
server_call( REQ_SET_SOCKET_EVENT );
sock_server_call( REQ_SET_SOCKET_EVENT );
return 0;
}
else SetLastError(WSAEINVAL);
......@@ -2120,7 +2133,7 @@ VOID CALLBACK WINSOCK_DoAsyncEvent( ULONG_PTR ptr )
req->handle = info->sock;
req->service = TRUE;
req->s_event = info->event; /* <== avoid race conditions */
server_call( REQ_GET_SOCKET_EVENT );
sock_server_call( REQ_GET_SOCKET_EVENT );
if ( GetLastError() == WSAEINVAL )
{
/* orphaned event (socket closed or something) */
......
......@@ -1138,6 +1138,7 @@ enum request
#ifndef __WINE_SERVER__
#include "thread.h"
#include "ntddk.h"
/* client communication functions */
......@@ -1161,7 +1162,7 @@ static inline int WINE_UNUSED server_remaining( const void *ptr )
static inline int server_call( enum request req )
{
unsigned int res = server_call_noerr( req );
if (res) SetLastError( res );
if (res) SetLastError( RtlNtStatusToDosError(res) );
return res;
}
......
......@@ -252,7 +252,7 @@ unsigned int server_call_fd( enum request req, int fd_out, int *fd_in )
if (fd_in) res = wait_reply_fd( fd_in );
else res = wait_reply();
if (res) SetLastError( res );
if (res) SetLastError( RtlNtStatusToDosError(res) );
return res; /* error code */
}
......
......@@ -8,7 +8,6 @@
#include <stdio.h>
#include <stdlib.h>
#include "winerror.h"
#include "winnt.h"
#include "handle.h"
......
......@@ -24,7 +24,6 @@
#include <time.h>
#include <unistd.h>
#include "winerror.h"
#include "winnt.h"
#include "wincon.h"
......@@ -148,7 +147,7 @@ int alloc_console( struct process *process )
{
if (process->console_in || process->console_out)
{
set_error( ERROR_ACCESS_DENIED );
set_error( STATUS_ACCESS_DENIED );
return 0;
}
if ((process->console_in = create_console_input( -1 )))
......@@ -191,7 +190,7 @@ static int set_console_fd( int handle, int fd_in, int fd_out, int pid )
}
else
{
set_error( ERROR_INVALID_HANDLE );
set_error( STATUS_OBJECT_TYPE_MISMATCH );
release_object( obj );
return 0;
}
......@@ -220,7 +219,7 @@ static int get_console_mode( int handle )
else if (obj->ops == &screen_buffer_ops)
ret = ((struct screen_buffer *)obj)->mode;
else
set_error( ERROR_INVALID_HANDLE );
set_error( STATUS_OBJECT_TYPE_MISMATCH );
release_object( obj );
}
return ret;
......@@ -243,7 +242,7 @@ static int set_console_mode( int handle, int mode )
((struct screen_buffer *)obj)->mode = mode;
ret = 1;
}
else set_error( ERROR_INVALID_HANDLE );
else set_error( STATUS_OBJECT_TYPE_MISMATCH );
release_object( obj );
return ret;
}
......@@ -288,7 +287,7 @@ static int write_console_input( int handle, int count, INPUT_RECORD *records )
if (!(new_rec = realloc( console->records,
(console->recnum + count) * sizeof(INPUT_RECORD) )))
{
set_error( ERROR_NOT_ENOUGH_MEMORY );
set_error( STATUS_NO_MEMORY );
release_object( console );
return -1;
}
......@@ -434,7 +433,7 @@ DECL_HANDLER(open_console)
struct object *obj= req->output ? current->process->console_out : current->process->console_in;
if (obj) req->handle = alloc_handle( current->process, obj, req->access, req->inherit );
else set_error( ERROR_ACCESS_DENIED );
else set_error( STATUS_ACCESS_DENIED );
}
/* set info about a console (output only) */
......
......@@ -14,7 +14,6 @@
#include <sys/user.h>
#include "winbase.h"
#include "winerror.h"
#include "thread.h"
#include "request.h"
......@@ -230,7 +229,7 @@ DECL_HANDLER(get_thread_context)
{
suspend_thread( thread, 0 );
if (thread->attached) get_thread_context( thread, req->flags, &req->context );
else set_error( ERROR_ACCESS_DENIED );
else set_error( STATUS_ACCESS_DENIED );
resume_thread( thread );
}
release_object( thread );
......@@ -254,7 +253,7 @@ DECL_HANDLER(set_thread_context)
{
suspend_thread( thread, 0 );
if (thread->attached) set_thread_context( thread, req->flags, &req->context );
else set_error( ERROR_ACCESS_DENIED );
else set_error( STATUS_ACCESS_DENIED );
resume_thread( thread );
}
release_object( thread );
......
......@@ -9,7 +9,6 @@
#include <stdio.h>
#include "winbase.h"
#include "winerror.h"
#include "handle.h"
#include "process.h"
......@@ -293,7 +292,7 @@ static int wait_for_debug_event( int timeout )
if (!debug_ctx) /* current thread is not a debugger */
{
set_error( ERROR_INVALID_HANDLE );
set_error( STATUS_INVALID_HANDLE );
return 0;
}
if (timeout != -1) flags = SELECT_TIMEOUT;
......@@ -326,7 +325,7 @@ static int continue_debug_event( struct process *process, struct thread *thread,
return 1;
error:
/* not debugging this process, or no such event */
set_error( ERROR_ACCESS_DENIED ); /* FIXME */
set_error( STATUS_ACCESS_DENIED ); /* FIXME */
return 0;
}
......@@ -386,14 +385,14 @@ int debugger_attach( struct process *process, struct thread *debugger )
if (process->debugger) /* already being debugged */
{
set_error( ERROR_ACCESS_DENIED );
set_error( STATUS_ACCESS_DENIED );
return 0;
}
/* make sure we don't create a debugging loop */
for (thread = debugger; thread; thread = thread->process->debugger)
if (thread->process == process)
{
set_error( ERROR_ACCESS_DENIED );
set_error( STATUS_ACCESS_DENIED );
return 0;
}
......
......@@ -16,7 +16,6 @@
#include <stdlib.h>
#include <string.h>
#include "winerror.h"
#include "winbase.h"
#include "handle.h"
......
......@@ -8,7 +8,6 @@
#include <stdio.h>
#include <stdlib.h>
#include "winerror.h"
#include "winnt.h"
#include "handle.h"
......@@ -51,7 +50,7 @@ static struct event *create_event( const WCHAR *name, size_t len,
if ((event = create_named_object( &event_ops, name, len )))
{
if (get_error() != ERROR_ALREADY_EXISTS)
if (get_error() != STATUS_OBJECT_NAME_COLLISION)
{
/* initialize it if it didn't already exist */
event->manual_reset = manual_reset;
......
......@@ -97,7 +97,7 @@ static int check_sharing( const char *name, int hash, unsigned int access,
if ((existing_access & GENERIC_WRITE) && !(sharing & FILE_SHARE_WRITE)) goto error;
return 1;
error:
set_error( ERROR_SHARING_VIOLATION );
set_error( STATUS_SHARING_VIOLATION );
return 0;
}
......@@ -143,7 +143,7 @@ static struct file *create_file( const char *nameptr, size_t len, unsigned int a
case OPEN_ALWAYS: flags = O_CREAT; break;
case TRUNCATE_EXISTING: flags = O_TRUNC; break;
case OPEN_EXISTING: flags = 0; break;
default: set_error( ERROR_INVALID_PARAMETER ); goto error;
default: set_error( STATUS_INVALID_PARAMETER ); goto error;
}
switch(access & (GENERIC_READ | GENERIC_WRITE))
{
......@@ -153,7 +153,7 @@ static struct file *create_file( const char *nameptr, size_t len, unsigned int a
case GENERIC_READ|GENERIC_WRITE: flags |= O_RDWR; break;
}
/* FIXME: should set error to ERROR_ALREADY_EXISTS if file existed before */
/* FIXME: should set error to STATUS_OBJECT_NAME_COLLISION if file existed before */
if ((fd = open( name, flags | O_NONBLOCK,
(attrs & FILE_ATTRIBUTE_READONLY) ? 0444 : 0666 )) == -1)
goto file_error;
......@@ -161,7 +161,7 @@ static struct file *create_file( const char *nameptr, size_t len, unsigned int a
if (fstat( fd, &st ) == -1) goto file_error;
if (S_ISDIR(st.st_mode))
{
set_error( ERROR_ACCESS_DENIED );
set_error( STATUS_ACCESS_DENIED );
goto error;
}
......@@ -193,7 +193,7 @@ int create_anonymous_file(void)
{
if (!(name = tmpnam(NULL)))
{
set_error( ERROR_TOO_MANY_OPEN_FILES );
set_error( STATUS_TOO_MANY_OPENED_FILES );
return -1;
}
fd = open( name, O_CREAT | O_EXCL | O_RDWR, 0600 );
......@@ -309,23 +309,23 @@ void file_set_error(void)
{
switch (errno)
{
case EAGAIN: set_error( ERROR_SHARING_VIOLATION ); break;
case EBADF: set_error( ERROR_INVALID_HANDLE ); break;
case ENOSPC: set_error( ERROR_HANDLE_DISK_FULL ); break;
case EAGAIN: set_error( STATUS_SHARING_VIOLATION ); break;
case EBADF: set_error( STATUS_INVALID_HANDLE ); break;
case ENOSPC: set_error( STATUS_DISK_FULL ); break;
case EACCES:
case EPERM: set_error( ERROR_ACCESS_DENIED ); break;
case EROFS: set_error( ERROR_WRITE_PROTECT ); break;
case EBUSY: set_error( ERROR_LOCK_VIOLATION ); break;
case ENOENT: set_error( ERROR_FILE_NOT_FOUND ); break;
case EISDIR: set_error( ERROR_CANNOT_MAKE ); break;
case EPERM: set_error( STATUS_ACCESS_DENIED ); break;
case EROFS: set_error( STATUS_MEDIA_WRITE_PROTECTED ); break;
case EBUSY: set_error( STATUS_FILE_LOCK_CONFLICT ); break;
case ENOENT: set_error( STATUS_NO_SUCH_FILE ); break;
case EISDIR: set_error( 0xc0010000 | ERROR_CANNOT_MAKE /* FIXME */ ); break;
case ENFILE:
case EMFILE: set_error( ERROR_NO_MORE_FILES ); break;
case EEXIST: set_error( ERROR_FILE_EXISTS ); break;
case EINVAL: set_error( ERROR_INVALID_PARAMETER ); break;
case ESPIPE: set_error( ERROR_SEEK ); break;
case ENOTEMPTY: set_error( ERROR_DIR_NOT_EMPTY ); break;
case EIO: set_error( ERROR_NOACCESS ); break;
default: perror("file_set_error"); set_error( ERROR_UNKNOWN ); break;
case EMFILE: set_error( STATUS_NO_MORE_FILES ); break;
case EEXIST: set_error( STATUS_OBJECT_NAME_COLLISION ); break;
case EINVAL: set_error( STATUS_INVALID_PARAMETER ); break;
case ESPIPE: set_error( 0xc0010000 | ERROR_SEEK /* FIXME */ ); break;
case ENOTEMPTY: set_error( STATUS_DIRECTORY_NOT_EMPTY ); break;
case EIO: set_error( STATUS_ACCESS_VIOLATION ); break;
default: perror("file_set_error"); set_error( ERROR_UNKNOWN /* FIXME */ ); break;
}
}
......@@ -347,7 +347,7 @@ static int set_file_pointer( int handle, int *low, int *high, int whence )
if (*high)
{
fprintf( stderr, "set_file_pointer: offset > 4Gb not supported yet\n" );
set_error( ERROR_INVALID_PARAMETER );
set_error( STATUS_INVALID_PARAMETER );
return 0;
}
......@@ -357,7 +357,7 @@ static int set_file_pointer( int handle, int *low, int *high, int whence )
{
/* Check for seek before start of file */
if ((errno == EINVAL) && (whence != SEEK_SET) && (*low < 0))
set_error( ERROR_NEGATIVE_SEEK );
set_error( 0xc0010000 | ERROR_NEGATIVE_SEEK /* FIXME */ );
else
file_set_error();
release_object( file );
......@@ -394,7 +394,7 @@ int grow_file( struct file *file, int size_high, int size_low )
if (size_high)
{
set_error( ERROR_INVALID_PARAMETER );
set_error( STATUS_INVALID_PARAMETER );
return 0;
}
if (fstat( file->obj.fd, &st ) == -1)
......
......@@ -10,7 +10,6 @@
#include <stdio.h>
#include <stdlib.h>
#include "winerror.h"
#include "winbase.h"
#include "handle.h"
......@@ -150,7 +149,7 @@ static int grow_handle_table( struct handle_table *table )
count *= 2;
if (!(new_entries = realloc( table->entries, count * sizeof(struct handle_entry) )))
{
set_error( ERROR_OUTOFMEMORY );
set_error( STATUS_NO_MEMORY );
return 0;
}
table->entries = new_entries;
......@@ -225,7 +224,7 @@ static struct handle_entry *get_handle( struct process *process, int handle )
return entry;
error:
set_error( ERROR_INVALID_HANDLE );
set_error( STATUS_INVALID_HANDLE );
return NULL;
}
......@@ -291,7 +290,7 @@ int close_handle( struct process *process, int handle )
if (!(entry = get_handle( process, handle ))) return 0;
if (entry->access & RESERVED_CLOSE_PROTECT)
{
set_error( ERROR_INVALID_HANDLE );
set_error( STATUS_INVALID_HANDLE );
return 0;
}
obj = entry->ptr;
......@@ -340,14 +339,14 @@ struct object *get_handle_obj( struct process *process, int handle,
if (!(entry = get_handle( process, handle ))) return NULL;
if ((entry->access & access) != access)
{
set_error( ERROR_ACCESS_DENIED );
set_error( STATUS_ACCESS_DENIED );
return NULL;
}
obj = entry->ptr;
}
if (ops && (obj->ops != ops))
{
set_error( ERROR_INVALID_HANDLE ); /* not the right type */
set_error( STATUS_OBJECT_TYPE_MISMATCH ); /* not the right type */
return NULL;
}
return grab_object( obj );
......@@ -362,7 +361,7 @@ static int set_handle_info( struct process *process, int handle, int mask, int f
if (get_magic_handle( handle ))
{
/* we can retrieve but not set info for magic handles */
if (mask) set_error( ERROR_ACCESS_DENIED );
if (mask) set_error( STATUS_ACCESS_DENIED );
return 0;
}
if (!(entry = get_handle( process, handle ))) return -1;
......@@ -409,13 +408,13 @@ int open_object( const WCHAR *name, size_t len, const struct object_ops *ops,
if (obj)
{
if (ops && obj->ops != ops)
set_error( ERROR_INVALID_HANDLE );
set_error( STATUS_OBJECT_TYPE_MISMATCH );
else
handle = alloc_handle( current->process, obj, access, inherit );
release_object( obj );
}
else
set_error( ERROR_FILE_NOT_FOUND );
set_error( STATUS_OBJECT_NAME_NOT_FOUND );
return handle;
}
......
......@@ -10,7 +10,6 @@
#include <unistd.h>
#include "config.h"
#include "winerror.h"
#include "winnt.h"
#include "winbase.h"
......@@ -95,7 +94,7 @@ static struct object *create_mapping( int size_high, int size_low, int protect,
if (!(mapping = create_named_object( &mapping_ops, name, len )))
return NULL;
if (get_error() == ERROR_ALREADY_EXISTS)
if (get_error() == STATUS_OBJECT_NAME_COLLISION)
return &mapping->obj; /* Nothing else to do */
if (protect & VPROT_READ) access |= GENERIC_READ;
......@@ -118,7 +117,7 @@ static struct object *create_mapping( int size_high, int size_low, int protect,
{
if (!size_high && !size_low)
{
set_error( ERROR_INVALID_PARAMETER );
set_error( STATUS_INVALID_PARAMETER );
mapping->file = NULL;
goto error;
}
......
......@@ -8,7 +8,6 @@
#include <stdio.h>
#include <stdlib.h>
#include "winerror.h"
#include "winnt.h"
#include "handle.h"
......@@ -54,7 +53,7 @@ static struct mutex *create_mutex( const WCHAR *name, size_t len, int owned )
if ((mutex = create_named_object( &mutex_ops, name, len )))
{
if (get_error() != ERROR_ALREADY_EXISTS)
if (get_error() != STATUS_OBJECT_NAME_COLLISION)
{
/* initialize it if it didn't already exist */
mutex->count = 0;
......@@ -166,7 +165,7 @@ DECL_HANDLER(release_mutex)
if ((mutex = (struct mutex *)get_handle_obj( current->process, req->handle,
MUTEX_MODIFY_STATE, &mutex_ops )))
{
if (!mutex->count || (mutex->owner != current)) set_error( ERROR_NOT_OWNER );
if (!mutex->count || (mutex->owner != current)) set_error( STATUS_MUTANT_NOT_OWNED );
else if (!--mutex->count) do_release( mutex );
release_object( mutex );
}
......
......@@ -12,7 +12,6 @@
#include <string.h>
#include <unistd.h>
#include "winerror.h"
#include "thread.h"
#include "unicode.h"
......@@ -53,7 +52,7 @@ void *mem_alloc( size_t size )
{
void *ptr = malloc( size );
if (ptr) memset( ptr, 0x55, size );
else if (current) set_error( ERROR_OUTOFMEMORY );
else if (current) set_error( STATUS_NO_MEMORY );
return ptr;
}
......@@ -165,10 +164,10 @@ void *create_named_object( const struct object_ops *ops, const WCHAR *name, size
free( name_ptr ); /* we no longer need it */
if (obj->ops == ops)
{
set_error( ERROR_ALREADY_EXISTS );
set_error( STATUS_OBJECT_NAME_COLLISION );
return obj;
}
set_error( ERROR_INVALID_HANDLE );
set_error( STATUS_OBJECT_TYPE_MISMATCH );
return NULL;
}
if ((obj = alloc_object( ops, -1 )))
......@@ -242,7 +241,7 @@ struct object *find_object( const WCHAR *name, size_t len )
int no_add_queue( struct object *obj, struct wait_queue_entry *entry )
{
set_error( ERROR_INVALID_HANDLE );
set_error( STATUS_OBJECT_TYPE_MISMATCH );
return 0;
}
......@@ -253,25 +252,25 @@ int no_satisfied( struct object *obj, struct thread *thread )
int no_read_fd( struct object *obj )
{
set_error( ERROR_INVALID_HANDLE );
set_error( STATUS_OBJECT_TYPE_MISMATCH );
return -1;
}
int no_write_fd( struct object *obj )
{
set_error( ERROR_INVALID_HANDLE );
set_error( STATUS_OBJECT_TYPE_MISMATCH );
return -1;
}
int no_flush( struct object *obj )
{
set_error( ERROR_INVALID_HANDLE );
set_error( STATUS_OBJECT_TYPE_MISMATCH );
return 0;
}
int no_get_file_info( struct object *obj, struct get_file_info_request *info )
{
set_error( ERROR_INVALID_HANDLE );
set_error( STATUS_OBJECT_TYPE_MISMATCH );
return 0;
}
......
......@@ -20,7 +20,6 @@
#include <time.h>
#include <unistd.h>
#include "winerror.h"
#include "winbase.h"
#include "handle.h"
......@@ -122,12 +121,12 @@ static int pipe_get_read_fd( struct object *obj )
if (!pipe->other)
{
set_error( ERROR_BROKEN_PIPE );
set_error( STATUS_PIPE_BROKEN );
return -1;
}
if (pipe->side != READ_SIDE) /* FIXME: should not be necessary */
{
set_error( ERROR_ACCESS_DENIED );
set_error( STATUS_ACCESS_DENIED );
return -1;
}
return dup( pipe->obj.fd );
......@@ -140,12 +139,12 @@ static int pipe_get_write_fd( struct object *obj )
if (!pipe->other)
{
set_error( ERROR_BROKEN_PIPE );
set_error( STATUS_PIPE_BROKEN );
return -1;
}
if (pipe->side != WRITE_SIDE) /* FIXME: should not be necessary */
{
set_error( ERROR_ACCESS_DENIED );
set_error( STATUS_ACCESS_DENIED );
return -1;
}
return dup( pipe->obj.fd );
......
......@@ -14,7 +14,6 @@
#include <sys/time.h>
#include <unistd.h>
#include "winerror.h"
#include "winbase.h"
#include "winnt.h"
......@@ -205,7 +204,7 @@ struct process *get_process_from_id( void *id )
struct process *p = first_process;
while (p && (p != id)) p = p->next;
if (p) grab_object( p );
else set_error( ERROR_INVALID_PARAMETER );
else set_error( STATUS_INVALID_PARAMETER );
return p;
}
......@@ -329,7 +328,7 @@ static void set_process_info( struct process *process,
process->priority = req->priority;
if (req->mask & SET_PROCESS_INFO_AFFINITY)
{
if (req->affinity != 1) set_error( ERROR_INVALID_PARAMETER );
if (req->affinity != 1) set_error( STATUS_INVALID_PARAMETER );
else process->affinity = req->affinity;
}
}
......@@ -344,7 +343,7 @@ static void read_process_memory( struct process *process, const int *addr,
if ((unsigned int)addr % sizeof(int)) /* address must be aligned */
{
set_error( ERROR_INVALID_PARAMETER );
set_error( STATUS_INVALID_PARAMETER );
return;
}
suspend_thread( thread, 0 );
......@@ -369,7 +368,7 @@ static void read_process_memory( struct process *process, const int *addr,
if (len && (read_thread_int( thread, addr + len - 1, &dummy ) == -1)) goto done;
}
}
else set_error( ERROR_ACCESS_DENIED );
else set_error( STATUS_ACCESS_DENIED );
done:
resume_thread( thread );
}
......@@ -385,7 +384,7 @@ static void write_process_memory( struct process *process, int *addr, size_t len
if (!len || ((unsigned int)addr % sizeof(int))) /* address must be aligned */
{
set_error( ERROR_INVALID_PARAMETER );
set_error( STATUS_INVALID_PARAMETER );
return;
}
suspend_thread( thread, 0 );
......@@ -425,7 +424,7 @@ static void write_process_memory( struct process *process, int *addr, size_t len
if (len && (write_thread_int( thread, addr + len - 1, 0, 0 ) == -1)) goto done;
}
}
else set_error( ERROR_ACCESS_DENIED );
else set_error( STATUS_ACCESS_DENIED );
done:
resume_thread( thread );
}
......
......@@ -21,7 +21,6 @@
#include "unicode.h"
#include "winbase.h"
#include "winerror.h"
#include "winreg.h"
......@@ -364,7 +363,7 @@ static int grow_subkeys( struct key *key )
nb_subkeys = key->nb_subkeys + (key->nb_subkeys / 2); /* grow by 50% */
if (!(new_subkeys = realloc( key->subkeys, nb_subkeys * sizeof(*new_subkeys) )))
{
set_error( ERROR_OUTOFMEMORY );
set_error( STATUS_NO_MEMORY );
return 0;
}
}
......@@ -461,7 +460,7 @@ static struct key *open_key( struct key *key, const WCHAR *name, size_t maxlen )
{
if (!(key = find_subkey( key, path, &index )))
{
set_error( ERROR_FILE_NOT_FOUND );
set_error( STATUS_OBJECT_NAME_NOT_FOUND );
break;
}
path = get_path_token( NULL, 0 );
......@@ -482,13 +481,13 @@ static struct key *create_key( struct key *key, const WCHAR *name, size_t maxlen
if (key->flags & KEY_DELETED) /* we cannot create a subkey under a deleted key */
{
set_error( ERROR_KEY_DELETED );
set_error( STATUS_KEY_DELETED );
return NULL;
}
if (options & REG_OPTION_VOLATILE) flags |= KEY_VOLATILE;
else if (key->flags & KEY_VOLATILE)
{
set_error( ERROR_CHILD_MUST_BE_VOLATILE );
set_error( STATUS_CHILD_MUST_BE_VOLATILE );
return NULL;
}
......@@ -532,7 +531,7 @@ static void enum_key( struct key *parent, int index, WCHAR *name, WCHAR *class,
{
struct key *key;
if ((index < 0) || (index > parent->last_subkey)) set_error( ERROR_NO_MORE_ITEMS );
if ((index < 0) || (index > parent->last_subkey)) set_error( STATUS_NO_MORE_ENTRIES );
else
{
key = parent->subkeys[index];
......@@ -593,12 +592,12 @@ static void delete_key( struct key *key, const WCHAR *name, size_t maxlen )
/* deleting this key, must find parent and index */
if (key->flags & KEY_ROOT)
{
set_error( ERROR_ACCESS_DENIED );
set_error( STATUS_ACCESS_DENIED );
return;
}
if (!(parent = key->parent) || (key->flags & KEY_DELETED))
{
set_error( ERROR_KEY_DELETED );
set_error( STATUS_KEY_DELETED );
return;
}
for (index = 0; index <= parent->last_subkey; index++)
......@@ -610,7 +609,7 @@ static void delete_key( struct key *key, const WCHAR *name, size_t maxlen )
parent = key;
if (!(key = find_subkey( parent, path, &index )))
{
set_error( ERROR_FILE_NOT_FOUND );
set_error( STATUS_OBJECT_NAME_NOT_FOUND );
return;
}
path = get_path_token( NULL, 0 );
......@@ -619,7 +618,7 @@ static void delete_key( struct key *key, const WCHAR *name, size_t maxlen )
/* we can only delete a key that has no subkeys (FIXME) */
if ((key->flags & KEY_ROOT) || (key->last_subkey >= 0))
{
set_error( ERROR_ACCESS_DENIED );
set_error( STATUS_ACCESS_DENIED );
return;
}
if (debug_level > 1) dump_operation( key, NULL, "Delete" );
......@@ -638,7 +637,7 @@ static int grow_values( struct key *key )
nb_values = key->nb_values + (key->nb_values / 2); /* grow by 50% */
if (!(new_val = realloc( key->values, nb_values * sizeof(*new_val) )))
{
set_error( ERROR_OUTOFMEMORY );
set_error( STATUS_NO_MEMORY );
return 0;
}
}
......@@ -741,7 +740,7 @@ static void get_value( struct key *key, WCHAR *name, int *type, int *len, void *
{
*type = -1;
*len = 0;
set_error( ERROR_FILE_NOT_FOUND );
set_error( STATUS_OBJECT_NAME_NOT_FOUND );
}
}
......@@ -754,7 +753,7 @@ static void enum_value( struct key *key, int i, WCHAR *name, int *type, int *len
{
name[0] = 0;
*len = 0;
set_error( ERROR_NO_MORE_ITEMS );
set_error( STATUS_NO_MORE_ENTRIES );
}
else
{
......@@ -775,7 +774,7 @@ static void delete_value( struct key *key, const WCHAR *name )
if (!(value = find_value( key, name, &index )))
{
set_error( ERROR_FILE_NOT_FOUND );
set_error( STATUS_OBJECT_NAME_NOT_FOUND );
return;
}
if (debug_level > 1) dump_operation( key, value, "Delete" );
......@@ -922,7 +921,7 @@ static int read_next_line( struct file_load_info *info )
newlen = info->len + info->len / 2;
if (!(newbuf = realloc( info->buffer, newlen )))
{
set_error( ERROR_OUTOFMEMORY );
set_error( STATUS_NO_MEMORY );
return -1;
}
info->buffer = newbuf;
......@@ -937,7 +936,7 @@ static int get_file_tmp_space( struct file_load_info *info, int size )
if (info->tmplen >= size) return 1;
if (!(tmp = realloc( info->tmp, size )))
{
set_error( ERROR_OUTOFMEMORY );
set_error( STATUS_NO_MEMORY );
return 0;
}
info->tmp = tmp;
......@@ -1196,7 +1195,7 @@ static void load_keys( struct key *key, FILE *f )
if ((read_next_line( &info ) != 1) ||
strcmp( info.buffer, "WINE REGISTRY Version 2" ))
{
set_error( ERROR_NOT_REGISTRY_FILE );
set_error( STATUS_NOT_REGISTRY_FILE );
goto done;
}
......@@ -1319,7 +1318,7 @@ static void save_registry( struct key *key, int handle )
if (key->flags & KEY_DELETED)
{
set_error( ERROR_KEY_DELETED );
set_error( STATUS_KEY_DELETED );
return;
}
if (!(obj = get_handle_obj( current->process, handle, GENERIC_WRITE, NULL ))) return;
......@@ -1443,7 +1442,7 @@ DECL_HANDLER(set_key_value)
int datalen = req->len;
if (datalen > max)
{
set_error( ERROR_OUTOFMEMORY ); /* FIXME */
set_error( STATUS_NO_MEMORY ); /* FIXME */
return;
}
if ((key = get_hkey_obj( req->hkey, KEY_SET_VALUE )))
......
......@@ -21,7 +21,6 @@
#include <sys/uio.h>
#include <unistd.h>
#include "winerror.h"
#include "winnt.h"
#include "winbase.h"
#include "wincon.h"
......
......@@ -8,7 +8,6 @@
#include <stdio.h>
#include <stdlib.h>
#include "winerror.h"
#include "winnt.h"
#include "handle.h"
......@@ -51,12 +50,12 @@ static struct semaphore *create_semaphore( const WCHAR *name, size_t len,
if (!max || (initial > max))
{
set_error( ERROR_INVALID_PARAMETER );
set_error( STATUS_INVALID_PARAMETER );
return NULL;
}
if ((sem = create_named_object( &semaphore_ops, name, len )))
{
if (get_error() != ERROR_ALREADY_EXISTS)
if (get_error() != STATUS_OBJECT_NAME_COLLISION)
{
/* initialize it if it didn't already exist */
sem->count = initial;
......@@ -77,7 +76,7 @@ static unsigned int release_semaphore( int handle, unsigned int count )
prev = sem->count;
if (sem->count + count < sem->count || sem->count + count > sem->max)
{
set_error( ERROR_TOO_MANY_POSTS );
set_error( STATUS_SEMAPHORE_LIMIT_EXCEEDED );
}
else if (sem->count)
{
......
......@@ -10,7 +10,6 @@
#include <stdio.h>
#include <stdlib.h>
#include "winerror.h"
#include "winnt.h"
#include "tlhelp32.h"
......@@ -72,13 +71,13 @@ static int snapshot_next_process( struct snapshot *snapshot, struct next_process
if (!snapshot->process_count)
{
set_error( ERROR_INVALID_PARAMETER ); /* FIXME */
set_error( STATUS_INVALID_PARAMETER ); /* FIXME */
return 0;
}
if (req->reset) snapshot->process_pos = 0;
else if (snapshot->process_pos >= snapshot->process_count)
{
set_error( ERROR_NO_MORE_FILES );
set_error( STATUS_NO_MORE_FILES );
return 0;
}
ptr = &snapshot->process[snapshot->process_pos++];
......
......@@ -25,7 +25,6 @@
#include "winbase.h"
#include "winerror.h"
#include "handle.h"
#include "process.h"
......@@ -247,7 +246,7 @@ static void set_thread_info( struct thread *thread,
thread->priority = req->priority;
if (req->mask & SET_THREAD_INFO_AFFINITY)
{
if (req->affinity != 1) set_error( ERROR_INVALID_PARAMETER );
if (req->affinity != 1) set_error( STATUS_INVALID_PARAMETER );
else thread->affinity = req->affinity;
}
}
......@@ -260,7 +259,7 @@ int suspend_thread( struct thread *thread, int check_limit )
{
if (!(thread->process->suspend + thread->suspend++)) stop_thread( thread );
}
else set_error( ERROR_SIGNAL_REFUSED );
else set_error( STATUS_SUSPEND_COUNT_EXCEEDED );
return old_count;
}
......@@ -475,7 +474,7 @@ static int select_on( int count, int *handles, int flags, int timeout )
if ((count < 0) || (count > MAXIMUM_WAIT_OBJECTS))
{
set_error( ERROR_INVALID_PARAMETER );
set_error( STATUS_INVALID_PARAMETER );
return 0;
}
for (i = 0; i < count; i++)
......
......@@ -10,8 +10,6 @@
#include <sys/time.h>
#include <sys/types.h>
#include "winerror.h"
#include "handle.h"
#include "request.h"
......@@ -62,7 +60,7 @@ static struct timer *create_timer( const WCHAR *name, size_t len, int manual )
if ((timer = create_named_object( &timer_ops, name, len )))
{
if (get_error() != ERROR_ALREADY_EXISTS)
if (get_error() != STATUS_OBJECT_NAME_COLLISION)
{
/* initialize it if it didn't already exist */
timer->manual = manual;
......
......@@ -1475,7 +1475,7 @@ void trace_kill( struct thread *thread )
void trace_reply( struct thread *thread )
{
fprintf( stderr, "%08x: %s() = %d",
fprintf( stderr, "%08x: %s() = %x",
(unsigned int)thread, req_names[thread->last_req], thread->error );
if (reply_dumpers[thread->last_req])
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment