When WIN64EXCEPTIONS is defined, fields pCurrentContextPointers,
pCallerContextPointers, pCurrentContext and pCallerContext of the
REGDISPLAY are used. So we need to fix their values after coping.
Commit migrated from https://github.com/dotnet/coreclr/commit/
2eed20ce511fa25085742d4aaffc29a3939e84dd
void CopyREGDISPLAY(REGDISPLAY* pDst, REGDISPLAY* pSrc)
{
*pDst = *pSrc;
+
+#ifdef WIN64EXCEPTIONS
+ if (pSrc->pCurrentContextPointers == &(pSrc->ctxPtrsOne))
+ {
+ pDst->pCurrentContextPointers = &(pDst->ctxPtrsOne);
+ pDst->pCallerContextPointers = &(pDst->ctxPtrsTwo);
+ }
+ else
+ {
+ pDst->pCurrentContextPointers = &(pDst->ctxPtrsTwo);
+ pDst->pCallerContextPointers = &(pDst->ctxPtrsOne);
+ }
+
+ if (pSrc->pCurrentContext == &(pSrc->ctxOne))
+ {
+ pDst->pCurrentContext = &(pDst->ctxOne);
+ pDst->pCallerContext = &(pDst->ctxTwo);
+ }
+ else
+ {
+ pDst->pCurrentContext = &(pDst->ctxTwo);
+ pDst->pCallerContext = &(pDst->ctxOne);
+ }
+#endif
}