1

Please see this minimal example of my interface definition.

The .idl file:

#pragma once

import "oaidl.idl";

#define RC_INVOKED 1

#include <CertSrv.h>

[
    object,
    uuid(A9A5951C-B9C3-45DA-94AA-7959959AA5C3),
    helpstring("My minimal example Interface"),
    local
]
interface IMinimalExample : IUnknown
{
    HRESULT Initialize();
};

This does not compile as long as CertSrv.h is included. As soon as I remove the include, it compiles just fine.

I am using midl.exe from the Windows 10 SDK (10.0.18362). The project is set to use the latest found Windows 10 SDK and platform toolset v142. I also confirmed that in fact the latest version of midl.exe is used.

The compiler errors:

MIDL2025 syntax error : expecting a declarator or * near "handle_t" C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\shared\rpcdce.h 74

MIDL2025 syntax error : expecting ; or , near "handle_t" C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\shared\rpcdce.h 74

MIDL2025 syntax error : expecting a type specification near "LPOVERLAPPED" C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\shared\rpcasync.h 121

I added #define RC_INVOKED 1 to get rid of other related errors (related to INT, _LARGE_INTEGER, and others in winnt.h).

Has anyone encountered this before and can point me in the right direction?

Exa
  • 4,020
  • 7
  • 43
  • 60
  • Well, `CertSrv.h` is in C language, and IDL is not C; you can't include arbitrary headers in an IDL file and expect it to compile. Why do you feel the need to include `CertSrv.h`? What's the ultimate problem you are trying to solve? – Igor Tandetnik Feb 20 '20 at 15:36
  • Writing an NDES Policy Module (handing out certificates). – Exa Feb 20 '20 at 15:45
  • How would including `CertSrv.h` help with this lofty goal? You probably want to import `certpol.idl` – Igor Tandetnik Feb 20 '20 at 17:20

0 Answers0