Hi,

Here's a small patch which implements NtQueryInformationProcess properly for 
ProcessInformationClass set to ProcessDebugPort.

It fixes cases when ProcessInformationLength != 4, but doesn't check if a 
debugger is present or not. Should it ? I don't expect that anyone would like 
to run Visual Studio on Wine to debug a Win32 program :-)

Laurent Pinchart
--- dlls/ntdll/nt.c	9 Mar 2002 23:39:09 -0000	1.38
+++ dlls/ntdll/nt.c	2 Apr 2002 17:15:43 -0000
@@ -116,13 +116,32 @@
 	IN ULONG ProcessInformationLength,
 	OUT PULONG ReturnLength)
 {
-	FIXME("(0x%08x,0x%08x,%p,0x%08lx,%p),stub!\n",
-		ProcessHandle,ProcessInformationClass,ProcessInformation,ProcessInformationLength,ReturnLength
-	);
-	/* "These are not the debuggers you are looking for." */
-	if (ProcessInformationClass == ProcessDebugPort)
-	    /* set it to 0 aka "no debugger" to satisfy copy protections */
-	    memset(ProcessInformation,0,ProcessInformationLength);
+	NTSTATUS ret = STATUS_SUCCESS;
+	ULONG len = 0;
+
+	switch (ProcessInformationClass) {
+	case ProcessDebugPort:
+		/* "These are not the debuggers you are looking for." */
+		/* set it to 0 aka "no debugger" to satisfy copy protections */
+		if (ProcessInformationLength == 4)
+		{
+			memset(ProcessInformation,0,ProcessInformationLength);
+			len = 4;
+		}
+		else
+			retv = STATUS_INFO_LENGTH_MISMATCH;
+		break;
+	default:
+		FIXME("(0x%08x,0x%08x,%p,0x%08lx,%p),stub!\n",
+			ProcessHandle,ProcessInformationClass,
+			ProcessInformation,ProcessInformationLength,
+			ReturnLength
+		);
+		break;
+	}
+
+	if (ReturnLength)
+		*ReturnLength = len;
 
 	return 0;
 }

Reply via email to