VirtualBox

source: kBuild/trunk/src/lib/nt/ntdir.h@ 2985

Last change on this file since 2985 was 2985, checked in by bird, 9 years ago

lib/nt: Got fts-nt halfways working, quite a few NT interface changes.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.4 KB
Line 
1/* $Id: ntdir.h 2985 2016-11-01 18:26:35Z bird $ */
2/** @file
3 * MSC + NT opendir, readdir, closedir and friends.
4 */
5
6/*
7 * Copyright (c) 2005-2013 knut st. osmundsen <[email protected]>
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
25 * IN THE SOFTWARE.
26 *
27 * Alternatively, the content of this file may be used under the terms of the
28 * GPL version 2 or later, or LGPL version 2.1 or later.
29 */
30
31#ifndef ___nt_ntdir_h
32#define ___nt_ntdir_h
33
34#include "nttypes.h"
35#include "ntstat.h"
36
37typedef struct dirent
38{
39 /** Optional stat information.
40 * Only provided if using birdDirOpenExtraInfo(). */
41 BirdStat_T d_stat;
42 /** The record length. */
43 unsigned __int16 d_reclen;
44 /** The name length. */
45 unsigned __int16 d_namlen;
46 /** The name type. */
47 unsigned char d_type;
48 /** The name. */
49 char d_name[512 - sizeof(BirdStat_T) - 2 - 2 - 1];
50} BirdDirEntry_T;
51
52#define d_ino d_stat.st_ino;
53
54/** @name d_type values.
55 * @{ */
56#define DT_UNKNOWN 0
57#define DT_FIFO 1
58#define DT_CHR 2
59#define DT_DIR 4
60#define DT_BLK 6
61#define DT_REG 8
62#define DT_LNK 10
63#define DT_SOCK 12
64#define DT_WHT 14
65/** @} */
66
67/** @name BIRDDIR_F_XXX - birdDirOpenFromHandle & BirdDir_T::fFlags
68 * @{ */
69/** birdDirClose should also close pvHandle. */
70#define BIRDDIR_F_CLOSE_HANDLE 1U
71/** birdDirClose should not close the handle. */
72#define BIRDDIR_F_KEEP_HANDLE 0U
73/** Provide extra info (stat). */
74#define BIRDDIR_F_EXTRA_INFO 2U
75/** Whether to restart the scan. */
76#define BIRDDIR_F_RESTART_SCAN 4U
77/** @} */
78
79typedef struct BirdDir
80{
81 /** Magic value. */
82 unsigned uMagic;
83 /** Flags. */
84 unsigned fFlags;
85 /** The directory handle. */
86 void *pvHandle;
87 /** The device number (st_dev). */
88 unsigned __int64 uDev;
89 /** The current position. */
90 long offPos;
91
92 /** Set if we haven't yet read anything. */
93 int fFirst;
94 /** Set if we have data in the buffer. */
95 int fHaveData;
96 /** The info type we're querying. */
97 int iInfoClass;
98 /** The current buffer position. */
99 unsigned offBuf;
100 /** The number of bytes allocated for pabBuf. */
101 unsigned cbBuf;
102 /** Buffer of size cbBuf. */
103 unsigned char *pabBuf;
104
105 /** Static directory entry. */
106 BirdDirEntry_T DirEntry;
107} BirdDir_T;
108/** Magic value for BirdDir. */
109#define BIRD_DIR_MAGIC 0x19731120
110
111
112BirdDir_T *birdDirOpen(const char *pszPath);
113BirdDir_T *birdDirOpenExtraInfo(const char *pszPath);
114BirdDir_T *birdDirOpenExW(void *hRoot, const wchar_t *pwszPath, const wchar_t *pwszFilter, unsigned fFlags);
115BirdDir_T *birdDirOpenFromHandle(void *hDir, const void *pvReserved, unsigned fFlags);
116BirdDirEntry_T *birdDirRead(BirdDir_T *pDir);
117long birdDirTell(BirdDir_T *pDir);
118void birdDirSeek(BirdDir_T *pDir, long offDir);
119int birdDirClose(BirdDir_T *pDir);
120
121#define opendir birdDirOpen
122#define readdir birdDirRead
123#define telldir birdDirTell
124#define seekdir birdDirSeek
125#define rewinddir(a_pDir, a_offDir) birdDirSeek(a_pDir, 0)
126#define closedir birdDirClose
127#define _D_NAMLEN(a_pEnt) ((a_pEnt)->d_namlen)
128typedef BirdDir_T DIR;
129
130#endif
131
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette