Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
2.6 KiB

  1. //
  2. // Sharing.h
  3. //
  4. // Utility functions to help with file and printer sharing.
  5. //
  6. #pragma once
  7. #include "mysvrapi.h"
  8. // Flags defining access to shared resources
  9. #define NETACCESS_NONE 0
  10. #define NETACCESS_READONLY 1
  11. #define NETACCESS_FULL 2
  12. #define NETACCESS_DEPENDSON (NETACCESS_READONLY | NETACCESS_FULL)
  13. #define NETACCESS_MASK (NETACCESS_READONLY | NETACCESS_FULL)
  14. #define NETFLAGS_PERSIST 0x0100 // share lasts past a reboot
  15. #define NETFLAGS_SYSTEM 0x0200 // share is not visible to users
  16. #define DRIVESHARE_SOME 1
  17. #define DRIVESHARE_ALL 2
  18. #define SHARE_NAME_LENGTH 12 // same as LM20_NNLEN from lmcons.h
  19. #define SHARE_PASSWORD_LENGTH 8 // same as SHPWLEN from svrapi.h
  20. #include <pshpack1.h>
  21. // Note: this struct is identical to SHARE_INFO_502
  22. typedef struct _SHARE_INFO
  23. {
  24. LPWSTR szShareName; //shi502_netname;
  25. DWORD bShareType; //shi502_type;
  26. LPWSTR shi502_remark;
  27. DWORD uFlags; //shi502_permissions;
  28. DWORD shi502_max_uses;
  29. DWORD shi502_current_uses;
  30. LPWSTR pszPath; //shi502_path;
  31. LPWSTR shi502_passwd;
  32. DWORD shi502_reserved;
  33. PSECURITY_DESCRIPTOR shi502_security_descriptor;
  34. } SHARE_INFO;
  35. #include <poppack.h>
  36. int EnumLocalShares(SHARE_INFO** pprgShares);
  37. int EnumSharedDrives(LPBYTE pbDriveArray, int cShares, const SHARE_INFO* prgShares);
  38. int EnumSharedDrives(LPBYTE pbDriveArray);
  39. BOOL ShareFolder(LPCTSTR pszPath, LPCTSTR pszShareName, DWORD dwAccess, LPCTSTR pszReadOnlyPassword = NULL, LPCTSTR pszFullAccessPassword = NULL);
  40. BOOL UnshareFolder(LPCTSTR pszPath);
  41. BOOL IsFolderSharedEx(LPCTSTR pszPath, BOOL bDetectHidden, BOOL bPrinter, int cShares, const SHARE_INFO* prgShares);
  42. BOOL IsFolderShared(LPCTSTR pszPath, BOOL bDetectHidden = FALSE);
  43. BOOL ShareNameFromPath(LPCTSTR pszPath, LPTSTR pszShareName, UINT cchShareName);
  44. BOOL IsVisibleFolderShare(const SHARE_INFO* pShare);
  45. BOOL IsShareNameInUse(LPCTSTR pszShareName);
  46. void MakeSharePersistent(LPCTSTR pszShareName);
  47. BOOL SetShareInfo502(LPCTSTR pszShareName, SHARE_INFO_502* pShare);
  48. BOOL GetShareInfo502(LPCTSTR pszShareName, SHARE_INFO_502** ppShare);
  49. BOOL SharePrinter(LPCTSTR pszPrinterName, LPCTSTR pszShareName, LPCTSTR pszPassword = NULL);
  50. BOOL IsPrinterShared(LPCTSTR pszPrinterName);
  51. BOOL SetSharePassword(LPCTSTR pszShareName, LPCTSTR pszReadOnlyPassword, LPCTSTR pszFullAccessPassword);
  52. BOOL GetSharePassword(LPCTSTR pszShareName, LPTSTR pszReadOnlyPassword, DWORD cchRO, LPTSTR pszFullAccessPassword, DWORD cchFA);