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.

174 lines
5.1 KiB

  1. #include <windows.h>
  2. #include <windowsx.h>
  3. #include <ole2.h>
  4. #include <lm.h>
  5. #include <wchar.h>
  6. #include <commctrl.h>
  7. #include <shellapi.h> // public
  8. #include <shlapip.h>
  9. #include <shlobj.h> // public
  10. #include <shlobjp.h> // shell private
  11. extern "C"
  12. {
  13. #include <icanon.h>
  14. }
  15. #include <messages.h>
  16. #include <debug.h>
  17. //////////////////////////////////////////////////////////////////////////////
  18. //////////////////////////////////////////////////////////////////////////////
  19. //
  20. // Debugging stuff
  21. //
  22. //////////////////////////////////////////////////////////////////////////////
  23. //////////////////////////////////////////////////////////////////////////////
  24. //
  25. // Fix the warning levels
  26. //
  27. #pragma warning(3:4092) // sizeof returns 'unsigned long'
  28. #pragma warning(3:4121) // structure is sensitive to alignment
  29. #pragma warning(3:4125) // decimal digit in octal sequence
  30. #pragma warning(3:4130) // logical operation on address of string constant
  31. #pragma warning(3:4132) // const object should be initialized
  32. #pragma warning(4:4200) // nonstandard zero-sized array extension
  33. #pragma warning(4:4206) // Source File is empty
  34. #pragma warning(3:4208) // delete[exp] - exp evaluated but ignored
  35. #pragma warning(3:4212) // function declaration used ellipsis
  36. #pragma warning(3:4220) // varargs matched remaining parameters
  37. #pragma warning(4:4509) // SEH used in function w/ _trycontext
  38. #pragma warning(error:4700) // Local used w/o being initialized
  39. #pragma warning(3:4706) // assignment w/i conditional expression
  40. #pragma warning(3:4709) // command operator w/o index expression
  41. //////////////////////////////////////////////////////////////////////////////
  42. #if DBG == 1
  43. DECLARE_DEBUG(Sharing)
  44. #define appDebugOut(x) SharingInlineDebugOut x
  45. #define appAssert(x) Win4Assert(x)
  46. #define CHECK_HRESULT(hr) \
  47. if ( FAILED(hr) ) \
  48. { \
  49. appDebugOut((DEB_IERROR, \
  50. "**** ERROR RETURN <%s @line %d> -> 0x%08lx\n", \
  51. __FILE__, __LINE__, hr)); \
  52. }
  53. #define CHECK_NEW(p) \
  54. if ( NULL == (p) ) \
  55. { \
  56. appDebugOut((DEB_IERROR, \
  57. "**** NULL POINTER (OUT OF MEMORY!) <%s @line %d>\n", \
  58. __FILE__, __LINE__)); \
  59. }
  60. #define CHECK_NULL(p) \
  61. if ( NULL == (p) ) \
  62. { \
  63. appDebugOut((DEB_IERROR, \
  64. "**** NULL POINTER <%s @line %d>: %s\n", \
  65. __FILE__, __LINE__, #p)); \
  66. }
  67. #define CHECK_THIS appAssert(NULL != this && "'this' pointer is NULL")
  68. #define DECLARE_SIG ULONG __sig
  69. #define INIT_SIG(class) __sig = SIG_##class
  70. #define CHECK_SIG(class) \
  71. appAssert((NULL != this) && "'this' pointer is NULL"); \
  72. appAssert((SIG_##class == __sig) && "Signature doesn't match")
  73. #else // DBG == 1
  74. #define appDebugOut(x)
  75. #define appAssert(x)
  76. #define CHECK_HRESULT(hr)
  77. #define CHECK_NEW(p)
  78. #define CHECK_NULL(p)
  79. #define CHECK_THIS
  80. #define DECLARE_SIG
  81. #define INIT_SIG(class)
  82. #define CHECK_SIG(class)
  83. #endif // DBG == 1
  84. #if DBG == 1
  85. #define SIG_CSharingPropertyPage 0xabcdef00
  86. #define SIG_CShareInfo 0xabcdef02
  87. #define SIG_CDlgNewShare 0xabcdef03
  88. #define SIG_CBuffer 0xabcdef05
  89. #endif // DBG == 1
  90. ////////////////////////////////////////////////////////////////////////////
  91. //
  92. // macros
  93. //
  94. #ifndef offsetof
  95. #define offsetof(type,field) ((size_t)(ULONG_PTR)&(((type*)0)->field))
  96. #endif
  97. #define IMPL(class,member,pointer) \
  98. (&((class*)0)->member == pointer, \
  99. ((class*)(((LONG_PTR)pointer) - offsetof(class,member))))
  100. #define ARRAYLEN(a) (sizeof(a) / sizeof((a)[0]))
  101. ////////////////////////////////////////////////////////////////////////////
  102. //
  103. // Hard-coded constants: user limit on shares
  104. //
  105. // Note: the maximum number of users on the workstation is hard-coded in the
  106. // server as 10. The max number on the server is essentially a dword, but we
  107. // are using the common up/down control, which only supports a word value.
  108. //
  109. // Note that DEFAULT_MAX_USERS must be <= both the server and workstation
  110. // maximums!
  111. #define MAX_USERS_ON_WORKSTATION 10
  112. #define MAX_USERS_ON_SERVER UD_MAXVAL
  113. #define DEFAULT_MAX_USERS 10
  114. ////////////////////////////////////////////////////////////////////////////
  115. //
  116. // global variables
  117. //
  118. extern HINSTANCE g_hInstance;
  119. extern UINT g_NonOLEDLLRefs;
  120. extern UINT g_uiMaxUsers; // max number of users based on product type
  121. extern WCHAR g_szAdminShare[]; // ADMIN$
  122. extern WCHAR g_szIpcShare[]; // IPC$
  123. extern UINT g_cfHIDA;
  124. //////////////////////////////////////////////////////////////////////////////
  125. enum COLUMNS1
  126. {
  127. ICOL1_NAME = 0,
  128. ICOL1_COMMENT,
  129. ICOL1_MAX
  130. };
  131. enum COLUMNS2
  132. {
  133. ICOL2_NAME = 0,
  134. ICOL2_COMMENT,
  135. ICOL2_PATH,
  136. ICOL2_MAXUSES,
  137. ICOL2_MAX
  138. };
  139. //////////////////////////////////////////////////////////////////////////////