I have some problems with WinNet APIs. I use help files win32.hlp and sock2.hlp. Everybody can read there for example:
LPTSTR servername,
LPTSTR netname,
DWORD level,
LPBYTE *bufptr

But note that this information is obsolete and if you open svrapi.inc file you read there: NetShareGetInfo PROTO :DWORD, :DWORD, :DWORD, :DWORD, :DWORD, :DWORD because true format of this API is
* char FAR * servername,
* char FAR * netname,
* short level,
* char FAR * buf,
* unsigned short buflen,
* unsigned short FAR *totalavail
); // From BC5 documentation

There are other bugs in documentation so when I try to create a small program using NetShareGetInfo, NetShareAdd and NetShareDelete APIs it will NOT work properly. Can everybody show me example of working program with those APIs ?

Thanks to everybody who help me,
Posted on 2001-11-13 04:58:57 by Mike
This is because nt/2k/xp has a different implementation of NetShareGetInfo
than old, buggy, crappy, unstable, obsolete windows 9x. Here is
what the platformsdk as of august 2001 has to say:

Windows NT/2000/XP: The parameter order is as follows.

LPWSTR servername,
LPWSTR netname,
DWORD level,
LPBYTE *bufptr
Windows 95/98/Me: The calling application must use the cbBuffer parameter to specify the size, in bytes, of the information buffer pointed to by the pbBuffer parameter. If the length of the buffer is not large enough to hold all of the data, the function returns as much as will fit in the buffer. The function returns the total number of bytes of information available in the pcbTotalAvail parameter. The parameter list is as follows.

const char FAR * pszServer,
const char FAR * pszNetName,
short sLevel,
char FAR * pbBuffer,
unsigned short cbBuffer,
unsigned short FAR * pcbTotalAvail

Now, it is a bit weird and sucky that this function is implemented
differently under nt/2k/xp and win9x..
Posted on 2001-11-13 08:09:36 by f0dder