Solved

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

Posted on 2001-06-19
2
3,593 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

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 a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
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…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

813 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

17 Experts available now in Live!

Get 1:1 Help Now