- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
/*
|
|
|
|
* Helper functions for ntdll
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* Copyright 2000 Juergen Schmied
|
2010-05-09 13:09:47 +02:00
|
|
|
* Copyright 2010 Marcus Meissner
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
*/
|
|
|
|
|
2001-11-06 21:57:11 +01:00
|
|
|
#include <time.h>
|
|
|
|
#include <math.h>
|
|
|
|
|
2016-06-01 09:00:07 +02:00
|
|
|
#include "ntstatus.h"
|
|
|
|
#define WIN32_NO_STATUS
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
#include "ntdll_misc.h"
|
2016-02-24 19:35:01 +01:00
|
|
|
#include "wmistr.h"
|
|
|
|
#include "evntrace.h"
|
2016-10-27 15:17:31 +02:00
|
|
|
#include "evntprov.h"
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
|
2015-04-21 22:06:33 +02:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
|
2009-02-16 11:46:44 +01:00
|
|
|
LPCSTR debugstr_ObjectAttributes(const OBJECT_ATTRIBUTES *oa)
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
{
|
2009-02-16 11:46:44 +01:00
|
|
|
if (!oa) return "<null>";
|
2020-05-18 22:59:23 +02:00
|
|
|
return wine_dbg_sprintf( "{name=%s, attr=0x%08x, hRoot=%p, sd=%p}",
|
2009-02-16 11:46:44 +01:00
|
|
|
debugstr_us(oa->ObjectName), oa->Attributes,
|
|
|
|
oa->RootDirectory, oa->SecurityDescriptor );
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
}
|
|
|
|
|
2000-08-26 23:16:36 +02:00
|
|
|
LPCSTR debugstr_us( const UNICODE_STRING *us )
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
{
|
2000-08-26 23:16:36 +02:00
|
|
|
if (!us) return "<null>";
|
2002-08-13 20:10:28 +02:00
|
|
|
return debugstr_wn(us->Buffer, us->Length / sizeof(WCHAR));
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
}
|
|
|
|
|
2008-03-26 19:41:54 +01:00
|
|
|
/*********************************************************************
|
|
|
|
* wine_get_version (NTDLL.@)
|
|
|
|
*/
|
2020-06-30 12:08:00 +02:00
|
|
|
const char * CDECL wine_get_version(void)
|
2008-03-26 19:41:54 +01:00
|
|
|
{
|
2020-05-17 11:09:30 +02:00
|
|
|
return unix_funcs->get_version();
|
2008-03-26 19:41:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* wine_get_build_id (NTDLL.@)
|
|
|
|
*/
|
2020-06-30 12:08:00 +02:00
|
|
|
const char * CDECL wine_get_build_id(void)
|
2008-03-26 19:41:54 +01:00
|
|
|
{
|
2020-05-17 11:09:30 +02:00
|
|
|
return unix_funcs->get_build_id();
|
2008-03-26 19:41:54 +01:00
|
|
|
}
|
|
|
|
|
2008-12-09 19:33:06 +01:00
|
|
|
/*********************************************************************
|
|
|
|
* wine_get_host_version (NTDLL.@)
|
|
|
|
*/
|
2020-06-30 12:08:00 +02:00
|
|
|
void CDECL wine_get_host_version( const char **sysname, const char **release )
|
2008-12-09 19:33:06 +01:00
|
|
|
{
|
2020-05-17 11:09:30 +02:00
|
|
|
return unix_funcs->get_host_version( sysname, release );
|
2008-12-09 19:33:06 +01:00
|
|
|
}
|
|
|
|
|
2006-04-18 20:31:41 +02:00
|
|
|
/*********************************************************************
|
|
|
|
* abs (NTDLL.@)
|
|
|
|
*/
|
2020-06-30 12:08:00 +02:00
|
|
|
int CDECL abs( int i )
|
2006-04-18 20:31:41 +02:00
|
|
|
{
|
2020-06-26 09:12:11 +02:00
|
|
|
return i >= 0 ? i : -i;
|
2006-04-18 20:31:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* atan (NTDLL.@)
|
|
|
|
*/
|
2020-06-30 12:08:00 +02:00
|
|
|
double CDECL atan( double d )
|
2006-04-18 20:31:41 +02:00
|
|
|
{
|
2020-06-26 09:12:11 +02:00
|
|
|
return unix_funcs->atan( d );
|
2006-04-18 20:31:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* ceil (NTDLL.@)
|
|
|
|
*/
|
2020-06-30 12:08:00 +02:00
|
|
|
double CDECL ceil( double d )
|
2006-04-18 20:31:41 +02:00
|
|
|
{
|
2020-06-26 09:12:11 +02:00
|
|
|
return unix_funcs->ceil( d );
|
2006-04-18 20:31:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* cos (NTDLL.@)
|
|
|
|
*/
|
2020-06-30 12:08:00 +02:00
|
|
|
double CDECL cos( double d )
|
2006-04-18 20:31:41 +02:00
|
|
|
{
|
2020-06-26 09:12:11 +02:00
|
|
|
return unix_funcs->cos( d );
|
2006-04-18 20:31:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* fabs (NTDLL.@)
|
|
|
|
*/
|
2020-06-30 12:08:00 +02:00
|
|
|
double CDECL fabs( double d )
|
2006-04-18 20:31:41 +02:00
|
|
|
{
|
2020-06-26 09:12:11 +02:00
|
|
|
return unix_funcs->fabs( d );
|
2006-04-18 20:31:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* floor (NTDLL.@)
|
|
|
|
*/
|
2020-06-30 12:08:00 +02:00
|
|
|
double CDECL floor( double d )
|
2006-04-18 20:31:41 +02:00
|
|
|
{
|
2020-06-26 09:12:11 +02:00
|
|
|
return unix_funcs->floor( d );
|
2006-04-18 20:31:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* log (NTDLL.@)
|
|
|
|
*/
|
2020-06-30 12:08:00 +02:00
|
|
|
double CDECL log( double d )
|
2006-04-18 20:31:41 +02:00
|
|
|
{
|
2020-06-26 09:12:11 +02:00
|
|
|
return unix_funcs->log( d );
|
2006-04-18 20:31:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* pow (NTDLL.@)
|
|
|
|
*/
|
2020-06-30 12:08:00 +02:00
|
|
|
double CDECL pow( double x, double y )
|
2006-04-18 20:31:41 +02:00
|
|
|
{
|
2020-06-26 09:12:11 +02:00
|
|
|
return unix_funcs->pow( x, y );
|
2006-04-18 20:31:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* sin (NTDLL.@)
|
|
|
|
*/
|
2020-06-30 12:08:00 +02:00
|
|
|
double CDECL sin( double d )
|
2006-04-18 20:31:41 +02:00
|
|
|
{
|
2020-06-26 09:12:11 +02:00
|
|
|
return unix_funcs->sin( d );
|
2006-04-18 20:31:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* sqrt (NTDLL.@)
|
|
|
|
*/
|
2020-06-30 12:08:00 +02:00
|
|
|
double CDECL sqrt( double d )
|
2006-04-18 20:31:41 +02:00
|
|
|
{
|
2020-06-26 09:12:11 +02:00
|
|
|
return unix_funcs->sqrt( d );
|
2006-04-18 20:31:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* tan (NTDLL.@)
|
|
|
|
*/
|
2020-06-30 12:08:00 +02:00
|
|
|
double CDECL tan( double d )
|
2006-04-18 20:31:41 +02:00
|
|
|
{
|
2020-06-26 09:12:11 +02:00
|
|
|
return unix_funcs->tan( d );
|
2006-04-18 20:31:41 +02:00
|
|
|
}
|
2010-05-09 13:09:47 +02:00
|
|
|
|
2013-03-14 13:43:46 +01:00
|
|
|
#if defined(__GNUC__) && defined(__i386__)
|
|
|
|
|
|
|
|
#define FPU_DOUBLE(var) double var; \
|
|
|
|
__asm__ __volatile__( "fstpl %0;fwait" : "=m" (var) : )
|
|
|
|
#define FPU_DOUBLES(var1,var2) double var1,var2; \
|
|
|
|
__asm__ __volatile__( "fstpl %0;fwait" : "=m" (var2) : ); \
|
|
|
|
__asm__ __volatile__( "fstpl %0;fwait" : "=m" (var1) : )
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* _CIcos (NTDLL.@)
|
|
|
|
*/
|
2020-06-30 12:08:00 +02:00
|
|
|
double CDECL _CIcos(void)
|
2013-03-14 13:43:46 +01:00
|
|
|
{
|
|
|
|
FPU_DOUBLE(x);
|
2020-06-30 12:08:00 +02:00
|
|
|
return cos(x);
|
2013-03-14 13:43:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* _CIlog (NTDLL.@)
|
|
|
|
*/
|
2020-06-30 12:08:00 +02:00
|
|
|
double CDECL _CIlog(void)
|
2013-03-14 13:43:46 +01:00
|
|
|
{
|
|
|
|
FPU_DOUBLE(x);
|
2020-06-30 12:08:00 +02:00
|
|
|
return log(x);
|
2013-03-14 13:43:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* _CIpow (NTDLL.@)
|
|
|
|
*/
|
2020-06-30 12:08:00 +02:00
|
|
|
double CDECL _CIpow(void)
|
2013-03-14 13:43:46 +01:00
|
|
|
{
|
|
|
|
FPU_DOUBLES(x,y);
|
2020-06-30 12:08:00 +02:00
|
|
|
return pow(x,y);
|
2013-03-14 13:43:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* _CIsin (NTDLL.@)
|
|
|
|
*/
|
2020-06-30 12:08:00 +02:00
|
|
|
double CDECL _CIsin(void)
|
2013-03-14 13:43:46 +01:00
|
|
|
{
|
|
|
|
FPU_DOUBLE(x);
|
2020-06-30 12:08:00 +02:00
|
|
|
return sin(x);
|
2013-03-14 13:43:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* _CIsqrt (NTDLL.@)
|
|
|
|
*/
|
2020-06-30 12:08:00 +02:00
|
|
|
double CDECL _CIsqrt(void)
|
2013-03-14 13:43:46 +01:00
|
|
|
{
|
|
|
|
FPU_DOUBLE(x);
|
2020-06-30 12:08:00 +02:00
|
|
|
return sqrt(x);
|
2013-03-14 13:43:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* _ftol (NTDLL.@)
|
|
|
|
*/
|
2020-06-30 12:08:00 +02:00
|
|
|
LONGLONG CDECL _ftol(void)
|
2013-03-14 13:43:46 +01:00
|
|
|
{
|
|
|
|
FPU_DOUBLE(x);
|
|
|
|
return (LONGLONG)x;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* defined(__GNUC__) && defined(__i386__) */
|
2010-05-09 13:09:47 +02:00
|
|
|
|
2010-05-12 07:53:39 +02:00
|
|
|
static void
|
2010-10-02 00:31:03 +02:00
|
|
|
NTDLL_mergesort( void *arr, void *barr, size_t elemsize, int(__cdecl *compar)(const void *, const void *),
|
|
|
|
size_t left, size_t right )
|
2010-05-09 13:09:47 +02:00
|
|
|
{
|
|
|
|
if(right>left) {
|
2010-10-02 00:31:03 +02:00
|
|
|
size_t i, j, k, m;
|
2010-10-05 00:03:34 +02:00
|
|
|
m=left+(right-left)/2;
|
2010-05-12 07:53:39 +02:00
|
|
|
NTDLL_mergesort( arr, barr, elemsize, compar, left, m);
|
|
|
|
NTDLL_mergesort( arr, barr, elemsize, compar, m+1, right);
|
2010-05-09 13:09:47 +02:00
|
|
|
|
|
|
|
#define X(a,i) ((char*)a+elemsize*(i))
|
2011-03-30 10:56:27 +02:00
|
|
|
for (k=left, i=left, j=m+1; i<=m && j<=right; k++) {
|
|
|
|
if (compar(X(arr, i), X(arr,j)) <= 0) {
|
|
|
|
memcpy(X(barr,k), X(arr, i), elemsize);
|
2010-05-09 13:09:47 +02:00
|
|
|
i++;
|
|
|
|
} else {
|
2011-03-30 10:56:27 +02:00
|
|
|
memcpy(X(barr,k), X(arr, j), elemsize);
|
|
|
|
j++;
|
2010-05-09 13:09:47 +02:00
|
|
|
}
|
|
|
|
}
|
2011-03-30 10:56:27 +02:00
|
|
|
if (i<=m)
|
|
|
|
memcpy(X(barr,k), X(arr,i), (m-i+1)*elemsize);
|
|
|
|
else
|
|
|
|
memcpy(X(barr,k), X(arr,j), (right-j+1)*elemsize);
|
|
|
|
|
|
|
|
memcpy(X(arr, left), X(barr, left), (right-left+1)*elemsize);
|
2010-05-09 13:09:47 +02:00
|
|
|
}
|
|
|
|
#undef X
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* qsort (NTDLL.@)
|
|
|
|
*/
|
2020-06-30 12:01:37 +02:00
|
|
|
void __cdecl qsort( void *base, size_t nmemb, size_t size,
|
|
|
|
int (__cdecl *compar)(const void *, const void *) )
|
2010-05-09 13:09:47 +02:00
|
|
|
{
|
2010-10-05 00:04:44 +02:00
|
|
|
void *secondarr;
|
|
|
|
if (nmemb < 2 || size == 0) return;
|
|
|
|
secondarr = RtlAllocateHeap (GetProcessHeap(), 0, nmemb*size);
|
2010-05-12 07:53:39 +02:00
|
|
|
NTDLL_mergesort( base, secondarr, size, compar, 0, nmemb-1 );
|
2010-05-09 13:09:47 +02:00
|
|
|
RtlFreeHeap (GetProcessHeap(),0, secondarr);
|
|
|
|
}
|
2010-05-12 17:26:33 +02:00
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* bsearch (NTDLL.@)
|
|
|
|
*/
|
2020-06-30 12:01:37 +02:00
|
|
|
void * __cdecl bsearch( const void *key, const void *base, size_t nmemb,
|
|
|
|
size_t size, int (__cdecl *compar)(const void *, const void *) )
|
2010-05-12 17:26:33 +02:00
|
|
|
{
|
2010-05-23 22:25:06 +02:00
|
|
|
ssize_t min = 0;
|
|
|
|
ssize_t max = nmemb - 1;
|
|
|
|
|
|
|
|
while (min <= max)
|
|
|
|
{
|
2014-07-03 12:19:25 +02:00
|
|
|
ssize_t cursor = min + (max - min) / 2;
|
2010-05-23 22:25:06 +02:00
|
|
|
int ret = compar(key,(const char *)base+(cursor*size));
|
2010-05-12 17:26:33 +02:00
|
|
|
if (!ret)
|
|
|
|
return (char*)base+(cursor*size);
|
|
|
|
if (ret < 0)
|
2010-05-23 22:25:06 +02:00
|
|
|
max = cursor - 1;
|
2010-05-12 17:26:33 +02:00
|
|
|
else
|
2010-05-23 22:25:06 +02:00
|
|
|
min = cursor + 1;
|
2010-05-12 17:26:33 +02:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* _lfind (NTDLL.@)
|
|
|
|
*/
|
|
|
|
void * __cdecl _lfind( const void *key, const void *base, unsigned int *nmemb,
|
|
|
|
size_t size, int(__cdecl *compar)(const void *, const void *) )
|
|
|
|
{
|
|
|
|
size_t i, n = *nmemb;
|
|
|
|
|
|
|
|
for (i=0;i<n;i++)
|
|
|
|
if (!compar(key,(char*)base+(size*i)))
|
|
|
|
return (char*)base+(size*i);
|
|
|
|
return NULL;
|
|
|
|
}
|
2015-04-21 22:06:33 +02:00
|
|
|
|
2016-06-01 09:00:07 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* WinSqmEndSession (NTDLL.@)
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI WinSqmEndSession(HANDLE session)
|
|
|
|
{
|
|
|
|
FIXME("(%p): stub\n", session);
|
|
|
|
return STATUS_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2018-11-05 14:25:03 +01:00
|
|
|
/*********************************************************************
|
|
|
|
* WinSqmIncrementDWORD (NTDLL.@)
|
|
|
|
*/
|
|
|
|
void WINAPI WinSqmIncrementDWORD(DWORD unk1, DWORD unk2, DWORD unk3)
|
|
|
|
{
|
|
|
|
FIXME("(%d, %d, %d): stub\n", unk1, unk2, unk3);
|
|
|
|
}
|
|
|
|
|
2015-04-21 22:06:33 +02:00
|
|
|
/*********************************************************************
|
|
|
|
* WinSqmIsOptedIn (NTDLL.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI WinSqmIsOptedIn(void)
|
|
|
|
{
|
2016-06-01 09:00:07 +02:00
|
|
|
FIXME("(): stub\n");
|
2015-04-21 22:06:33 +02:00
|
|
|
return FALSE;
|
|
|
|
}
|
2016-02-24 19:35:01 +01:00
|
|
|
|
2016-06-01 09:00:07 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* WinSqmStartSession (NTDLL.@)
|
|
|
|
*/
|
|
|
|
HANDLE WINAPI WinSqmStartSession(GUID *sessionguid, DWORD sessionid, DWORD unknown1)
|
|
|
|
{
|
|
|
|
FIXME("(%p, 0x%x, 0x%x): stub\n", sessionguid, sessionid, unknown1);
|
|
|
|
return INVALID_HANDLE_VALUE;
|
|
|
|
}
|
|
|
|
|
2018-06-17 18:18:32 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* WinSqmSetDWORD (NTDLL.@)
|
|
|
|
*/
|
|
|
|
void WINAPI WinSqmSetDWORD(HANDLE session, DWORD datapoint_id, DWORD datapoint_value)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %d, %d): stub\n", session, datapoint_id, datapoint_value);
|
|
|
|
}
|
|
|
|
|
2019-06-24 12:19:20 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* EtwEventActivityIdControl (NTDLL.@)
|
|
|
|
*/
|
|
|
|
ULONG WINAPI EtwEventActivityIdControl(ULONG code, GUID *guid)
|
|
|
|
{
|
|
|
|
static int once;
|
|
|
|
|
|
|
|
if (!once++) FIXME("0x%x, %p: stub\n", code, guid);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* EtwEventProviderEnabled (NTDLL.@)
|
|
|
|
*/
|
|
|
|
BOOLEAN WINAPI EtwEventProviderEnabled( REGHANDLE handle, UCHAR level, ULONGLONG keyword )
|
|
|
|
{
|
|
|
|
FIXME("%s, %u, %s: stub\n", wine_dbgstr_longlong(handle), level, wine_dbgstr_longlong(keyword));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2016-10-27 15:17:31 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* EtwEventRegister (NTDLL.@)
|
|
|
|
*/
|
|
|
|
ULONG WINAPI EtwEventRegister( LPCGUID provider, PENABLECALLBACK callback, PVOID context,
|
|
|
|
PREGHANDLE handle )
|
|
|
|
{
|
|
|
|
FIXME("(%s, %p, %p, %p) stub.\n", debugstr_guid(provider), callback, context, handle);
|
|
|
|
|
2019-10-31 14:58:02 +01:00
|
|
|
if (!handle) return ERROR_INVALID_PARAMETER;
|
|
|
|
|
2016-10-27 15:17:31 +02:00
|
|
|
*handle = 0xdeadbeef;
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* EtwEventUnregister (NTDLL.@)
|
|
|
|
*/
|
|
|
|
ULONG WINAPI EtwEventUnregister( REGHANDLE handle )
|
|
|
|
{
|
|
|
|
FIXME("(%s) stub.\n", wine_dbgstr_longlong(handle));
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2016-12-02 13:34:37 +01:00
|
|
|
/*********************************************************************
|
|
|
|
* EtwEventSetInformation (NTDLL.@)
|
|
|
|
*/
|
|
|
|
ULONG WINAPI EtwEventSetInformation( REGHANDLE handle, EVENT_INFO_CLASS class, void *info,
|
|
|
|
ULONG length )
|
|
|
|
{
|
|
|
|
FIXME("(%s, %u, %p, %u) stub\n", wine_dbgstr_longlong(handle), class, info, length);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2019-08-19 01:14:30 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* EtwEventWriteString (NTDLL.@)
|
|
|
|
*/
|
|
|
|
ULONG WINAPI EtwEventWriteString( REGHANDLE handle, UCHAR level, ULONGLONG keyword, PCWSTR string )
|
|
|
|
{
|
|
|
|
FIXME("%s, %u, %s, %s: stub\n", wine_dbgstr_longlong(handle), level,
|
|
|
|
wine_dbgstr_longlong(keyword), debugstr_w(string));
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2019-06-24 12:19:20 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* EtwEventWriteTransfer (NTDLL.@)
|
|
|
|
*/
|
|
|
|
ULONG WINAPI EtwEventWriteTransfer( REGHANDLE handle, PCEVENT_DESCRIPTOR descriptor, LPCGUID activity,
|
|
|
|
LPCGUID related, ULONG count, PEVENT_DATA_DESCRIPTOR data )
|
|
|
|
{
|
|
|
|
FIXME("%s, %p, %s, %s, %u, %p: stub\n", wine_dbgstr_longlong(handle), descriptor,
|
|
|
|
debugstr_guid(activity), debugstr_guid(related), count, data);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2016-02-24 19:35:01 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* EtwRegisterTraceGuidsW (NTDLL.@)
|
|
|
|
*
|
|
|
|
* Register an event trace provider and the event trace classes that it uses
|
|
|
|
* to generate events.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* RequestAddress [I] ControlCallback function
|
|
|
|
* RequestContext [I] Optional provider-defined context
|
|
|
|
* ControlGuid [I] GUID of the registering provider
|
|
|
|
* GuidCount [I] Number of elements in the TraceGuidReg array
|
|
|
|
* TraceGuidReg [I/O] Array of TRACE_GUID_REGISTRATION structures
|
|
|
|
* MofImagePath [I] not supported, set to NULL
|
|
|
|
* MofResourceName [I] not supported, set to NULL
|
|
|
|
* RegistrationHandle [O] Provider's registration handle
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS
|
|
|
|
* Failure: System error code
|
|
|
|
*/
|
|
|
|
ULONG WINAPI EtwRegisterTraceGuidsW( WMIDPREQUEST RequestAddress,
|
|
|
|
void *RequestContext, const GUID *ControlGuid, ULONG GuidCount,
|
|
|
|
TRACE_GUID_REGISTRATION *TraceGuidReg, const WCHAR *MofImagePath,
|
|
|
|
const WCHAR *MofResourceName, TRACEHANDLE *RegistrationHandle )
|
|
|
|
{
|
|
|
|
FIXME("(%p, %p, %s, %u, %p, %s, %s, %p): stub\n", RequestAddress, RequestContext,
|
|
|
|
debugstr_guid(ControlGuid), GuidCount, TraceGuidReg, debugstr_w(MofImagePath),
|
|
|
|
debugstr_w(MofResourceName), RegistrationHandle);
|
|
|
|
|
|
|
|
if (TraceGuidReg)
|
|
|
|
{
|
|
|
|
ULONG i;
|
|
|
|
for (i = 0; i < GuidCount; i++)
|
|
|
|
{
|
|
|
|
FIXME(" register trace class %s\n", debugstr_guid(TraceGuidReg[i].Guid));
|
|
|
|
TraceGuidReg[i].RegHandle = (HANDLE)0xdeadbeef;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*RegistrationHandle = (TRACEHANDLE)0xdeadbeef;
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* EtwRegisterTraceGuidsA (NTDLL.@)
|
|
|
|
*/
|
|
|
|
ULONG WINAPI EtwRegisterTraceGuidsA( WMIDPREQUEST RequestAddress,
|
|
|
|
void *RequestContext, const GUID *ControlGuid, ULONG GuidCount,
|
|
|
|
TRACE_GUID_REGISTRATION *TraceGuidReg, const char *MofImagePath,
|
|
|
|
const char *MofResourceName, TRACEHANDLE *RegistrationHandle )
|
|
|
|
{
|
|
|
|
FIXME("(%p, %p, %s, %u, %p, %s, %s, %p): stub\n", RequestAddress, RequestContext,
|
|
|
|
debugstr_guid(ControlGuid), GuidCount, TraceGuidReg, debugstr_a(MofImagePath),
|
|
|
|
debugstr_a(MofResourceName), RegistrationHandle);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2017-01-25 16:18:43 +01:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* EtwUnregisterTraceGuids (NTDLL.@)
|
|
|
|
*/
|
|
|
|
ULONG WINAPI EtwUnregisterTraceGuids( TRACEHANDLE RegistrationHandle )
|
|
|
|
{
|
|
|
|
if (!RegistrationHandle)
|
|
|
|
return ERROR_INVALID_PARAMETER;
|
|
|
|
|
|
|
|
FIXME("%s: stub\n", wine_dbgstr_longlong(RegistrationHandle));
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2017-05-05 17:50:16 +02:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* EtwEventEnabled (NTDLL.@)
|
|
|
|
*/
|
|
|
|
BOOLEAN WINAPI EtwEventEnabled( REGHANDLE handle, const EVENT_DESCRIPTOR *descriptor )
|
|
|
|
{
|
|
|
|
FIXME("(%s, %p): stub\n", wine_dbgstr_longlong(handle), descriptor);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2017-05-07 16:51:20 +02:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* EtwEventWrite (NTDLL.@)
|
|
|
|
*/
|
|
|
|
ULONG WINAPI EtwEventWrite( REGHANDLE handle, const EVENT_DESCRIPTOR *descriptor, ULONG count,
|
|
|
|
EVENT_DATA_DESCRIPTOR *data )
|
|
|
|
{
|
|
|
|
FIXME("(%s, %p, %u, %p): stub\n", wine_dbgstr_longlong(handle), descriptor, count, data);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
2018-04-23 23:24:30 +02:00
|
|
|
|
2019-06-24 12:19:20 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* EtwGetTraceEnableFlags (NTDLL.@)
|
|
|
|
*/
|
|
|
|
ULONG WINAPI EtwGetTraceEnableFlags( TRACEHANDLE handle )
|
|
|
|
{
|
|
|
|
FIXME("(%s) stub\n", wine_dbgstr_longlong(handle));
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* EtwGetTraceEnableLevel (NTDLL.@)
|
|
|
|
*/
|
|
|
|
UCHAR WINAPI EtwGetTraceEnableLevel( TRACEHANDLE handle )
|
|
|
|
{
|
|
|
|
FIXME("(%s) stub\n", wine_dbgstr_longlong(handle));
|
|
|
|
return TRACE_LEVEL_VERBOSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* EtwGetTraceLoggerHandle (NTDLL.@)
|
|
|
|
*/
|
|
|
|
TRACEHANDLE WINAPI EtwGetTraceLoggerHandle( PVOID buf )
|
|
|
|
{
|
|
|
|
FIXME("(%p) stub\n", buf);
|
|
|
|
return INVALID_PROCESSTRACE_HANDLE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* EtwLogTraceEvent (NTDLL.@)
|
|
|
|
*/
|
|
|
|
ULONG WINAPI EtwLogTraceEvent( TRACEHANDLE SessionHandle, PEVENT_TRACE_HEADER EventTrace )
|
|
|
|
{
|
|
|
|
FIXME("%s %p\n", wine_dbgstr_longlong(SessionHandle), EventTrace);
|
|
|
|
return ERROR_CALL_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* EtwTraceMessageVa (NTDLL.@)
|
|
|
|
*/
|
|
|
|
ULONG WINAPI EtwTraceMessageVa( TRACEHANDLE handle, ULONG flags, LPGUID guid, USHORT number,
|
|
|
|
__ms_va_list args )
|
|
|
|
{
|
|
|
|
FIXME("(%s %x %s %d) : stub\n", wine_dbgstr_longlong(handle), flags, debugstr_guid(guid), number);
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* EtwTraceMessage (NTDLL.@)
|
|
|
|
*/
|
2020-05-22 14:31:35 +02:00
|
|
|
ULONG WINAPIV EtwTraceMessage( TRACEHANDLE handle, ULONG flags, LPGUID guid, /*USHORT*/ ULONG number, ... )
|
2019-06-24 12:19:20 +02:00
|
|
|
{
|
|
|
|
__ms_va_list valist;
|
|
|
|
ULONG ret;
|
|
|
|
|
|
|
|
__ms_va_start( valist, number );
|
|
|
|
ret = EtwTraceMessageVa( handle, flags, guid, number, valist );
|
|
|
|
__ms_va_end( valist );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2018-08-16 22:41:41 +02:00
|
|
|
NTSTATUS WINAPI NtCreateLowBoxToken(HANDLE *token_handle, HANDLE existing_token_handle, ACCESS_MASK desired_access,
|
|
|
|
OBJECT_ATTRIBUTES *object_attributes, SID *package_sid, ULONG capability_count,
|
|
|
|
SID_AND_ATTRIBUTES *capabilities, ULONG handle_count, HANDLE *handle)
|
|
|
|
{
|
|
|
|
FIXME("(%p, %p, %x, %p, %p, %u, %p, %u, %p): stub\n", token_handle, existing_token_handle, desired_access,
|
|
|
|
object_attributes, package_sid, capability_count, capabilities, handle_count, handle);
|
|
|
|
|
|
|
|
/* We need to return a NULL handle since later it will be passed to CloseHandle and that must not fail */
|
|
|
|
*token_handle = NULL;
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
2018-09-12 05:53:50 +02:00
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* ApiSetQueryApiSetPresence (NTDLL.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI ApiSetQueryApiSetPresence(const UNICODE_STRING *namespace, BOOLEAN *present)
|
|
|
|
{
|
|
|
|
FIXME("(%s, %p) stub!\n", debugstr_us(namespace), present);
|
|
|
|
|
|
|
|
if(present)
|
|
|
|
*present = TRUE;
|
|
|
|
return TRUE;
|
|
|
|
}
|