title: Error 1314 when I call AuthzRegisterSecurityEventSource() in Windows 2008 but works in Windows 2003
body: <p>New to windows programming here, and I am looking at code that was written for Windows Server 2003 that fails with Windows Server 2008.</p>
  
  <p>The code essentially does the following:</p>
  
  <p>Calls LookupPrivilageValue(NULL, _T("SeAuditPrivelage"), &amp;luidSeAudit)); to get the LUID struct.</p>
  
  <p>Please note, I check the return code of every API call to make sure no problems are encountered.</p>
  
  <p>It then adjusts the TOKEN_PRIVELAGES:</p>
  
  <pre><code>OpenProcessToken(...);
  TOKEN_PRIVILEGES tp;
  tp.PrivilegeCount = 1;
  tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
  tp.Privileges[0].Luid = luidSeAudit;
  
  AjustTokenPrivelages(tokenHandle, FALSE, &amp;tp, 0, NULL, NULL);
  CloseHandle(tokenHandle);
  
  
  GetModuleFileName(NULL, pBuf, 260);
  strPath = pBuf;
  iRet = strPath.ReverseFind('\\');
  strPath = strPath.Left(iRet);
  CString strName = strPath;
  strName += _T("\\");
  strName += _T("MyTool.exe");
  _tcscpy_s(pBuf, 260, strName);
  
  AUTHZ_SOURCE_SCHEMA_REGISTRATION ar;
  memset(&amp;ar, 0, sizeof(ar));
  ar.dwFlags = AUTHZ_ALLOW_MULTIPLE_SOURCE_INSTANCES;
  ar.szEventSourceName = _T("MySim");
  ar.szEventMessageFile = pBuf;
  ar.szEventSourceXmlSchemaFile = NULL;
  ar.szEventAccessStringsFile = pBuf;
  ar.szExecutableImagePath = NULL;
  </code></pre>
  
  <p>Then I call</p>
  
  <pre><code>AuthzInstallSecurityEventSource(0, &amp;ar);  
  </code></pre>
  
  <p>No errors here either.</p>
  
  <p>However, when I call:</p>
  
  <pre><code>if (!AuthzRegisterSecurityEventSource(0, _T("MySim"), &amp;m_secEvProv)) {
      ....GetLastError()...;
      return Error;
  }
  </code></pre>
  
  <p>Note that m_secEvProv is of type: AUTHZ_SECURITY_EVENT_PROVIDER_HANDLE.</p>
  
  <p>I get error 1314: </p>
  
  <p>ERROR_PRIVILEGE_NOT_HELD
  1314 (0x522)
  A required privilege is not held by the client.</p>
  
  <p>So to that end, what additional steps do I need to take to acquire such privilege in 2008?</p>
  
  <p>Thank you</p>