Commit ce41edab authored by Jinoh Kang's avatar Jinoh Kang Committed by Alexandre Julliard

ntdll: Implement NtMakePermanentObject.

parent e368515e
......@@ -253,7 +253,7 @@
# @ stub NtLockProductActivationKeys
# @ stub NtLockRegistryKey
@ stdcall -syscall NtLockVirtualMemory(long ptr ptr long)
# @ stub NtMakePermanentObject
@ stdcall -syscall NtMakePermanentObject(long)
@ stdcall -syscall NtMakeTemporaryObject(long)
# @ stub NtMapUserPhysicalPages
# @ stub NtMapUserPhysicalPagesScatter
......@@ -1302,7 +1302,7 @@
# @ stub ZwLockProductActivationKeys
# @ stub ZwLockRegistryKey
@ stdcall -private -syscall ZwLockVirtualMemory(long ptr ptr long) NtLockVirtualMemory
# @ stub ZwMakePermanentObject
@ stdcall -private -syscall ZwMakePermanentObject(long) NtMakePermanentObject
@ stdcall -private -syscall ZwMakeTemporaryObject(long) NtMakeTemporaryObject
# @ stub ZwMapUserPhysicalPages
# @ stub ZwMapUserPhysicalPagesScatter
......
......@@ -611,6 +611,11 @@ NTSTATUS SYSCALL_API NtLockVirtualMemory( HANDLE process, PVOID *addr, SIZE_T *s
SYSCALL_FUNC( NtLockVirtualMemory );
}
NTSTATUS SYSCALL_API NtMakePermanentObject( HANDLE handle )
{
SYSCALL_FUNC( NtMakePermanentObject );
}
NTSTATUS SYSCALL_API NtMakeTemporaryObject( HANDLE handle )
{
SYSCALL_FUNC( NtMakeTemporaryObject );
......
......@@ -3163,6 +3163,7 @@ static void test_object_permanence(void)
ULONG initial_attr;
ACCESS_MASK access;
BOOLEAN make_temporary;
BOOLEAN make_permanent;
NTSTATUS make_temp_status;
} tests[] = {
{
......@@ -3184,6 +3185,20 @@ static void test_object_permanence(void)
.make_temporary = TRUE,
.make_temp_status = STATUS_ACCESS_DENIED,
},
{
.name = "NtMakePermanentObject() succeeds even if already permanent",
.initial_attr = OBJ_PERMANENT,
.access = EVENT_ALL_ACCESS & ~DELETE,
.make_permanent = TRUE,
},
{
.name = "NtMakePermanentObject() reverses effect of NtMakeTemporaryObject()",
.initial_attr = OBJ_PERMANENT,
.access = GENERIC_ALL,
.make_temporary = TRUE,
.make_temp_status = STATUS_SUCCESS,
.make_permanent = TRUE,
},
{
.name = "temporary object disappears",
......@@ -3204,6 +3219,20 @@ static void test_object_permanence(void)
.make_temporary = TRUE,
.make_temp_status = STATUS_ACCESS_DENIED,
},
{
.name = "NtMakePermanentObject() makes an object persist",
.initial_attr = 0,
.access = EVENT_ALL_ACCESS & ~DELETE,
.make_permanent = TRUE,
},
{
.name = "NtMakePermanentObject() is not annulled by calling NtMakeTemporaryObject() on an already temporary object",
.initial_attr = 0,
.access = GENERIC_ALL,
.make_temporary = TRUE,
.make_temp_status = STATUS_SUCCESS,
.make_permanent = TRUE,
},
};
const struct object_permanence_test *test;
HANDLE process_token = NULL, thread_token = NULL;
......@@ -3317,6 +3346,14 @@ static void test_object_permanence(void)
}
winetest_pop_context();
if (test->make_permanent)
{
status = NtMakePermanentObject( handle );
todo_wine_if(status == STATUS_SUCCESS || status == STATUS_PRIVILEGE_NOT_HELD)
ok( status == make_perma_status, "NtMakePermanentObject returned %08lx expected (%08lx)\n", status, make_perma_status );
if (!NT_ERROR(status)) is_permanent = TRUE;
}
if (winetest_debug > 1)
trace( "NOTE: about to close earlier handle (%p) which should be the last", handle );
NtClose( handle );
......
......@@ -1273,6 +1273,26 @@ NTSTATUS WINAPI NtQuerySymbolicLinkObject( HANDLE handle, UNICODE_STRING *target
/**************************************************************************
* NtMakePermanentObject (NTDLL.@)
*/
NTSTATUS WINAPI NtMakePermanentObject( HANDLE handle )
{
unsigned int ret;
TRACE("%p\n", handle);
SERVER_START_REQ( set_object_permanence )
{
req->handle = wine_server_obj_handle( handle );
req->permanent = 1;
ret = wine_server_call( req );
}
SERVER_END_REQ;
return ret;
}
/**************************************************************************
* NtMakeTemporaryObject (NTDLL.@)
*/
NTSTATUS WINAPI NtMakeTemporaryObject( HANDLE handle )
......
......@@ -799,7 +799,6 @@
@ stdcall NtFsControlFile(long long ptr ptr ptr long ptr long ptr long)
@ stub NtGlobalFlag
@ stdcall NtLockFile(long long ptr ptr ptr ptr ptr ptr long long)
@ stub NtMakePermanentObject
@ stdcall NtMapViewOfSection(long long ptr long long ptr ptr long long long)
@ stdcall NtNotifyChangeDirectoryFile(long long ptr ptr ptr ptr long long long)
@ stdcall NtOpenFile(ptr long ptr ptr long long)
......@@ -1446,6 +1445,7 @@
@ stdcall -private ZwLoadKey(ptr ptr) NtLoadKey
@ stdcall -private ZwLockFile(long long ptr ptr ptr ptr ptr ptr long long) NtLockFile
@ stdcall -private ZwLockVirtualMemory(long ptr ptr long) NtLockVirtualMemory
@ stdcall ZwMakePermanentObject(long) NtMakePermanentObject
@ stdcall ZwMakeTemporaryObject(long) NtMakeTemporaryObject
@ stdcall ZwMapViewOfSection(long long ptr long long ptr ptr long long long) NtMapViewOfSection
@ stdcall -private ZwNotifyChangeDirectoryFile(long long ptr ptr ptr ptr long long long) NtNotifyChangeDirectoryFile
......
......@@ -535,6 +535,17 @@ NTSTATUS WINAPI wow64_NtListenPort( UINT *args )
/**********************************************************************
* wow64_NtMakePermanentObject
*/
NTSTATUS WINAPI wow64_NtMakePermanentObject( UINT *args )
{
HANDLE handle = get_handle( &args );
return NtMakePermanentObject( handle );
}
/**********************************************************************
* wow64_NtMakeTemporaryObject
*/
NTSTATUS WINAPI wow64_NtMakeTemporaryObject( UINT *args )
......
......@@ -4480,6 +4480,7 @@ NTSYSAPI NTSTATUS WINAPI NtLoadKey2(const OBJECT_ATTRIBUTES *,OBJECT_ATTRIBUTES
NTSYSAPI NTSTATUS WINAPI NtLoadKeyEx(const OBJECT_ATTRIBUTES *,OBJECT_ATTRIBUTES *,ULONG,HANDLE,HANDLE,ACCESS_MASK,HANDLE *,IO_STATUS_BLOCK *);
NTSYSAPI NTSTATUS WINAPI NtLockFile(HANDLE,HANDLE,PIO_APC_ROUTINE,void*,PIO_STATUS_BLOCK,PLARGE_INTEGER,PLARGE_INTEGER,ULONG*,BOOLEAN,BOOLEAN);
NTSYSAPI NTSTATUS WINAPI NtLockVirtualMemory(HANDLE,PVOID*,SIZE_T*,ULONG);
NTSYSAPI NTSTATUS WINAPI NtMakePermanentObject(HANDLE);
NTSYSAPI NTSTATUS WINAPI NtMakeTemporaryObject(HANDLE);
NTSYSAPI NTSTATUS WINAPI NtMapViewOfSection(HANDLE,HANDLE,PVOID*,ULONG_PTR,SIZE_T,const LARGE_INTEGER*,SIZE_T*,SECTION_INHERIT,ULONG,ULONG);
NTSYSAPI NTSTATUS WINAPI NtMapViewOfSectionEx(HANDLE,HANDLE,PVOID*,const LARGE_INTEGER*,SIZE_T*,ULONG,ULONG,MEM_EXTENDED_PARAMETER*,ULONG);
......
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