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.

114 lines
3.6 KiB

  1. #include <windows.h>
  2. #include <windowsx.h>
  3. #include <shellapi.h>
  4. #include <lm.h>
  5. #include <msshrui.h>
  6. extern "C"
  7. {
  8. #include <icanon.h> // NetpNameValidate
  9. }
  10. #include <sddl.h> // ConvertSidToStringSid, ConvertStringSecurityDescriptorToSecurityDescriptor
  11. #include <messages.h>
  12. #include <shlobj.h>
  13. #include <shlobjp.h> // SHObjectProperties
  14. #include <shlwapi.h> // PathCombine
  15. #include <shlwapip.h> // IsOS
  16. #include <shfusion.h>
  17. #include <debug.h>
  18. #include <ccstock.h>
  19. #include <ccstock2.h>
  20. #define ARRAYLEN(a) (sizeof(a) / sizeof((a)[0]))
  21. ////////////////////////////////////////////////////////////////////////////
  22. //
  23. // Hard-coded constants: user limit on shares
  24. //
  25. // Note: the maximum number of users on the workstation is hard-coded in the
  26. // server as 10. The max number on the server is essentially a dword, but we
  27. // are using the common up/down control, which only supports a word value.
  28. //
  29. // Note that DEFAULT_MAX_USERS must be <= both the server and workstation
  30. // maximums!
  31. #define MAX_USERS_ON_WORKSTATION 10
  32. #define MAX_USERS_ON_SERVER UD_MAXVAL
  33. #define DEFAULT_MAX_USERS 10
  34. ////////////////////////////////////////////////////////////////////////////
  35. //
  36. // functions
  37. //
  38. STDAPI CanShareFolderW(LPCWSTR pszPath);
  39. STDAPI ShowShareFolderUIW(HWND hwndParent, LPCWSTR pszPath);
  40. ////////////////////////////////////////////////////////////////////////////
  41. //
  42. // global variables
  43. //
  44. extern UINT g_NonOLEDLLRefs;
  45. extern HINSTANCE g_hInstance;
  46. extern BOOL g_fSharingEnabled;
  47. extern UINT g_uiMaxUsers; // max number of users based on product type
  48. extern WCHAR g_szAdminShare[]; // ADMIN$
  49. extern WCHAR g_szIpcShare[]; // IPC$
  50. extern const WCHAR c_szReadonlyShareSD[];
  51. //////////////////////////////////////////////////////////////////////////////
  52. //////////////////////////////////////////////////////////////////////////////
  53. //
  54. // Debugging stuff
  55. //
  56. //////////////////////////////////////////////////////////////////////////////
  57. //////////////////////////////////////////////////////////////////////////////
  58. #if DBG == 1
  59. #define DEB_ERROR TF_ERROR
  60. #define DEB_IERROR TF_ERROR
  61. #define DEB_TRACE TF_GENERAL
  62. #define DEB_ITRACE TF_GENERAL
  63. #define DEB_NOCOMPNAME 0
  64. #define appDebugOut(x) TraceMsg x
  65. #define appAssert(x) ASSERT(x)
  66. #define CHECK_HRESULT(hr) THR(hr)
  67. #define DECLARE_SIG ULONG __sig
  68. #define INIT_SIG(class) __sig = SIG_##class
  69. #define CHECK_SIG(class) \
  70. appAssert((NULL != this) && "'this' pointer is NULL"); \
  71. appAssert((SIG_##class == __sig) && "Signature doesn't match")
  72. #else // DBG == 1
  73. #define appDebugOut(x)
  74. #define appAssert(x)
  75. #define CHECK_HRESULT(hr)
  76. #define DECLARE_SIG
  77. #define INIT_SIG(class)
  78. #define CHECK_SIG(class)
  79. #endif // DBG == 1
  80. #if DBG == 1
  81. #define SIG_CSharingPropertyPage 0xabcdef00
  82. #define SIG_CShare 0xabcdef01
  83. #define SIG_CShareInfo 0xabcdef02
  84. #define SIG_CDlgNewShare 0xabcdef03
  85. #define SIG_CShareCF 0xabcdef04
  86. #define SIG_CBuffer 0xabcdef05
  87. #define SIG_CStrHashBucketElem 0xabcdef06
  88. #define SIG_CStrHashBucket 0xabcdef07
  89. #define SIG_CStrHashTable 0xabcdef08
  90. #define SIG_CShareCopyHook 0xabcdef09
  91. #define SIG_CShareBase 0xabcdef0a
  92. #define SIG_CSimpleSharingPage 0xabcdef0b
  93. #endif // DBG == 1