CVS: winex/dlls/ntdll nt.c,1.19,1.20
[email protected] 12 Sep 2007 12:40:05 -0000
| Newsgroups | gmane.comp.emulators.winex.cvs |
|---|---|
| Message-ID | <[email protected]> |
Subject: winex/dlls/ntdll nt.c,1.19,1.20Update of /var/lib/cvsd/cvsroot/winex/dlls/ntdll
In directory agravaine:/tmp/cvs-serv13093/dlls/ntdll
Modified Files:
nt.c
Log Message:
- made NtQuerySystemInformation() fail on SystemProcessInformation calls.
- fixed up the SystemRegistryQuotaInformation case to behave like native (still returns the same values as it previously did - 32MB max registry size, 2MB used)
- fixed up the NtQuerySystemInformation() function to behave more like native in general (including calls for SystemDriverInformation and SystemDebuggerInformation that are added in the CP patch).
Index: nt.c
===================================================================
RCS file: /var/lib/cvsd/cvsroot/winex/dlls/ntdll/nt.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- nt.c 12 Sep 2007 12:37:19 -0000 1.19
+++ nt.c 12 Sep 2007 12:40:02 -0000 1.20
@@ -775,6 +775,27 @@
return 0;
}
+
+static NTSTATUS collectProcessInformation(void *buf, ULONG length, ULONG *resultLength){
+ if (buf){
+ FIXME("gather process information\n");
+
+ /* FIXME!! return an error for now */
+ return STATUS_ACCESS_VIOLATION;
+ }
+
+ else{
+ if (resultLength)
+ *resultLength = 1024;
+
+ return STATUS_ACCESS_VIOLATION;
+ }
+
+
+ return STATUS_SUCCESS;
+}
+
+
/******************************************************************************
* NtQuerySystemInformation [NTDLL.@]
* ZwQuerySystemInformation [NTDLL.@]
@@ -800,32 +821,96 @@
IN ULONG Length,
OUT PULONG ResultLength)
{
+ NTSTATUS result = STATUS_SUCCESS;
+
+
+ FIXME("(0x%08x,%p,0x%08lx,%p), mostly-stub!\n",
+ SystemInformationClass, SystemInformation,
+ Length, ResultLength);
+
+
+ /* native checks if the buffer length is 0 before checking if the buffer is NULL
+ (<ResultLength> is not modified in this case) => fail */
+ if (Length == 0)
+ return STATUS_INFO_LENGTH_MISMATCH;
+
+ /* native checks if this buffer is NULL on a case-by-case basis. For now we'll just
+ do the same thing for all information classes */
+ if (SystemInformation == NULL){
+ if (ResultLength)
+ *ResultLength = 0;
+
+ return STATUS_ACCESS_VIOLATION;
+ }
+
+
switch(SystemInformationClass)
{
case SystemRegistryQuotaInformation:
/* Something to do with the size of the registry *
* Since we don't have a size limitation, fake it *
* This is almost certainly wrong. *
- * This sets each of the three words in the struct to 32 MB, *
- * which is enough to make the IE 5 installer happy. */
- FIXME("(0x%08x,%p,0x%08lx,%p) faking max registry size of 32 MB\n",
- SystemInformationClass,SystemInformation,Length,ResultLength);
- *(DWORD *)SystemInformation = 0x2000000;
- *(((DWORD *)SystemInformation)+1) = 0x200000;
- *(((DWORD *)SystemInformation)+2) = 0x200000;
+ * This sets the max registry size to 32MB and the currently *
+ * used amount to 2MB which is enough to make the IE 5 *
+ * installer happy. */
+ /* NOTE: native returns 120MB for the max registry size on
+ an admin account on XP pro SP2. The 'used' amount is
+ set to 4.3MB on a 1.5 year old system on the same account.
+ The <Reserved1> member is set to 0x16800000. Not sure
+ what that's used for or what it means. It's not a valid
+ memory address in the process. Perhaps a permissions
+ mask? */
+ if (SystemInformation){
+ SYSTEM_REGISTRY_QUOTA_INFORMATION *quota = (SYSTEM_REGISTRY_QUOTA_INFORMATION *)SystemInformation;
+
+
+ /* output buffer is too small */
+ if (Length < sizeof(SYSTEM_REGISTRY_QUOTA_INFORMATION))
+ return STATUS_INFO_LENGTH_MISMATCH;
+
+
+ FIXME("(0x%08x,%p,0x%08lx,%p) faking max registry size of 32 MB\n",
+ SystemInformationClass, SystemInformation, Length, ResultLength);
+
+ quota->RegistryQuotaAllowed = 0x02000000;
+ quota->RegistryQuotaUsed = 0x00200000;
+ quota->Reserved1 = 0x16800000;
+
+ if (ResultLength)
+ *ResultLength = sizeof(SYSTEM_REGISTRY_QUOTA_INFORMATION);
+ }
+
+ /* no buffer => access violation */
+ else{
+
+ /* native has some strange behaviour in this case => set <ResultLength> to 0 */
+ if (Length == 0 && ResultLength)
+ *ResultLength = 0;
+
+ result = STATUS_ACCESS_VIOLATION;
+ }
+
break;
case SystemProcessInformation:
FIXME("implement the SystemProcessInformation case!\n");
+ result = collectProcessInformation(SystemInformation, Length, ResultLength);
break;
default:
FIXME("(0x%08x,%p,0x%08lx,%p) stub\n",
SystemInformationClass,SystemInformation,Length,ResultLength);
- ZeroMemory (SystemInformation, Length);
+
+ if (SystemInformation)
+ ZeroMemory (SystemInformation, Length);
+
+ if (ResultLength)
+ *ResultLength = 0;
+
+ result = STATUS_ACCESS_VIOLATION;
}
- return STATUS_SUCCESS;
+ return result;
}
/******************************************************************************