1 /********************************************************************/ 2 /* */ 3 /* dir_win.h Directory access using the windows capabilitys. */ 4 /* Copyright (C) 1989 - 2007 Thomas Mertes */ 5 /* */ 6 /* This file is part of the Seed7 Runtime Library. */ 7 /* */ 8 /* The Seed7 Runtime Library is free software; you can */ 9 /* redistribute it and/or modify it under the terms of the GNU */ 10 /* Lesser General Public License as published by the Free Software */ 11 /* Foundation; either version 2.1 of the License, or (at your */ 12 /* option) any later version. */ 13 /* */ 14 /* The Seed7 Runtime Library is distributed in the hope that it */ 15 /* will be useful, but WITHOUT ANY WARRANTY; without even the */ 16 /* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR */ 17 /* PURPOSE. See the GNU Lesser General Public License for more */ 18 /* details. */ 19 /* */ 20 /* You should have received a copy of the GNU Lesser General */ 21 /* Public License along with this program; if not, write to the */ 22 /* Free Software Foundation, Inc., 51 Franklin Street, */ 23 /* Fifth Floor, Boston, MA 02110-1301, USA. */ 24 /* */ 25 /* Module: Seed7 Runtime Library */ 26 /* File: seed7/src/dir_win.h */ 27 /* Changes: 1993, 1994, 2007 Thomas Mertes */ 28 /* Content: Directory access using _findfirst and _findnext. */ 29 /* */ 30 /* Implements opendir, readdir and closedir in the way it is */ 31 /* defined in Unix. */ 32 /* */ 33 /********************************************************************/ 34 35 #include "windows.h" 36 37 #if MAP_ABSOLUTE_PATH_TO_DRIVE_LETTERS 38 #include "vol_drv.h" 39 #endif 40 41 42 #ifdef OS_STRI_WCHAR 43 44 struct wdirent { 45 wchar_t *d_name; 46 }; 47 48 typedef struct { 49 /* FirstElement can only be 0 or 1. This way a WDIR can never */ 50 /* start with UINT32TYPE_MAX, which is the magic value of a */ 51 /* volumeListType value. */ 52 int firstElement; 53 HANDLE dirHandle; 54 WIN32_FIND_DATAW findData; 55 struct wdirent dirEntry; 56 } WDIR; 57 58 WDIR *wopendir (const wchar_t *name); 59 struct wdirent *wreaddir (WDIR *curr_dir); 60 int wclosedir (WDIR *curr_dir); 61 62 63 #else 64 65 66 struct dirent { 67 char *d_name; 68 }; 69 70 typedef struct { 71 /* FirstElement can only be 0 or 1. This way a DIR can never */ 72 /* start with UINT32TYPE_MAX, which is the magic value of a */ 73 /* volumeListType value. */ 74 int firstElement; 75 HANDLE dirHandle; 76 WIN32_FIND_DATAA findData; 77 struct dirent dirEntry; 78 } DIR; 79 80 DIR *opendir (const char *name); 81 struct dirent *readdir (DIR *curr_dir); 82 int closedir (DIR *curr_dir); 83 84 #endif 85