> hello, > > the following code gives me an error in 64 bit: > > > unsigned char pRSTBuffer; > > PHYSICAL_ADDRESS pAddr; > > : > > : > > //some code > > : > > : > > pRSTBuffer = (unsigned char) pAddr.LowPart; > > > Why are you not using pAddr.QuaPart
> error C4312: ‘type cast’ : conversion from ‘ULONG’ to ‘unsigned char *’ of > greater size > > > > How do I fix this code? > > > > Thanks > > > > AP > > > — NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and > other seminars visit: http://www.osr.com/seminars To unsubscribe, visit > the List Server section of OSR Online at > http://www.osronline.com/page.cfm?name=ListServer
error C4312: ‘type cast’ : conversion from ‘ULONG’ to ‘unsigned char
*’ of
greater size
How do I fix this code?
Correct use of UlongToPtr ‘pRSTBuffer = UlongToPtr(pAddr.LowPart)’ will
get rid of the compile error, but if pAddr actually represents a
physical address, your code will still be broken
If it actually is a physical address, you need to map it to a virtual
address before you can do something useful with it. If it’s not actually
a physical address, .LowPart is only a ULONG and is not sufficient to
hold a pointer in 64 bit mode, hence the error.
If you can elaborate on what you are trying to do, you are more likely
to find help…