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.1 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. FileInfo.c
  5. Abstract:
  6. This file contains NetpFileStructureInfo().
  7. Author:
  8. John Rogers (JohnRo) 15-Aug-1991
  9. Environment:
  10. Portable to any flat, 32-bit environment. (Uses Win32 typedefs.)
  11. Requires ANSI C extensions: slash-slash comments, long external names.
  12. Revision History:
  13. 15-Aug-1991 JohnRo
  14. Implement downlevel NetFile APIs.
  15. 20-Nov-1991 JohnRo
  16. Removed NT dependencies to reduce recompiles.
  17. 13-Dec-1991 JohnRo
  18. Quiet debug output by default.
  19. --*/
  20. // These must be included first:
  21. #include <windef.h> // IN, DWORD, etc.
  22. #include <lmcons.h> // LM20_ equates, NET_API_STATUS, etc.
  23. #include <rap.h> // LPDESC, needed by <strucinf.h>.
  24. // These may be included in any order:
  25. #include <lmerr.h> // ERROR_ and NERR_ equates.
  26. #include <lmshare.h> // FILE_INFO_2, etc.
  27. #include <netlib.h> // NetpSetOptionalArg().
  28. #include <netdebug.h> // NetpAssert().
  29. #include <remdef.h> // REM16_, REM32_, REMSmb_ equates.
  30. #include <strucinf.h> // My prototype.
  31. #define MAX_FILE_2_STRING_LENGTH \
  32. (0)
  33. #define MAX_FILE_2_STRING_SIZE \
  34. (MAX_FILE_2_STRING_LENGTH * sizeof(TCHAR))
  35. #define MAX_FILE_2_TOTAL_SIZE \
  36. (MAX_FILE_2_STRING_SIZE + sizeof(FILE_INFO_2))
  37. #define MAX_FILE_3_STRING_LENGTH \
  38. (LM20_PATHLEN+1 + LM20_UNLEN+1)
  39. #define MAX_FILE_3_STRING_SIZE \
  40. (MAX_FILE_3_STRING_LENGTH * sizeof(TCHAR))
  41. #define MAX_FILE_3_TOTAL_SIZE \
  42. (MAX_FILE_3_STRING_SIZE + sizeof(FILE_INFO_3))
  43. NET_API_STATUS
  44. NetpFileStructureInfo (
  45. IN DWORD Level,
  46. IN DWORD ParmNum, // Use PARMNUM_ALL if not applicable.
  47. IN BOOL Native, // Should sizes be native or RAP?
  48. OUT LPDESC * DataDesc16 OPTIONAL,
  49. OUT LPDESC * DataDesc32 OPTIONAL,
  50. OUT LPDESC * DataDescSmb OPTIONAL,
  51. OUT LPDWORD MaxSize OPTIONAL,
  52. OUT LPDWORD FixedSize OPTIONAL,
  53. OUT LPDWORD StringSize OPTIONAL
  54. )
  55. {
  56. DBG_UNREFERENCED_PARAMETER(ParmNum);
  57. NetpAssert( Native );
  58. //
  59. // Decide what to do based on the info level.
  60. //
  61. switch (Level) {
  62. #define SetSizes(fixed,variable) \
  63. { \
  64. NetpSetOptionalArg( MaxSize, (fixed) + (variable) ); \
  65. NetpSetOptionalArg( FixedSize, (fixed) ); \
  66. NetpSetOptionalArg( StringSize, (variable) ); \
  67. }
  68. case 2 :
  69. NetpSetOptionalArg( DataDesc16, REM16_file_info_2 );
  70. NetpSetOptionalArg( DataDesc32, REM32_file_info_2 );
  71. NetpSetOptionalArg( DataDescSmb, REMSmb_file_info_2 );
  72. SetSizes( sizeof(FILE_INFO_2), MAX_FILE_2_STRING_SIZE );
  73. break;
  74. case 3 :
  75. NetpSetOptionalArg( DataDesc16, REM16_file_info_3 );
  76. NetpSetOptionalArg( DataDesc32, REM32_file_info_3 );
  77. NetpSetOptionalArg( DataDescSmb, REMSmb_file_info_3 );
  78. SetSizes( sizeof(FILE_INFO_3), MAX_FILE_3_STRING_SIZE );
  79. break;
  80. default :
  81. return (ERROR_INVALID_LEVEL);
  82. }
  83. return (NERR_Success);
  84. } // NetpFileStructureInfo