本文整理汇总了C++中release_object函数的典型用法代码示例。如果您正苦于以下问题:C++ release_object函数的具体用法?C++ release_object怎么用?C++ release_object使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了release_object函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NtTerminateProcess
NTSTATUS SERVICECALL
NtTerminateProcess(IN HANDLE ProcessHandle,
IN NTSTATUS ExitStatus)
{
struct eprocess *process;
struct ethread *cur_thread;
NTSTATUS status;
ktrace("\n");
if ((status = ref_object_by_handle(ProcessHandle ? ProcessHandle : NtCurrentProcess(),
PROCESS_TERMINATE,
process_object_type,
get_pre_mode(),
(PVOID *) &process,
NULL)))
return status;
cur_thread = (struct ethread *) get_current_ethread();
terminate_process(process->win32process, ExitStatus);
release_object(process->win32process);
lock_process(process);
if (process->exit_time.quad) {
unlock_process(process);
deref_object(process);
return STATUS_PROCESS_IS_TERMINATING;
}
query_sys_time(&process->exit_time);
process->exit_status = (unsigned long)ExitStatus;
unlock_process(process);
deref_object(process);
if (process == get_current_eprocess()) {
cur_thread->exit_status = ExitStatus;
do_group_exit((ExitStatus & 0xff) << 8);
} else {
struct ethread *first_thread = get_first_thread(process);
first_thread->exit_status = ExitStatus;
send_sig_info(SIGKILL, SEND_SIG_FORCED, first_thread->et_task->group_leader);
}
return STATUS_SUCCESS;
}
示例2: link_event
/* link an event at the end of the queue */
static void link_event( struct debug_event *event )
{
struct debug_ctx *debug_ctx = event->debugger->debug_ctx;
assert( debug_ctx );
grab_object( event );
list_add_tail( &debug_ctx->event_queue, &event->entry );
if (!event->sender->debug_event)
{
/* grab reference since debugger could be killed while trying to wake up */
grab_object( debug_ctx );
wake_up( &debug_ctx->obj, 0 );
release_object( debug_ctx );
}
}
示例3: release_object
/* allocate a new handle table */
struct handle_table *alloc_handle_table( struct process *process, int count )
{
struct handle_table *table;
if (count < MIN_HANDLE_ENTRIES) count = MIN_HANDLE_ENTRIES;
if (!(table = alloc_object( &handle_table_ops )))
return NULL;
table->process = process;
table->count = count;
table->last = -1;
table->free = 0;
if ((table->entries = mem_alloc( count * sizeof(*table->entries) ))) return table;
release_object( table );
return NULL;
}
示例4: device_ioctl
static obj_handle_t device_ioctl(struct fd *fd, ioctl_code_t code, const async_data_t *async_data,
const void *data, data_size_t size)
{
struct device *device = get_fd_user(fd);
struct ioctl_call *ioctl;
obj_handle_t handle;
if (!device->manager) /* it has been deleted */ {
set_error(STATUS_FILE_DELETED);
return 0;
}
if (!(ioctl = create_ioctl(device, code, data, size, get_reply_max_size())))
return 0;
ioctl->thread = (struct w32thread *)grab_object(current_thread);
ioctl->user_arg = async_data->arg;
if (!(handle = alloc_handle(get_current_w32process(), ioctl, SYNCHRONIZE, 0))) {
release_object(ioctl);
return 0;
}
if (!(ioctl->async = fd_queue_async(device->fd, async_data, ASYNC_TYPE_WAIT, 0))) {
close_handle(get_current_eprocess(), handle);
release_object(ioctl);
return 0;
}
list_add_before(&device->requests, &ioctl->dev_entry);
list_add_before(&device->manager->requests, &ioctl->mgr_entry);
if (list_head(&device->manager->requests) == &ioctl->mgr_entry) /* first one */
uk_wake_up(&device->manager->obj, 0);
/* don't release ioctl since it is now queued in the device */
set_error(STATUS_PENDING);
return handle;
}
示例5: open_object
/* open a new handle to an existing object */
obj_handle_t open_object( struct process *process, obj_handle_t parent, unsigned int access,
const struct object_ops *ops, const struct unicode_str *name,
unsigned int attributes )
{
obj_handle_t handle = 0;
struct directory *root = NULL;
struct object *obj;
if (name->len >= 65534)
{
set_error( STATUS_OBJECT_NAME_INVALID );
return 0;
}
if (parent && !(root = get_directory_obj( process, parent, 0 ))) return 0;
if ((obj = open_object_dir( root, name, attributes, ops )))
{
handle = alloc_handle( process, obj, access, attributes );
release_object( obj );
}
if (root) release_object( root );
return handle;
}
示例6: file_map_access
/* if the function fails the fd is closed */
static struct file *create_file_for_fd( int fd, unsigned int access, unsigned int sharing )
{
struct file *file;
if ((file = alloc_object( &file_ops )))
{
file->access = file_map_access( &file->obj, access );
file->options = FILE_SYNCHRONOUS_IO_NONALERT;
if (!(file->fd = create_anonymous_fd( &file_fd_ops, fd, &file->obj )))
{
release_object( file );
return NULL;
}
}
return file;
}
示例7: dir_gc
static int dir_gc(lua_State *L)
{
lua_apr_dir *directory = checkdir(L, 1, 0);
if (object_collectable((lua_apr_refobj*)directory)) {
if (directory->handle != NULL) {
apr_dir_close(directory->handle);
directory->handle = NULL;
}
if (directory->memory_pool != NULL) {
apr_pool_destroy(directory->memory_pool);
directory->memory_pool = NULL;
}
}
release_object((lua_apr_refobj*)directory);
return 0;
}
示例8: duplicate_handle
/* duplicate a handle */
obj_handle_t duplicate_handle( struct process *src, obj_handle_t src_handle, struct process *dst,
unsigned int access, unsigned int attr, unsigned int options )
{
obj_handle_t res;
struct handle_entry *entry;
unsigned int src_access;
struct object *obj = get_handle_obj( src, src_handle, 0, NULL );
if (!obj) return 0;
if ((entry = get_handle( src, src_handle )))
src_access = entry->access;
else /* pseudo-handle, give it full access */
src_access = obj->ops->map_access( obj, GENERIC_ALL );
src_access &= ~RESERVED_ALL;
if (options & DUP_HANDLE_SAME_ACCESS)
access = src_access;
else
access = obj->ops->map_access( obj, access ) & ~RESERVED_ALL;
/* asking for the more access rights than src_access? */
if (access & ~src_access)
{
if (options & DUP_HANDLE_MAKE_GLOBAL)
res = alloc_global_handle( obj, access );
else
res = alloc_handle( dst, obj, access, attr );
}
else
{
if (options & DUP_HANDLE_MAKE_GLOBAL)
res = alloc_global_handle_no_access_check( obj, access );
else if ((options & DUP_HANDLE_CLOSE_SOURCE) && src == dst &&
entry && !(entry->access & RESERVED_CLOSE_PROTECT))
{
if (attr & OBJ_INHERIT) access |= RESERVED_INHERIT;
entry->access = access;
res = src_handle;
}
else
res = alloc_handle_entry( dst, obj, access, attr );
}
release_object( obj );
return res;
}
示例9: debug_exit_thread
/* a thread is exiting */
void debug_exit_thread( struct thread *thread )
{
if (thread->debug_ctx) /* this thread is a debugger */
{
if (thread->debug_ctx->kill_on_exit)
{
/* kill all debugged processes */
kill_debugged_processes( thread, thread->exit_code );
}
else
{
detach_debugged_processes( thread );
}
release_object( thread->debug_ctx );
thread->debug_ctx = NULL;
}
}
示例10: device_file_flush
static obj_handle_t device_file_flush( struct fd *fd, const async_data_t *async_data, int blocking )
{
struct device_file *file = get_fd_user( fd );
struct irp_call *irp;
obj_handle_t handle;
irp_params_t params;
memset( ¶ms, 0, sizeof(params) );
params.flush.major = IRP_MJ_FLUSH_BUFFERS;
params.flush.file = file->user_ptr;
irp = create_irp( file, ¶ms, NULL, 0, 0 );
if (!irp) return 0;
handle = queue_irp( file, irp, async_data, blocking );
release_object( irp );
return handle;
}
示例11: NtTerminateThread
NTSTATUS
SERVICECALL
NtTerminateThread(IN HANDLE ThreadHandle,
IN NTSTATUS ExitStatus)
{
struct ethread * thread;
struct w32thread *w32thread;
NTSTATUS status;
ktrace("%p\n", ThreadHandle);
status = ref_object_by_handle(ThreadHandle,
THREAD_TERMINATE,
thread_object_type,
get_pre_mode(),
(PVOID *)&thread,
NULL);
if (!NT_SUCCESS(status))
return status;
if (!thread->et_task){
deref_object(thread);
return STATUS_THREAD_IS_TERMINATING;
}
w32thread = thread->tcb.win32thread;
remove_process_thread(w32thread->process, w32thread);
thread->tcb.win32thread = NULL;
release_object(w32thread);
/* FIXME Make sure this is not a system thread */
if (thread != get_current_ethread()) {
terminate_thread_by_pointer(thread, ExitStatus);
deref_object(thread);
} else {
deref_object(thread);
thread->exit_status = ExitStatus;
do_exit((ExitStatus & 0xff) << 8);
}
return STATUS_SUCCESS;
}
示例12: list_add_before
static struct device *create_device(HANDLE root, const struct unicode_str *name,
struct device_manager *manager, unsigned int attr)
{
struct device *device;
if ((device = create_named_object_dir(root, name, attr, &device_ops))) {
if (get_error() != STATUS_OBJECT_NAME_EXISTS) {
/* initialize it if it didn't already exist */
device->manager = manager;
list_add_before(&manager->devices, &device->entry);
INIT_LIST_HEAD(&device->requests);
if (!(device->fd = alloc_pseudo_fd(&device_fd_ops, &device->obj, 0))) {
release_object(device);
device = NULL;
}
}
}
return device;
}
示例13: handler_poll_event
static void handler_poll_event( struct fd *fd, int event )
{
struct handler *handler = get_fd_user( fd );
if (event & (POLLERR | POLLHUP))
{
/* this is not supposed to happen */
fprintf( stderr, "wineserver: Error on signal handler pipe\n" );
release_object( handler );
}
else if (event & POLLIN)
{
char dummy;
handler->pending = 0;
read( get_unix_fd( handler->fd ), &dummy, 1 );
handler->callback();
}
}
示例14: cleanup_clipboard_thread
/* Called when thread terminates to allow release of clipboard */
void cleanup_clipboard_thread(struct w32thread *thread)
{
struct clipboard *clipboard;
struct winstation *winstation = get_process_winstation(thread->process, WINSTA_ACCESSCLIPBOARD);
if (!winstation)
return;
if ((clipboard = winstation->clipboard)) {
if (thread == clipboard->open_thread) {
clipboard->open_win = 0;
clipboard->open_thread = NULL;
}
if (thread == clipboard->owner_thread) {
clipboard->owner_win = 0;
clipboard->owner_thread = NULL;
}
}
release_object(winstation);
}
示例15: key_hook
int key_hook(unsigned int key, t_core *c)
{
if (key == K_ESC)
{
release_object(&c->otest);
exit(0);
}
else if (key == K_A)
c->anim = !c->anim;
else if (key == K_T)
c->tex_enabled = !c->tex_enabled;
else if (key == K_1 || key == K_N1)
change_rotation(&c->rotations.x);
else if (key == K_2 || key == K_N2)
change_rotation(&c->rotations.y);
else if (key == K_3 || key == K_N3)
change_rotation(&c->rotations.z);
else if (key == K_HOME)
c->current_texture = (c->current_texture + 1) % c->texture_max;
return (1);
}