473,794 Members | 2,804 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ReadProcessMemo ry fails with 299,...

Hi,

can someone postme a running sample of the
ReadProcessMemo ry(...) function. I would
like to dump the complete memory of the main
module in my application e.g MyApplication.e xe
into a file. Here is a working example of the API
import call:

[DllImport("kern el32.dll", SetLastError = true)]
public static extern bool ReadProcessMemo ry(
IntPtr hProcess,
IntPtr lpBaseAddress,
[Out()] byte[] lpBuffer,
int dwSize,
out int lpNumberOfBytes Read
);

The point is, that i get always a 299 (i know what it means!)
for this call:

Process p = Process.GetCurr entProcess();
string MemoryDumpFileN ame = p.MainModule.Fi leName + ".mem";
byte[] ProcessMemory = new byte[p.MainModule.Mo duleMemorySize];
int NumberOfBytesRe ad = 0;

....
hProcess =
DRWin32APIClass .OpenProcess(DR Win32APIClass.P rocessAccessFla gs.QueryInforma tion
|
DRWin32APIClass .ProcessAccessF lags.VMOperatio n |
DRWin32APIClass .ProcessAccessF lags.VMRead,
false,
(uint) p.Id);
bool _ret = DRWin32APIClass .ReadProcessMem ory(p.Handle,
p.MainModule.Ba seAddress,
ProcessMemory,
p.MainModule.Mo duleMemorySize,
out NumberOfBytesRe ad);

_ret is false (GetLastError=2 99) and lpNumberOfBytes Read is 0, why?
I also enabled any possible privilige in my application including debugging!
Handle to process and ID is valid, confirmed!

Thanks is advance,..

Regards

Kerem
--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Latest Project: http://www.codeplex.com/restarts
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."

Oct 15 '08 #1
0 1594

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
8258
by: Luke | last post by:
I am trying to convert some VB6 projects to VB.NET, however I'm having trouble finding documentation of a new format for some functions, in specific ReadProcessMemory. Since .NET no longer supports the 'as any' declare I found myself trying integers & longs, however all attempts throw back the error message 'Object reference not set to an instance of an object.'. My API declare is as follows Public Declare Function ReadProcessMemory Lib...
2
6330
by: pangel83 | last post by:
I've been trying for days to write a piece of VB.NET code that will read from winamp's memory space the paths of the files from the current winamp playlist. The GETPLAYLISTFILE command of the winamp API will only return a pointer to the position of the asked path. An article available on http://msmvps.com/ch21st/archive/2004/02/26.aspx provides a VB6 implementation of this, using the ReadProcessMemory Windows API command, but something...
6
1577
by: kenneth fleckenstein nielsen | last post by:
Hi guru's It runs ok on my developmaschine, and on the test server that i've set up. but fails after installing on the customers server. I made a XML webservice that does these steps: a) access a db for updating ( fails on client ) b) saves some associated files (DIMES/SOAP) ( not testet outside development ) c) writes a log file ( fails on client ) I think a and c has to do with setting ISS up correctly on the customers server.
7
2537
by: SevDer | last post by:
Hi I have a class library that needs to download the HTML in a specific page of ours with provided querystring. When I open this URL with any browser, it loads fine. When I do WebRequest from Web Project it is again fine. However whenever I do this request from this class library, it fails. I put every kind of user permission to the actual folder, and through inetmgr. Right now everyone has full control. But still I got the problem.
1
4240
by: comp.lang.php | last post by:
Consider my code: if ($this->isSuccessful && is_file($_FILES)) { // STEP 6: MOVE RESUME TO DIRECTORY $uuid = $this->sfug->getUUID(); if (!$uuid) $this->sfug->setUUID(); $uuid = $this->sfug->getUUID();
2
6322
by: Richard Hsu | last post by:
// code #include "stdio.h" int status(FILE * f) { printf("ftell:%d, feof:%s\n", ftell(f), feof(f) != 0 ? "true" : "false"); } int case1() { FILE * f = fopen("c:\\blah", "wb+"); int i = 5;
12
7916
by: Jim Rodgers | last post by:
I have a big asp file that has an error under certain conditions -- totally repeatable. However, it only fails when I set response.buffer = True at the top. WHen I set it False in order to debug it, it works every time! I even set it to True, but did a .Flush just before the error, and the error won't happen. It only happens when response.buffer is True and no .response.flush is issued. The error is a string variable turns-up empty...
5
2927
by: Evolution445 | last post by:
Hi all, I got a problem with my code to check a game's chat position and write text to the game when a command is written by someone on the chat. I haven't figured out yet how to make it send keys to the gamewindow when it's not focussed, and WriteProcessMemory, but that's for a later issue. This is my current code: Public Const PROCESS_ALL_ACCESS As Long = &H1F0FFF Declare Auto Function FindWindow Lib "user32" (ByVal lpClassName As...
0
1776
by: =?iso-8859-1?B?S2VyZW0gR/xtcvxrY/w=?= | last post by:
Hi, can someone postme a running sample of the ReadProcessMemory(...) function. I would like to dump the complete memory of the main module in my application e.g MyApplication.exe into a file. Here is a working example of the API import call:
0
9672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10435
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10213
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6779
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.