From: Paul Gofman <pgofman@codeweavers.com> --- dlls/kernel32/tests/process.c | 4 ++++ dlls/ntdll/unix/loader.c | 2 ++ dlls/ntdll/unix/process.c | 4 ++-- dlls/ntdll/unix/system.c | 2 +- dlls/ntdll/unix/unix_private.h | 2 ++ 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c index fd7f5a8d34c..f67189205d5 100644 --- a/dlls/kernel32/tests/process.c +++ b/dlls/kernel32/tests/process.c @@ -4369,8 +4369,12 @@ static void test_process_info(HANDLE hproc) break; case ProcessCookie: if (is_current) + { ok(status == STATUS_SUCCESS || status == STATUS_INVALID_PARAMETER /* before win8 */, "for info %lu got %08lx (ret_len %lu)\n", i, status, ret_len); + if (!status) + ok( *(ULONG *)buf, "got 0.\n" ); + } else ok(status == STATUS_INVALID_PARAMETER /* before win8 */ || status == STATUS_ACCESS_DENIED, "for info %lu got %08lx (ret_len %lu)\n", i, status, ret_len); diff --git a/dlls/ntdll/unix/loader.c b/dlls/ntdll/unix/loader.c index cb700dd80e8..c1ac262e5d6 100644 --- a/dlls/ntdll/unix/loader.c +++ b/dlls/ntdll/unix/loader.c @@ -1914,6 +1914,8 @@ static void start_main_thread(void) startup_info_size = server_init_process(); virtual_map_user_shared_data(); init_cpu_info(); + process_cookie = 0xdeadbeef; + get_random( &process_cookie, sizeof(process_cookie) ); init_files(); init_startup_info(); *(ULONG_PTR *)&peb->CloudFileFlags = get_image_address(); diff --git a/dlls/ntdll/unix/process.c b/dlls/ntdll/unix/process.c index 4c2e7eba49a..15405f3d0f6 100644 --- a/dlls/ntdll/unix/process.c +++ b/dlls/ntdll/unix/process.c @@ -77,6 +77,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(process); static ULONG execute_flags = MEM_EXECUTE_OPTION_DISABLE; static UINT process_error_mode; +ULONG process_cookie; static char **build_argv( const UNICODE_STRING *cmdline, int reserved ) { @@ -1506,11 +1507,10 @@ NTSTATUS WINAPI NtQueryInformationProcess( HANDLE handle, PROCESSINFOCLASS class break; case ProcessCookie: - FIXME( "ProcessCookie (%p,%p,0x%08x,%p) stub\n", handle, info, size, ret_len ); if (handle == NtCurrentProcess()) { len = sizeof(ULONG); - if (size == len) *(ULONG *)info = 0; + if (size == len) *(ULONG *)info = process_cookie; else ret = STATUS_INFO_LENGTH_MISMATCH; } else ret = STATUS_INVALID_PARAMETER; diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c index 08774d79de7..31df6fcf496 100644 --- a/dlls/ntdll/unix/system.c +++ b/dlls/ntdll/unix/system.c @@ -3024,7 +3024,7 @@ static void read_dev_urandom( void *buf, ULONG len ) else WARN( "can't open /dev/urandom\n" ); } -static void get_random( void *buf, ULONG len ) +void get_random( void *buf, ULONG len ) { #ifdef HAVE_GETRANDOM int ret; diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index 3932b175a96..727a443b0d9 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -203,6 +203,7 @@ extern timeout_t server_start_time; extern sigset_t server_block_set; extern pthread_mutex_t fd_cache_mutex; extern struct _KUSER_SHARED_DATA *user_shared_data; +extern ULONG process_cookie; extern void init_environment(void); extern void init_startup_info(void); @@ -271,6 +272,7 @@ extern NTSTATUS get_thread_context( HANDLE handle, void *context, BOOL *self, US extern unsigned int alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, struct object_attributes **ret, data_size_t *ret_len ); extern NTSTATUS system_time_precise( void *args ); +extern void get_random( void *buf, ULONG len ); extern void *anon_mmap_fixed( void *start, size_t size, int prot, int flags ); extern void *anon_mmap_alloc( size_t size, int prot ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9926