GetGPOList() seems to break when used with multi-threaded COM

B

Bernard Duggan

(Apologies - I posted this to the AD group before I noticed there was a GP group)

Hi all,
We're having an interesting issue with the GetGPOList() function.
Our basic little test app (which just registers a GPO watcher and
dumps GetGPOList() output to the console) works fine. When we go to
use it in our application, however, it returns FALSE, and
GetLastError() returns 262 (an error code that I can't for the life of
me find mentioned anywhere).
I've tracked the problem down to a call we make to
CoInitializeEx(NULL, COINIT_MULTITHREADED);
If I change this call to just
CoInitialize(NULL);
(which if I read the docs right, uses a single-threaded model)
everything starts working fine (except that it breaks the rest of our
product, so I'd rather not have to resort to that).
Any ideas? The GetGPOList() et al documentation doesn't seem to
contain any mention of problems with COM or its threading models.
Obviously the other option is to break this out into a separate
executable, but again, it's something I'd rather avoid if possible.

Cheers,

Bernard
 
M

marll

Humm, I'm interested in any sample code using GPO, write me at mwiseman1
at hushmail dot com.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top