Source code of Windows XP (NT5)
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.

181 lines
5.4 KiB

  1. // ****************************************************************************
  2. //
  3. // Copyright (c) Microsoft Corporation
  4. //
  5. // Module Name:
  6. //
  7. // OpenFiles.h
  8. //
  9. // Abstract:
  10. //
  11. // macros and function prototypes of OpenFiles.cpp
  12. //
  13. // Author:
  14. //
  15. // Akhil Gokhale ([email protected]) 1-Nov-2000
  16. //
  17. // Revision History:
  18. //
  19. // Akhil Gokhale ([email protected]) 1-Nov-2000 : Created It.
  20. //
  21. // ****************************************************************************
  22. #ifndef _OPENFILES_H
  23. #define _OPENFILES_H
  24. #include "pch.h"
  25. #include "resource.h"
  26. #include "chstring.h"
  27. #define FORMAT_OPTIONS GetResString(IDS_FORMAT_OPTIONS)
  28. // command line options and their indexes in the array
  29. #define MAX_OPTIONS 5
  30. #define MAX_QUERY_OPTIONS 7
  31. #define MAX_DISCONNECT_OPTIONS 8
  32. #define MAX_LOCAL_OPTIONS 1
  33. // options allowed ( no need to localize )
  34. #define OPTION_DISCONNECT _T("disconnect")
  35. #define OPTION_QUERY _T("query")
  36. #define OPTION_USAGE _T( "?" )
  37. #define OPTION_SERVER _T( "s" )
  38. #define OPTION_USERNAME _T( "u" )
  39. #define OPTION_PASSWORD _T( "p" )
  40. #define OPTION_ID _T( "id")
  41. #define OPTION_ACCESSEDBY _T( "a" )
  42. #define OPTION_OPENMODE _T( "o" )
  43. #define OPTION_OPENFILE _T( "op" )
  44. #define OPTION_FORMAT _T("fo")
  45. #define OPTION_NOHEADER _T("nh")
  46. #define OPTION_VERBOSE _T("v")
  47. #define OPTION_LOCAL _T("local")
  48. #define DOUBLE_SLASH _T("\\\\")
  49. #define SINGLE_SLASH _T("\\")
  50. #define SINGLE_DOT _T(".")
  51. #define DOT_DOT L".."
  52. #define BLANK_LINE L"\n"
  53. // option indexes MAIN
  54. #define OI_DISCONNECT 0
  55. #define OI_QUERY 1
  56. #define OI_USAGE 2
  57. #define OI_LOCAL 3
  58. #define OI_DEFAULT 4
  59. // Option Indexes QUERY
  60. #define OI_Q_QUERY 0
  61. #define OI_Q_SERVER_NAME 1
  62. #define OI_Q_USER_NAME 2
  63. #define OI_Q_PASSWORD 3
  64. #define OI_Q_FORMAT 4
  65. #define OI_Q_NO_HEADER 5
  66. #define OI_Q_VERBOSE 6
  67. // Option Indexes DISCONNECT
  68. #define OI_D_DISCONNECT 0
  69. #define OI_D_SERVER_NAME 1
  70. #define OI_D_USER_NAME 2
  71. #define OI_D_PASSWORD 3
  72. #define OI_D_ID 4
  73. #define OI_D_ACCESSED_BY 5
  74. #define OI_D_OPEN_MODE 6
  75. #define OI_D_OPEN_FILE 7
  76. // Option Indexes for LOCAL
  77. #define OI_O_LOCAL 0
  78. // Option Index for showresult for locally open files
  79. // LOF means Localy Open Files
  80. #define LOF_ID 0
  81. #define LOF_TYPE 1
  82. #define LOF_ACCESSED_BY 2
  83. #define LOF_PROCESS_NAME 3
  84. #define LOF_OPEN_FILENAME 4
  85. // No of columns in locally open file
  86. #define NO_OF_COL_LOCAL_OPENFILE 5
  87. // Column width for local open file showresult
  88. #define COL_L_ID 5
  89. #define COL_L_TYPE 10
  90. #define COL_L_ACCESSED_BY 15
  91. #define COL_L_PROCESS_NAME 20
  92. #define COL_L_OPEN_FILENAME 50
  93. BOOL DoLocalOpenFiles(DWORD dwFormat,BOOL bShowNoHeader,BOOL bVerbose,LPCTSTR pszLocalValue);
  94. BOOL GetProcessOwner(LPTSTR pszUserName,DWORD hFile);
  95. #define MAC_DLL_FILE_NAME L"\\SFMAPI.DLL"
  96. #define MIN_MEMORY_REQUIRED 256
  97. // Macro definitions
  98. #define SAFEDELETE(pObj) \
  99. if (pObj) \
  100. { \
  101. delete[] pObj; \
  102. pObj = NULL; \
  103. }
  104. #define SAFEIRELEASE(pIObj) \
  105. if (pIObj) \
  106. {\
  107. pIObj->Release(); \
  108. pIObj = NULL;\
  109. }
  110. // SAFEBSTRFREE
  111. #define SAFEBSTRFREE(bstrVal) \
  112. if (bstrVal) \
  113. { \
  114. SysFreeString(bstrVal); \
  115. bstrVal = NULL; \
  116. }
  117. #define SAFERELDYNARRAY(pArray)\
  118. if(pArray!=NULL)\
  119. {\
  120. DestroyDynamicArray(&pArray);\
  121. pArray = NULL;\
  122. }
  123. #define FREE_LIBRARY(hModule)\
  124. if(hModule!=NULL)\
  125. {\
  126. ::FreeLibrary (hModule);\
  127. hModule = NULL;\
  128. }
  129. // Following are Windows Undocumented defines and structures
  130. //////////////////////////////////////////////////////////////////
  131. // START UNDOCUMETED FEATURES
  132. //////////////////////////////////////////////////////////////////
  133. #define AFP_OPEN_MODE_NONE 0x00000000
  134. #define AFP_OPEN_MODE_READ 0x00000001
  135. #define AFP_OPEN_MODE_WRITE 0x00000002
  136. // Fork type of an open file
  137. #define AFP_FORK_DATA 0x00000000
  138. #define AFP_FORK_RESOURCE 0x00000001
  139. typedef struct _AFP_FILE_INFO
  140. {
  141. DWORD afpfile_id; // Id of the open file fork
  142. DWORD afpfile_open_mode; // Mode in which file is opened
  143. DWORD afpfile_num_locks; // Number of locks on the file
  144. DWORD afpfile_fork_type; // Fork type
  145. LPWSTR afpfile_username; // File opened by this user. max UNLEN
  146. LPWSTR afpfile_path; // Absolute canonical path to the file
  147. } AFP_FILE_INFO, *PAFP_FILE_INFO;
  148. // Used as RPC binding handle to server
  149. typedef ULONG_PTR AFP_SERVER_HANDLE;
  150. typedef ULONG_PTR *PAFP_SERVER_HANDLE;
  151. /////////////////////////////////////////////////////////////////////////////
  152. // END UNDOCUMETED FEATURES
  153. /////////////////////////////////////////////////////////////////////////////
  154. #endif