VirtualCopy()?

VirtualCopy()?

Post by Su,Jiun-Pin » Sat, 04 Mar 2000 04:00:00



Hello, all:
  I work on x86, CE2.11, Maxall.
  I try to code:
--------------------------
LPVOID lpv;
BOOL bRet;
lpv = VirtualAlloc(0, SIZE, MEM_RESERVE, PAGE_NOACCESS);
bRet=VirtualCopy(lpv, (void *)(0x64000000/256), 128*1024,
PAGE_READWRITE | PAGE_PHYSICAL | PAGE_NOCACHE);
----------------------------------
lpv is 0x0a000000
but, bRet =false;

Could you tell me what's wrong with it?
Thank you!

J.P.SU

 
 
 

VirtualCopy()?

Post by Bill » Sat, 04 Mar 2000 04:00:00


The third parameter in the VirtualCopy call should be SIZE (the same as the
2nd parameter in the VirtualAlloc call).  If SIZE # 128*1024, this might
cause the problem that you are seeing.  You could also add GetLastError() to
find out what the error is.

>Hello, all:
>  I work on x86, CE2.11, Maxall.
>  I try to code:
>--------------------------
>LPVOID lpv;
>BOOL bRet;
>lpv = VirtualAlloc(0, SIZE, MEM_RESERVE, PAGE_NOACCESS);
>bRet=VirtualCopy(lpv, (void *)(0x64000000/256), 128*1024,
>PAGE_READWRITE | PAGE_PHYSICAL | PAGE_NOCACHE);
>----------------------------------
>lpv is 0x0a000000
>but, bRet =false;

>Could you tell me what's wrong with it?
>Thank you!

>J.P.SU


 
 
 

VirtualCopy()?

Post by Su,Jiun-Pin » Sun, 05 Mar 2000 04:00:00


   Thank you!
   Another question: why I say the sample of ../common/.. ,
VirtualAlloc(...,PAGE_NOACCESS)
 VirtualCopy(...,PAGE_READWRITE | PAGE_NOCACHE )
---------------------------------------------------------------------------------

but my code will fail, I must use PAGE_PHYSICAL, the codes will work
VirtualCopy(....,PAGE_READWRITE | PAGE_NOCACHE |PAGE_PHYSICAL)


> The third parameter in the VirtualCopy call should be SIZE (the same as the
> 2nd parameter in the VirtualAlloc call).  If SIZE # 128*1024, this might
> cause the problem that you are seeing.  You could also add GetLastError() to
> find out what the error is.


> >Hello, all:
> >  I work on x86, CE2.11, Maxall.
> >  I try to code:
> >--------------------------
> >LPVOID lpv;
> >BOOL bRet;
> >lpv = VirtualAlloc(0, SIZE, MEM_RESERVE, PAGE_NOACCESS);
> >bRet=VirtualCopy(lpv, (void *)(0x64000000/256), 128*1024,
> >PAGE_READWRITE | PAGE_PHYSICAL | PAGE_NOCACHE);
> >----------------------------------
> >lpv is 0x0a000000
> >but, bRet =false;

> >Could you tell me what's wrong with it?
> >Thank you!

> >J.P.SU