Error 1305 is ERROR_UNKNOWN_REVISION
("The revision level is unknown"), which typically refers to security objects. Indeed, you're passing two SECURITY_ATTRIBUTES
structures (Security1
and Security2
) which have never been initialized.
You need to either pass NULL
instead of &Security1
and &Security2
, or properly initialize the structures.