ntdll: Return buffer filled with random values from NtQuerySystemInformation(SystemInterruptInformation).
Based on a patch by Sebastian Lackner. Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
23a879ec0e
commit
ec02224941
|
@ -7486,6 +7486,7 @@ for ac_header in \
|
||||||
sys/protosw.h \
|
sys/protosw.h \
|
||||||
sys/ptrace.h \
|
sys/ptrace.h \
|
||||||
sys/queue.h \
|
sys/queue.h \
|
||||||
|
sys/random.h \
|
||||||
sys/resource.h \
|
sys/resource.h \
|
||||||
sys/scsiio.h \
|
sys/scsiio.h \
|
||||||
sys/shm.h \
|
sys/shm.h \
|
||||||
|
@ -17877,6 +17878,7 @@ for ac_func in \
|
||||||
getauxval \
|
getauxval \
|
||||||
getifaddrs \
|
getifaddrs \
|
||||||
getopt_long_only \
|
getopt_long_only \
|
||||||
|
getrandom \
|
||||||
kqueue \
|
kqueue \
|
||||||
lstat \
|
lstat \
|
||||||
mach_continuous_time \
|
mach_continuous_time \
|
||||||
|
|
|
@ -514,6 +514,7 @@ AC_CHECK_HEADERS(\
|
||||||
sys/protosw.h \
|
sys/protosw.h \
|
||||||
sys/ptrace.h \
|
sys/ptrace.h \
|
||||||
sys/queue.h \
|
sys/queue.h \
|
||||||
|
sys/random.h \
|
||||||
sys/resource.h \
|
sys/resource.h \
|
||||||
sys/scsiio.h \
|
sys/scsiio.h \
|
||||||
sys/shm.h \
|
sys/shm.h \
|
||||||
|
@ -2181,6 +2182,7 @@ AC_CHECK_FUNCS(\
|
||||||
getauxval \
|
getauxval \
|
||||||
getifaddrs \
|
getifaddrs \
|
||||||
getopt_long_only \
|
getopt_long_only \
|
||||||
|
getrandom \
|
||||||
kqueue \
|
kqueue \
|
||||||
lstat \
|
lstat \
|
||||||
mach_continuous_time \
|
mach_continuous_time \
|
||||||
|
|
|
@ -643,7 +643,8 @@ static void test_query_interrupt(void)
|
||||||
sii = HeapAlloc(GetProcessHeap(), 0, NeededLength);
|
sii = HeapAlloc(GetProcessHeap(), 0, NeededLength);
|
||||||
|
|
||||||
status = pNtQuerySystemInformation(SystemInterruptInformation, sii, 0, &ReturnLength);
|
status = pNtQuerySystemInformation(SystemInterruptInformation, sii, 0, &ReturnLength);
|
||||||
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
|
ok(status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
|
||||||
|
ok(ReturnLength == NeededLength, "got %u\n", ReturnLength);
|
||||||
|
|
||||||
/* Try it for all processors */
|
/* Try it for all processors */
|
||||||
status = pNtQuerySystemInformation(SystemInterruptInformation, sii, NeededLength, &ReturnLength);
|
status = pNtQuerySystemInformation(SystemInterruptInformation, sii, NeededLength, &ReturnLength);
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <errno.h>
|
||||||
#ifdef HAVE_SYS_TIME_H
|
#ifdef HAVE_SYS_TIME_H
|
||||||
# include <sys/time.h>
|
# include <sys/time.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -42,6 +43,9 @@
|
||||||
#ifdef HAVE_MACHINE_CPU_H
|
#ifdef HAVE_MACHINE_CPU_H
|
||||||
# include <machine/cpu.h>
|
# include <machine/cpu.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_SYS_RANDOM_H
|
||||||
|
# include <sys/random.h>
|
||||||
|
#endif
|
||||||
#ifdef HAVE_IOKIT_IOKITLIB_H
|
#ifdef HAVE_IOKIT_IOKITLIB_H
|
||||||
# include <CoreFoundation/CoreFoundation.h>
|
# include <CoreFoundation/CoreFoundation.h>
|
||||||
# include <IOKit/IOKitLib.h>
|
# include <IOKit/IOKitLib.h>
|
||||||
|
@ -2422,16 +2426,36 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
|
||||||
|
|
||||||
case SystemInterruptInformation:
|
case SystemInterruptInformation:
|
||||||
{
|
{
|
||||||
SYSTEM_INTERRUPT_INFORMATION sii = {{ 0 }};
|
len = NtCurrentTeb()->Peb->NumberOfProcessors * sizeof(SYSTEM_INTERRUPT_INFORMATION);
|
||||||
|
|
||||||
len = sizeof(sii);
|
|
||||||
if (size >= len)
|
if (size >= len)
|
||||||
{
|
{
|
||||||
if (!info) ret = STATUS_ACCESS_VIOLATION;
|
if (!info) ret = STATUS_ACCESS_VIOLATION;
|
||||||
else memcpy( info, &sii, len);
|
else
|
||||||
|
{
|
||||||
|
#ifdef HAVE_GETRANDOM
|
||||||
|
int ret;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
ret = getrandom( info, len, 0 );
|
||||||
|
}
|
||||||
|
while (ret == -1 && errno == EINTR);
|
||||||
|
#else
|
||||||
|
int fd = open( "/dev/urandom", O_RDONLY );
|
||||||
|
if (fd != -1)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
ret = read( fd, info, len );
|
||||||
|
}
|
||||||
|
while (ret == -1 && errno == EINTR);
|
||||||
|
close( fd );
|
||||||
|
}
|
||||||
|
else WARN( "can't open /dev/urandom\n" );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else ret = STATUS_INFO_LENGTH_MISMATCH;
|
else ret = STATUS_INFO_LENGTH_MISMATCH;
|
||||||
FIXME("info_class SYSTEM_INTERRUPT_INFORMATION\n");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -252,6 +252,9 @@
|
||||||
/* Define to 1 if you have the `getopt_long_only' function. */
|
/* Define to 1 if you have the `getopt_long_only' function. */
|
||||||
#undef HAVE_GETOPT_LONG_ONLY
|
#undef HAVE_GETOPT_LONG_ONLY
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `getrandom' function. */
|
||||||
|
#undef HAVE_GETRANDOM
|
||||||
|
|
||||||
/* Define to 1 if you have the `getservbyport' function. */
|
/* Define to 1 if you have the `getservbyport' function. */
|
||||||
#undef HAVE_GETSERVBYPORT
|
#undef HAVE_GETSERVBYPORT
|
||||||
|
|
||||||
|
@ -1061,6 +1064,9 @@
|
||||||
/* Define to 1 if you have the <sys/queue.h> header file. */
|
/* Define to 1 if you have the <sys/queue.h> header file. */
|
||||||
#undef HAVE_SYS_QUEUE_H
|
#undef HAVE_SYS_QUEUE_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/random.h> header file. */
|
||||||
|
#undef HAVE_SYS_RANDOM_H
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/resource.h> header file. */
|
/* Define to 1 if you have the <sys/resource.h> header file. */
|
||||||
#undef HAVE_SYS_RESOURCE_H
|
#undef HAVE_SYS_RESOURCE_H
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue