All but two of these samples demonstrate Net*() functions, which are not as obsolete as
you might think (or as Microsoft would like them to be).
Are you trying to call Net*() functions on Win9X? Read this first! Afterwards, don't forget to
check out the details (and samples!) here.
Here are a few points to ponder, all for the NT version of the Net*() APIs:
| On Windows NT, all strings that you pass into or get from Net*() functions are
Unicode, no matter what the docs or headers say. This means you may even have to do
some creative casting. |
| If you need to work with domain accounts, use NetGetAnyDCName() to find a domain
controller. Use the returned name as the servername argument (usually the first
arg in any Net*() function). If you need to _set_ information for a domain account, you
must talk to the primary domain controller. You can use NetGetDCName() to get the PDC's
name. |
| Many of the information-returning functions want a void ** or an LPBYTE * .
For these, declare a vanilla pointer and set it to NULL before the call. Don't forget to
use NetApiBufferFree() afterwards: |
BYTE *p;
p = NULL;
Net...( ..., &p, ... );
// process results
if ( p != NULL )
NetApiBufferFree( p );
And now, the samples:
|