|
-
August 19th, 2009, 03:14 PM
#1
[RESOLVED] EnumPorts error
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
-
August 21st, 2009, 01:28 PM
#2
Re: EnumPorts error
Solved. Turns out I called EnumPorts() when we still had teh spooler turned off. Changed the call to after we restart the spooler and worked great.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|