Bonjour,
je cherche a recuperer les arguments de certains processus tournant sur le serveur sur lequelle s'execute un site en ASP.NET (VB).
Pour ce faire, je recupere la liste des processus avec System.Diagnostic.Process.GetProcesses("monProcess")
puis pour chaque process :
je lance un fonction avec comme paramètre un process.
Dans cette fonction, j'utilise une fonction de la dll ntdll.dll (pas trouver mieux pour recuperer les argument de processus independant du site)
Voila donc ma structure se remplie mais ensuite, un membre de cette structure contient un pointeur vers une autre structure qui contient elle même encore un pointeur vers une autre structure qui contient enfin un membre de type UNICODE_STRING en C qui s'appelle CommandLine.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 <StructLayout(LayoutKind.Sequential)> Structure PROCESS_BASIC_INFORMATION Public ExitStatus As Integer Public PebBaseAddress As Integer Public AffinityMask As Integer Public BasePriority As Integer Public UniqueProcessId As Integer Public InheritedFromUniqueProcessId As Integer Public Function Length() As Integer Return Len(Me) End Function End Structure <DllImport("ntdll.dll")> _ Public Shared Function NtQueryInformationProcess(ByVal processHandle As IntPtr, ByVal processInformationClass As Integer, _ ByRef processInformation As PROCESS_BASIC_INFORMATION, ByVal processInformationLength As Integer, _ ByVal returnLength As IntPtr) As Integer End Function
Après tous ca ma question est finallement assez courte, comment recuperer le membre CommandLine?
Voila la definition en C des différentes structures :
Voila j'ai pas mal chercher mais je galère.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 typedef struct _PROCESS_BASIC_INFORMATION { PVOID Reserved1; PPEB PebBaseAddress; PVOID Reserved2[2]; ULONG_PTR UniqueProcessId; PVOID Reserved3; } PROCESS_BASIC_INFORMATION; typedef struct _PEB { BYTE Reserved1[2]; BYTE BeingDebugged; BYTE Reserved2[9]; PPEB_LDR_DATA LoaderData; PRTL_USER_PROCESS_PARAMETERS ProcessParameters; BYTE Reserved3[312]; PPS_POST_PROCESS_INIT_ROUTINE PostProcessInitRoutine; BYTE Reserved4[132]; ULONG SessionId; } PEB, *PPEB; typedef struct _RTL_USER_PROCESS_PARAMETERS { BYTE Reserved1[56]; UNICODE_STRING ImagePathName; UNICODE_STRING CommandLine; BYTE Reserved2[92]; } RTL_USER_PROCESS_PARAMETERS, *PRTL_USER_PROCESS_PARAMETERS;
Nota : C'est mon premier programme en VB.Net alors soyez indulgent...
A+
Partager