CopyFile Seems to Not Work in Adobe Acrobat Protected Mode
Hi everyone,
I’m facing an issue while trying to copy an entire document in Adobe Acrobat Protected Mode. The same code works perfectly fine in Non-Protected Mode, but it fails in Protected Mode.
I have already:
Given the right permissions to my working directory.
Whitelisted my entire C drive.
Still, the CopyFile operation doesn't seem to work. I am not sure what I am missing, and I hope someone can point me in the right direction. Here is the relevant code:
AVDoc avDoc = AVAppGetActiveDoc();
PDDoc doc = AVDocGetPDDoc(avDoc);
PDDocSave(doc, PDSaveIncremental, NULL, ASGetDefaultFileSys(), NULL, NULL); // Save first
ASFile f = PDDocGetFile(doc);
ASFileSys fs = ASFileGetFileSys(f);
ASPathName pn = ASFileAcquirePathName(f);
char* fn = ASFileSysDisplayStringFromPath(fs, pn);
char bfn[MAX_PATH + 1], nfn[MAX_PATH + 1];
StringCopy(bfn, sizeof(bfn), fn);
PathRemoveExtension(bfn);
StringCat(bfn, sizeof(bfn), " - Copy");
StringCopy(nfn, sizeof(nfn), bfn);
StringCat(nfn, sizeof(nfn), ".pdf");
for (int i = 2; i < 100; i++) {
if (!PathFileExists(nfn))
break;
StringPrintf(nfn, sizeof(nfn), "%s%d.pdf", bfn, i);
}
if (!CopyFile(fn, nfn, TRUE)) {
MessageBox(NULL, "Error copying file", "Error", MB_OK | MB_ICONERROR);
throw 0;
}
