Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2001-06-19
2
Medium Priority
?
4,066 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 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
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…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

971 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