@@ -748,6 +748,76 @@ NtQueryInformationProcess(
748748 break ;
749749 }
750750
751+ #if (NTDDI_VERSION >= NTDDI_VISTA ) || (DLL_EXPORT_VERSION >= _WIN32_WINNT_VISTA )
752+ case ProcessImageFileNameWin32 :
753+ {
754+ PFILE_OBJECT FileObject ;
755+ POBJECT_NAME_INFORMATION ObjectNameInformation ;
756+
757+ /* Reference the process */
758+ Status = ObReferenceObjectByHandle (ProcessHandle ,
759+ PROCESS_QUERY_INFORMATION , // FIXME: Use PROCESS_QUERY_LIMITED_INFORMATION if implemented
760+ PsProcessType ,
761+ PreviousMode ,
762+ (PVOID * )& Process ,
763+ NULL );
764+ if (!NT_SUCCESS (Status ))
765+ {
766+ break ;
767+ }
768+
769+ /* Get the image path */
770+ Status = PsReferenceProcessFilePointer (Process , & FileObject );
771+ ObDereferenceObject (Process );
772+ if (!NT_SUCCESS (Status ))
773+ {
774+ break ;
775+ }
776+ Status = IoQueryFileDosDeviceName (FileObject , & ObjectNameInformation );
777+ ObDereferenceObject (FileObject );
778+ if (!NT_SUCCESS (Status ))
779+ {
780+ break ;
781+ }
782+
783+ /* Determine return length and output */
784+ Length = sizeof (UNICODE_STRING ) + ObjectNameInformation -> Name .MaximumLength ;
785+ if (Length <= ProcessInformationLength )
786+ {
787+ _SEH2_TRY
788+ {
789+ PUNICODE_STRING ImageName = (PUNICODE_STRING )ProcessInformation ;
790+ ImageName -> Length = ObjectNameInformation -> Name .Length ;
791+ ImageName -> MaximumLength = ObjectNameInformation -> Name .MaximumLength ;
792+ if (ObjectNameInformation -> Name .MaximumLength )
793+ {
794+ ImageName -> Buffer = (PWSTR )(ImageName + 1 );
795+ RtlCopyMemory (ImageName -> Buffer ,
796+ ObjectNameInformation -> Name .Buffer ,
797+ ObjectNameInformation -> Name .MaximumLength );
798+ }
799+ else
800+ {
801+ ASSERT (ImageName -> Length == 0 );
802+ ImageName -> Buffer = NULL ;
803+ }
804+ }
805+ _SEH2_EXCEPT (EXCEPTION_EXECUTE_HANDLER )
806+ {
807+ Status = _SEH2_GetExceptionCode ();
808+ }
809+ _SEH2_END ;
810+ }
811+ else
812+ {
813+ Status = STATUS_INFO_LENGTH_MISMATCH ;
814+ }
815+ ExFreePool (ObjectNameInformation );
816+
817+ break ;
818+ }
819+ #endif /* (NTDDI_VERSION >= NTDDI_VISTA) || (DLL_EXPORT_VERSION >= _WIN32_WINNT_VISTA) */
820+
751821 case ProcessDebugFlags :
752822
753823 if (ProcessInformationLength != sizeof (ULONG ))
0 commit comments