Page 1 of 1

NetGetDCName_

Posted: Tue Oct 26, 2010 6:32 pm
by blackborg
I feel like this should be easy.. but...

How can I read the name of the Domain Controller that's returned...

I get a result code that says the function succeeded..

Code: Select all

    mydc.s = Space(255)
    
    rc.l = NetGetDCName_(0,0,@mydc)
       
    PrintN("Did I get my DC? " + Str(rc))

but I have had no luck reading the name of the server from @mydc.. not with peekS, uni2ansi.. etc..

The program is compiled Unicode on PB 4.50

Re: NetGetDCName_

Posted: Tue Oct 26, 2010 6:46 pm
by srod
Get rid of mydc.s = Space(255) because you want mydc to be an integer variable.

Use PeekS(mydc...) rather than PeekS(@mydc...)

Re: NetGetDCName_

Posted: Tue Oct 26, 2010 7:19 pm
by blackborg
Thanks much.. the part I missed was the api expects a pointer to a pointer..

It works great now..

Re: NetGetDCName_

Posted: Tue Oct 26, 2010 7:44 pm
by srod
Don't forget to use NetApiBufferFree_() when you are done with the buffer.