if (!WriteProcessMemory(Handle, (BYTE*)((DWORD)GetProcAddress(GetModuleHandle("ntdll.dll"), "LdrLoadDll")), &btLdrLoadDll, sizeof(btLdrLoadDll), NULL)) {
CloseHandle(Handle);
std::cout << "
Failed to write Bytes to memory. Press enter to exit.";
I am looking for a way to run a process form memory, without having any executable. The application will be kept inside a resource and will be extracted during run time. It should be then started as a new process. I couldn't find a solution that works also on x64
I would like to ask about editing proccess memory.For example,I would like to create some program for a multiplayer game which I play.How do I work with memory adresses and what are commands for it.
I want to create 9 child processes and eventually write from each process to another. How can I specifically create 9 child processes and leave them running? Right now, I am using a loop from i=0 to i=8 and running fork() within that loop, but each child process also runs the loop, which spawns dozens (maybe hundreds?) of processes. I specifically only want to create nine of them. How can I do this?
Why the size of a process grows larger in size for lots of small memory allocations. For example, say I have this struct, which is 16 bytes (for a 32 bit build):
Code: struct Person { int iID; int iAge; char * pForeName; char * pSurName; };
If I allocate memory like this:
Code: LPBYTE lpB = new BYTE[sizeof(Person) * 1000000];
Then my process grows to 16,48KB in size, which is what I expected. However if I allocate memory like this:
Code: Person * lpPerson; for(int i = 0; i < 1000000; ++i) lpPerson = new Person;
Then the process grows to 78,656KB, which I don't understand.
Additionally, I was surprised to find a vector acts more similarly to the first example. This code:
Code: Person temp = { 0 }; std::vector<Person> people; for(int i = 0; i < 1000000; ++i) people.push_back(temp);
I have a complex program, around 25.000 code lines. It is quite stable, but I have a bug which only happens from time to time, and when in online-mode, so it is quite difficult for me to reproduce it. I have put lot of efforts to see where the problem is, and I have seen where the code crash, but that line is not the culprit, it only refers to read a memory location where it is supposed to be good data, and it is not. The real bug has happens before in execution. That data is read-only, I mean, I only compute it at program start-up, and then never write into it again, but my bug write to it doring code run, maybe because bad pointers address in any place, and look ramdom (different snapshots execution write at different memory locations).
My question is, is there a way to know when my code 'write' into that 'to me protected memory'? I thinking if there is a method to make a hash of all variables and arrays in that memory section, or any way to 'assert' when that big memory section is written, taking into accound that when I refer to that memory section it could be any of the lots of variables and arrays I precompute at start-up.
I'm not sure if I should do this with malloc or a char array. What I need to do is create 4 methods to read and 4 to write to memory like this (and it has to be fast):
Code:
char GetByte(char* memory, int offset); uint16 GetInt16(char* memory, int offset); uint32 GetInt32(char* memory, int offset); char[] GetString(char* memory, int offset);
So basically memory is the malloced memory and the offset is the position I want to read at.
I'm not sure if there's already a way to do this and maybe I'm overlooking something.
I decided I wanted to make a proper programming language with a virtual machine and bytecode. I used this tutorial: [URL] .....
As a starting point for my project. So far I have modified it to allow for 32-bit addressing so that I can theoretically use 4GB in my programs. Now the problem I'm having is creating the memory.
Question:
I'm not sure if I should do this with malloc or a char array. What I need to do is create 4 methods to read and 4 to write to memory like this (and it has to be fast):
char GetByte(char* memory, int offset); uint16 GetInt16(char* memory, int offset); uint32 GetInt32(char* memory, int offset); char[] GetString(char* memory, int offset);
So basically memory is the malloced memory and the offset is the position I want to read at.
I am doing a project which I have to read, write and erase data from a NorFlash Memory. Then, I have to compare those data files in order to find errors.
Besides, I would like to know which is the best way to TEST errors in this kind of memories.
I am using NetBeans 7.3.1 for writting the code and Cygwin running on Windows XP Virtual Machine. The Memory Flash (S29JL064J 64 Megabit) is incorporated on an external board which is connected to an adapter board (using HDMI cable). This adapter is connected to the Laptop (using an USB).
I have two from in visual studio 2010 with C#. In form1 I have one combobox and one button .In form2 I have Reportviewer . When Button in form1 is clicked form2 is shown. Now my problem is when I click button to show form2 on the line Form2.Show(); this error appear : Attempted to read or write protected memory. This is often an indication that other memory is corrupt. What can i do? In form1 I have one combobox that combo fill with Database with this code in the Form Load:
I have CAN Dll program for my application,which was separately used.Now I have included the Drivers program into my application Program and I am having this error System Access Violation Exception:Attempted to read or write protected memory.i am attaching the Dll code and Application code which is throwing this error.
My Application Code which is the receiver thread for accessing the messages got onto the CAN bus.
DWORD WINAPI Rcv_Msg(LPVOID param){ int*MsgId = new int;//msg id from CAN intRcvVal;//0 = there is data in the queue; 1 = there is no data unsigned int uMsgId; *MsgId = 0; unsigned char CanData[8];
Im using some motors which run off PWM pins.Theres a High byte and Loq byte register (PWMH,PWML).I have an int which i need to put into these registers but i dont know how???so for example
I need to read repeatedly data from a MPEG2 file to the buffer of 188 bytes and analyse data bit by bit.
I have the problem with correct bytes reading from file. In my code listed below I have two methods for that.
First one is lossing this bytes which in hex_base mode have 0 at the begining, eg: 03, 0F, etc.
The second method based on read function which need to have buffer as a char (lenght > 1 byte). Because of that I receive different values from that from file in some cases.
How can I properly read such file?
Code: #include <iostream> #include <fstream> #include <stdlib.h> #include <windows.h> using namespace std; int main() { fstream plik_in;
I am encoding some information in a binary file, and I want to check what I am doing by printing out all the bytes that represent the file.
This is being done by opening a pointer to the file with fopen, reading in each byte of data as a char, and then writing this char to the screen.
I have some image files (e.g. "image.jpg"), whose structure I know, so that I can test my program.
When I print out the chars, they are initially correct, and follow the structure of the file as expected.
However, after about 40 bytes, I find that every subsequent character is ' ' i.e. a blank character.
I then created a CharToBin function, which allows me to print out the actual bits in the char. When doing this, it shows that all the bits are 1 for the characters. i.e. most of the file is represented by 1's, which is clearly not correct.
This happens on all the image files I have tested, and furthermore, on several other non-image files. They all start printing out ' ' after a while. However, all these files are fine and not corrupted, e.g. the image files display correctly.
Code: #include <fstream> #include <iostream> #include <sstring> #include <string> #include <stdio.h> using namespace std; string CharToBin(char ch) { bool bits[8]; for (int i = 0; i < 8; i++)
I have a FILE stream, and I want to create a function that streams a specified number of bytes (up to four bytes) and returns the value of this, as an integar.
For example, supposing that my FILE has the following data, in hex: 74 C8 02 33 F2 7B....... I then want to stream three bytes and store this as an integar. So, I want to stream "04 08 02". The data stored in the integar should then be "00 74 C8 02", because I have not streamed anything into the first byte. By converting the hex to dec, the integar should then be of the value 7653378 (if it is unsigned).
To try to achieve this, I have written the following function. I create an integar and initialise it to zero, then take each byte from the stream, and OR it with my integar. Then, I shift the integar left by 8, and read the next byte, and so on.
The problem is, when I convert "c" to "c_int", it adds on a load of 1's to the left of the "c" data. This then means that the OR comparison changes all those bits in my integar to 1.
How to solve this? I am also wondering whether there is a much more simple way of doing this, rather than having to write my own function....
Code: int StreamFileToInt(FILE *fp, int num_bytes) { char c; int c_int; int x = 0x0000; for (int i = 0; i < num_bytes; i++) {
I made this program to convert bits to bytes, because I'm so sick of seeing ISP's advertise speeds in megabits, which I consider an intentional attempt to decieve :P And I think I've finally understood how the return value of scanf works since the last time I posted here, so my program can check to see if an integer was entered before processing the input, but I'm stuck on how to make the whole program start over if an integer is not entered. I have a hunch it would involve a loop, but I can't figure out how to make the program start over at "How many mb do you need converted?" if an integer is not entered into scanf..Here is the code I have so far:
Code:
#include <stdio.h> int main () { int b, mb, kb, Byte, kB, mB, gB; char term; }
[code]....
and my program makes the assumption for now at least, that mb will be inputted because that's the unit of measurement that i usually see advertised, and i didn't bother making an if statement to print a conversion in terms of gigabytes because i've never heard of a connection that fast :P