LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

ReadProcessMemory WinAPI - Hard time finding LV CLFN settings


Mathieu Steiner wrote:

Nathand, I've been trying the code you provided, and the return value for GetCurrentProcess is -1 (i'll try to get the last error to see why) (edit: or is it normal?)


On the off chance that it matters - GetCurrentProcess is supposed to return -1, according to the MSDN documentation it's a special value meaning "this process."  They recomend calling GetCurrentProcess instead of hard-coding -1 in case it changes in a future version.

0 Kudos
Message 11 of 13
(442 Views)

I read this, but was unsure I understood correctly though

Gonna try some code and post when I'm done

 

Thanks for your help


0 Kudos
Message 12 of 13
(440 Views)

@Mathieu Steiner wrote:

Alright.

There we go. I changed the rights to read, when opening the process memory and the handle to match the HANDLE type

 

I finally get something from the read function. Still working on this, but seems to be solved 😄

I'll post some more information when i'll have it work fine

 

Thanks a lot


In order for the ReadProcessMemory() to work correctly you indeed need to open the according process handle with access right PROCESS_VM_READ as MSDN describes. And the pseudo handle returned by GetCurrentProcess() has currently full the maximum rights that the DACL allows, which depending on the current users rights might or might not be enough to read the process memory. Opening a handle to a different process however needs a specific request with  PROCESS_VM_READ to for instance OpenProcess() and will only succeed if the process' DACL allows those rights.

Rolf Kalbermatter
My Blog
0 Kudos
Message 13 of 13
(436 Views)