?
Solved

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

Posted on 2001-06-19
2
Medium Priority
?
3,961 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 100 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
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…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

719 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