• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

C++ Windows - posting to application event log

Explorer ,
Jul 07, 2023 Jul 07, 2023

Copy link to clipboard

Copied

Is there anything special that needs to be done to post to the Windows Applicationevent log? Using some boilerplate code that doesn't get any error, but not seeing anything in the log.

I had to set up the policy.txt file to allow file access and to run an external application, but didn't see anything in the docs about event log access.

TOPICS
Acrobat SDK and JavaScript , Windows

Views

554

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 07, 2023 Jul 07, 2023

Copy link to clipboard

Copied

Actually, I was mistaken; it is getting access denied.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 07, 2023 Jul 07, 2023

Copy link to clipboard

Copied

code below. The handle returned from OpenEventLog is NULL and GetLastError returns 5, which is access denied. 

 
DWORD dwLastError = 0;
int PostToEventLog(string sMessage, bool bErr)
{
    HANDLE hHandle = OpenEventLog(NULL, "Application");
 
    if (NULL != hHandle)
    {
        int eventtype;
        if (bErr)
            eventtype = EVENTLOG_ERROR_TYPE;
        else
            eventtype = EVENTLOG_SUCCESS;
        if (!ReportEvent(hHandle, eventtype, 0, 0, NULL, 1, 0, (LPCTSTR *)sMessage.c_str(), NULL))
        {
            return -1;
        }
CloseEventLog(hHandle);
    }
else
{
dwLastError = GetLastError();
return (int)dwLastError;
}
    return 0;
}
 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 07, 2023 Jul 07, 2023

Copy link to clipboard

Copied

This is an Acrobat Developer forum. Are you running this code from within an Acrobat Plug-in?  

If not, then you are in the wrong place. 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 07, 2023 Jul 07, 2023

Copy link to clipboard

Copied

yes, I am. That's why I mentioned the policy.txt file and that's why I posted in this forum. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 07, 2023 Jul 07, 2023

Copy link to clipboard

Copied

Did you ensure Acrobat is not in Protected Mode?

 

Did you create a broker? Because if you are talking about a policy config for broker whitelist, then the file name is "ProtectedModeWhitelistConfig.txt"

 

https://www.adobe.com/devnet-docs/acrobatetk/tools/AppSec/sandboxprotections.html

 

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 07, 2023 Jul 07, 2023

Copy link to clipboard

Copied

As I said, I have running an EXE and using files working fine using the policy, so I obvioulsy know about that. And the docs I was referring to that make no mention of the event log are exactly what you are pointing to; some information that says nothing about what I am asking.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 07, 2023 Jul 07, 2023

Copy link to clipboard

Copied

Well, you are a bundle of joy 🙂  

You know, in order to provide help, its helpful to know what someone is going on about first. I have no idea what you are doing, what documentation you've looked at, what you've already tried, or where exactly the code you've posted is located. I only know what you've posted, and there isn't a lot of info there. 

Oh, and what EXE are you talking about?  Plug-ins are DLLs with a .api extension? Are you sure you're working on an Acrobat plug-in?

 

 

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 07, 2023 Jul 07, 2023

Copy link to clipboard

Copied

I asked in the Acrobat SDK forum about posting to the event log using C++ in WIndows (in title), mentioned that I am already using the policy file wth success but the docs have nothing about the event log. Sorry if I get a little testy when someoen then asks if I am using the SDK as if I just randomly picked this forum, then tells me about policy and refers me to the docs after I mentioned using it and that the docs said nothing about the event log.

The code posted is run in a plug in pas teh function a string and a boolean as to wether or not it it is an error and it posts to the event log in other applications where it is used. But it fails in Acrobat.

I mentioned using the policy.txt file to give me privileges to run and EXE and access files. The only thing this has to do with this is clarify that i am successfully using the policy.txt file for other uses.

Yes, plug-ins are DLLs with an API extension. If you have to ask that, you are a bit unqualified to be answering questions about the SDK.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 07, 2023 Jul 07, 2023

Copy link to clipboard

Copied

LATEST

Good Luck with all the assumptions! I'm just not very good with reading minds and vague questions. 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines