|
-
May 6th, 1999, 07:52 AM
#1
Lan Manager connection problem
Hi!
I'm writing a code to share my directory through netwrok.
But following code does not work.
Any idea will be appreciated.
** codes **
#include <windows.h>
#include <winuser.h>
#include <winbase.h>
#include <winnetwk.h>
#include <windef.h>
#include <lmcons.h>
#include <lmshare.h>
#include <lmaccess.h>
#include <lmerr.h>
#include <tchar.h>
#include <stdio.h>
#include <string.h>
int ShareResource(char *pszResourceName, char *pszPath)
{
SHARE_INFO_2 si2Rec;
DWORD ret;
char szBuff[1024];
si2Rec.shi2_netname = pszResourceName;
si2Rec.shi2_type = STYPE_DISKTREE;
si2Rec.shi2_remark = NULL;
si2Rec.shi2_permissions = ACCESS_ALL;
si2Rec.shi2_max_uses = -1;
si2Rec.shi2_current_uses = 0;
si2Rec.shi2_path = pszPath;
si2Rec.shi2_passwd = NULL;
ret = NetShareAdd(NULL, 2, LPBYTE(&si2Rec), NULL);
if (ret == NERR_Success) return 0;
FormatMessage(
FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
ret,
GetUserDefaultLangID(),
szBuff,
sizeof(szBuff),
NULL);
MessagePrint("Sharing failed (Error: %d) : %s", ret, szBuff);
return -1;
}
-
June 22nd, 1999, 01:44 AM
#2
Re: Lan Manager connection problem
If you are trying this in W95 or W98, No wonder you have a problem! The files you are using is for NT only!
In W95use the svrapi.h and link with svrapi.lib. This is not as simple as it sounds! The dokumentation is not compatible between the two (though MS may think otherwise!). Examine the header for the correct prototypes (there are some comments in it to help you out!). If your problem isn't W95 related....boy i've just wasted some time!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|