Jungo WinDriver  
Official Documentation

◆ WDS_IpcScanProcs()

DWORD DLLCALLCONV WDS_IpcScanProcs ( _Outptr_ WDS_IPC_SCAN_RESULT pIpcScanResult)

Scans and returns information of all registered processes that share the application process groupID (as was given to WDS_IpcRegister() or a specific groupID.)

Parameters
[out]pIpcScanResultPointer to IpcScanResult struct that will be filled by the function.
Returns
Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise
// WinDriver Callback functions must use DLLCALLCONV macro
static void DLLCALLCONV ipc_msg_event_cb(WDS_IPC_MSG_RX *pIpcRxMsg, void *pData)
{
printf("\n\nReceived an IPC message:\n"
"msgID [0x%lx], msgData [0x%llx] from process [0x%lx]\n",
pIpcRxMsg->dwMsgID, pIpcRxMsg->qwMsgData, pIpcRxMsg->dwSenderUID);
switch (pIpcRxMsg->dwMsgID)
{
case A:
{
// ...
}
break;
case B:
{
// ...
}
break;
default:
printf("Unknown IPC type. msgID [0x%lx], msgData [0x%llx] from "
"process [0x%lx]\n\n", pIpcRxMsg->dwMsgID, pIpcRxMsg->qwMsgData,
pIpcRxMsg->dwSenderUID);
}
}
int main(void)
{
DWORD dwSubGroupID = 0; // Or any other ID you want to choose
DWORD dwStatus;
WDS_IPC_SCAN_RESULT ipcScanResult;
// Make sure to fully initialize WinDriver!
if (!WD_DriverName(DEFAULT_DRIVER_NAME))
{
ErrLog("Failed to set the driver name for WDC library.\n");
return;
}
/* Open a handle to the driver and initialize the WDC library */
dwStatus = WDC_DriverOpen(WDC_DRV_OPEN_DEFAULT, DEFAULT_LICENSE_STRING);
if (WD_STATUS_SUCCESS != dwStatus)
{
printf("Failed to initialize the WDC library. Error 0x%lx - %s\n",
dwStatus, Stat2Str(dwStatus));
return dwStatus;
}
dwStatus = WDS_IpcRegister(DEFAULT_PROCESS_NAME, DEFAULT_PROCESS_GROUP_ID,
dwSubGroupID, WD_IPC_ALL_MSG, ipc_msg_event_cb, NULL /* Your cb ctx */);
if (WD_STATUS_SUCCESS != dwStatus)
{
printf("Failed registering process to IPC. Error [0x%lx - %s]\n",
dwStatus, Stat2Str(dwStatus));
goto Exit;
}
printf("Registration completed successfully\n");
printf("Scanning for processes...\n");
dwStatus = WDS_IpcScanProcs(&ipcScanResult);
if (WD_STATUS_SUCCESS != dwStatus)
{
printf("Failed scanning registered processes. Error [0x%lx - %s]\n",
dwStatus, Stat2Str(dwStatus));
goto Exit;
}
if (ipcScanResult.dwNumProcs)
{
printf("Found %ld processes in current group\n",
ipcScanResult.dwNumProcs);
for (i = 0; i < ipcScanResult.dwNumProcs; i++)
{
printf(" %lu) Name: %s, SubGroup ID: 0x%lx, UID: 0x%lx\n", i + 1,
ipcScanResult.procInfo[i].cProcessName,
ipcScanResult.procInfo[i].dwSubGroupID,
ipcScanResult.procInfo[i].hIpc);
}
}
else
{
printf("No processes found in current group\n");
}
// ...
// Rest of your application code
// ...
dwStatus = WDS_IpcUnRegister();
if (dwStatus)
{
printf("Failed unregistering IPC Error [0x%lx - %s]\n",
dwStatus, Stat2Str(dwStatus));
goto Exit;
}
Exit:
}
#define NULL
Definition: kpstdlib.h:268
const char *DLLCALLCONV Stat2Str(_In_ DWORD dwStatus)
Retrieves the status string that corresponds to a status code.
DWORD dwSenderUID
WinDriver IPC unique ID of the sending process.
Definition: wds_lib.h:44
DWORD dwMsgID
A 32 bit unique number defined by the user application.
Definition: wds_lib.h:45
UINT64 qwMsgData
Optional - 64 bit additional data from the sending user-application process.
Definition: wds_lib.h:50
IPC message received.
Definition: wds_lib.h:43
DWORD dwNumProcs
Number of matching processes.
Definition: wds_lib.h:38
WD_IPC_PROCESS procInfo[WD_IPC_MAX_PROCS]
Array of processes info.
Definition: wds_lib.h:39
IPC scan processes results.
Definition: wds_lib.h:37
DWORD hIpc
Returned from WD_IpcRegister()
Definition: windrvr.h:796
CHAR cProcessName[WD_PROCESS_NAME_LENGTH]
Definition: windrvr.h:790
DWORD dwSubGroupID
Identifier of the processes type.
Definition: windrvr.h:791
#define WDC_DRV_OPEN_DEFAULT
Definition: wdc_lib.h:69
DWORD DLLCALLCONV WDC_DriverClose(void)
Closes the WDC WinDriver handle (acquired and stored by a previous call to WDC_DriverOpen()) and unin...
DWORD DLLCALLCONV WDC_DriverOpen(_In_ WDC_DRV_OPEN_OPTIONS openOptions, _In_ const CHAR *pcLicense)
Opens and stores a handle to WinDriver's kernel module and initializes the WDC library according to t...
DWORD DLLCALLCONV WDS_IpcRegister(_In_ const CHAR *pcProcessName, _In_ DWORD dwGroupID, _In_ DWORD dwSubGroupID, _In_ DWORD dwAction, _In_ IPC_MSG_RX_HANDLER pFunc, _In_ void *pData)
Registers an application with WinDriver IPC.
void DLLCALLCONV WDS_IpcUnRegister(void)
This function enables the user application to unregister with WinDriver IPC.
DWORD DLLCALLCONV WDS_IpcScanProcs(_Outptr_ WDS_IPC_SCAN_RESULT *pIpcScanResult)
Scans and returns information of all registered processes that share the application process groupID ...
#define WD_IPC_ALL_MSG
Definition: windrvr.h:1479
@ WD_STATUS_SUCCESS
[0] Operation completed successfully
Definition: windrvr.h:1066
const char *DLLCALLCONV WD_DriverName(const char *sName)
Sets the name of the WinDriver kernel module, which will be used by the calling application.
#define DLLCALLCONV
Definition: windrvr.h:32