Solved

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

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Vb.Net Loading Word 11 95
Windows 10 Scheduled Tasks 11 62
SQL to ElasticSearch Query 1 518
GUI: DIalog Stacking and Popping in MS C++ 4 58
zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
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…

763 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

6 Experts available now in Live!

Get 1:1 Help Now