I did a search and couldn't find any help. I am calling EnumPorts to get a list of network printers installed on the computer. When I call EnumPorts the first time (to find the buffer size) it returns 0 (fails) and GetLastError() gives : 1722 (RPC server is unavailable). Has anyone seen this before?

I call EnumPorts in the install, but when I call the uninstall it gives this error.

Further info: this is in a driver and being built with WDK 7100

Code:
   DWORD needed(0);
   DWORD returned(0);
   DWORD status = ERROR_SUCCESS;
   DWORD err;
   SetLastError(ERROR_SUCCESS);

   BOOL brc = EnumPorts(NULL, 1, NULL, 0, &needed, &returned);
   err = GetLastError();//err = 1722 at this point
   PORT_INFO_1* port_into_1s = (PORT_INFO_1*) new BYTE[needed];
   brc = EnumPorts(NULL, 1, (PBYTE) port_into_1s, needed, &needed, &returned);
   err = GetLastError();  err = 1722 at this point