Start cleaning up error messages.
[wine/multimedia.git] / server / token.c
blob67d42b436a974401876121590a40a4ad3186ea95
1 /*
2 * Tokens
4 * Copyright (C) 1998 Alexandre Julliard
5 * Copyright (C) 2003 Mike McCormack
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "config.h"
24 #include <assert.h>
25 #include <stdio.h>
26 #include <stdlib.h>
28 #include "windef.h"
30 #include "handle.h"
31 #include "thread.h"
32 #include "process.h"
33 #include "request.h"
35 struct token
37 struct object obj; /* object header */
40 static void token_dump( struct object *obj, int verbose );
42 static const struct object_ops token_ops =
44 sizeof(struct token), /* size */
45 token_dump, /* dump */
46 no_add_queue, /* add_queue */
47 NULL, /* remove_queue */
48 NULL, /* signaled */
49 NULL, /* satified */
50 no_get_fd, /* get_fd */
51 no_destroy /* destroy */
55 static void token_dump( struct object *obj, int verbose )
57 fprintf( stderr, "Security token\n" );
60 struct token *create_token( void )
62 struct token *token = alloc_object( &token_ops );
63 return token;
66 /* open a security token */
67 DECL_HANDLER(open_token)
69 if( req->flags & OPEN_TOKEN_THREAD )
71 struct thread *thread = get_thread_from_handle( req->handle, 0 );
72 if (thread)
74 if (thread->token)
75 reply->token = alloc_handle( current->process, thread->token, TOKEN_ALL_ACCESS, 0);
76 release_object( thread );
79 else
81 struct process *process = get_process_from_handle( req->handle, 0 );
82 if (process)
84 if (process->token)
85 reply->token = alloc_handle( current->process, process->token, TOKEN_ALL_ACCESS, 0);
86 release_object( process );