Click here to Skip to main content
15,894,740 members
Home / Discussions / C#
   

C#

 
GeneralRe: read-only Pin
Anonymous28-Jul-04 12:40
Anonymous28-Jul-04 12:40 
GeneralRe: read-only Pin
Heath Stewart28-Jul-04 12:43
protectorHeath Stewart28-Jul-04 12:43 
GeneralRe: read-only Pin
Anonymous28-Jul-04 12:52
Anonymous28-Jul-04 12:52 
GeneralRe: read-only Pin
Heath Stewart28-Jul-04 12:56
protectorHeath Stewart28-Jul-04 12:56 
GeneralRe: read-only Pin
Anonymous28-Jul-04 13:00
Anonymous28-Jul-04 13:00 
GeneralDynamically adding textbox's Pin
Adam °Wimsatt28-Jul-04 11:35
Adam °Wimsatt28-Jul-04 11:35 
GeneralRe: Dynamically adding textbox's Pin
Nick Parker28-Jul-04 11:39
protectorNick Parker28-Jul-04 11:39 
GeneralHelp with writing to buffers Pin
Winter28-Jul-04 11:11
Winter28-Jul-04 11:11 
Hello all.
I have encountered some difficulties while writing a program that is supposed to use memcpy. To be honest, I can't get it to work at all, and I don't have a clue what I'm doing wrong.

Here's the most important part of the code:
<br />
DllImport("msvcrt.dll")]<br />
public static extern unsafe void memcpy(void* to, void* from, int len);<br />
<br />
[StructLayout(LayoutKind.Explicit)]<br />
private struct Buffer<br />
 {<br />
[FieldOffset(8)]<br />
public byte Buff0;<br />
[FieldOffset(0)]<br />
public int Length;<br />
FieldOffset(4)]<br />
public int Start;<br />
<br />
private static unsafe void CopyToBuffer(Buffer* buffer, byte* data, int len){<br />
if ((( buffer.Length + buffer.Start) + len) >= 262144)<br />
{<br />
throw new NullReferenceException(string.Format("Buffer overflow, or something"));<br />
      }<br />
memcpy(((&buffer.Buff0 + buffer.Start) + buffer.Length), data, len);<br />
buffer.Length += len;<br />
}<br />
}<br />


The errors I get are
"Operator '.' cannot be applied to operand of type Buffer*".
I thought that I declared buffer.Lenght as int, so why isn't it working?

I call CopyToBuffer like:
<br />
buffx = p.Finalize(); //p, being a packet<br />
unsafe {<br />
fixed (byte* buff= buffer1)<br />
{<br />
CopyToBuffer(m_Buffy, buff, buffx.Length);<br />
}<br />
}<br />
return;<br />

m_Buffy is declared as
<br />
private unsafe static Buffer* m_Buffy;<br />

and gets its value on runtime (the address of the recieve buffer).

It's a pretty simple thing, really. I just want to send a text message to a process through its recieve buffer. Smile | :)
I'm a little new to all of this, so I haven't yet fully gotten then hang of API hooking, dll injection and packet filtering and all that which migth have aided me here, but I do my best.

Any response is deeply appreciated. Rose | [Rose]
GeneralRe: Help with writing to buffers Pin
Daniel Turini28-Jul-04 11:29
Daniel Turini28-Jul-04 11:29 
GeneralHelp Required. Pin
Nasir Wasim28-Jul-04 9:45
Nasir Wasim28-Jul-04 9:45 
GeneralRe: Help Required. Pin
Nick Parker28-Jul-04 10:00
protectorNick Parker28-Jul-04 10:00 
QuestionHow do I create a dynamic webservice client in C# Pin
JM9328-Jul-04 9:41
JM9328-Jul-04 9:41 
AnswerRe: How do I create a dynamic webservice client in C# Pin
Nick Parker28-Jul-04 9:56
protectorNick Parker28-Jul-04 9:56 
GeneralRe: How do I create a dynamic webservice client in C# Pin
JM9329-Jul-04 8:00
JM9329-Jul-04 8:00 
GeneralRe: How do I create a dynamic webservice client in C# Pin
Nick Parker29-Jul-04 8:45
protectorNick Parker29-Jul-04 8:45 
GeneralWMI Windows Service Pin
silverbullet28-Jul-04 9:12
silverbullet28-Jul-04 9:12 
GeneralRe: WMI Windows Service Pin
Heath Stewart28-Jul-04 10:10
protectorHeath Stewart28-Jul-04 10:10 
QuestionHow do I disconnect my crystal report from it's datasource Pin
kornstyle28-Jul-04 8:24
kornstyle28-Jul-04 8:24 
AnswerRe: How do I disconnect my crystal report from it's datasource Pin
Heath Stewart28-Jul-04 8:50
protectorHeath Stewart28-Jul-04 8:50 
Generallogg/scan open windows Pin
pat27088128-Jul-04 6:25
pat27088128-Jul-04 6:25 
GeneralRe: logg/scan open windows Pin
pat27088128-Jul-04 6:55
pat27088128-Jul-04 6:55 
GeneralRe: logg/scan open windows Pin
Heath Stewart28-Jul-04 7:04
protectorHeath Stewart28-Jul-04 7:04 
GeneralRe: logg/scan open windows Pin
pat27088128-Jul-04 7:41
pat27088128-Jul-04 7:41 
GeneralRe: logg/scan open windows Pin
Nick Parker28-Jul-04 8:11
protectorNick Parker28-Jul-04 8:11 
GeneralRe: logg/scan open windows Pin
pat27088128-Jul-04 8:23
pat27088128-Jul-04 8:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.