CreateFile Access denied for portmonitor

I am developing a portmonitor. I am using createfile to open a handle to a driver we have.

Handle = CreateFile ( deviceInterfaceDetailData->DevicePath,
GENERIC_READ | GENERIC_WRITE,
0,
NULL, // no SECURITY_ATTRIBUTES structure
OPEN_EXISTING, // No special create flags
FILE_FLAG_OVERLAPPED, // No special attributes
NULL);

I am getting ERROR_ACCESS_DENIED when I try to open the driver.
The interesting observation is that if i give a print the portmonitor calls a createfile fails with error code 5. On restarting the spooler with out cancelling the queued print job, it prints. But if I try to print again it gives the same error code.

Since portmonitor is a dll which loads into spooler service it should have administrative privileges.

Somebody please help me with some suggestions

When createfile is called between RevertToPrinterSelf();ImpersonatePrinterClient(hToken); it works.