ObjFW  Check-in [f61f430bfb]

Overview
Comment:Add missing NTAPI for RtlGenRandom
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: f61f430bfb713a3657755b26a43dc0c53658c69c1c16d703539be423adc49819
User & Date: js on 2024-04-21 19:55:51
Other Links: manifest | tags
Context
2024-04-23
01:00
Simplify calls to objfw-embed check-in: 569a7aa657 user: js tags: trunk
2024-04-22
00:02
Merge trunk into 1.1 branch check-in: 69075d7082 user: js tags: 1.1
2024-04-21
19:55
Add missing NTAPI for RtlGenRandom check-in: f61f430bfb user: js tags: trunk
19:15
Use RtlGenRandom on Windows if available check-in: 2bcb2bd40f user: js tags: trunk
Changes

Modified src/OFObject.m from [e25577ee55] to [aac1ccf77b].

81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
extern struct Stret OFForward_stret(id, SEL, ...);
#else
# define OFForward OFMethodNotFound
# define OFForward_stret OFMethodNotFound_stret
#endif

#ifdef OF_WINDOWS
BOOLEAN (*RtlGenRandomFuncPtr)(PVOID, ULONG);
#endif

struct PreIvars {
#ifdef OF_MSDOS
	ptrdiff_t offset;
#endif
	int retainCount;







|







81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
extern struct Stret OFForward_stret(id, SEL, ...);
#else
# define OFForward OFMethodNotFound
# define OFForward_stret OFMethodNotFound_stret
#endif

#ifdef OF_WINDOWS
static BOOLEAN NTAPI (*RtlGenRandomFuncPtr)(PVOID, ULONG);
#endif

struct PreIvars {
#ifdef OF_MSDOS
	ptrdiff_t offset;
#endif
	int retainCount;
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
{
	struct timeval tv;

# ifdef OF_WINDOWS
	HANDLE handle;

	if ((handle = GetModuleHandleA("advapi32.dll")) != NULL &&
	    (RtlGenRandomFuncPtr = (BOOLEAN (*)(PVOID, ULONG))
	    GetProcAddress(handle, "SystemFunction036")) != NULL)
		return;
# endif

# ifdef HAVE_RANDOM
	gettimeofday(&tv, NULL);
	srandom((unsigned)(tv.tv_sec ^ tv.tv_usec));







|







205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
{
	struct timeval tv;

# ifdef OF_WINDOWS
	HANDLE handle;

	if ((handle = GetModuleHandleA("advapi32.dll")) != NULL &&
	    (RtlGenRandomFuncPtr = (BOOLEAN NTAPI (*)(PVOID, ULONG))
	    GetProcAddress(handle, "SystemFunction036")) != NULL)
		return;
# endif

# ifdef HAVE_RANDOM
	gettimeofday(&tv, NULL);
	srandom((unsigned)(tv.tv_sec ^ tv.tv_usec));