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

G

Guest

Guest
Archived from groups: microsoft.public.win2000.group_policy (More info?)

(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
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.group_policy (More info?)

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

Bernard Duggan wrote:
> *(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 * :aaa



--
marll
------------------------------------------------------------------------
Posted via http://www.mcse.ms
------------------------------------------------------------------------
View this thread: http://www.mcse.ms/message1163943.html