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.

174 lines
5.1 KiB

  1. /*************************************************************************
  2. **
  3. ** OLE 2.0 Property Set Utilities
  4. **
  5. ** wn_dos.h
  6. **
  7. ** This file contains file contains data structure defintions,
  8. ** function prototypes, constants, etc. for Windows 3.x form of
  9. ** DOS calls. This is used by the SUMINFO OLE 2.0 Property Set
  10. ** utilities used to manage the Summary Info property set.
  11. **
  12. ** (c) Copyright Microsoft Corp. 1990 - 1992 All Rights Reserved
  13. **
  14. *************************************************************************/
  15. #ifndef WN_DOS_H
  16. #define WN_DOS_H
  17. #include <dos.h>
  18. #define WIN 1
  19. #define cbMaxFile 146 //from inc\path.h
  20. #define SEEK_FROM_BEGINNING 0
  21. #define SEEK_FROM_END 2
  22. #define chDOSPath ('\\') // FUTURE: not used all places it could be
  23. #define chDOSWildAll '*' /* DOS File name wild card. */
  24. #define chDOSWildSingle '?'
  25. // Close, seek, delete, rename, flush, get attributes, read, write
  26. /* RPC TEMP
  27. int FCloseOsfnWin(WORD);
  28. #define FCloseOsfn(osfn) FCloseOsfnWin(osfn)
  29. long DwSeekDwWin(WORD,LONG,WORD);
  30. #define DwSeekDw(osfn, dwSeek, bSeekFrom) DwSeekDwWin(osfn, dwSeek, bSeekFrom)
  31. EC EcDeleteSzFfnameWin(char *);
  32. #define EcDeleteSzFfname(szFile) EcDeleteSzFfnameWin(szFile)
  33. EC EcRenameSzFfnameWin(char *,char *);
  34. #define EcRenameSzFfname(szFileCur,szFileNew) EcRenameSzFfnameWin(szFileCur,szFileNew)
  35. int FFlushOsfnWin(int);
  36. #define FFlushOsfn(osfn) FFlushOsfnWin(osfn)
  37. WORD DaGetFileModeSzWin(char *);
  38. #define DaGetFileModeSz(szFile) DaGetFileModeSzWin(szFile)
  39. int CbReadOsfnWin(int, void far *, UINT);
  40. int CbWriteOsfnWin(int, void far *, UINT);
  41. #define CbWriteOsfn(osfn,lpch,cbWrite) CbWriteOsfnWin(osfn,lpch,cbWrite)
  42. */
  43. #define WinOpenFile(sz,ofs,n) OpenFile(sz,ofs,n)
  44. #define SeekHfile(f,off,kind) _llseek(f,off,kind)
  45. #define CbReadOsfn(osfn,lpch,cbRead) CbReadOsfnWin(osfn,lpch,cbRead)
  46. #define CbReadHfile(f,buf,n) _lread(f,buf,n)
  47. #define CbReadOsfnWin(f,buf,n) CbReadHfile(f,buf,n)
  48. #define EcFindFirst4dm(a,b,c) _dos_findfirst((const char *)(b),c,(struct find_t*)a)
  49. #define EcFindNext4dm(a) _dos_findnext((struct find_t*)a)
  50. #define FHfileToSffsDate(handle,date,time) _dos_getftime(handle, (unsigned *)(date), (unsigned *)(time))
  51. #define SeekHfile(f, off, kind) _llseek(f,off,kind)
  52. /* buffer structure to be used with EcFindFirst() and EcFindNext() */
  53. typedef struct _SFFS
  54. { /* Search Find File Structure */
  55. uchar buff[21]; // dos search info
  56. uchar wAttr;
  57. union
  58. {
  59. unsigned short timeVariable; /*RPC47*/
  60. BF time:16;
  61. struct
  62. {
  63. BF sec : 5;
  64. BF mint: 6;
  65. BF hr : 5;
  66. };
  67. };
  68. union
  69. {
  70. unsigned short dateVariable;
  71. BF date:16;
  72. struct
  73. {
  74. BF dom : 5;
  75. BF mon : 4;
  76. BF yr : 7;
  77. };
  78. };
  79. ulong cbFile;
  80. uchar szFileName[13];
  81. } SFFS;
  82. // find first file/find next file
  83. #define PszFromPsffs(psffs) ((psffs)->szFileName)
  84. #define CopySzFilePsffs(psffs,sz) OemToAnsi((char HUGE *)&((psffs)->szFileName[0]),(char HUGE *)(sz))
  85. #define CbSzFilePsffs(psffs) CbSz((psffs)->szFileName)
  86. #define CbFileSizePsffs(psffs) (psffs)->cbFile
  87. #define AttribPsffs(psffs) (psffs)->wAttr
  88. #define EcFindFirstCore(psffs, sz, wAttr) EcFindFirst(psffs, sz, wAttr) /*RPC22*/
  89. #define FDotPsffs(psffs) ((psffs)->szFileName[0]=='.') /*RPC23*/
  90. #define AppendSzWild(sz) {int i=_fstrlen((char FAR *)(sz)); sz[i]='*'; sz[i+1]='.'; sz[i+2]='*'; sz[i+3]='\0';}
  91. // disk free space
  92. unsigned long LcbDiskFreeSpaceWin(int);
  93. #define LcbDiskFreeSpace(chDrive) LcbDiskFreeSpaceWin(chDrive)
  94. // date and time /*RPC39*/
  95. /*
  96. typedef struct _TIM { // Time structure returned by OsTime
  97. CHAR minutes, hour, hsec, sec;
  98. } TIM;
  99. typedef struct _DAT { // Date structure returned by OsDate
  100. int year;
  101. CHAR month, day, dayOfWeek;
  102. } DAT;
  103. */
  104. #define TIM dostime_t /*RPC39*/
  105. #define DAT dosdate_t
  106. #define OsTimeWin(TIM) _dos_gettime(TIM)
  107. #define OsDateWin(DAT) _dos_getdate(DAT)
  108. /* DOS File Attributes */
  109. #define DA_NORMAL 0x00
  110. #define DA_READONLY 0x01
  111. #define DA_HIDDEN 0x02
  112. #define DA_SYSTEM 0x04
  113. #define DA_VOLUME 0x08
  114. #define DA_SUBDIR 0x10
  115. #define DA_ARCHIVE 0x20
  116. #define DA_NIL 0xFFFF /* Error DA */
  117. #define dosxSharing 32 /* Extended error code for sharing viol. */
  118. #define nErrNoAcc 5 /* OpenFile error code for Access Denied */
  119. #define nErrFnf 2 /* OpenFile error code for File Not Found */
  120. /* Components of the Open mode for OpenSzFfname (DOS FUNC 3DH) */
  121. #define MASK_fINH 0x80
  122. #define MASK_bSHARE 0x70
  123. #define MASK_bACCESS 0x07
  124. #define bSHARE_DENYRDWR 0x10
  125. #define bSHARE_DENYWR 0x20
  126. #define bSHARE_DENYNONE 0x40
  127. /* Seek-from type codes passed to DOS function 42H */
  128. #define SF_BEGINNING 0 /* Seek from beginning of file */
  129. #define SF_CURRENT 1 /* Seek from current file pointer */
  130. #define SF_END 2 /* Seek from end of file */
  131. typedef struct _DOSDTTM /* DOS DaTe TiMe */
  132. {
  133. union
  134. {
  135. long lDOSDttm;
  136. struct
  137. {
  138. BF day: 5;
  139. BF month: 4;
  140. BF year: 7;
  141. BF sec: 5;
  142. BF mint: 6;
  143. BF hours: 5;
  144. } S1;
  145. } U1;
  146. } DOSDTTM;
  147. int FOsfnIsFile(int);
  148. void DateStamp(int, LONG *, int);
  149. int DosxError(void);
  150. int ShellExec(int, int);
  151. #endif //WN_DOS_H