Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


quick question

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
blackmorpheus
Expert Cheater
Reputation: 0

Joined: 05 Apr 2008
Posts: 159

PostPosted: Fri May 08, 2009 12:50 pm    Post subject: quick question Reply with quote

Hey, i made a little program.

this is the function i have,
Code:

char RecvPacket[80];

int WINAPI sendto_t(
   SOCKET s,
   const char *buf,
   int len,
   int flags,
   const struct sockaddr *to,
   int tolen
   ){
      RecvPacket =  *buf;
      if (RecvPacket[2] == 0xFC && RecvPacket[3]==0x01)
      {
         sendFakePlayer(RecvPacket);
      }

      return sendto_o(s, buf, len, flags, to, tolen);
}


the error I get is:

error C2440: '=' : cannot convert from 'const char' to 'char [80]'
at the line RecvPacket = *buf;
how can i solve this problem?
I thought maybe using memcpy but not sure..
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Fri May 08, 2009 3:28 pm    Post subject: Reply with quote

memcpy for sure, or __movsb if you want to use intrinsic functions.

Code:
memcpy((LPVOID)RecvPacket, (LPVOID)buf, len);


Assuming len is the size of the buffer.

_________________
Back to top
View user's profile Send private message
blackmorpheus
Expert Cheater
Reputation: 0

Joined: 05 Apr 2008
Posts: 159

PostPosted: Mon May 11, 2009 1:48 pm    Post subject: Reply with quote

Thanks Lurc.
Well another problem. I want to get the ip and port of my sockaddr* to.
But i dont really know how to get it...

this is how the struct looks like:
Code:

struct sockaddr {
    unsigned short    sa_family;    // address family, AF_xxx
    char              sa_data[14];  // 14 bytes of protocol address
};


can I somehow typecast it to an sockaddr_in and then get it using

Code:
struct sockaddr_in {
    short            sin_family;   // e.g. AF_INET, AF_INET6
    unsigned short   sin_port;     // e.g. htons(3490)
    struct in_addr   sin_addr;     // see struct in_addr, below
    char             sin_zero[8];  // zero this if you want to
};


Help me out please Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites