Ok Im New To C++ But Im Making A Code That Should Hopefuly Make Me Able To Write Into A Program's Memory

I Get These Error's

error C2059: syntax error : '.'
error C2447: '{' : missing function header (old-style formal list?)

My Code Is

.void WriteMem(DWORD MemOffset, DWORD DataPtr, DWORD dataLen) ;{
 DWORD OldProt;
 VirtualProtect((void*) MemOffset, dataLen, PAGE_EXECUTE_READWRITE, &OldProt);
 RtlMoveMemory((void*)  MemOffset, (const void*)  DataPtr, dataLen);
 VirtualProtect((void*) MemOffset, dataLen, OldProt, &OldProt);
}

If Anyone Can Help, It Would Be Great!

Recommended Answers

All 22 Replies

>>.void WriteMem(DWORD MemOffset, DWORD DataPtr, DWORD dataLen) ;{

remove the period and the semicolon. neither belong there.

Same Error's Just Fractionaly Diffrent

Heres My Code

>>.void WriteMem(DWORD MemOffset, DWORD DataPtr, DWORD dataLen) ;{
 DWORD OldProt;
 VirtualProtect((void*) MemOffset, dataLen, PAGE_EXECUTE_READWRITE, &OldProt);
 RtlMoveMemory((void*)  MemOffset, (const void*)  DataPtr, dataLen);
 VirtualProtect((void*) MemOffset, dataLen, OldProt, &OldProt);
}

Here's The Error's

Error C2059: syntax error : '>>'
Error C2447: '{' : missing function header (old-style formal list?)

Thx For Helping Thogh, But I Still Need More (When I Say Im New To C++ I Mean Im New)

Did you even bother to read my post? I told you how to correct those errors. Re-read and pay more attention this time.

when I posted >> I was quoting your code -- its not meant for you to add >> to your code and compile it.

>>When I Say Im New To C++ I Mean Im New

If you are that new then you are attempting to do something that is wayyyyy over your head. Buy an Introduction to C or C++ book and start studying from page 1. Jumping into the middle like that will do little more than confuse you.

that takes time and money the ony thing i didnt understand was words...

period and semicolon

-.- I Cant Help A Habbit I Have

that takes time and money the ony thing i didnt understand was words...

period and semicolon

If you are not ready to spend time and money to educate yourself, why should we spend ours trying to educate you?

-.- I Cant Help A Habbit I Have

When you are adviced for your own good, be humble and try to correct it. Excuses and arrogance will not help you here. Arrogance will be tolerated once you start contributing to the community, but until that you are a newbie, so start acting like one.

Judging from your previous two posts, I see that you are way out of line and your attitude will be harmful to this community. Let this serve as a first warning.

Err... in a less hostile way.

To gunner64

Please try to understand that all the people out here help others voluntarily, there is as such no bonding on us. We take out our time to see that the newcomers dont face the difficulties which many of us have faced.

So by just showing a little bit of patience, effort in writing code and respect to the senior members you can get from this community much more than you expected.

Hope you understand that and by the way welcome to DaniWeb.

the ony thing i didnt understand was words...

period and semicolon

Is English your firse language, or a foreign language to you? If you took English in grade school (grades K - 8) your teacher probably introduced you to writing sentences, and you should have been taught what a period and semicolon look like. My 5-year-old grandaughter already knows that much:eek:

A period looks like these characters

...........

and a semicolon is this thing

;;;;;;;;;;;;;;;;;;;;;;;

now, just delete both those two characters from your original post and I said before.

Ok Thank You (Atleast Someone Is Kind Enough To Help Me, I Would Rather Spend Money On Him Than A Book. And How Can A Habbit On Capital Letters Give Me A Warning...

You Just Post Usless Stuff And Giving Me Warning's For Hopless Things.. Gosh How Lame People.

Thx Again For Your Help But Now I Get 3 More Error's.....

BTW Im English I Dont Use Those Words For Those Sigh's In English Here.

commented: You're an illiterate leet speaking wannabe +0

> BTW Im English I Dont Use Those Words For Those Sigh's In English Here.

Really? What words do you use? I have never heard them referred to by any other name.

> that takes time and money the ony thing i didnt understand was words...

You do know how to do an internet search right? Try typing "define: semicolon" into google

> Thx Again For Your Help But Now I Get 3 More Error's.....

That's too bad.

>>And How Can A Habbit On Capital Letters Give Me A Warning...

Don't try that with the code you attempt to compile -- your compiler will complain bitterly if you capitalize when you should not.

Capatalizing every word is annoying, not cute, and just shows lack of intelligence. If you are under age 10 then you should be reading commic books or out doors playing softball.


>>BTW Im English I Dont Use Those Words For Those Sigh's In English Here.
what do you call them?

>>But Now I Get 3 More Error's.....

post code and a few of the errrors you are getting

We Call '.' A Fullstop And I Forgot The Other One xD

Ok Heres The Error's I Get

error C2059: syntax error : '>>'
error C2143: syntax error : missing ';' before '{'
error C2447: '{' : missing function header (old-style formal list?)

And Heres My Code

>>void patch_(PVOID address, int type, int bytes){
   DWORD d, ds;
   VirtualProtect(address, bytes, PAGE_EXECUTE_READWRITE, &d);
   memset(address, type, bytes);
   VirtualProtect(address,bytes,d,&ds);
}

Well, if you are going to ignore what we tell you is wrong with your program then I am going to stop trying to help you. You didn't change a thing. :mad:

I Changed This...

Original
.void WriteMem(DWORD MemOffset, DWORD DataPtr, DWORD dataLen) ;{

New
>>void WriteMem(DWORD MemOffset, DWORD DataPtr, DWORD dataLen) {

Or Do You Mean Delete All The . And ; In The Code...

Or Do You Mean Delete All The . And ; In The Code...

No.

also delete >>

void WriteMem(DWORD MemOffset, DWORD DataPtr, DWORD dataLen) {

More Error's........

C2065: 'DWORD' : undeclared identifier
C2146: syntax error : missing ')' before identifier 'MemOffset'
C2182: 'WriteMem' : illegal use of type 'void'
C2059: syntax error : ')'
C2143: syntax error : missing ';' before '{'
C2447: '{' : missing function header (old-style formal list?)

And My Code Is

void WriteMem(DWORD MemOffset, DWORD DataPtr, DWORD dataLen) {
   DWORD d, ds;
   VirtualProtect(address, bytes, PAGE_EXECUTE_READWRITE, &d);
   memset(address, type, bytes);
   VirtualProtect(address,bytes,d,&ds);
}

I Hate These Error's If Only I Could Thank Dragon In Another Way Than Saying Thank You

DWORD as well as other win32 api functions are declared in windows.h, so just add that to the top of your program and it should compile

#include <windows.h>
// other code goes here

Ok I Have One Last Error!

fatal error C1083: Cannot open include file: 'windows.h':

I Think I Know How To Solve Thogh ;)
O Need SDK

what compiler are you using?

Windows Visual C++ 2005

BTW I Though I Had The Correct Idea But I Dont I Get

error C1083: Cannot open include file: 'windows.h'

Error...

Learn how to post questions if you want to receive answers. A template:

Hi, this all of my code.

/*... */

This code gives me the following errors:

errors

Piece parts and what not exacerbate things.

Especially This Annoying Typing Convention.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.