[?] RtlMoveMemory: file not found |
Author: |
Message: |
SmokingCookie
Senior Member
Posts: 815 Reputation: 15
30 / /
Joined: Jul 2007
|
O.P. [?] RtlMoveMemory: file not found
Hi folks,
I'm trying to move a string from pointer A to B. The debugger states that an exception has occurred while executing RtlMoveMemory, without any specific information. Interop.GetLastError() returns 2, which means a specified file is not found. I don't see what files have to do with moving memory data.
Can anyone help me on this one?
|
|
03-24-2009 06:46 PM |
|
|
Mnjul
forum super mod
plz wub me
Posts: 5396 Reputation: 58
– / /
Joined: Nov 2002
Status: Away
|
RE: [?] RtlMoveMemory: file not found
Care to paste full code? (including the GetLastError part)
This post was edited on 03-24-2009 at 07:07 PM by Mnjul.
|
|
03-24-2009 07:05 PM |
|
|
matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
Joined: Dec 2002
Status: Away
|
RE: [?] RtlMoveMemory: file not found
js code: var ptrA = Interop.Allocate(4);
var s = 'this is some text';
var ptrA_string = Interop.Allocate(2*s.length+2)
ptrA_string.WriteString(0, s);
ptrA.WriteDWORD(0, ptrA_string.DataPtr);
var ptrB = Interop.Allocate(4);
Interop.Call('kernel32', 'RtlMoveMemory', ptrB, ptrA, 4);
Debug.Trace(ptrB.ReadString(0));
This post was edited on 03-24-2009 at 08:07 PM by matty.
|
|
03-24-2009 07:29 PM |
|
|
SmokingCookie
Senior Member
Posts: 815 Reputation: 15
30 / /
Joined: Jul 2007
|
O.P. RE: [?] RtlMoveMemory: file not found
JScript code: var PagePtr = lParam;
if(PagePtr === 0) {
Internet(Script.WebURL);
return API_SUCCESS;
}
var Size = lParam;
var oPage = Interop.Allocate(Size);
Interop.Call("Kernel32.dll","RtlMoveMemory",oPage.DataPtr,PagePtr,Size);
TraceWin32Error();
|
|
03-24-2009 07:50 PM |
|
|
Mnjul
forum super mod
plz wub me
Posts: 5396 Reputation: 58
– / /
Joined: Nov 2002
Status: Away
|
RE: [?] RtlMoveMemory: file not found
Well, you're taking lParam for PagePtr's use and Size's use, I guess one should be wParam.
And matty, a 4-byte DataBloc can not hold "this is some text", which is a couple dozen bytes.
|
|
03-24-2009 07:53 PM |
|
|
SmokingCookie
Senior Member
Posts: 815 Reputation: 15
30 / /
Joined: Jul 2007
|
O.P. RE: [?] RtlMoveMemory: file not found
well, that's another stupid one
Thanks anyway
|
|
03-24-2009 07:57 PM |
|
|
matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
Joined: Dec 2002
Status: Away
|
RE: [?] RtlMoveMemory: file not found
quote: Originally posted by Mnjul
And matty, a 4-byte DataBloc can not hold "this is some text", which is a couple dozen bytes.
I thought I made a booboo and changed it hence the
quote: Originally posted by matty
This post was edited Today at 02:30 PM by matty.
|
|
03-24-2009 08:06 PM |
|
|
TheSteve
Full Member
The Man from Japan
Posts: 179 Reputation: 23
40 / /
Joined: Aug 2005
|
RE: [?] RtlMoveMemory: file not found
Is there a reason that you're using RtlMoveMemory rather than RtlCopyMemory?
If the two buffers don't overlap (which they don't) you should not be using RtlMoveMemory.
|
|
03-25-2009 12:38 AM |
|
|
matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
Joined: Dec 2002
Status: Away
|
RE: [?] RtlMoveMemory: file not found
quote: Originally posted by TheSteve
Is there a reason that you're using RtlMoveMemory rather than RtlCopyMemory?
If the two buffers don't overlap (which they don't) you should not be using RtlMoveMemory.
I didn't realize that API existed... learned something new today.
|
|
03-25-2009 10:48 AM |
|
|
SmokingCookie
Senior Member
Posts: 815 Reputation: 15
30 / /
Joined: Jul 2007
|
O.P. RE: [?] RtlMoveMemory: file not found
There is.
I use this system for communication between two different scripts. RtlCopyMemory would mean lots of extra memory management to prevent leaks. Let me put it this way:
Script A sends a pointer to script B. Script B is now responsible for handling that pointer, to relieve script A (the contents of the pointer will most likely be stored in a variable). Script B then destroys the pointer (allocated by the Interop object) when it's no longer needed.
Using RtlCopyMemory would mean extra work for script A.
|
|
03-25-2009 06:24 PM |
|
|
Pages: (2):
« First
[ 1 ]
2
»
Last »
|
|