Index: trunk/src/NTDLL/nt.cpp
===================================================================
--- trunk/src/NTDLL/nt.cpp	(revision 2126)
+++ trunk/src/NTDLL/nt.cpp	(revision 2128)
@@ -1,3 +1,3 @@
-/* $Id: nt.cpp,v 1.3 1999-12-18 20:01:13 sandervl Exp $ */
+/* $Id: nt.cpp,v 1.4 1999-12-18 21:45:13 sandervl Exp $ */
 
 
@@ -15,4 +15,6 @@
 #include <string.h>
 #include <time.h>
+#include <os2win.h>
+#include <handlemanager.h>
 
 #include "ntdll.h"
@@ -258,11 +260,15 @@
                                    PHANDLE TokenHandle)
 {
-  dprintf(("NTDLL: NtOpenProcessToken(%08xh,%08xh,%08xh) not implemented.\n",
+  dprintf(("NTDLL: NtOpenProcessToken(%08xh,%08xh,%08xh) not correctly implemented.\n",
            ProcessHandle,
            DesiredAccess,
            TokenHandle));
 
-  *TokenHandle = 0xcafe;
-  return 0;
+  if(ProcessHandle == GetCurrentProcess()) {
+	HMOpenProcessToken(ProcessHandle, DesiredAccess, (ULONG)&ProcSecInfo, TokenHandle);
+	return STATUS_SUCCESS;
+  }
+  *TokenHandle = 0;
+  return ERROR_INVALID_HANDLE;
 }
 
@@ -282,6 +288,6 @@
            TokenHandle));
 
-  *TokenHandle = 0xcafe;
-  return 0;
+  *TokenHandle = 0;
+  return ERROR_INVALID_HANDLE;
 }
 
@@ -321,5 +327,7 @@
                                         LPDWORD ReturnLength)
 {
-  dprintf(("NTDLL: NtQueryInformationToken(%08xh,%08xh,%08xh,%08xh,%08xh) not implemented.\n",
+ PROCESSTHREAD_SECURITYINFO *pSecInfo;
+
+  dprintf(("NTDLL: NtQueryInformationToken(%08xh,%08xh,%08xh,%08xh,%08xh) not correctly implemented.\n",
            Token,
            TokenInformationClass,
@@ -328,4 +336,8 @@
            ReturnLength));
 
+  pSecInfo = (PROCESSTHREAD_SECURITYINFO*)HMHandleGetUserData(Token);
+  if((ULONG)pSecInfo == -1) {
+	return ERROR_INVALID_HANDLE;
+  }
   switch (TokenInformationClass)
   {
@@ -335,5 +347,5 @@
 		return STATUS_BUFFER_TOO_SMALL;
 	}
-	memset(TokenInformation, 0, sizeof(TOKEN_GROUPS));
+	memcpy(TokenInformation, (LPVOID)pSecInfo->pTokenGroups, sizeof(TOKEN_GROUPS));
 	break;
     case TokenUser:                     /* 1 */
Index: trunk/src/NTDLL/ntdll.cpp
===================================================================
--- trunk/src/NTDLL/ntdll.cpp	(revision 2126)
+++ trunk/src/NTDLL/ntdll.cpp	(revision 2128)
@@ -1,3 +1,3 @@
-/* $Id: ntdll.cpp,v 1.4 1999-12-18 20:01:14 sandervl Exp $ */
+/* $Id: ntdll.cpp,v 1.5 1999-12-18 21:45:13 sandervl Exp $ */
 
 /*
@@ -38,5 +38,5 @@
 #include <string.h>
 #include <ctype.h>
-#include "misc.h"
+#include <misc.h>
 #include "unicode.h"
 
@@ -52,4 +52,6 @@
 //SvL: per process heap for NTDLL
 HANDLE NTDLL_hHeap = 0;
+
+PROCESSTHREAD_SECURITYINFO ProcSecInfo = {0};
 
 /*****************************************************************************
@@ -87,6 +89,27 @@
     switch (fdwReason) {
     case DLL_PROCESS_ATTACH:
-        NTDLL_hHeap = HeapCreate(0, 0x10000, 0);
+    {
+     SID_IDENTIFIER_AUTHORITY sidIdAuth = {0};
+
+     	NTDLL_hHeap = HeapCreate(0, 0x10000, 0);
+
+	ProcSecInfo.dwType = SECTYPE_PROCESS;
+        RtlAllocateAndInitializeSid(&sidIdAuth, 1, 0, 0, 0, 0, 0, 0, 0, 0, &ProcSecInfo.SidUser.User.Sid);
+	ProcSecInfo.SidUser.User.Attributes = 0; //?????????
+
+        ProcSecInfo.pTokenGroups = (TOKEN_GROUPS*)Heap_Alloc(sizeof(TOKEN_GROUPS));
+	ProcSecInfo.pTokenGroups->GroupCount = 1;
+        RtlAllocateAndInitializeSid(&sidIdAuth, 1, 0, 0, 0, 0, 0, 0, 0, 0, &ProcSecInfo.PrimaryGroup.PrimaryGroup);
+	ProcSecInfo.pTokenGroups->Groups[0].Sid = ProcSecInfo.PrimaryGroup.PrimaryGroup;
+	ProcSecInfo.pTokenGroups->Groups[0].Attributes = 0; //????
+
+//        pPrivilegeSet   = NULL;
+//        pTokenPrivileges= NULL;
+//        TokenOwner      = {0};
+//        DefaultDACL     = {0};
+//        TokenSource     = {0};
+        ProcSecInfo.TokenType = TokenPrimary;
 	break;
+    }
     case DLL_PROCESS_DETACH:
         HeapDestroy(NTDLL_hHeap);
Index: trunk/src/NTDLL/ntdll.h
===================================================================
--- trunk/src/NTDLL/ntdll.h	(revision 2126)
+++ trunk/src/NTDLL/ntdll.h	(revision 2128)
@@ -1,3 +1,3 @@
-/* $Id: ntdll.h,v 1.8 1999-12-18 20:01:14 sandervl Exp $ */
+/* $Id: ntdll.h,v 1.9 1999-12-18 21:45:13 sandervl Exp $ */
 
 /*
@@ -655,4 +655,25 @@
 PSID_IDENTIFIER_AUTHORITY WINAPI GetSidIdentifierAuthority(PSID);
 
+//SvL: Security data for win32 process (nothing fancy; just trying to fool apps
+//     into thinking the security subsystem is in perfect shape.
+#define SECTYPE_THREAD		0
+#define SECTYPE_PROCESS		1
+
+typedef struct {
+ DWORD               dwType;
+ TOKEN_USER          SidUser;
+ TOKEN_GROUPS       *pTokenGroups;
+ PRIVILEGE_SET      *pPrivilegeSet;
+ TOKEN_PRIVILEGES   *pTokenPrivileges;
+ TOKEN_OWNER         TokenOwner;
+ TOKEN_PRIMARY_GROUP PrimaryGroup;
+ TOKEN_DEFAULT_DACL  DefaultDACL;
+ TOKEN_SOURCE        TokenSource;
+ TOKEN_TYPE          TokenType;
+} PROCESSTHREAD_SECURITYINFO;
+
+//Per process info; Should probably be stored in process database structure
+extern PROCESSTHREAD_SECURITYINFO ProcSecInfo;
+
 #ifdef __cplusplus
 }
