- 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
|
|
|
|
*
|
|
|
|
* 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
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2001-11-06 21:57:11 +01:00
|
|
|
#include <time.h>
|
|
|
|
#include <math.h>
|
|
|
|
|
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"
|
|
|
|
|
2002-03-10 00:29:33 +01: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
|
|
|
|
2000-06-23 18:16:30 +02:00
|
|
|
#if defined(__GNUC__) && defined(__i386__)
|
|
|
|
#define DO_FPU(x,y) __asm__ __volatile__( x " %0;fwait" : "=m" (y) : )
|
|
|
|
#define POP_FPU(x) DO_FPU("fstpl",x)
|
|
|
|
#endif
|
|
|
|
|
2000-10-15 02:39:11 +02:00
|
|
|
void dump_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
|
|
|
{
|
|
|
|
if (oa)
|
2006-10-16 13:49:06 +02:00
|
|
|
TRACE("%p:(name=%s, attr=0x%08x, hRoot=%p, sd=%p)\n",
|
- 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
|
|
|
oa, debugstr_us(oa->ObjectName),
|
|
|
|
oa->Attributes, oa->RootDirectory, oa->SecurityDescriptor);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2000-06-23 18:16:30 +02:00
|
|
|
/*********************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* _ftol (NTDLL.@)
|
2000-12-03 00:44:59 +01:00
|
|
|
*
|
|
|
|
* VERSION
|
|
|
|
* [GNUC && i386]
|
2000-06-23 18:16:30 +02:00
|
|
|
*/
|
2000-12-03 00:44:59 +01:00
|
|
|
#if defined(__GNUC__) && defined(__i386__)
|
2006-06-12 21:35:07 +02:00
|
|
|
LONGLONG CDECL NTDLL__ftol(void)
|
2000-06-23 18:16:30 +02:00
|
|
|
{
|
|
|
|
/* don't just do DO_FPU("fistp",retval), because the rounding
|
|
|
|
* mode must also be set to "round towards zero"... */
|
|
|
|
double fl;
|
|
|
|
POP_FPU(fl);
|
2003-08-19 03:03:08 +02:00
|
|
|
return (LONGLONG)fl;
|
2000-06-23 18:16:30 +02:00
|
|
|
}
|
2000-12-03 00:44:59 +01:00
|
|
|
#endif /* defined(__GNUC__) && defined(__i386__) */
|
|
|
|
|
|
|
|
/*********************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* _ftol (NTDLL.@)
|
2000-12-03 00:44:59 +01:00
|
|
|
*
|
|
|
|
* FIXME
|
|
|
|
* Should be register function
|
|
|
|
* VERSION
|
|
|
|
* [!GNUC && i386]
|
|
|
|
*/
|
2001-07-26 23:41:22 +02:00
|
|
|
#if !defined(__GNUC__) && defined(__i386__)
|
2006-06-12 21:35:07 +02:00
|
|
|
LONGLONG CDECL NTDLL__ftol(double fl)
|
2000-06-23 18:16:30 +02:00
|
|
|
{
|
|
|
|
FIXME("should be register function\n");
|
2003-08-19 03:03:08 +02:00
|
|
|
return (LONGLONG)fl;
|
2000-06-23 18:16:30 +02:00
|
|
|
}
|
2000-12-03 00:44:59 +01:00
|
|
|
#endif /* !defined(__GNUC__) && defined(__i386__) */
|
|
|
|
|
|
|
|
/*********************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* _ftol (NTDLL.@)
|
2000-12-03 00:44:59 +01:00
|
|
|
* VERSION
|
|
|
|
* [!i386]
|
|
|
|
*/
|
|
|
|
#ifndef __i386__
|
2006-06-12 21:35:07 +02:00
|
|
|
LONG CDECL NTDLL__ftol(double fl)
|
2000-12-03 00:44:59 +01:00
|
|
|
{
|
|
|
|
return (LONG) fl;
|
|
|
|
}
|
|
|
|
#endif /* !defined(__i386__) */
|
2000-06-23 18:16:30 +02:00
|
|
|
|
|
|
|
/*********************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* _CIpow (NTDLL.@)
|
2000-12-03 00:44:59 +01:00
|
|
|
* VERSION
|
|
|
|
* [GNUC && i386]
|
2000-06-23 18:16:30 +02:00
|
|
|
*/
|
2000-12-03 00:44:59 +01:00
|
|
|
#if defined(__GNUC__) && defined(__i386__)
|
2006-06-12 21:35:07 +02:00
|
|
|
double CDECL NTDLL__CIpow(void)
|
2000-06-23 18:16:30 +02:00
|
|
|
{
|
|
|
|
double x,y;
|
|
|
|
POP_FPU(y);
|
|
|
|
POP_FPU(x);
|
|
|
|
return pow(x,y);
|
|
|
|
}
|
2000-12-03 00:44:59 +01:00
|
|
|
#endif /* defined(__GNUC__) && defined(__i386__) */
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* _CIpow (NTDLL.@)
|
2000-12-03 00:44:59 +01:00
|
|
|
*
|
|
|
|
* FIXME
|
|
|
|
* Should be register function
|
|
|
|
*
|
|
|
|
* VERSION
|
|
|
|
* [!GNUC && i386]
|
|
|
|
*/
|
|
|
|
#if !defined(__GNUC__) && defined(__i386__)
|
2006-06-12 21:35:07 +02:00
|
|
|
double CDECL NTDLL__CIpow(double x,double y)
|
2000-06-23 18:16:30 +02:00
|
|
|
{
|
|
|
|
FIXME("should be register function\n");
|
|
|
|
return pow(x,y);
|
|
|
|
}
|
2000-12-03 00:44:59 +01:00
|
|
|
#endif /* !defined(__GNUC__) && defined(__i386__) */
|
|
|
|
|
|
|
|
/*********************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* _CIpow (NTDLL.@)
|
2000-12-03 00:44:59 +01:00
|
|
|
* VERSION
|
|
|
|
* [!i386]
|
|
|
|
*/
|
|
|
|
#ifndef __i386__
|
2006-06-12 21:35:07 +02:00
|
|
|
double CDECL NTDLL__CIpow(double x,double y)
|
2000-12-03 00:44:59 +01:00
|
|
|
{
|
|
|
|
return pow(x,y);
|
|
|
|
}
|
|
|
|
#endif /* !defined(__i386__) */
|
2006-04-18 20:31:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* abs (NTDLL.@)
|
|
|
|
*/
|
2006-06-12 21:35:07 +02:00
|
|
|
int CDECL NTDLL_abs( int i )
|
2006-04-18 20:31:41 +02:00
|
|
|
{
|
|
|
|
return abs( i );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* labs (NTDLL.@)
|
|
|
|
*/
|
2006-06-12 21:35:07 +02:00
|
|
|
long int CDECL NTDLL_labs( long int i )
|
2006-04-18 20:31:41 +02:00
|
|
|
{
|
|
|
|
return labs( i );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* atan (NTDLL.@)
|
|
|
|
*/
|
2006-06-12 21:35:07 +02:00
|
|
|
double CDECL NTDLL_atan( double d )
|
2006-04-18 20:31:41 +02:00
|
|
|
{
|
|
|
|
return atan( d );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* ceil (NTDLL.@)
|
|
|
|
*/
|
2006-06-12 21:35:07 +02:00
|
|
|
double CDECL NTDLL_ceil( double d )
|
2006-04-18 20:31:41 +02:00
|
|
|
{
|
|
|
|
return ceil( d );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* cos (NTDLL.@)
|
|
|
|
*/
|
2006-06-12 21:35:07 +02:00
|
|
|
double CDECL NTDLL_cos( double d )
|
2006-04-18 20:31:41 +02:00
|
|
|
{
|
|
|
|
return cos( d );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* fabs (NTDLL.@)
|
|
|
|
*/
|
2006-06-12 21:35:07 +02:00
|
|
|
double CDECL NTDLL_fabs( double d )
|
2006-04-18 20:31:41 +02:00
|
|
|
{
|
|
|
|
return fabs( d );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* floor (NTDLL.@)
|
|
|
|
*/
|
2006-06-12 21:35:07 +02:00
|
|
|
double CDECL NTDLL_floor( double d )
|
2006-04-18 20:31:41 +02:00
|
|
|
{
|
|
|
|
return floor( d );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* log (NTDLL.@)
|
|
|
|
*/
|
2006-06-12 21:35:07 +02:00
|
|
|
double CDECL NTDLL_log( double d )
|
2006-04-18 20:31:41 +02:00
|
|
|
{
|
|
|
|
return log( d );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* pow (NTDLL.@)
|
|
|
|
*/
|
2006-06-12 21:35:07 +02:00
|
|
|
double CDECL NTDLL_pow( double x, double y )
|
2006-04-18 20:31:41 +02:00
|
|
|
{
|
|
|
|
return pow( x, y );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* sin (NTDLL.@)
|
|
|
|
*/
|
2006-06-12 21:35:07 +02:00
|
|
|
double CDECL NTDLL_sin( double d )
|
2006-04-18 20:31:41 +02:00
|
|
|
{
|
|
|
|
return sin( d );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* sqrt (NTDLL.@)
|
|
|
|
*/
|
2006-06-12 21:35:07 +02:00
|
|
|
double CDECL NTDLL_sqrt( double d )
|
2006-04-18 20:31:41 +02:00
|
|
|
{
|
|
|
|
return sqrt( d );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
* tan (NTDLL.@)
|
|
|
|
*/
|
2006-06-12 21:35:07 +02:00
|
|
|
double CDECL NTDLL_tan( double d )
|
2006-04-18 20:31:41 +02:00
|
|
|
{
|
|
|
|
return tan( d );
|
|
|
|
}
|