1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 #pragma once
22
23 #include "SecurityDescriptor.hpp"
24
25 #include "../../../core/ttypes.hpp"
26
27
28 #include<lm.h>
29
30 namespace jmmcg { namespace NTUtils {
31
32
33
34 const tchar server_info_9X_lib_name[]=_T("svrapi.dll");
35 const tchar dir_separator=_T('\\');
36
37
38
39 class AFX_EXT_CLASS NetShare : virtual protected LoadLibraryWrapper
40 {
41 public:
42 __stdcall NetShare(void);
43 __stdcall NetShare(const jmmcg::tstring &DirectoryToShare,const TCHAR * const Sharename,const TCHAR * const description,const TCHAR * const Server,const DWORD max_connections,SECURITY_DESCRIPTOR *sd,const DWORD share_perms);
44 __stdcall NetShare(const jmmcg::tstring &DirectoryToShare,const TCHAR * const Sharename,const TCHAR * const description,const TCHAR * const Username,const TCHAR * const Server,const DWORD access_mask,const DWORD max_connections,const DWORD share_perms);
45 __stdcall ~NetShare(void);
46
47 bool __fastcall Create(const jmmcg::tstring &DirectoryToShare,const TCHAR * const Sharename,const TCHAR * const description,const TCHAR * const Server,const DWORD max_connections,const SECURITY_DESCRIPTOR * const sd,const DWORD share_perms);
48 bool __fastcall Create(const jmmcg::tstring &DirectoryToShare,const TCHAR * const Sharename,const TCHAR * const description,const TCHAR * const Username,const TCHAR * const Server,const DWORD access_mask,const DWORD max_connections,const DWORD share_perms);
49 bool __fastcall Delete(void);
50
51 private:
52 typedef NET_API_STATUS (NET_API_FUNCTION * const NetShareAddType)(IN LPCWSTR servername,IN DWORD level,IN LPBYTE buf,OUT LPDWORD parm_err);
53 typedef NET_API_STATUS (NET_API_FUNCTION * const NetShareDelType)(IN LPCWSTR servername,IN LPCWSTR netname,IN DWORD reserved);
54
55 const NetShareAddType pNetShareAdd;
56 const NetShareDelType pNetShareDel;
57
58 std::wstring machine_w,sharename_w;
59 bool deleted;
60 SecurityDescriptor sd;
61
62
63 __stdcall NetShare(const NetShare &);
64 NetShare & __fastcall operator=(const NetShare &);
65 };
66
67 } }