Solved

the difference of "CopyMemory", "memcpy", "RtlCopyMemory"

Posted on 2001-06-19
2
3,548 Views
Last Modified: 2013-12-03
As it is..

What are differences of "CopyMemory", "memcpy", "RtlCopyMemory" ?

Which is fastest ?

Which is most stable ?

and so on..

Please , in detail .

Thank you
0
Comment
Question by:can9999
2 Comments
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 6209436
By my expireance, CopyMemory and memcpy are same,
Only 1 difference: CopyMemory -> it is pure Windows
stuff, memcpy -> portable for every c++ compilers.
In fact, CopyMemory realized with help of memcpy!
About RtlCopyMemory: it is simple macro for memcpy
#define RtlCopyMemory(dst, src, len) memcpy(dst, src, len)
See more details in
http://support.microsoft.com/support/kb/articles/Q129/9/47.asp


0
 
LVL 1

Accepted Solution

by:
hakob earned 50 total points
ID: 6209451
They are similar to each other. Look at winnt.h header file (Visual C 6.0). First, it defines RtlCopyMemory() function
simply as memcpy():

#define RtlCopyMemory(Destination,Source,Length)        memcpy((Destination),(Source),(Length))

Then you can find the definition of CopyMemory as:

#define CopyMemory RtlCopyMemory

As soon as the definitions are made at the compilation time, all the functions have the same speed and you can use
any of them.

Of course, the realization can be changed in next versions
of Visual C. So as usually it is recommended to use the API function CopyMemory().





0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now