Questions tagged [psapi]

The Microsoft process status application programming interface (PSAPI) is a helper library that makes it easier for you to obtain information about processes and device drivers.

The process status API (PSAPI) provides sets of functions for retrieving the following information:

  • Process Information
  • Module Information
  • Device Driver Information
  • Process Memory Usage Information
  • Working Set Information
  • Memory-Mapped File Information

PSAPI Functions

29 questions
0
votes
1 answer

EnumProcesses failing to update the Vector

I am trying to enumerate windows processes using the EnumProcesses function provided by Win32 (psapi). Life is smooth, so I am using Rust instead of C++. The code is below. Cargo.toml [dependencies.windows] features = [ "Win32_Foundation", …
Tushar Saurabh
  • 687
  • 2
  • 13
  • 27
0
votes
0 answers

GetModuleFilename failed with: Error 126 "The specified module could not be found" on EnumProcessModules results

I generated a list of modules from the EnumProcessModules() result and the try to get filenames of modules of that list via GetModuleFilename() function. auto sizeInBytes = getModulesSize(); std::vector hmodules(sizeInBytes /…
zaulan
  • 1
  • 2
0
votes
1 answer

What's the actual size of PSAPI_WORKING_SET_INFORMATION buffer used in QueryWorkingSet function of PSAPI.h

I'd like to use the function QueryWorkingSet available in PSAPI, but I'm having trouble to actually define the size of the buffer pv. Here is the code : #include #include #include void testQueryWorkingSet() { …
Wassim
  • 386
  • 2
  • 15
0
votes
1 answer

Direct data into non existing array

I want to find the number of running processes using EnumProcesses function from psapi library. The function requieres an array that will receive the list of process identifiers. It also writes the total number of bytes of found data into a given…
B B
  • 13
  • 4
0
votes
2 answers

GetModuleInformation Fails on Linkage in Windows 10

I am trying to create a DLL Injector that will directly execute functions within the DLL in the target process. I am trying to get the entry point of the DLL I injected so I can get the offset of the function. I read on the Microsoft Docs to use…
Delkarix
  • 84
  • 11
0
votes
1 answer

How would I include Psapi.h without running into a multiply included error?

Currently running into an issue where Winsock.h is already included in a header file elsewhere in my project... Header not directly included: # if defined(_WINSOCKAPI_) && !defined(_WINSOCK2API_) # error WinSock.h has already been included # endif…
Ian
  • 675
  • 1
  • 9
  • 25
0
votes
1 answer

Windows program entry point using EnumProcessModules returns unexpected value

I am running a simple app and trying to read a specific offset within it's memory using Window's PSAPI. when I run my debugger, I get the real value of the memory address, and the relative one to my ".exe" entry point. yet, when I run the…
Noobay
  • 377
  • 4
  • 15
0
votes
1 answer

C++ iterate processes and find out command line args of each process

I have the following problem to solve (VS2012, C++) I have to find out if a specific HTA app is running from my exe. For that, I have to find the process mshta and check if it has correct arguments (should have been started as "mshta somehta.hta").…
Petr Osipov
  • 621
  • 6
  • 16
0
votes
1 answer

Error when trying to get the current process memory size on C++, MinGW

When I try to call GetProcessMemoryInfo I get an error: undefined reference to `GetProcessMemoryInfo' I've seen this issue:Undefined reference to getprocessmemoryinfo@12 but it doesn't solve mine. I'm trying to know what is the size of my process in…
yossico
  • 3,421
  • 5
  • 41
  • 76
0
votes
1 answer

Issue finding and linking Psapi library to executable using cmake

I am trying to link the psapi library to a project with cmake, nothing complex. Here's my cmake-file: cmake_minimum_required(VERSION 2.8) project(BenchmarkTests) add_definitions(-DPSAPI_VERSION=1) if (WIN32) FILE(GLOB win32_head …
Daniel N
  • 53
  • 1
  • 11
-1
votes
1 answer

g++ compilation with linked libraries

I'm new to g++ and am trying to compile / run the example c++ code found on this page: https://learn.microsoft.com/en-us/windows/desktop/psapi/enumerating-all-processes Compiling the code with g++ -o ex.exe ex.cpp Doesn't work, so i'm pretty sure…
Martin
  • 1,336
  • 4
  • 32
  • 69
-1
votes
1 answer

Cant include EnumProcessModulesEx

I am attempting to make a program that will iterate through a list of actively running processes, find one that is from a certain executable, and then write to that processes memory. I have been following along with the msdn tutorial, modifying it…
Curious Cube
  • 35
  • 2
  • 8
-1
votes
1 answer

Does Microsoft psapi methods return bytes using decimal or binary notation?

I just started a project that has been going on for a few years now. It uses Microsoft's PSAPI interface to obtain memory data. More specifically, we are using GetProcessMemoryInfo(). I started working on it under the assumption that the data we…
Chrus
  • 31
  • 9
-2
votes
1 answer

How can I get only the executable name after using GetModuleFileNameEx

I want to store the executable name without the directory (i.e. system.exe). How can I do this? HANDLE Handle = OpenProcess(PROCESS_ALL_ACCESS, 0, ProcessID); if (GetModuleFileNameEx(Handle, 0, (LPWSTR)exename, sizeof(exename) - 1)) { ProcessName…
1
2