Article View: borland.public.cppbuilder.nativeapi
Article #10501Re: CopyMemory API problem
From: Bob Gonder
Date: Tue, 13 Apr 2004 02:47
Date: Tue, 13 Apr 2004 02:47
34 lines
2410 bytes
2410 bytes
Martin C wrote:
>> Re-reading the help, I think this line might also be wrong:
>> > CopyMemory(&WriteAddress, &ReadAddress, Granularity); // Error shows
>>
>> More likely to be
>> CopyMemory(WriteAddress, ReadAddress, Granularity);
>
>First of all there is no relation between 0013F584 and the 3 parameters at
>all. I've checked this twice.
Which means you aren't getting the correct values to the Copy.
Check again, but this time, look at _where_ those 3 values are
located. I'm thinking ReadAddress is located at (or very near) that
address. That's a big clue that you are passing the Address of
ReadAddress when it wants the Value of ReadAddress.
> Now When I remove the (&) all I receive is
>compiler error as shown below, as the CopyMemory parameter requires Void,
>and what I am passing is integer.
>
>[C++ Error] Unit1.cpp(120): E2034 Cannot convert 'int' to 'void *'
>[C++ Error] Unit1.cpp(120): E2342 Type mismatch in parameter '__dest'
>(wanted 'void *', got 'int')
WriteAddress and ReadAddress should really be addresses not ints.
char*WriteAddress;
char*ReadAddress;
or void* could work too.
Or, you could override (cast) their types:
CopyMemory((void*)WriteAddress,(void*) ReadAddress, Granularity);
Technical Details
Message-ID:
<qkkm70p57m1qsqpvf7a292e844mm859bg9@4ax.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!newsrout1.ntli.net!news.ntli.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<40786e5f@newsgroups.borland.com> <5v7m701261mpcjc68up9v6m226cd698sq8@4ax.com> <407b397b@newsgroups.borland.com> <4kgm70p9rkijgdp1sopku8vkn46b52cbg3@4ax.com> <407b4eab@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,aeea745eda602570 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2004-04-12 20:09:37 PST From: Bob Gonder <notbg@notmindspring.invalid> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: CopyMemory API problem Date: Mon, 12 Apr 2004 19:47:25 -0700 Organization: MindSpring Enterprises, Inc. Reply-To: notbg@notmindspring.invalid Message-ID: <qkkm70p57m1qsqpvf7a292e844mm859bg9@4ax.com> References: <40786e5f@newsgroups.borland.com> <5v7m701261mpcjc68up9v6m226cd698sq8@4ax.com> <407b397b@newsgroups.borland.com> <4kgm70p9rkijgdp1sopku8vkn46b52cbg3@4ax.com> <407b4eab@newsgroups.borland.com> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 4.228.96.146 X-Trace: newsgroups.borland.com 1081824449 4.228.96.146 (12 Apr 2004 19:47:29 -0800) Lines: 36 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!newsrout1.ntli.net!news.ntli.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail