40. FAQ o Win API

Whether Q> It is possible in 95 to use functions Net * () (NetFileEnum, etc.)? 
A> It is possible. 
Variant 1: we Do in sequence -  

 Item 1 - Is bought a qualitative tambourine. 
 Item 2 - Periodically tapping with a tambourine and bypassing mentioned below 
       Rake we write a program. 

In Win95 you should include a file svrapi.h, instead of lm.h as in NT. 
Also it is necessary to use svrapi.lib and svrapi.dll, instead of netapi32.lib and 
netapi32.dll.Если It would be desirable to support both platforms - прийдется dll 
To load dynamic. 
Attention: in 95 Net * () functions have other semantics in comparison with NT. 
Lines should be in ANSI, not all levels are accessible. Returned structures 
Are various. Memory management variously. 
For NT the pointer address on the buffer is required, 95 it is necessary the pointer on the buffer. 

    //Windows NT 
    BYTE *buf; 
    DWORD prefmaxlen; 
    //... 
    buf = NULL; 
    prefmaxlen = 8192;//or whatever 
    result = NetSomeFunction (..., &buf, prefmaxlen...); 
    //process buffer... 
    NetApiBufferFree (buf); 

    //Windows 9X 
    BYTE *buf; 
    WORD cbBuffer; 
    //... 
    cbBuffer = 8192;//or whatever 
    buf = (BYTE *) malloc (cbBuffer); 
    result = NetSomeFunction (..., buf, cbBuffer...); 
    //process buffer... 
    free (buf); 

Extremely it is recommended to look svrapi.h at a file. 

PS: If it turns out nothing - that or this function generally misses 
    In srvapi.h and dll (it is quite good to look at first), or shook a tambourine a little. 
PPS: Speak still well the pipe from small берцовой helps a bone 
     Virgins - spirits well humours ;-) 

Variant 2: 

From: "Michael L. Stepuchev" <stepuchev@prognoz.ru> 

For Windows 95 there is something of type Administration Kit (lies in WinNT Resource 
Kit). Here there is 2 dll-iny (radmin32.dll and rlocal32.dll), in 
Which are described all functions NT-evoj all or nearly so netapi32.dll. Hадо 
юзать these dll-iny. 

2000 (c) DM