Torna indietro   Hardware Upgrade Forum > Software > Programmazione

Lenovo LOQ 15i Gen 10 (15IRX10) alla prova: il notebook gaming 'budget' che non ti aspetti
Lenovo LOQ 15i Gen 10 (15IRX10) alla prova: il notebook gaming 'budget' che non ti aspetti
Il Lenovo LOQ 15i Gen 10 (15IRX10) offre prestazioni convincenti grazie al Core i7-13650HX e alla RTX 5060 Laptop a 100W, mantenendo un prezzo competitivo tra 1100 e 1300 euro. Costruzione solida, buon display e ampia espandibilità lo rendono una scelta equilibrata per chi cerca un notebook gaming accessibile ma moderno.
Due mesi di Battlefield 6: dalla campagna al battle royale, è l'FPS che stavamo aspettando
Due mesi di Battlefield 6: dalla campagna al battle royale, è l'FPS che stavamo aspettando
Abbiamo giocato a lungo a Battlefield 6, abbiamo provato tutte le modalità multiplayer, Redsec, e le numerose personalizzazioni. In sintesi, ci siamo concentrati su ogni aspetto del titolo per comprendere al meglio uno degli FPS più ambiziosi della storia dei videogiochi e, dopo quasi due mesi, abbiamo tirato le somme. In questo articolo, condividiamo con voi tutto ciò che è Battlefield 6, un gioco che, a nostro avviso, rappresenta esattamente ciò che questo genere attendeva da tempo
Antigravity A1: drone futuristico per riprese a 360° in 8K con qualche lacuna da colmare
Antigravity A1: drone futuristico per riprese a 360° in 8K con qualche lacuna da colmare
Abbiamo messo alla prova il drone Antigravity A1 capace di riprese in 8K a 360° che permette un reframe in post-produzione ad eliche ferme. Il concetto è molto valido, permette al pilota di concentrarsi sul volo e le manovre in tutta sicurezza e decidere con tutta tranquillità come gestire le riprese. La qualità dei video, tuttavia, ha bisogno di uno step in più per essere competitiva
Tutti gli articoli Tutte le news

Vai al Forum
Rispondi
 
Strumenti
Old 05-10-2005, 04:31   #1
GordonFreeman
Member
 
Iscritto dal: Apr 2005
Messaggi: 296
problema con NtQueryObject

rispondete in ita

after obtained all file handles open in the system,i have duplicated them in my
process,and i've queried them with NtQueryObject for
retrieving filenames...but with several handles my program goes in deadlock when it does the call , and i've also done checks for finding out what process those handles belong to,and these are some results

"C:\\WINDOWS\\system32\\ZoneLabs\\vsmon.exe"
"C:\WINDOWS\\system32\\services.exe"
"C:\\WINDOWS\\system32\\lsass.exe"
"C:\\WINDOWS\\system32\\svchost.exe"
...

but sincerely...i don't think that querying an handle that belongs to a system service (like all the processes listed above),makes a call to NtQueryObject to wait forever...however,this is the code

Codice:
// some defines from ntddk

	 typedef struct _LSA_UNICODE_STRING { 
		USHORT Length;
		USHORT MaximumLength;
  		PWSTR Buffer;
	} LSA_UNICODE_STRING, *PLSA_UNICODE_STRING, UNICODE_STRING, *PUNICODE_STRING;

	typedef struct _STRING { 
  		USHORT  Length;
  		USHORT  MaximumLength;
  		PCHAR  Buffer;
	} ANSI_STRING, *PANSI_STRING;

 typedef struct _OBJECT_ATTRIBUTES {
	ULONG uLength;
    HANDLE  RootDirectory;
    PUNICODE_STRING  ObjectName;
    ULONG  Attributes;
    PSECURITY_DESCRIPTOR  SecurityDescriptor;
    PVOID SecurityQualityOfService;
 } OBJECT_ATTRIBUTES,*POBJECT_ATTRIBUTES;

 typedef struct _CLIENT_ID {
	 DWORD UniqueProcess;
	 DWORD UniqueThread;
 } CLIENT_ID, *PCLIENT_ID;

	typedef struct _SYSTEM_HANDLE_INFORMATION {
		USHORT ProcessId;
        USHORT CreatorBackTraceIndex;
		UCHAR ObjectTypeNumber;
		UCHAR Flags;
		USHORT Handle;
		PVOID Object;
		ACCESS_MASK GrantedAccess;
	} SYSTEM_HANDLE_INFORMATION, *PSYSTEM_HANDLE_INFORMATION;

	typedef struct _SYSTEM_HANDLE_INFORMATION_EX {
		ULONG NumberOfHandles;
		SYSTEM_HANDLE_INFORMATION Information[1];
	} SYSTEM_HANDLE_INFORMATION_EX, *PSYSTEM_HANDLE_INFORMATION_EX;

	typedef struct _OBJECT_NAME_INFORMATION {
		UNICODE_STRING Name;
	} OBJECT_NAME_INFORMATION, *POBJECT_NAME_INFORMATION;


Codice:
// the code is incomplete,for readibility purpose

void GetFileHandles(){

 HANDLE hThisProcess;
//.. initialize hThisProcess with GetCurrentProcess() and DuplicateHandle() ...

// ... use NtQueryObject for obtaining the "File" type index,to be compared 
// with ObjectTypeNumber field of SYSTEM_HANDLE_INFORMATION ,because
// i'm interested in file handles only... that index will be hold in the
// uFileTypeIndex variable

// the pStruct variable points to the handle table ,it's a PSYSTEM_HANDLE_INFORMATION_EX
// obtained via NtQuerySystemInformation() with SystemHandleInformation parameter 

    ULONG uLen = sizeof(UNICODE_STRING) + (MAX_PATH + 1) * sizeof(WCHAR);

    POBJECT_NAME_INFORMATION pNameInfo = (POBJECT_NAME_INFORMATION)malloc(uLen);  

	HANDLE hSourceProcess;   // remote process
	OBJECT_ATTRIBUTES oa;
	CLIENT_ID ClientId;

    for(ULONG u = 0;u < pStruct->NumberOfHandles;u++)

     if(pStruct->Information[u].ObjectTypeNumber == uFileTypeIndex){  // check handle type,must be a file

      HANDLE hSource = (HANDLE)pStruct->Information[u].Handle,hCopy;

	  memset(&oa,0,sizeof(oa));
	  ClientId.UniqueThread = 0;
	  ClientId.UniqueProcess = (DWORD)pStruct->Information[u].ProcessId; 

	   if(NtOpenProcess(&hSourceProcess,PROCESS_ALL_ACCESS,&oa,&ClientId))
	    continue;

	  if(NtDuplicateObject(hSourceProcess,hSource,hThisProcess,&hCopy,PROCESS_QUERY_INFORMATION,0,0))
	   continue;

// with some file handles this call will not return...???

      if(NtQueryObject(hCopy,ObjectNameInformation,pNameInfo,uLen,NULL)){
CloseHandle(hSourceProcess);
	   CloseHandle(hCopy); 
	   continue;
	  }

//...  do something with the filename,in pNameInfo->Name.Buffer
 
	  CloseHandle(hCopy); 
                  CloseHandle(hSourceProcess);

	 }
	 
	CloseHandle(hThisProcess);
	free(pNameInfo);
	free(pStruct); 

}
GordonFreeman è offline   Rispondi citando il messaggio o parte di esso
Old 06-10-2005, 00:40   #2
GordonFreeman
Member
 
Iscritto dal: Apr 2005
Messaggi: 296
up
GordonFreeman è offline   Rispondi citando il messaggio o parte di esso
Old 06-10-2005, 10:46   #3
cionci
Senior Member
 
L'Avatar di cionci
 
Iscritto dal: Apr 2000
Città: Vicino a Montecatini(Pistoia) Moto:Kawasaki Ninja ZX-9R Scudetti: 29
Messaggi: 53971
In generale questa procedura ti funziona con gli altri processi che non siano servizi ?
cionci è offline   Rispondi citando il messaggio o parte di esso
Old 06-10-2005, 21:12   #4
GordonFreeman
Member
 
Iscritto dal: Apr 2005
Messaggi: 296
Quote:
Originariamente inviato da cionci
In generale questa procedura ti funziona con gli altri processi che non siano servizi ?
risposta mia in un altro forum:

someone told me:

--------------------------------------------------------------------------------

Your problem is this:

When you query for object name on a pipe handle (opened for synchronous io, and where there are pending read operations) then your thread will hang. Permanently. And attempts to terminate the thread will possibly end in a bluescreen.

There is no difference between system services and other applications, besides that services more often uses pipes.

I don't know of solutions around this problem. GetFileType(...) and other attempts to determine that is it a pipe object will deadlock aswell. Plain stupid.

- petter
-------------------------------------------------------------------------

allora,la mia procedura funziona solo con gli handle a file non sincronizzati,cioè che non siano pipes etc. , non c'entra niente se il processo a cui appartiene l'handle è di sistema o no...

secondo te come si può risolvere?

io proporrei di chiederlo al kernel il nome dell'handle,cioè interrogando il file system driver...ma come si fa??

oppure proponimi altre soluzioni
GordonFreeman è offline   Rispondi citando il messaggio o parte di esso
 Rispondi


Lenovo LOQ 15i Gen 10 (15IRX10) alla prova: il notebook gaming 'budget' che non ti aspetti Lenovo LOQ 15i Gen 10 (15IRX10) alla prova: il n...
Due mesi di Battlefield 6: dalla campagna al battle royale, è l'FPS che stavamo aspettando Due mesi di Battlefield 6: dalla campagna al bat...
Antigravity A1: drone futuristico per riprese a 360° in 8K con qualche lacuna da colmare Antigravity A1: drone futuristico per riprese a ...
Sony Alpha 7 V, anteprima e novità della nuova 30fps, che tende la mano anche ai creator Sony Alpha 7 V, anteprima e novità della ...
realme GT 8 Pro Dream Edition: prestazioni da flagship e anima racing da F1 realme GT 8 Pro Dream Edition: prestazioni da fl...
SpaceX: l'offerta pubblica iniziale del ...
La NASA prova i droni marziani nella Dea...
IBM acquisisce Confluent, leader nella g...
La Commissione Europea indaga AWS e Azur...
Sonda spaziale ESA JUICE: rilasciata una...
PS5 PRO a 698€? L'offerta che nessuno si...
L'equipaggio di Shenzhou-21 ha completat...
Dal milione di download alla rimozione f...
Legno, pelle naturale e socket AM5: la G...
Attenti a X-GPU: la piattaforma sospetta...
La Lotus Eletre Plug-in esiste davvero, ...
Garanzia estesa su Pixel 9 Pro e 9 Pro X...
Addio intelligenza artificiale su Window...
FRAME 4000D LCD RS ARGB, il nuovo case d...
Netflix: AV1 ora gestisce il 30% dello s...
Chromium
GPU-Z
OCCT
LibreOffice Portable
Opera One Portable
Opera One 106
CCleaner Portable
CCleaner Standard
Cpu-Z
Driver NVIDIA GeForce 546.65 WHQL
SmartFTP
Trillian
Google Chrome Portable
Google Chrome 120
VirtualBox
Tutti gli articoli Tutte le news Tutti i download

Strumenti

Regole
Non Puoi aprire nuove discussioni
Non Puoi rispondere ai messaggi
Non Puoi allegare file
Non Puoi modificare i tuoi messaggi

Il codice vB è On
Le Faccine sono On
Il codice [IMG] è On
Il codice HTML è Off
Vai al Forum


Tutti gli orari sono GMT +1. Ora sono le: 03:19.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Served by www3v