WLH handle
handle
Local memory handle of memory object to convert.
To convert a local memory handle to a pointer, use the Dereference Local Handle (WLH) command. WLH converts a local memory handle into a near or a far pointer. Use WGH to convert global memory handles.
The WDG and WDL commands convert the handle into a pointer and display the value of the pointer in segment:offset format. You can then use that value to access the memory.
In a Windows program, the LocalLock function is used to convert memory handles into near or far pointers. You may know the handle of the memory object, but you might not know what near or far address it refers to unless you are debugging in an area where the program has just called LocalLock.
You use the WLH command to find out at any time what the pointer addresses are for local memory handles.
The following example uses WLH to refer to an array during a debugging session. First, the following code sets up the array:
{
HANDLE hLocalMem;
int near * pnArray;
hLocalMem = LocalAlloc( LMEM_MOVEABLE, 100 );
pnArray = LocalLock( hLocalMem );
/* load values into the array */
LocalUnlock( hLocalMem );
. . .
Now, after setting a breakpoint immediately after the call to LocalLock, the following command displays the array location:
>mdw pnArray
Outside of this fragment, though, you cannot rely on the value of the pnArray variable since the actual data in the memory object may move. Therefore, use the following sequence to display the correct array location:
>wlh hLocalMem
0192:100A
>mdw 0192:100A