root/experimental/NT-based/NTSpecific/NetShare.hpp

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /******************************************************************************
   2 ** $Header: svn+ssh://jmmcg@svn.code.sf.net/p/libjmmcg/code/trunk/libjmmcg/experimental/NT-based/NTSpecific/NetShare.hpp 2055 2017-05-13 19:35:47Z jmmcg $
   3 ** 
   4 ** Copyright © 2002 by J.M.McGuiness, coder@hussar.me.uk
   5 **
   6 ** This library is free software; you can redistribute it and/or
   7 ** modify it under the terms of the GNU Lesser General Public
   8 ** License as published by the Free Software Foundation; either
   9 ** version 2.1 of the License, or (at your option) any later version.
  10 **
  11 ** This library is distributed in the hope that it will be useful,
  12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14 ** Lesser General Public License for more details.
  15 **
  16 ** You should have received a copy of the GNU Lesser General Public
  17 ** License along with this library; if not, write to the Free Software
  18 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19 */
  20 
  21 #pragma once
  22 
  23 #include "SecurityDescriptor.hpp"
  24 
  25 #include "../../../core/ttypes.hpp"
  26 
  27 // Networking functionality such as browsing.
  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         // Stop any compiler silliness...
  63         __stdcall NetShare(const NetShare &);
  64         NetShare & __fastcall operator=(const NetShare &);
  65 };
  66 
  67 } }

/* [<][>][^][v][top][bottom][index][help] */