RunningAppEnum

Top  Previous  Next

int _stdcall

RunningAppEnum(

   IN  RUNNINGAPP_ENUM_CALLBACK     Callback,

   IN  LPVOID                       Data )

Enumerates virtual applications currently running within the current user session.

Parameters

Callback [in]

Callback function called for each deployed virtual application. The callback routine should be of type:

BOOL _stdcall RUNNINGAPP_ENUM_CALLBACK(

 IN  LPVOID                                Data,

 IN  RUNNING_APP*                        AppID )

 

with RUNNING_APP:

typedef struct {

 DWORD                                Version;

 DWORD                                SerialId;

 TCHAR                                        CarrierExeName[MAX_PATH * 4];

 DWORD                                CarrierPID;

 DWORD                                StartTickTime;

 DWORD                                SyncStreamingDuration;

 DWORD                                TotalProcesses;

 VIRT_PROCESS                        Processes[2048];

 TCHAR                                        AppID[MAX_APPID_LENGTH];

 TCHAR                                        FriendlyName[MAX_APPID_LENGTH];

} RUNNING_APP, *PRUNNING_APP;

With:

Version: structure version (2).
SerialId: serial number, automatically increased for each virtual application launched.
CarrierExeName: name of the executable used to launch the virtual application.
CarrierPID: process ID of the first process which started the virtual application.
StartTickTime: equal to GetTickCount() at the time the virtual application was started.
SyncStreamingDuration: reserved.
TotalProcesses: the number of processes that are part of this virtual application.
Processes: a list of processes (PID and Flags) that are part of this virtual application.
AppID: unique virtual application ID.
FriendlyName: friendly, more descriptive name of this virtual application.

Data [in]

Arbitrary data to passed to the callback routine.

Return value

If successful, the return value is APIRET_SUCCESS.

Code sample

// RunningAppEnumCallback

BOOL _stdcall

RunningAppEnumCallback(

 IN  LPVOID                        Data,

 IN  RUNNING_APP*                RunningApp )

{

 printf("%ws: %ws\n", RunningApp->AppID, RunningApp->CarrierExeName);

 for (int i = 0; i < (int)RunningApp->TotalProcesses; i++)

 {

         printf("  PID %d\n", RunningApp->Processes[i].PID);

 }

 return (TRUE);

}

 

...

 

RunningAppEnum(RunningAppEnumCallback, NULL);