PLUGINFUNCTIONEND PLUGINFUNCTIONSHORT(Copy) { int size = 0; HANDLE source, dest; char *str; // Get the string if ((str = system_popstring()) == NULL) return; // Check for size option if (str[0] == '/') { size = (int) myatoi64(str+1); dest = (HANDLE) popint64(); } else dest = (HANDLE) myatoi64(str); source = (HANDLE) popint64(); // Ok, check the size if (size == 0) size = (int) GlobalSize(source); // and the destinantion if ((int) dest == 0) { dest = GlobalAlloc((GPTR), size); system_pushint((int) dest); } // COPY! copymem(dest, source, size); GlobalFree(str); }
PLUGINFUNCTIONEND PLUGINFUNCTIONSHORT(StrAlloc) { int size; if ((size = popint64()) == 0) { system_pushint(0); return; } system_pushint((int) GlobalAlloc(GPTR, size * sizeof(TCHAR))); }
PLUGINFUNCTIONEND PLUGINFUNCTIONSHORT(Free) { GlobalFree((HANDLE) popint64()); }