- made the security functions consistent. advapi calls down to ntdll now
- new SetSecurityDescriptorGroup,  SetSecurityDescriptorOwner,
  SetSecurityDescriptorSacl, GetSecurityDescriptorDacl
- nt-header cleanup

diff --git a/dlls/ntdll/rtl.c b/dlls/ntdll/rtl.c
index 517faf7..b58e51e 100644
--- a/dlls/ntdll/rtl.c
+++ b/dlls/ntdll/rtl.c
@@ -17,18 +17,53 @@
 #include "winuser.h"
 #include "wine/winestring.h"
 #include "file.h"
-#include "stackframe.h"
-#include "winnls.h"
-#include "ntdll.h"
-#include "debugstr.h"
 #include "heap.h"
+#include "winnls.h"
+#include "debugstr.h"
+#include "debug.h"
+#include "winuser.h"
+#include "winerror.h"
+#include "stackframe.h"
+
+#include "ntdll.h"
 #include "ntdef.h"
 #include "winreg.h"
 
-#include "debug.h"
 
-/* fixme: move to windef.h*/
-typedef BOOL32 *LPBOOL;   
+/*	##############################
+	######	SID FUNCTIONS	######
+	##############################
+*/
+/******************************************************************************
+ *  RtlAllocateAndInitializeSid		[NTDLL.265] 
+ *
+ */
+BOOLEAN WINAPI RtlAllocateAndInitializeSid (PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,
+	DWORD nSubAuthorityCount,DWORD x3,DWORD x4,DWORD x5,DWORD x6,DWORD x7,DWORD x8,DWORD x9,DWORD x10, PSID pSid) 
+{
+	FIXME(ntdll,"(%p,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,%p),stub!\n",
+		pIdentifierAuthority,nSubAuthorityCount,x3,x4,x5,x6,x7,x8,x9,x10,pSid);
+	return 0;
+}
+/******************************************************************************
+ *  RtlEqualSid		[NTDLL.352] 
+ *
+ */
+DWORD WINAPI RtlEqualSid(DWORD x1,DWORD x2) 
+{	
+	FIXME(ntdll,"(0x%08lx,0x%08lx),stub!\n", x1,x2);
+	return TRUE;
+}
+
+/******************************************************************************
+ *  RtlFreeSid		[NTDLL.376] 
+ */
+DWORD WINAPI RtlFreeSid(DWORD x1) 
+{
+	FIXME(ntdll,"(0x%08lx),stub!\n", x1);
+	return TRUE;
+}
+
 /**************************************************************************
  *                 RtlLengthRequiredSid			[NTDLL.427]
  */
@@ -41,13 +76,294 @@
  *                 RtlLengthSid				[NTDLL.429]
  */
 DWORD WINAPI RtlLengthSid(PSID sid)
-{	TRACE(ntdll,"sid=%p\n",sid);
+{
+	TRACE(ntdll,"sid=%p\n",sid);
 	if (!sid)
 	  return FALSE; 
 	return sizeof(DWORD)*sid->SubAuthorityCount+sizeof(SID);
 }
 
 /**************************************************************************
+ *                 RtlInitializeSid			[NTDLL.410]
+ */
+DWORD WINAPI RtlInitializeSid(PSID PSID,PSID_IDENTIFIER_AUTHORITY PSIDauth,
+                              DWORD c)
+{
+	BYTE	a = c&0xff;
+
+	if (a>=SID_MAX_SUB_AUTHORITIES)
+		return a;
+	PSID->SubAuthorityCount = a;
+	PSID->Revision		 = SID_REVISION;
+	memcpy(&(PSID->IdentifierAuthority),PSIDauth,sizeof(SID_IDENTIFIER_AUTHORITY));
+	return STATUS_SUCCESS;
+}
+
+/**************************************************************************
+ *                 RtlSubAuthoritySid			[NTDLL.497]
+ */
+LPDWORD WINAPI RtlSubAuthoritySid(PSID PSID,DWORD nr)
+{
+	return &(PSID->SubAuthority[nr]);
+}
+
+/**************************************************************************
+ *                 RtlSubAuthorityCountSid		[NTDLL.496]
+ */
+
+LPBYTE WINAPI RtlSubAuthorityCountSid(PSID PSID)
+{
+	return ((LPBYTE)PSID)+1;
+}
+
+/**************************************************************************
+ *                 RtlCopySid				[NTDLL.302]
+ */
+DWORD WINAPI RtlCopySid(DWORD len,PSID to,PSID from)
+{	if (!from)
+		return 0;
+	if (len<(from->SubAuthorityCount*4+8))
+		return STATUS_BUFFER_TOO_SMALL;
+	memmove(to,from,from->SubAuthorityCount*4+8);
+	return STATUS_SUCCESS;
+}
+
+/*	##############################################
+	######	SECURITY DESCRIPTOR FUNCTIONS	######
+	##############################################
+*/
+/**************************************************************************
+ * RtlCreateSecurityDescriptor			[NTDLL.313]
+ *
+ * RETURNS:
+ *  0 success, 
+ *  STATUS_INVALID_OWNER, STATUS_PRIVILEGE_NOT_HELD, STATUS_NO_INHERITANCE,
+ *  STATUS_NO_MEMORY 
+ */
+NTSTATUS WINAPI RtlCreateSecurityDescriptor(
+	PSECURITY_DESCRIPTOR lpsd,
+	DWORD rev)
+{
+	if (rev!=SECURITY_DESCRIPTOR_REVISION)
+		return STATUS_UNKNOWN_REVISION;
+	memset(lpsd,'\0',sizeof(*lpsd));
+	lpsd->Revision = SECURITY_DESCRIPTOR_REVISION;
+	return STATUS_SUCCESS;
+}
+/**************************************************************************
+ * RtlValidSecurityDescriptor			[NTDLL.313]
+ *
+ */
+NTSTATUS WINAPI RtlValidSecurityDescriptor(
+	PSECURITY_DESCRIPTOR SecurityDescriptor)
+{
+	if ( ! SecurityDescriptor )
+		return STATUS_INVALID_SECURITY_DESCR;
+	if ( SecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION )
+		return STATUS_UNKNOWN_REVISION;
+
+	return STATUS_SUCCESS;
+}
+
+/******************************************************************************
+ *  RtlGetDaclSecurityDescriptor		[NTDLL] 
+ *
+ */
+DWORD WINAPI RtlGetDaclSecurityDescriptor(
+	IN PSECURITY_DESCRIPTOR pSecurityDescriptor,
+	OUT PBOOLEAN lpbDaclPresent,
+	OUT PACL *pDacl,
+	OUT PBOOLEAN lpbDaclDefaulted)
+{
+	TRACE(ntdll,"(%p,%p,%p,%p)\n",
+	pSecurityDescriptor, lpbDaclPresent, *pDacl, lpbDaclDefaulted);
+
+	if (pSecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION)
+	  return STATUS_UNKNOWN_REVISION ;
+
+	if ( (*lpbDaclPresent = (SE_DACL_PRESENT & pSecurityDescriptor->Control) ? 1 : 0) )
+	{
+	  if ( SE_SELF_RELATIVE & pSecurityDescriptor->Control)
+	  { *pDacl = (PACL) ((LPBYTE)pSecurityDescriptor + (DWORD)pSecurityDescriptor->Dacl);
+	  }
+	  else
+	  { *pDacl = pSecurityDescriptor->Dacl;
+	  }
+	}
+
+	*lpbDaclDefaulted = (( SE_DACL_DEFAULTED & pSecurityDescriptor->Control ) ? 1 : 0);
+	
+	return STATUS_SUCCESS;
+}
+
+/**************************************************************************
+ *  RtlSetDaclSecurityDescriptor		[NTDLL.483]
+ */
+NTSTATUS WINAPI RtlSetDaclSecurityDescriptor (
+	PSECURITY_DESCRIPTOR lpsd,
+	BOOLEAN daclpresent,
+	PACL dacl,
+	BOOLEAN dacldefaulted )
+{
+	if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
+		return STATUS_UNKNOWN_REVISION;
+	if (lpsd->Control & SE_SELF_RELATIVE)
+		return STATUS_INVALID_SECURITY_DESCR;
+
+	if (!daclpresent) 
+	{	lpsd->Control &= ~SE_DACL_PRESENT;
+		return TRUE;
+	}
+
+	lpsd->Control |= SE_DACL_PRESENT;
+	lpsd->Dacl = dacl;
+
+	if (dacldefaulted)
+		lpsd->Control |= SE_DACL_DEFAULTED;
+	else
+		lpsd->Control &= ~SE_DACL_DEFAULTED;
+
+	return STATUS_SUCCESS;
+}
+/**************************************************************************
+ *  RtlLengthSecurityDescriptor			[NTDLL]
+ */
+ULONG WINAPI RtlLengthSecurityDescriptor(
+	PSECURITY_DESCRIPTOR SecurityDescriptor)
+{
+	ULONG Size;
+	Size = SECURITY_DESCRIPTOR_MIN_LENGTH;
+	if ( SecurityDescriptor == NULL )
+		return 0;
+
+	if ( SecurityDescriptor->Owner != NULL )
+		Size += SecurityDescriptor->Owner->SubAuthorityCount;
+	if ( SecurityDescriptor->Group != NULL )
+		Size += SecurityDescriptor->Group->SubAuthorityCount;
+
+
+	if ( SecurityDescriptor->Sacl != NULL )
+		Size += SecurityDescriptor->Sacl->AclSize;
+	if ( SecurityDescriptor->Dacl != NULL )
+		Size += SecurityDescriptor->Dacl->AclSize;
+
+	return Size;
+}
+/**************************************************************************
+ * RtlSetSaclSecurityDescriptor			[NTDLL.488]
+ */
+DWORD  WINAPI RtlSetSaclSecurityDescriptor (
+	PSECURITY_DESCRIPTOR lpsd,
+	BOOLEAN saclpresent,
+	PACL sacl,
+	BOOLEAN sacldefaulted)
+{
+	if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
+		return STATUS_UNKNOWN_REVISION;
+	if (lpsd->Control & SE_SELF_RELATIVE)
+		return STATUS_INVALID_SECURITY_DESCR;
+	if (!saclpresent) {
+		lpsd->Control &= ~SE_SACL_PRESENT;
+		return 0;
+	}
+	lpsd->Control |= SE_SACL_PRESENT;
+	lpsd->Sacl = sacl;
+	if (sacldefaulted)
+		lpsd->Control |= SE_SACL_DEFAULTED;
+	else
+		lpsd->Control &= ~SE_SACL_DEFAULTED;
+	return STATUS_SUCCESS;
+}
+
+/**************************************************************************
+ * RtlGetOwnerSecurityDescriptor		[NTDLL.488]
+ */
+NTSTATUS WINAPI RtlGetOwnerSecurityDescriptor(
+	PSECURITY_DESCRIPTOR SecurityDescriptor,
+	PSID *Owner,
+	PBOOLEAN OwnerDefaulted)
+{
+	if ( !SecurityDescriptor  || !Owner || !OwnerDefaulted )
+		return STATUS_INVALID_PARAMETER;
+
+	*Owner = SecurityDescriptor->Owner;
+	if ( *Owner != NULL )  {
+		if ( SecurityDescriptor->Control & SE_OWNER_DEFAULTED )
+			*OwnerDefaulted = TRUE;
+		else
+			*OwnerDefaulted = FALSE;
+	}
+	return STATUS_SUCCESS;
+}
+
+/**************************************************************************
+ *                 RtlSetOwnerSecurityDescriptor		[NTDLL.487]
+ */
+NTSTATUS WINAPI RtlSetOwnerSecurityDescriptor(
+	PSECURITY_DESCRIPTOR lpsd,
+	PSID owner,
+	BOOLEAN ownerdefaulted)
+{
+	if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
+		return STATUS_UNKNOWN_REVISION;
+	if (lpsd->Control & SE_SELF_RELATIVE)
+		return STATUS_INVALID_SECURITY_DESCR;
+
+	lpsd->Owner = owner;
+	if (ownerdefaulted)
+		lpsd->Control |= SE_OWNER_DEFAULTED;
+	else
+		lpsd->Control &= ~SE_OWNER_DEFAULTED;
+	return STATUS_SUCCESS;
+}
+
+/**************************************************************************
+ *                 RtlSetGroupSecurityDescriptor		[NTDLL.485]
+ */
+NTSTATUS WINAPI RtlSetGroupSecurityDescriptor (
+	PSECURITY_DESCRIPTOR lpsd,
+	PSID group,
+	BOOLEAN groupdefaulted)
+{
+	if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
+		return STATUS_UNKNOWN_REVISION;
+	if (lpsd->Control & SE_SELF_RELATIVE)
+		return STATUS_INVALID_SECURITY_DESCR;
+
+	lpsd->Group = group;
+	if (groupdefaulted)
+		lpsd->Control |= SE_GROUP_DEFAULTED;
+	else
+		lpsd->Control &= ~SE_GROUP_DEFAULTED;
+	return STATUS_SUCCESS;
+}
+/**************************************************************************
+ *                 RtlGetGroupSecurityDescriptor		[NTDLL]
+ */
+NTSTATUS WINAPI RtlGetGroupSecurityDescriptor(
+	PSECURITY_DESCRIPTOR SecurityDescriptor,
+	PSID *Group,
+	PBOOLEAN GroupDefaulted)
+{
+	if ( !SecurityDescriptor || !Group || !GroupDefaulted )
+		return STATUS_INVALID_PARAMETER;
+
+	*Group = SecurityDescriptor->Group;
+	if ( *Group != NULL )  {
+		if ( SecurityDescriptor->Control & SE_GROUP_DEFAULTED )
+			*GroupDefaulted = TRUE;
+		else
+			*GroupDefaulted = FALSE;
+	}
+	return STATUS_SUCCESS;
+} 
+
+/*	##############################
+	######	ACL FUNCTIONS	######
+	##############################
+*/
+
+/**************************************************************************
  *                 RtlCreateAcl				[NTDLL.306]
  *
  * NOTES
@@ -74,7 +390,7 @@
  * looks for the AceCount+1 ACE, and if it is still within the alloced
  * ACL, return a pointer to it
  */
-BOOL32 WINAPI RtlFirstFreeAce(
+BOOLEAN WINAPI RtlFirstFreeAce(
 	PACL acl,
 	LPACE_HEADER *x)
 {
@@ -123,179 +439,32 @@
 	return STATUS_SUCCESS;
 }
 
-/**************************************************************************
- *                 RtlCreateSecurityDescriptor		[NTDLL.313]
- *
- * RETURNS:
- *  0 success, 
- *  STATUS_INVALID_OWNER, STATUS_PRIVILEGE_NOT_HELD, STATUS_NO_INHERITANCE,
- *  STATUS_NO_MEMORY 
+/******************************************************************************
+ *  RtlAddAccessAllowedAce		[NTDLL] 
  */
-NTSTATUS WINAPI RtlCreateSecurityDescriptor(
-	PSECURITY_DESCRIPTOR lpsd,
-	DWORD rev)
-{
-	if (rev!=SECURITY_DESCRIPTOR_REVISION)
-		return STATUS_UNKNOWN_REVISION;
-	memset(lpsd,'\0',sizeof(*lpsd));
-	lpsd->Revision = SECURITY_DESCRIPTOR_REVISION;
-	return STATUS_SUCCESS;
+DWORD WINAPI RtlAddAccessAllowedAce(DWORD x1,DWORD x2,DWORD x3,DWORD x4) {
+	FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4);
+	return 0;
 }
 
-/**************************************************************************
- *                 RtlSetDaclSecurityDescriptor		[NTDLL.483]
+/******************************************************************************
+ *  RtlGetAce		[NTDLL] 
  */
-NTSTATUS WINAPI RtlSetDaclSecurityDescriptor (
-	PSECURITY_DESCRIPTOR lpsd,
-	BOOL32 daclpresent,
-	PACL dacl,
-	BOOL32 dacldefaulted )
-{
-	if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
-		return STATUS_UNKNOWN_REVISION;
-	if (lpsd->Control & SE_SELF_RELATIVE)
-		return STATUS_INVALID_SECURITY_DESCR;
-	if (!daclpresent) 
-	{	lpsd->Control &= ~SE_DACL_PRESENT;
-		return TRUE;
-	}
-	lpsd->Control |= SE_DACL_PRESENT;
-	lpsd->Dacl = dacl;
-	if (dacldefaulted)
-		lpsd->Control |= SE_DACL_DEFAULTED;
-	else
-		lpsd->Control &= ~SE_DACL_DEFAULTED;
-
-	return STATUS_SUCCESS;
+DWORD WINAPI RtlGetAce(PACL pAcl,DWORD dwAceIndex,LPVOID *pAce ) {
+	FIXME(ntdll,"(%p,%ld,%p),stub!\n",pAcl,dwAceIndex,pAce);
+	return 0;
 }
 
-/**************************************************************************
- *                 RtlSetSaclSecurityDescriptor		[NTDLL.488]
- */
-DWORD  WINAPI RtlSetSaclSecurityDescriptor (
-	PSECURITY_DESCRIPTOR lpsd,
-	BOOL32 saclpresent,
-	PACL sacl,
-	BOOL32 sacldefaulted)
-{
-	if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
-		return STATUS_UNKNOWN_REVISION;
-	if (lpsd->Control & SE_SELF_RELATIVE)
-		return STATUS_INVALID_SECURITY_DESCR;
-	if (!saclpresent) {
-		lpsd->Control &= ~SE_SACL_PRESENT;
-		return 0;
-	}
-	lpsd->Control |= SE_SACL_PRESENT;
-	lpsd->Sacl = sacl;
-	if (sacldefaulted)
-		lpsd->Control |= SE_SACL_DEFAULTED;
-	else
-		lpsd->Control &= ~SE_SACL_DEFAULTED;
-	return STATUS_SUCCESS;
-}
-
-/**************************************************************************
- *                 RtlSetOwnerSecurityDescriptor		[NTDLL.487]
- */
-NTSTATUS WINAPI RtlSetOwnerSecurityDescriptor(
-	PSECURITY_DESCRIPTOR lpsd,
-	PSID owner,
-	BOOL32 ownerdefaulted)
-{
-	if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
-		return STATUS_UNKNOWN_REVISION;
-	if (lpsd->Control & SE_SELF_RELATIVE)
-		return STATUS_INVALID_SECURITY_DESCR;
-
-	lpsd->Owner = owner;
-	if (ownerdefaulted)
-		lpsd->Control |= SE_OWNER_DEFAULTED;
-	else
-		lpsd->Control &= ~SE_OWNER_DEFAULTED;
-	return STATUS_SUCCESS;
-}
-
-/**************************************************************************
- *                 RtlSetGroupSecurityDescriptor		[NTDLL.485]
- */
-NTSTATUS WINAPI RtlSetGroupSecurityDescriptor (
-	PSECURITY_DESCRIPTOR lpsd,
-	PSID group,
-	BOOL32 groupdefaulted)
-{
-	if (lpsd->Revision!=SECURITY_DESCRIPTOR_REVISION)
-		return STATUS_UNKNOWN_REVISION;
-	if (lpsd->Control & SE_SELF_RELATIVE)
-		return STATUS_INVALID_SECURITY_DESCR;
-
-	lpsd->Group = group;
-	if (groupdefaulted)
-		lpsd->Control |= SE_GROUP_DEFAULTED;
-	else
-		lpsd->Control &= ~SE_GROUP_DEFAULTED;
-	return STATUS_SUCCESS;
-}
-
-
-/**************************************************************************
- *                 RtlNormalizeProcessParams		[NTDLL.441]
- */
-LPVOID WINAPI RtlNormalizeProcessParams(LPVOID x)
-{
-    FIXME(ntdll,"(%p), stub\n",x);
-    return x;
-}
-
-/**************************************************************************
- *                 RtlInitializeSid			[NTDLL.410]
- */
-DWORD WINAPI RtlInitializeSid(PSID PSID,PSID_IDENTIFIER_AUTHORITY PSIDauth,
-                              DWORD c)
-{
-	BYTE	a = c&0xff;
-
-	if (a>=SID_MAX_SUB_AUTHORITIES)
-		return a;
-	PSID->SubAuthorityCount = a;
-	PSID->Revision		 = SID_REVISION;
-	memcpy(&(PSID->IdentifierAuthority),PSIDauth,sizeof(SID_IDENTIFIER_AUTHORITY));
-	return STATUS_SUCCESS;
-}
-
-/**************************************************************************
- *                 RtlSubAuthoritySid			[NTDLL.497]
- */
-LPDWORD WINAPI RtlSubAuthoritySid(PSID PSID,DWORD nr)
-{
-	return &(PSID->SubAuthority[nr]);
-}
-
-/**************************************************************************
- *                 RtlSubAuthorityCountSid		[NTDLL.496]
- */
-LPBYTE WINAPI RtlSubAuthorityCountSid(PSID PSID)
-{
-	return ((LPBYTE)PSID)+1;
-}
-
-/**************************************************************************
- *                 RtlCopySid				[NTDLL.302]
- */
-DWORD WINAPI RtlCopySid(DWORD len,PSID to,PSID from)
-{	if (!from)
-		return 0;
-	if (len<(from->SubAuthorityCount*4+8))
-		return STATUS_BUFFER_TOO_SMALL;
-	memmove(to,from,from->SubAuthorityCount*4+8);
-	return STATUS_SUCCESS;
-}
+/*	######################################
+	######	STRING FUNCTIONS	######
+	######################################
+*/
 
 /**************************************************************************
  *                 RtlAnsiStringToUnicodeString		[NTDLL.269]
  */
 DWORD /* NTSTATUS */ 
-WINAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING uni,PANSI_STRING ansi,BOOL32 doalloc)
+WINAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING uni,PANSI_STRING ansi,BOOLEAN doalloc)
 {
 	DWORD	unilen = (ansi->Length+1)*sizeof(WCHAR);
 
@@ -318,7 +487,7 @@
  *                 RtlOemStringToUnicodeString		[NTDLL.447]
  */
 DWORD /* NTSTATUS */ 
-WINAPI RtlOemStringToUnicodeString(PUNICODE_STRING uni,PSTRING ansi,BOOL32 doalloc)
+WINAPI RtlOemStringToUnicodeString(PUNICODE_STRING uni,PSTRING ansi,BOOLEAN doalloc)
 {
 	DWORD	unilen = (ansi->Length+1)*sizeof(WCHAR);
 
@@ -455,7 +624,7 @@
  *                 RtlUnicodeStringToOemString		[NTDLL.511]
  */
 DWORD /* NTSTATUS */ 
-WINAPI RtlUnicodeStringToOemString(PANSI_STRING oem,PUNICODE_STRING uni,BOOL32 alloc)
+WINAPI RtlUnicodeStringToOemString(PANSI_STRING oem,PUNICODE_STRING uni,BOOLEAN alloc)
 {
 	if (alloc) {
 		oem->Buffer = (LPSTR)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,uni->Length/2)+1;
@@ -470,7 +639,7 @@
  *                 RtlUnicodeStringToAnsiString		[NTDLL.507]
  */
 DWORD /* NTSTATUS */ 
-WINAPI RtlUnicodeStringToAnsiString(PANSI_STRING oem,PUNICODE_STRING uni,BOOL32 alloc)
+WINAPI RtlUnicodeStringToAnsiString(PANSI_STRING oem,PUNICODE_STRING uni,BOOLEAN alloc)
 {
 	if (alloc) {
 		oem->Buffer = (LPSTR)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,uni->Length/2)+1;
@@ -493,28 +662,9 @@
 }
 
 /**************************************************************************
- *                 RtlNtStatusToDosErro			[NTDLL.442]
- */
-DWORD WINAPI RtlNtStatusToDosError(DWORD error)
-{
-    FIXME(ntdll, "(%lx): map STATUS_ to ERROR_\n",error);
-    return error;
-}
-
-/**************************************************************************
- *                 RtlGetNtProductType			[NTDLL.390]
- */
-BOOL32 WINAPI RtlGetNtProductType(LPDWORD type)
-{
-    FIXME(ntdll, "(%p): stub\n", type);
-    *type=3; /* dunno. 1 for client, 3 for server? */
-    return 1;
-}
-
-/**************************************************************************
  *                 RtlUpcaseUnicodeString		[NTDLL.520]
  */
-DWORD WINAPI RtlUpcaseUnicodeString(PUNICODE_STRING dest,PUNICODE_STRING src,BOOL32 doalloc)
+DWORD WINAPI RtlUpcaseUnicodeString(PUNICODE_STRING dest,PUNICODE_STRING src,BOOLEAN doalloc)
 {
 	LPWSTR	s,t;
 	DWORD	i,len;
@@ -595,294 +745,7 @@
 	return len;
 }
 
-/**************************************************************************
- *                 RtlDosPathNameToNtPathName_U		[NTDLL.338]
- *
- * FIXME: convert to UNC or whatever is expected here
- */
-BOOL32  WINAPI RtlDosPathNameToNtPathName_U(
-	LPWSTR from,PUNICODE_STRING us,DWORD x2,DWORD x3)
-{
-	LPSTR	fromA = HEAP_strdupWtoA(GetProcessHeap(),0,from);
 
-	FIXME(ntdll,"(%s,%p,%08lx,%08lx)\n",fromA,us,x2,x3);
-	if (us)
-		RtlInitUnicodeString(us,HEAP_strdupW(GetProcessHeap(),0,from));
-	return TRUE;
-}
-
-/**************************************************************************
- *                 NTDLL_chkstk				[NTDLL.862]
- *                 NTDLL_alloca_probe				[NTDLL.861]
- * Glorified "enter xxxx".
- */
-REGS_ENTRYPOINT(NTDLL_chkstk)
-{
-    ESP_reg(context) -= EAX_reg(context);
-}
-REGS_ENTRYPOINT(NTDLL_alloca_probe)
-{
-    ESP_reg(context) -= EAX_reg(context);
-}
-
-/******************************************************************************
- * RtlTimeToElapsedTimeFields [NTDLL.502]
- */
-DWORD WINAPI RtlTimeToElapsedTimeFields( DWORD x1, DWORD x2 )
-{
-    FIXME(ntdll,"(%lx,%lx): stub\n",x1,x2);
-    return 0;
-}
-
-
-/******************************************************************************
- * RtlExtendedLargeIntegerDivide [NTDLL.359]
- */
-INT32 WINAPI RtlExtendedLargeIntegerDivide(
-	LARGE_INTEGER dividend,
-	DWORD divisor,
-	LPDWORD rest
-) {
-#if SIZEOF_LONG_LONG==8
-	long long x1 = *(long long*)&dividend;
-
-	if (*rest)
-		*rest = x1 % divisor;
-	return x1/divisor;
-#else
-	FIXME(ntdll,"((%d<<32)+%d,%d,%p), implement this using normal integer arithmetic!\n",dividend.HighPart,dividend.LowPart,divisor,rest);
-	return 0;
-#endif
-}
-
-/******************************************************************************
- * RtlExtendedLargeIntegerMultiply [NTDLL.359]
- * Note: This even works, since gcc returns 64bit values in eax/edx just like
- * the caller expects. However... The relay code won't grok this I think.
- */
-long long /*LARGE_INTEGER*/ 
-WINAPI RtlExtendedIntegerMultiply(
-	LARGE_INTEGER factor1,INT32 factor2
-) {
-#if SIZEOF_LONG_LONG==8
-	return (*(long long*)&factor1)*factor2;
-#else
-	FIXME(ntdll,"((%d<<32)+%d,%ld), implement this using normal integer arithmetic!\n",factor1.HighPart,factor1.LowPart,factor2);
-	return 0;
-#endif
-}
-
-/******************************************************************************
- *  RtlFormatCurrentUserKeyPath		[NTDLL.371] 
- */
-DWORD WINAPI RtlFormatCurrentUserKeyPath(DWORD x)
-{
-    FIXME(ntdll,"(0x%08lx): stub\n",x);
-    return 1;
-}
-
-/******************************************************************************
- *  RtlOpenCurrentUser		[NTDLL] 
- */
-DWORD WINAPI RtlOpenCurrentUser(DWORD x1, DWORD *x2)
-{
-/* Note: this is not the correct solution, 
- * But this works pretty good on wine and NT4.0 binaries
- */
-	if  ( x1 == 0x2000000 )  {
-		*x2 = HKEY_CURRENT_USER; 
-		return TRUE;
-	}
-		
-	return FALSE;
-}
-/******************************************************************************
- *  RtlAllocateAndInitializeSid		[NTDLL.265] 
- *
- */
-BOOL32 WINAPI RtlAllocateAndInitializeSid (PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority,DWORD nSubAuthorityCount,
-		DWORD x3,DWORD x4,DWORD x5,DWORD x6,DWORD x7,DWORD x8,DWORD x9,DWORD x10, PSID pSid) 
-{	FIXME(ntdll,"(%p,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,%p),stub!\n",
-		pIdentifierAuthority,nSubAuthorityCount,x3,x4,x5,x6,x7,x8,x9,x10,pSid);
-	return 0;
-}
-/******************************************************************************
- *  RtlEqualSid		[NTDLL.352] 
- *
- */
-DWORD WINAPI RtlEqualSid(DWORD x1,DWORD x2) {	
-	FIXME(ntdll,"(0x%08lx,0x%08lx),stub!\n", x1,x2);
-	return TRUE;
-}
-
-/******************************************************************************
- *  RtlFreeSid		[NTDLL.376] 
- */
-DWORD WINAPI RtlFreeSid(DWORD x1) 
-{	FIXME(ntdll,"(0x%08lx),stub!\n", x1);
-	return TRUE;
-}
-
-/******************************************************************************
- *  RtlGetDaclSecurityDescriptor		[NTDLL] 
- *
- * NOTES: seems to be like GetSecurityDescriptorDacl (js)
- */
-DWORD WINAPI RtlGetDaclSecurityDescriptor(
-	IN PSECURITY_DESCRIPTOR pSecurityDescriptor,
-	OUT LPBOOL lpbDaclPresent,
-	OUT PACL *pDacl,
-	OUT LPBOOL lpbDaclDefaulted)
-{	DWORD ret = 0;
-
-	TRACE(ntdll,"(%p,%p,%p,%p)\n",
-	pSecurityDescriptor, lpbDaclPresent, *pDacl, lpbDaclDefaulted);
-
-	if (pSecurityDescriptor->Revision != SECURITY_DESCRIPTOR_REVISION)
-	  return STATUS_UNKNOWN_REVISION ;
-
-	if ( (*lpbDaclPresent = (SE_DACL_PRESENT & pSecurityDescriptor->Control) ? 1 : 0) )
-	{
-	  if ( SE_SELF_RELATIVE & pSecurityDescriptor->Control)
-	  { *pDacl = (PACL) ((LPBYTE)pSecurityDescriptor + (DWORD)pSecurityDescriptor->Dacl);
-	  }
-	  else
-	  { *pDacl = pSecurityDescriptor->Dacl;
-	  }
-	}
-
-	*lpbDaclDefaulted = (( SE_DACL_DEFAULTED & pSecurityDescriptor->Control ) ? 1 : 0);
-	
-	return ret;
-}
-
-/******************************************************************************
- *  RtlCreateEnvironment		[NTDLL] 
- */
-DWORD WINAPI RtlCreateEnvironment(DWORD x1,DWORD x2) {
-	FIXME(ntdll,"(0x%08lx,0x%08lx),stub!\n",x1,x2);
-	return 0;
-}
-
-
-/******************************************************************************
- *  RtlDestroyEnvironment		[NTDLL] 
- */
-DWORD WINAPI RtlDestroyEnvironment(DWORD x) {
-	FIXME(ntdll,"(0x%08lx),stub!\n",x);
-	return 0;
-}
-
-/******************************************************************************
- *  RtlQueryEnvironmentVariable_U		[NTDLL] 
- */
-DWORD WINAPI RtlQueryEnvironmentVariable_U(DWORD x1,PUNICODE_STRING key,PUNICODE_STRING val) {
-	FIXME(ntdll,"(0x%08lx,%s,%p),stub!\n",x1,debugstr_w(key->Buffer),val);
-	return 0;
-}
-
-/******************************************************************************
- *  RtlSetEnvironmentVariable		[NTDLL] 
- */
-DWORD WINAPI RtlSetEnvironmentVariable(DWORD x1,PUNICODE_STRING key,PUNICODE_STRING val) {
-	FIXME(ntdll,"(0x%08lx,%s,%s),stub!\n",x1,debugstr_w(key->Buffer),debugstr_w(val->Buffer));
-	return 0;
-}
-
-/******************************************************************************
- *  RtlNewSecurityObject		[NTDLL] 
- */
-DWORD WINAPI RtlNewSecurityObject(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5,DWORD x6) {
-	FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4,x5,x6);
-	return 0;
-}
-
-/******************************************************************************
- *  RtlDeleteSecurityObject		[NTDLL] 
- */
-DWORD WINAPI RtlDeleteSecurityObject(DWORD x1) {
-	FIXME(ntdll,"(0x%08lx),stub!\n",x1);
-	return 0;
-}
-
-/******************************************************************************
- *  RtlToTimeInSecondsSince1980		[NTDLL] 
- */
-BOOL32 WINAPI RtlTimeToSecondsSince1980(LPFILETIME ft,LPDWORD timeret) {
-	/* 1980 = 1970+10*365 days +  29. februar 1972 + 29.februar 1976 */
-	*timeret = DOSFS_FileTimeToUnixTime(ft,NULL) - (10*365+2)*24*3600;
-	return 1;
-}
-
-/******************************************************************************
- *  RtlToTimeInSecondsSince1970		[NTDLL] 
- */
-BOOL32 WINAPI RtlTimeToSecondsSince1970(LPFILETIME ft,LPDWORD timeret) {
-	*timeret = DOSFS_FileTimeToUnixTime(ft,NULL);
-	return 1;
-}
-
-/******************************************************************************
- *  RtlAcquirePebLock		[NTDLL] 
- */
-VOID WINAPI RtlAcquirePebLock(void) {
-	FIXME(ntdll,"()\n");
-	/* enter critical section ? */
-}
-
-/******************************************************************************
- *  RtlReleasePebLock		[NTDLL] 
- */
-VOID WINAPI RtlReleasePebLock(void) {
-	FIXME(ntdll,"()\n");
-	/* leave critical section ? */
-}
-
-/******************************************************************************
- *  RtlAddAccessAllowedAce		[NTDLL] 
- */
-DWORD WINAPI RtlAddAccessAllowedAce(DWORD x1,DWORD x2,DWORD x3,DWORD x4) {
-	FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4);
-	return 0;
-}
-
-/******************************************************************************
- *  RtlGetAce		[NTDLL] 
- */
-DWORD WINAPI RtlGetAce(PACL pAcl,DWORD dwAceIndex,LPVOID *pAce ) {
-	FIXME(ntdll,"(%p,%ld,%p),stub!\n",pAcl,dwAceIndex,pAce);
-	return 0;
-}
-
-/******************************************************************************
- *  RtlAdjustPrivilege		[NTDLL] 
- */
-DWORD WINAPI RtlAdjustPrivilege(DWORD x1,DWORD x2,DWORD x3,DWORD x4) {
-	FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4);
-	return 0;
-}
-
-/******************************************************************************
- *  RtlIntegerToChar	[NTDLL] 
- */
-DWORD WINAPI RtlIntegerToChar(DWORD x1,DWORD x2,DWORD x3,DWORD x4) {
-	FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4);
-	return 0;
-}
-/******************************************************************************
- *  RtlSystemTimeToLocalTime 	[NTDLL] 
- */
-DWORD WINAPI RtlSystemTimeToLocalTime(DWORD x1,DWORD x2) {
-	FIXME(ntdll,"(0x%08lx,0x%08lx),stub!\n",x1,x2);
-	return 0;
-}
-/******************************************************************************
- *  RtlTimeToTimeFields 	[NTDLL] 
- */
-DWORD WINAPI RtlTimeToTimeFields(DWORD x1,DWORD x2) {
-	FIXME(ntdll,"(0x%08lx,0x%08lx),stub!\n",x1,x2);
-	return 0;
-}
 /******************************************************************************
  *	RtlCompareUnicodeString	[NTDLL] 
  */
@@ -893,26 +756,11 @@
 	return 0;
 }
 
-/******************************************************************************
- *	DbgPrint	[NTDLL] 
- */
-void __cdecl DbgPrint(LPCSTR fmt,LPVOID args) {
-	char buf[512];
 
-	wvsprintf32A(buf,fmt,&args);
-	MSG("DbgPrint says: %s",buf);
-	/* hmm, raise exception? */
-}
-DWORD NtRaiseException ( DWORD dwExceptionCode, DWORD dwExceptionFlags, DWORD nNumberOfArguments,CONST ULONG_PTR *lpArguments)
-{	FIXME(ntdll,"0x%08lx 0x%08lx 0x%08lx %p\n", dwExceptionCode, dwExceptionFlags, nNumberOfArguments, lpArguments);
-	return 0;
-}
-
-DWORD RtlRaiseException ( DWORD x)
-{	FIXME(ntdll, "0x%08lx\n", x);
-	return 0;
-}
-
+/*	######################################
+	######	RESOURCE FUNCTIONS	######
+	######################################
+*/
 /***********************************************************************
  *           RtlInitializeResource	(NTDLL.409)
  *
@@ -1098,3 +946,276 @@
     }
 }
 
+/*	##############################
+	######	MISC FUNCTIONS	######
+	##############################
+*/
+
+/******************************************************************************
+ *	DbgPrint	[NTDLL] 
+ */
+void __cdecl DbgPrint(LPCSTR fmt,LPVOID args) {
+	char buf[512];
+
+	wvsprintf32A(buf,fmt,&args);
+	MSG("DbgPrint says: %s",buf);
+	/* hmm, raise exception? */
+}
+DWORD NtRaiseException ( DWORD dwExceptionCode, DWORD dwExceptionFlags, DWORD nNumberOfArguments,CONST ULONG_PTR *lpArguments)
+{	FIXME(ntdll,"0x%08lx 0x%08lx 0x%08lx %p\n", dwExceptionCode, dwExceptionFlags, nNumberOfArguments, lpArguments);
+	return 0;
+}
+
+DWORD RtlRaiseException ( DWORD x)
+{	FIXME(ntdll, "0x%08lx\n", x);
+	return 0;
+}
+/******************************************************************************
+ *  RtlAcquirePebLock		[NTDLL] 
+ */
+VOID WINAPI RtlAcquirePebLock(void) {
+	FIXME(ntdll,"()\n");
+	/* enter critical section ? */
+}
+
+/******************************************************************************
+ *  RtlReleasePebLock		[NTDLL] 
+ */
+VOID WINAPI RtlReleasePebLock(void) {
+	FIXME(ntdll,"()\n");
+	/* leave critical section ? */
+}
+
+/******************************************************************************
+ *  RtlAdjustPrivilege		[NTDLL] 
+ */
+DWORD WINAPI RtlAdjustPrivilege(DWORD x1,DWORD x2,DWORD x3,DWORD x4) {
+	FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4);
+	return 0;
+}
+
+/******************************************************************************
+ *  RtlIntegerToChar	[NTDLL] 
+ */
+DWORD WINAPI RtlIntegerToChar(DWORD x1,DWORD x2,DWORD x3,DWORD x4) {
+	FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4);
+	return 0;
+}
+/******************************************************************************
+ *  RtlSystemTimeToLocalTime 	[NTDLL] 
+ */
+DWORD WINAPI RtlSystemTimeToLocalTime(DWORD x1,DWORD x2) {
+	FIXME(ntdll,"(0x%08lx,0x%08lx),stub!\n",x1,x2);
+	return 0;
+}
+/******************************************************************************
+ *  RtlTimeToTimeFields 	[NTDLL] 
+ */
+DWORD WINAPI RtlTimeToTimeFields(DWORD x1,DWORD x2) {
+	FIXME(ntdll,"(0x%08lx,0x%08lx),stub!\n",x1,x2);
+	return 0;
+}
+/******************************************************************************
+ *  RtlSetEnvironmentVariable		[NTDLL] 
+ */
+DWORD WINAPI RtlSetEnvironmentVariable(DWORD x1,PUNICODE_STRING key,PUNICODE_STRING val) {
+	FIXME(ntdll,"(0x%08lx,%s,%s),stub!\n",x1,debugstr_w(key->Buffer),debugstr_w(val->Buffer));
+	return 0;
+}
+
+/******************************************************************************
+ *  RtlNewSecurityObject		[NTDLL] 
+ */
+DWORD WINAPI RtlNewSecurityObject(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5,DWORD x6) {
+	FIXME(ntdll,"(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub!\n",x1,x2,x3,x4,x5,x6);
+	return 0;
+}
+
+/******************************************************************************
+ *  RtlDeleteSecurityObject		[NTDLL] 
+ */
+DWORD WINAPI RtlDeleteSecurityObject(DWORD x1) {
+	FIXME(ntdll,"(0x%08lx),stub!\n",x1);
+	return 0;
+}
+
+/******************************************************************************
+ *  RtlToTimeInSecondsSince1980		[NTDLL] 
+ */
+BOOLEAN WINAPI RtlTimeToSecondsSince1980(LPFILETIME ft,LPDWORD timeret) {
+	/* 1980 = 1970+10*365 days +  29. februar 1972 + 29.februar 1976 */
+	*timeret = DOSFS_FileTimeToUnixTime(ft,NULL) - (10*365+2)*24*3600;
+	return 1;
+}
+
+/******************************************************************************
+ *  RtlToTimeInSecondsSince1970		[NTDLL] 
+ */
+BOOLEAN WINAPI RtlTimeToSecondsSince1970(LPFILETIME ft,LPDWORD timeret) {
+	*timeret = DOSFS_FileTimeToUnixTime(ft,NULL);
+	return 1;
+}
+/**************************************************************************
+ *                 RtlNormalizeProcessParams		[NTDLL.441]
+ */
+LPVOID WINAPI RtlNormalizeProcessParams(LPVOID x)
+{
+    FIXME(ntdll,"(%p), stub\n",x);
+    return x;
+}
+
+/**************************************************************************
+ *                 RtlNtStatusToDosError			[NTDLL.442]
+ */
+DWORD WINAPI RtlNtStatusToDosError(DWORD error)
+{
+	FIXME(ntdll, "(%lx): map STATUS_ to ERROR_\n",error);
+	switch (error)
+	{ case STATUS_SUCCESS:			return ERROR_SUCCESS;
+	  case STATUS_INVALID_PARAMETER:	return ERROR_BAD_ARGUMENTS;
+	  case STATUS_BUFFER_TOO_SMALL:		return ERROR_INSUFFICIENT_BUFFER;
+/*	  case STATUS_INVALID_SECURITY_DESCR:	return ERROR_INVALID_SECURITY_DESCR;*/
+	  case STATUS_NO_MEMORY:		return ERROR_NOT_ENOUGH_MEMORY;
+/*	  case STATUS_UNKNOWN_REVISION:
+	  case STATUS_BUFFER_OVERFLOW:*/
+	}
+	FIXME(ntdll, "unknown status (%lx)\n",error);
+	return ERROR_SUCCESS;
+}
+
+/**************************************************************************
+ *                 RtlGetNtProductType			[NTDLL.390]
+ */
+BOOLEAN WINAPI RtlGetNtProductType(LPDWORD type)
+{
+    FIXME(ntdll, "(%p): stub\n", type);
+    *type=3; /* dunno. 1 for client, 3 for server? */
+    return 1;
+}
+
+/**************************************************************************
+ *                 NTDLL_chkstk				[NTDLL.862]
+ *                 NTDLL_alloca_probe				[NTDLL.861]
+ * Glorified "enter xxxx".
+ */
+REGS_ENTRYPOINT(NTDLL_chkstk)
+{
+    ESP_reg(context) -= EAX_reg(context);
+}
+REGS_ENTRYPOINT(NTDLL_alloca_probe)
+{
+    ESP_reg(context) -= EAX_reg(context);
+}
+
+/******************************************************************************
+ * RtlTimeToElapsedTimeFields [NTDLL.502]
+ */
+DWORD WINAPI RtlTimeToElapsedTimeFields( DWORD x1, DWORD x2 )
+{
+    FIXME(ntdll,"(%lx,%lx): stub\n",x1,x2);
+    return 0;
+}
+
+
+/******************************************************************************
+ * RtlExtendedLargeIntegerDivide [NTDLL.359]
+ */
+INT32 WINAPI RtlExtendedLargeIntegerDivide(
+	LARGE_INTEGER dividend,
+	DWORD divisor,
+	LPDWORD rest
+) {
+#if SIZEOF_LONG_LONG==8
+	long long x1 = *(long long*)&dividend;
+
+	if (*rest)
+		*rest = x1 % divisor;
+	return x1/divisor;
+#else
+	FIXME(ntdll,"((%d<<32)+%d,%d,%p), implement this using normal integer arithmetic!\n",dividend.HighPart,dividend.LowPart,divisor,rest);
+	return 0;
+#endif
+}
+
+/******************************************************************************
+ * RtlExtendedLargeIntegerMultiply [NTDLL.359]
+ * Note: This even works, since gcc returns 64bit values in eax/edx just like
+ * the caller expects. However... The relay code won't grok this I think.
+ */
+long long /*LARGE_INTEGER*/ 
+WINAPI RtlExtendedIntegerMultiply(
+	LARGE_INTEGER factor1,INT32 factor2
+) {
+#if SIZEOF_LONG_LONG==8
+	return (*(long long*)&factor1)*factor2;
+#else
+	FIXME(ntdll,"((%d<<32)+%d,%ld), implement this using normal integer arithmetic!\n",factor1.HighPart,factor1.LowPart,factor2);
+	return 0;
+#endif
+}
+
+/******************************************************************************
+ *  RtlFormatCurrentUserKeyPath		[NTDLL.371] 
+ */
+DWORD WINAPI RtlFormatCurrentUserKeyPath(DWORD x)
+{
+    FIXME(ntdll,"(0x%08lx): stub\n",x);
+    return 1;
+}
+
+/******************************************************************************
+ *  RtlOpenCurrentUser		[NTDLL] 
+ */
+DWORD WINAPI RtlOpenCurrentUser(DWORD x1, DWORD *x2)
+{
+/* Note: this is not the correct solution, 
+ * But this works pretty good on wine and NT4.0 binaries
+ */
+	if  ( x1 == 0x2000000 )  {
+		*x2 = HKEY_CURRENT_USER; 
+		return TRUE;
+	}
+		
+	return FALSE;
+}
+/**************************************************************************
+ *                 RtlDosPathNameToNtPathName_U		[NTDLL.338]
+ *
+ * FIXME: convert to UNC or whatever is expected here
+ */
+BOOLEAN  WINAPI RtlDosPathNameToNtPathName_U(
+	LPWSTR from,PUNICODE_STRING us,DWORD x2,DWORD x3)
+{
+	LPSTR	fromA = HEAP_strdupWtoA(GetProcessHeap(),0,from);
+
+	FIXME(ntdll,"(%s,%p,%08lx,%08lx)\n",fromA,us,x2,x3);
+	if (us)
+		RtlInitUnicodeString(us,HEAP_strdupW(GetProcessHeap(),0,from));
+	return TRUE;
+}
+
+/******************************************************************************
+ *  RtlCreateEnvironment		[NTDLL] 
+ */
+DWORD WINAPI RtlCreateEnvironment(DWORD x1,DWORD x2) {
+	FIXME(ntdll,"(0x%08lx,0x%08lx),stub!\n",x1,x2);
+	return 0;
+}
+
+
+/******************************************************************************
+ *  RtlDestroyEnvironment		[NTDLL] 
+ */
+DWORD WINAPI RtlDestroyEnvironment(DWORD x) {
+	FIXME(ntdll,"(0x%08lx),stub!\n",x);
+	return 0;
+}
+
+/******************************************************************************
+ *  RtlQueryEnvironmentVariable_U		[NTDLL] 
+ */
+DWORD WINAPI RtlQueryEnvironmentVariable_U(DWORD x1,PUNICODE_STRING key,PUNICODE_STRING val) {
+	FIXME(ntdll,"(0x%08lx,%s,%p),stub!\n",x1,debugstr_w(key->Buffer),val);
+	return 0;
+}
+